From 7aa30e6f051272f6d2d5a199fd8f0f412171de5d Mon Sep 17 00:00:00 2001 From: WangXu10 Date: Wed, 7 Jun 2023 10:05:12 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=B5=8B=E8=AF=95=E8=B7=9F=E8=B8=AA)?= =?UTF-8?q?=EF=BC=9A=E6=B5=8B=E8=AF=95=E8=AE=A1=E5=88=92=E5=85=B3=E8=81=94?= =?UTF-8?q?=E7=94=A8=E4=BE=8B=E7=AD=9B=E9=80=89=E5=90=8E=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E4=B8=8D=E6=AD=A3=E7=A1=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1026557 --user=王旭 【测试跟踪】测试计划里关联几百条用例,用例列表里显示的数据不全 https://www.tapd.cn/55049933/s/1379441 --- .../functional/FunctionalTestCaseList.vue | 19 +++++++-- .../functional/TestPlanFunctional.vue | 40 ++++++++++++++++++- 2 files changed, 55 insertions(+), 4 deletions(-) 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 665f347193..55869302f7 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 @@ -436,6 +436,13 @@ export default { planStatus: { type: String }, + searchSelectNodeIds: { + type: Array + }, + searchSelect: { + type: Boolean, + default: false + }, }, computed: { editTestPlanTestCaseOrder() { @@ -636,8 +643,14 @@ export default { this.status = 'all'; } this.condition.nodeIds = []; - if (this.selectNodeIds && this.selectNodeIds.length > 0) { - this.condition.nodeIds = this.selectNodeIds; + 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; + } } this.condition.projectId = getCurrentProjectID(); if (this.planId) { @@ -720,8 +733,8 @@ export default { this.initTableData(); }, search() { - this.initTableData(); this.$emit('search'); + 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 aa7dc5550f..251a48a11d 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,6 +27,8 @@ :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" @@ -94,7 +96,9 @@ export default { condition: {}, tmpActiveDom: null, tmpPath: null, - currentNode: null + currentNode: null, + searchSelectNodeIds: [], + searchSelect: false, }; }, props: [ @@ -143,6 +147,7 @@ export default { }, clearSelectNode() { this.selectNodeIds = []; + this.searchSelectNodeIds = []; useStore().testPlanViewSelectNode = {}; }, initData() { @@ -158,6 +163,7 @@ export default { this.selectNodeIds = nodeIds; useStore().testPlanViewSelectNode = node; this.currentNode = node; + this.searchSelect = false; // 切换node后,重置分页数 if (this.$refs.testPlanTestCaseList) { this.$refs.testPlanTestCaseList.currentPage = 1; @@ -181,10 +187,42 @@ 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); + if (rootNode.children) { + for (let i = 0; i < rootNode.children.length; i++) { + this.pushNode(rootNode.children[i], nodeIds); + } + } + }, setCurrentKey() { if (this.$refs.nodeTree) { this.$refs.nodeTree.setCurrentKey(this.currentNode);