From b6dd3495d706d99280b80302f14e6ba41c80df05 Mon Sep 17 00:00:00 2001 From: chenjianxing Date: Fri, 17 Jun 2022 11:08:12 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=B5=8B=E8=AF=95=E8=B7=9F=E8=B8=AA):=20?= =?UTF-8?q?=E6=A8=A1=E5=9D=97=E5=A2=9E=E5=88=A0=E6=94=B9=EF=BC=8C=E8=84=91?= =?UTF-8?q?=E5=9B=BE=E6=B2=A1=E6=9C=89=E6=8F=90=E7=A4=BA=E5=88=B7=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1014167 --user=陈建星 【测试跟踪】脑图模式下,左侧模块增删改,脑图没有及时更新 https://www.tapd.cn/55049933/s/1184890 --- .../components/track/case/TestCase.vue | 4 +- .../track/common/minder/TestCaseMinder.vue | 45 +++++++++++++++++-- 2 files changed, 43 insertions(+), 6 deletions(-) diff --git a/frontend/src/business/components/track/case/TestCase.vue b/frontend/src/business/components/track/case/TestCase.vue index 0daa0f4f1c..9275dbf0db 100644 --- a/frontend/src/business/components/track/case/TestCase.vue +++ b/frontend/src/business/components/track/case/TestCase.vue @@ -120,6 +120,7 @@ :tree-nodes="treeNodes" :project-id="projectId" :condition="condition" + :active-name="activeName" v-if="activeDom === 'right'" @refresh="minderSaveRefresh" ref="minder"/> @@ -690,9 +691,6 @@ export default { if (this.$refs.testCaseList) { this.$refs.testCaseList.initTableData(); } - if (this.$refs.minder) { - this.$refs.minder.initData(); - } this.$refs.nodeTree.list(); this.setTable(data); }, diff --git a/frontend/src/business/components/track/common/minder/TestCaseMinder.vue b/frontend/src/business/components/track/common/minder/TestCaseMinder.vue index 56ae81f6d5..d3d19c886c 100644 --- a/frontend/src/business/components/track/common/minder/TestCaseMinder.vue +++ b/frontend/src/business/components/track/common/minder/TestCaseMinder.vue @@ -31,6 +31,10 @@ @refresh="refreshIssue" ref="issueEdit"/> + + @@ -60,12 +64,13 @@ import {addIssueHotBox, getSelectedNodeData, handleIssueAdd, handleIssueBatch} f import IssueRelateList from "@/business/components/track/case/components/IssueRelateList"; import TestPlanIssueEdit from "@/business/components/track/case/components/TestPlanIssueEdit"; import {setPriorityView} from "vue-minder-editor-plus/src/script/tool/utils"; +import IsChangeConfirm from "@/business/components/common/components/IsChangeConfirm"; const {getIssuesListById} = require("@/network/Issue"); const {getCurrentWorkspaceId} = require("@/common/js/utils"); export default { name: "TestCaseMinder", - components: {TestPlanIssueEdit, IssueRelateList, MsModuleMinder}, + components: {IsChangeConfirm, TestPlanIssueEdit, IssueRelateList, MsModuleMinder}, data() { return{ testCase: [], @@ -73,6 +78,7 @@ name: "TestCaseMinder", tags: [this.$t('api_test.definition.request.case'), this.$t('test_track.case.prerequisite'), this.$t('commons.remark'), this.$t('test_track.module.module')], result: {loading: false}, needRefresh: false, + noRefresh: false, saveCases: [], saveModules: [], saveModuleNodeMap: new Map(), @@ -91,6 +97,7 @@ name: "TestCaseMinder", currentVersion: String, condition: Object, projectId: String, + activeName: String }, computed: { selectNodeIds() { @@ -125,6 +132,12 @@ name: "TestCaseMinder", }, currentVersion() { this.$refs.minder.initData(); + }, + treeNodes(newVal, oldVal) { + if (newVal !== oldVal && this.activeName === 'default') { + // 模块刷新并且当前 tab 是用例列表时,提示是否刷新脑图 + this.handleNodeUpdateForMinder(); + } } }, mounted() { @@ -137,8 +150,30 @@ name: "TestCaseMinder", } }, methods: { + handleNodeUpdateForMinder() { + this.noRefresh = true; + // 如果脑图没有修改直接刷新,有修改提示 + if (!this.$store.state.isTestCaseMinderChanged) { + if (this.$refs.minder) { + this.$refs.minder.initData(); + } + } else { + this.$refs.isChangeConfirm.open(); + } + }, + changeConfirm(isSave) { + if (isSave) { + this.save(() => { + this.initData(); + }); + } else { + this.initData(); + } + }, initData() { - this.$refs.minder.initData(); + if (this.$refs.minder) { + this.$refs.minder.initData(); + } }, getMinderTreeExtraNodeCount() { return getMinderTreeExtraNodeCount; @@ -249,7 +284,11 @@ name: "TestCaseMinder", item.isExtraNode = false; }); this.extraNodeChanged = []; - this.$emit('refresh'); + if (!this.noRefresh) { + this.$emit('refresh'); + } + // 由于模块修改刷新的脑图,不刷新模块 + this.noRefresh = false; this.setIsChange(false); if (callback && callback instanceof Function) { callback();