diff --git a/test-track/frontend/src/business/case/TestCase.vue b/test-track/frontend/src/business/case/TestCase.vue index 2fa84c3df9..69b6cace5b 100644 --- a/test-track/frontend/src/business/case/TestCase.vue +++ b/test-track/frontend/src/business/case/TestCase.vue @@ -39,6 +39,7 @@ :show-operator="false" :public-total="publicTotal" :case-condition="condition" + :is-minder-mode="isMinderMode" @refreshTable="refresh" @setTreeNodes="setTreeNodes" @refreshAll="refreshAll" @@ -101,12 +102,12 @@ ref="testCaseList"> @@ -320,6 +321,9 @@ export default { }, moduleOptions() { return store.testCaseModuleOptions; + }, + isMinderMode() { + return this.activeDom === 'right'; } }, methods: { diff --git a/test-track/frontend/src/business/common/minder/TestCaseMinder.vue b/test-track/frontend/src/business/common/minder/TestCaseMinder.vue index 9cb2840856..4d38ba7e74 100644 --- a/test-track/frontend/src/business/common/minder/TestCaseMinder.vue +++ b/test-track/frontend/src/business/common/minder/TestCaseMinder.vue @@ -142,6 +142,14 @@ export default { } }, watch: { + // 刷新模块树触发 + treeNodes(newVal, oldVal) { + if (newVal !== oldVal && this.activeName === 'default') { + // 模块刷新并且当前 tab 是用例列表时,提示是否刷新脑图 + this.handleNodeUpdateForMinder(); + } + }, + // 点击模块触发 selectNode() { if (this.noRefreshMinderForSelectNode) { // 如果是保存触发的刷新模块,则不刷新脑图 @@ -155,12 +163,6 @@ export default { }, currentVersion() { this.$refs.minder.initData(); - }, - treeNodes(newVal, oldVal) { - if (newVal !== oldVal && this.activeName === 'default') { - // 模块刷新并且当前 tab 是用例列表时,提示是否刷新脑图 - this.handleNodeUpdateForMinder(); - } } }, mounted() { @@ -187,6 +189,13 @@ export default { this.noRefreshMinder = false; return; } + + if (this.selectNode && this.selectNode.data) { + // 列表刷新会修改 selectNode,触发 selectNode watch + // 这里就不重复刷新了 + return; + } + // 如果脑图没有修改直接刷新,有修改提示 if (!useStore().isTestCaseMinderChanged) { if (this.$refs.minder) { diff --git a/test-track/frontend/src/business/module/TestCaseNodeTree.vue b/test-track/frontend/src/business/module/TestCaseNodeTree.vue index 9d0e12ad89..746a320c85 100644 --- a/test-track/frontend/src/business/module/TestCaseNodeTree.vue +++ b/test-track/frontend/src/business/module/TestCaseNodeTree.vue @@ -110,7 +110,12 @@ export default { hideNodeOperator: { type: Boolean, default: false - } + }, + // 脑图模式 + isMinderMode: { + type: Boolean, + default: false + }, }, watch: { treeNodes() { @@ -166,7 +171,7 @@ export default { this.$emit('enablePublic', this.condition.publicEnable); this.$emit('toPublic', 'public'); }, - list({ isForceSetCurrentKey } = {}) { + list() { if (this.projectId) { this.caseCondition.casePublic = false; this.loading = true; @@ -193,7 +198,7 @@ export default { }); } } else { - if (isForceSetCurrentKey) { + if (this.isMinderMode) { this.forceSetCurrentKey(); } else { this.setCurrentKey(); @@ -229,7 +234,7 @@ export default { }, // 重新获取 currentNode ,因为脑图更新完之后可能存在 currentNode 过时的情况 forceSetCurrentKey() { - if (this.$refs.nodeTree && this.currentNode) { + if (this.$refs.nodeTree && this.currentNode && this.currentNode.data) { this.$refs.nodeTree.setCurrentKeyById(this.currentNode.data.id); } },