fix(测试跟踪): 脑图添两级临时节点后,修改第一级为模块,保存后第二级丢失

--bug=1024774 --user=陈建星 【测试跟踪】github#23044,功能用例-脑图模式下,添加多级临时节点,修改第一级临时节点为模块,保存后,该节点下数据丢失 https://www.tapd.cn/55049933/s/1357891
This commit is contained in:
chenjianxing 2023-03-30 20:19:07 +08:00 committed by jianxing
parent 02d528b559
commit 366a5a4826
3 changed files with 32 additions and 3 deletions

View File

@ -482,7 +482,7 @@ export default {
if (this.$refs.testCaseList) { if (this.$refs.testCaseList) {
this.$refs.testCaseList.initTableData(); this.$refs.testCaseList.initTableData();
} }
this.$refs.nodeTree.list(); this.$refs.nodeTree.list({ isForceSetCurrentKey: true });
}, },
toggleMinderFullScreen(isFullScreen) { toggleMinderFullScreen(isFullScreen) {
this.enableAsideHidden = isFullScreen; this.enableAsideHidden = isFullScreen;

View File

@ -102,6 +102,7 @@ export default {
needRefresh: false, needRefresh: false,
noRefresh: false, noRefresh: false,
noRefreshMinder: false, noRefreshMinder: false,
noRefreshMinderForSelectNode: false,
saveCases: [], saveCases: [],
saveModules: [], saveModules: [],
saveModuleNodeMap: new Map(), saveModuleNodeMap: new Map(),
@ -143,6 +144,11 @@ export default {
}, },
watch: { watch: {
selectNode() { selectNode() {
if (this.noRefreshMinderForSelectNode) {
//
this.noRefreshMinderForSelectNode = false;
return;
}
if (this.$refs.minder) { if (this.$refs.minder) {
this.caseNum = this.selectNode.data.caseNum; this.caseNum = this.selectNode.data.caseNum;
this.$refs.minder.handleNodeSelect(this.selectNode); this.$refs.minder.handleNodeSelect(this.selectNode);
@ -340,6 +346,10 @@ export default {
// //
// //
this.noRefreshMinder = true; this.noRefreshMinder = true;
if (this.selectNode && this.selectNode.data) {
// watch -> selectNode
this.noRefreshMinderForSelectNode = true;
}
} }
// //
this.noRefresh = false; this.noRefresh = false;
@ -418,6 +428,15 @@ export default {
this.pushDeleteNode(data); this.pushDeleteNode(data);
module.id = null; module.id = null;
this.extraNodeChanged.push(data); this.extraNodeChanged.push(data);
if (node.children) {
//
node.children.forEach((child) => {
if (child.data.isExtraNode) {
child.data.changed = true;
child.data.id = null;
}
});
}
} }
if (data.type === 'case') { if (data.type === 'case') {

View File

@ -166,7 +166,7 @@ export default {
this.$emit('enablePublic', this.condition.publicEnable); this.$emit('enablePublic', this.condition.publicEnable);
this.$emit('toPublic', 'public'); this.$emit('toPublic', 'public');
}, },
list() { list({ isForceSetCurrentKey } = {}) {
if (this.projectId) { if (this.projectId) {
this.caseCondition.casePublic = false; this.caseCondition.casePublic = false;
this.loading = true; this.loading = true;
@ -192,9 +192,13 @@ export default {
} }
}); });
} }
} else {
if (isForceSetCurrentKey) {
this.forceSetCurrentKey();
} else { } else {
this.setCurrentKey(); this.setCurrentKey();
} }
}
}); });
} }
}, },
@ -223,6 +227,12 @@ export default {
this.$refs.nodeTree.setCurrentKey(this.currentNode); this.$refs.nodeTree.setCurrentKey(this.currentNode);
} }
}, },
// currentNode currentNode
forceSetCurrentKey() {
if (this.$refs.nodeTree && this.currentNode) {
this.$refs.nodeTree.setCurrentKeyById(this.currentNode.data.id);
}
},
increase(id) { increase(id) {
this.$refs.nodeTree.increase(id); this.$refs.nodeTree.increase(id);
}, },