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: { planStatus: {
type: String type: String
}, },
searchSelectNodeIds: {
type: Array
},
searchSelect: {
type: Boolean,
default: false
},
}, },
computed: { computed: {
editTestPlanTestCaseOrder() { editTestPlanTestCaseOrder() {
@ -636,8 +643,14 @@ export default {
this.status = 'all'; this.status = 'all';
} }
this.condition.nodeIds = []; this.condition.nodeIds = [];
if (this.selectNodeIds && this.selectNodeIds.length > 0) { if (!this.searchSelect) {
this.condition.nodeIds = this.selectNodeIds; 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(); this.condition.projectId = getCurrentProjectID();
if (this.planId) { if (this.planId) {
@ -720,8 +733,8 @@ export default {
this.initTableData(); this.initTableData();
}, },
search() { search() {
this.initTableData();
this.$emit('search'); this.$emit('search');
this.initTableData();
}, },
buildPagePath(path) { buildPagePath(path) {
return path + "/" + this.currentPage + "/" + this.pageSize; return path + "/" + this.currentPage + "/" + this.pageSize;

View File

@ -27,6 +27,8 @@
:plan-status="planStatus " :plan-status="planStatus "
:clickType="clickType" :clickType="clickType"
:select-node-ids="selectNodeIds" :select-node-ids="selectNodeIds"
:search-select-node-ids="searchSelectNodeIds"
:search-select.sync="searchSelect"
:version-enable="versionEnable" :version-enable="versionEnable"
@refresh="refresh" @refresh="refresh"
@refreshTree="refreshTree" @refreshTree="refreshTree"
@ -94,7 +96,9 @@ export default {
condition: {}, condition: {},
tmpActiveDom: null, tmpActiveDom: null,
tmpPath: null, tmpPath: null,
currentNode: null currentNode: null,
searchSelectNodeIds: [],
searchSelect: false,
}; };
}, },
props: [ props: [
@ -143,6 +147,7 @@ export default {
}, },
clearSelectNode() { clearSelectNode() {
this.selectNodeIds = []; this.selectNodeIds = [];
this.searchSelectNodeIds = [];
useStore().testPlanViewSelectNode = {}; useStore().testPlanViewSelectNode = {};
}, },
initData() { initData() {
@ -158,6 +163,7 @@ export default {
this.selectNodeIds = nodeIds; this.selectNodeIds = nodeIds;
useStore().testPlanViewSelectNode = node; useStore().testPlanViewSelectNode = node;
this.currentNode = node; this.currentNode = node;
this.searchSelect = false;
// node // node
if (this.$refs.testPlanTestCaseList) { if (this.$refs.testPlanTestCaseList) {
this.$refs.testPlanTestCaseList.currentPage = 1; this.$refs.testPlanTestCaseList.currentPage = 1;
@ -181,10 +187,42 @@ export default {
this.loading = false; this.loading = false;
this.treeNodes = r.data; this.treeNodes = r.data;
this.setCurrentKey(); 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() { setCurrentKey() {
if (this.$refs.nodeTree) { if (this.$refs.nodeTree) {
this.$refs.nodeTree.setCurrentKey(this.currentNode); this.$refs.nodeTree.setCurrentKey(this.currentNode);