From 648988375ae6095dd23c3500ae60e7f04649c308 Mon Sep 17 00:00:00 2001 From: AgAngle <1323481023@qq.com> Date: Fri, 10 Nov 2023 17:51:27 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=B5=8B=E8=AF=95=E8=B7=9F=E8=B8=AA):=20?= =?UTF-8?q?=E6=B5=8B=E8=AF=95=E8=AE=A1=E5=88=92=E5=8A=9F=E8=83=BD=E7=94=A8?= =?UTF-8?q?=E4=BE=8B=EF=BC=8C=E9=80=89=E4=B8=AD=E6=A8=A1=E5=9D=97=EF=BC=8C?= =?UTF-8?q?=E7=AD=9B=E9=80=89=E5=90=8E=E9=87=8D=E7=BD=AE=E7=AD=9B=E9=80=89?= =?UTF-8?q?=EF=BC=8C=E7=94=A8=E4=BE=8B=E6=95=B0=E6=98=BE=E7=A4=BA=E9=94=99?= =?UTF-8?q?=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1032741 --user=陈建星 【测试跟踪】github#27478,最新版本:角色权限>>测试跟踪>>测试用例:不勾选【操作脑图】选项,当在测试跟踪>>功能测试,点击脑图查看测试用例时,报403。但是在升级前的版本(2.9版本之前的版本),用户权限都是一样的都没有【操作脑图】权限,大家都是可以用脑图的形式查看用例的 https://www.tapd.cn/55049933/s/1435196 --- .../src/components/module/MsNodeTree.vue | 12 ++++++ .../functional/FunctionalTestCaseList.vue | 25 ++++-------- .../functional/TestPlanFunctional.vue | 39 ++++--------------- 3 files changed, 28 insertions(+), 48 deletions(-) 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) {