diff --git a/framework/sdk-parent/frontend/src/components/module/MsNodeTree.vue b/framework/sdk-parent/frontend/src/components/module/MsNodeTree.vue index 1ab58434d7..f9a2ecdf51 100644 --- a/framework/sdk-parent/frontend/src/components/module/MsNodeTree.vue +++ b/framework/sdk-parent/frontend/src/components/module/MsNodeTree.vue @@ -716,6 +716,18 @@ export default { }); } }, + setCurrentKeyById(id) { + if (id) { + this.$nextTick(() => { + this.$refs.tree.setCurrentKey(id); + let currentDate = this.$refs.tree.getCurrentNode(); + if (currentDate) { + let currentNode = this.$refs.tree.getNode(currentDate); + this.handleNodeSelect(currentNode); + } + }); + } + }, isDefault(data) { return data.name === this.defaultLabel && data.level === 1; }, diff --git a/test-track/frontend/src/business/plan/view/comonents/functional/FunctionalTestCaseList.vue b/test-track/frontend/src/business/plan/view/comonents/functional/FunctionalTestCaseList.vue index c9e7a5c9fe..93e7e4d762 100644 --- a/test-track/frontend/src/business/plan/view/comonents/functional/FunctionalTestCaseList.vue +++ b/test-track/frontend/src/business/plan/view/comonents/functional/FunctionalTestCaseList.vue @@ -461,14 +461,7 @@ export default { }, planStatus: { type: String - }, - searchSelectNodeIds: { - type: Array - }, - searchSelect: { - type: Boolean, - default: false - }, + } }, computed: { editTestPlanTestCaseOrder() { @@ -670,14 +663,8 @@ export default { this.status = 'all'; } this.condition.nodeIds = []; - if (!this.searchSelect) { - if (this.selectNodeIds && this.selectNodeIds.length > 0) { - this.condition.nodeIds = this.selectNodeIds; - } - } else { - if (this.searchSelectNodeIds && this.searchSelectNodeIds.length > 0) { - this.condition.nodeIds = this.searchSelectNodeIds; - } + if (this.selectNodeIds && this.selectNodeIds.length > 0) { + this.condition.nodeIds = this.selectNodeIds; } this.condition.projectId = getCurrentProjectID(); if (this.planId) { @@ -762,7 +749,11 @@ export default { search() { this.currentPage = 1; this.$emit('search'); - this.initTableData(); + if (!this.selectNodeIds || this.selectNodeIds.length < 1) { + // 如果没有选中节点,则刷新列表 + // 如果选中了节点,刷新模块时,会触发列表刷新,这里就不刷新了 + this.initTableData(); + } }, buildPagePath(path) { return path + "/" + this.currentPage + "/" + this.pageSize; diff --git a/test-track/frontend/src/business/plan/view/comonents/functional/TestPlanFunctional.vue b/test-track/frontend/src/business/plan/view/comonents/functional/TestPlanFunctional.vue index 51334908cd..5866380168 100644 --- a/test-track/frontend/src/business/plan/view/comonents/functional/TestPlanFunctional.vue +++ b/test-track/frontend/src/business/plan/view/comonents/functional/TestPlanFunctional.vue @@ -27,8 +27,6 @@ :plan-status="planStatus " :clickType="clickType" :select-node-ids="selectNodeIds" - :search-select-node-ids="searchSelectNodeIds" - :search-select.sync="searchSelect" :version-enable="versionEnable" @refresh="refresh" @refreshTree="refreshTree" @@ -70,10 +68,11 @@ import TestPlanMinder from "@/business/common/minder/TestPlanMinder"; import {getCurrentProjectID} from "metersphere-frontend/src/utils/token"; import TestPlanFunctionalRelevance from "@/business/plan/view/comonents/functional/TestPlanFunctionalRelevance"; import IsChangeConfirm from "metersphere-frontend/src/components/IsChangeConfirm"; -import {openMinderConfirm, saveMinderConfirm} from "@/business/common/minder/minderUtils"; +import {clearOtherTagAfterBatchTag, openMinderConfirm, saveMinderConfirm} from "@/business/common/minder/minderUtils"; import {getTestPlanCaseNodesByCaseFilter} from "@/api/testCase"; import {useStore} from "@/store"; import {testPlanTestCaseGet} from "@/api/remote/plan/test-plan-test-case"; +import {setPriorityView} from "vue-minder-editor-plus/src/script/tool/utils"; export default { name: "TestPlanFunctional", @@ -97,8 +96,6 @@ export default { tmpActiveDom: null, tmpPath: null, currentNode: null, - searchSelectNodeIds: [], - searchSelect: false, }; }, props: [ @@ -147,7 +144,6 @@ export default { }, clearSelectNode() { this.selectNodeIds = []; - this.searchSelectNodeIds = []; useStore().testPlanViewSelectNode = {}; }, initData() { @@ -163,7 +159,6 @@ export default { this.selectNodeIds = nodeIds; useStore().testPlanViewSelectNode = node; this.currentNode = node; - this.searchSelect = false; // 切换node后,重置分页数 if (this.$refs.testPlanTestCaseList) { this.$refs.testPlanTestCaseList.currentPage = 1; @@ -187,33 +182,10 @@ export default { this.loading = false; this.treeNodes = r.data; this.setCurrentKey(); - this.$refs.testPlanTestCaseList.$nextTick(() => { - this.setSearchSelectNodeIds(r) - }); }); } } }, - setSearchSelectNodeIds(treeNodes) { - this.searchSelectNodeIds = [] - this.getChildNodeId(treeNodes.data[0], this.searchSelectNodeIds); - this.searchSelect = true; - }, - getChildNodeId(rootNode, nodeIds) { - if (rootNode && this.currentNode) { - if (rootNode.id === this.currentNode.data.id) { - this.pushNode(rootNode, nodeIds); - } else { - if (rootNode.children) { - for (let i = 0; i < rootNode.children.length; i++) { - if (rootNode.children[i].id === this.currentNode.data.id) { - this.pushNode(rootNode.children[i], nodeIds) - } - } - } - } - } - }, pushNode(rootNode, nodeIds) { //递归获取所有子节点ID nodeIds.push(rootNode.id); @@ -225,7 +197,12 @@ export default { }, setCurrentKey() { if (this.$refs.nodeTree) { - this.$refs.nodeTree.setCurrentKey(this.currentNode); + this.$refs.nodeTree.$nextTick(() => { + if (this.currentNode) { + // 这里传id,如果传node,可能会导致使用的是旧的node + this.$refs.nodeTree.setCurrentKeyById(this.currentNode.data.id); + } + }); } }, setCondition(data) {