fix(测试跟踪): 模块树交互样式问题

--bug=1033817 --user=宋昌昌 【测试跟踪】测试计划-重命名自定义模块-复制部分名称-点击添加子模块-提示名称不能为空-未显示子模块添加输入框 https://www.tapd.cn/55049933/s/1479684
This commit is contained in:
song-cc-rock 2024-03-25 11:53:26 +08:00 committed by Craftsman
parent 2ea06584e4
commit 48db282ed0
1 changed files with 7 additions and 6 deletions

View File

@ -49,7 +49,7 @@
v-if="data.id && !isDefault(data) && !hideNodeOperator" v-if="data.id && !isDefault(data) && !hideNodeOperator"
:content="$t('test_track.module.add_submodule')" :content="$t('test_track.module.add_submodule')"
placement="top"> placement="top">
<el-button class="node-operate-btn" @click.stop="append(node, data)" icon="el-icon-plus"/> <el-button class="node-operate-btn" @click.stop="append(node, data)" :disabled="appendChildDisable" icon="el-icon-plus"/>
</el-tooltip> </el-tooltip>
<el-button v-if="!data.id" class="node-operate-btn" @click="remove(node, data)" icon="el-icon-delete"/> <el-button v-if="!data.id" class="node-operate-btn" @click="remove(node, data)" icon="el-icon-delete"/>
@ -142,7 +142,7 @@
v-if="data.id && !isDefault(data) && !hideNodeOperator" v-if="data.id && !isDefault(data) && !hideNodeOperator"
:content="$t('test_track.module.add_submodule')" :content="$t('test_track.module.add_submodule')"
placement="top" :case-num="getCaseNum(data)"> placement="top" :case-num="getCaseNum(data)">
<el-button class="node-operate-btn" @click.stop="append(node, data)" icon="el-icon-plus"/> <el-button class="node-operate-btn" @click.stop="append(node, data)" :disabled="appendChildDisable" icon="el-icon-plus"/>
</el-tooltip> </el-tooltip>
<el-button v-if="!data.id" class="node-operate-btn" @click="remove(node, data)" icon="el-icon-delete"/> <el-button v-if="!data.id" class="node-operate-btn" @click="remove(node, data)" icon="el-icon-delete"/>
@ -210,6 +210,7 @@ export default {
label: "label" label: "label"
}, },
extendTreeNodes: [], extendTreeNodes: [],
appendChildDisable: false
}; };
}, },
props: { props: {
@ -396,6 +397,7 @@ export default {
} }
}, },
edit(node, data, isAppend) { edit(node, data, isAppend) {
this.appendChildDisable = true;
this.$set(data, 'isEdit', true); this.$set(data, 'isEdit', true);
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.nameInput.focus(); this.$refs.nameInput.focus();
@ -469,11 +471,8 @@ export default {
this.$set(data, 'children', []) this.$set(data, 'children', [])
} }
data.children.push(newChild); data.children.push(newChild);
this.edit(node, newChild, true);
node.expanded = true; node.expanded = true;
this.$nextTick(() => { this.edit(node, newChild, true);
this.$refs.nameInput.focus();
});
}, },
save(node, data) { save(node, data) {
if (data.name.trim() === '') { if (data.name.trim() === '') {
@ -506,10 +505,12 @@ export default {
data.level = param.level; data.level = param.level;
} }
this.$set(data, 'isEdit', false); this.$set(data, 'isEdit', false);
this.appendChildDisable = false;
}, },
remove(node, data) { remove(node, data) {
if (data.label === undefined) { if (data.label === undefined) {
this.$refs.tree.remove(node); this.$refs.tree.remove(node);
this.appendChildDisable = false;
return; return;
} }
let title = this.$t('commons.confirm_delete') + ': ' + this.$t("project.project_file.file_module_type.module") + data.label + "?"; let title = this.$t('commons.confirm_delete') + ': ' + this.$t("project.project_file.file_module_type.module") + data.label + "?";