refactor(测试跟踪): 用例列表url中添加当前选中的模块ID参数

--story=1011258 --user=陈建星 测试跟踪用例查询效率优化 https://www.tapd.cn/55049933/s/1343873
This commit is contained in:
chenjianxing 2023-02-28 09:59:14 +08:00 committed by jianxing
parent cbc4ae0f8b
commit f0e5a0950d
4 changed files with 31 additions and 2 deletions

View File

@ -627,6 +627,14 @@ export default {
})
}
},
setCurrentKeyById(id) {
if (id) {
this.$nextTick(() => {
this.handleNodeSelect(this.$refs.tree.getNode(id));
this.$refs.tree.setCurrentKey(id);
})
}
},
justSetCurrentKey(id) {
if (id) {
this.$nextTick(() => {

View File

@ -66,6 +66,7 @@
@importRefresh="importRefresh"
@importChangeConfirm="importChangeConfirm"
@createCase="handleCaseSimpleCreate($event, 'add')"
@nodeSelectEvent="handleCaseNodeSelect"
ref="nodeTree"/>
</ms-aside-container>
@ -206,6 +207,7 @@ import TestCasePublicNodeTree from "@/business/module/TestCasePublicNodeTree";
import TestCaseTrashNodeTree from "@/business/module/TestCaseTrashNodeTree";
import PublicTestCaseList from "@/business/case/components/public/PublicTestCaseList";
import {openCaseCreate} from "@/business/case/test-case";
import merge from 'webpack-merge';
const store = useStore();
export default {
@ -316,6 +318,9 @@ export default {
if (this.$store.state.temWorkspaceId) {
this.$refs.isChangeConfirm.open(null, this.$store.state.temWorkspaceId);
}
},
routeModuleId() {
return this.$route.query.moduleId;
}
},
computed: {
@ -455,6 +460,13 @@ export default {
this.$refs.testCaseTrashList.initTableData(nodeIds);
}
},
handleCaseNodeSelect(node, nodeIds, pNodes) {
if (node.data.id !== this.routeModuleId) {
this.$router.push({
query: merge(this.$route.query, {'moduleId': node.data.id})
});
}
},
increase(id) {
this.$refs.nodeTree.increase(id);
},

View File

@ -9,7 +9,7 @@
<template v-slot:title>
{{$t('test_track.case.case_desc')}}
</template>
<div v-loading="loading" style="height: 100%; overflow: auto">
<div style="height: 100%; overflow: auto">
<el-form :model="data" class="case-desc-form">
<div class="prerequisite-item-layout">
<h3>{{$t('test_track.case.prerequisite')}}</h3>

View File

@ -152,6 +152,9 @@ export default {
projectId() {
return getCurrentProjectID();
},
routeModuleId() {
return this.$route.query.moduleId;
}
},
methods: {
addTestCase() {
@ -208,7 +211,13 @@ export default {
if (this.$refs.nodeTree) {
this.$refs.nodeTree.filter(this.condition.filterText);
}
if (this.routeModuleId) {
if (this.$refs.nodeTree) {
this.$refs.nodeTree.setCurrentKeyById(this.routeModuleId);
}
} else {
this.setCurrentKey();
}
});
}
},