fix(测试跟踪): 用例脑图临时用例修改成模块后,其子模块不显示

--bug=1021999 --user=陈建星 【测试跟踪】github#21368,用例在脑图模式下,将已经带有case的模块B1拖动到新建的非模块脑图分支B2下保存,会导致B1下的用例丢失 https://www.tapd.cn/55049933/s/1343916
This commit is contained in:
chenjianxing 2023-02-28 14:32:23 +08:00 committed by jianxing
parent 5b232f3378
commit f768c5c852
2 changed files with 2 additions and 3 deletions

View File

@ -532,7 +532,6 @@ export function handleAfterSave(rootNode) {
rootNode.data.changed = false; rootNode.data.changed = false;
rootNode.data.contextChanged = false; rootNode.data.contextChanged = false;
rootNode.data.originId = null; rootNode.data.originId = null;
rootNode.data.isExtraNode = false;
if (isModuleNode(rootNode)) { if (isModuleNode(rootNode)) {
rootNode.data.type = 'node'; rootNode.data.type = 'node';
} else if (isCaseNodeData(rootNode.data)) { } else if (isCaseNodeData(rootNode.data)) {
@ -550,7 +549,6 @@ export function handleSaveError(rootNode) {
rootNode.data.id = rootNode.data.originId; rootNode.data.id = rootNode.data.originId;
} }
rootNode.data.originId = null; rootNode.data.originId = null;
rootNode.data.isExtraNode = false;
if (rootNode.children) { if (rootNode.children) {
for (let i = 0; i < rootNode.children.length; i++) { for (let i = 0; i < rootNode.children.length; i++) {
handleSaveError(rootNode.children[i]); handleSaveError(rootNode.children[i]);

View File

@ -211,7 +211,8 @@ export default {
if (this.$refs.nodeTree) { if (this.$refs.nodeTree) {
this.$refs.nodeTree.filter(this.condition.filterText); this.$refs.nodeTree.filter(this.condition.filterText);
} }
if (this.routeModuleId) { let isCurrentNodeEqualsRouteModule = this.currentNode && this.currentNode.data && this.currentNode.data.id === this.routeModuleId;
if (this.routeModuleId && !isCurrentNodeEqualsRouteModule) {
if (this.$refs.nodeTree) { if (this.$refs.nodeTree) {
this.$refs.nodeTree.setCurrentKeyById(this.routeModuleId); this.$refs.nodeTree.setCurrentKeyById(this.routeModuleId);
} }