fix(测试跟踪):测试计划关联用例筛选后列表显示不正确

--bug=1026557 --user=王旭 【测试跟踪】测试计划里关联几百条用例,用例列表里显示的数据不全 https://www.tapd.cn/55049933/s/1379441
This commit is contained in:
WangXu10 2023-06-07 10:05:12 +08:00 committed by fit2-zhao
parent c4e90f4923
commit 7aa30e6f05
2 changed files with 55 additions and 4 deletions

View File

@ -436,6 +436,13 @@ export default {
planStatus: {
type: String
},
searchSelectNodeIds: {
type: Array
},
searchSelect: {
type: Boolean,
default: false
},
},
computed: {
editTestPlanTestCaseOrder() {
@ -636,9 +643,15 @@ 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;
}
}
this.condition.projectId = getCurrentProjectID();
if (this.planId) {
this.result = getTestPlanTestCase(this.currentPage, this.pageSize, this.condition)
@ -720,8 +733,8 @@ export default {
this.initTableData();
},
search() {
this.initTableData();
this.$emit('search');
this.initTableData();
},
buildPagePath(path) {
return path + "/" + this.currentPage + "/" + this.pageSize;

View File

@ -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,7 +187,39 @@ 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);
}
}
},