diff --git a/framework/sdk-parent/frontend/src/components/new-ui/MsNodeTree.vue b/framework/sdk-parent/frontend/src/components/new-ui/MsNodeTree.vue index 53e2f78651..4d81411438 100644 --- a/framework/sdk-parent/frontend/src/components/new-ui/MsNodeTree.vue +++ b/framework/sdk-parent/frontend/src/components/new-ui/MsNodeTree.vue @@ -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(() => { diff --git a/test-track/frontend/src/business/case/TestCase.vue b/test-track/frontend/src/business/case/TestCase.vue index 32100ddeea..8df6cbeccf 100644 --- a/test-track/frontend/src/business/case/TestCase.vue +++ b/test-track/frontend/src/business/case/TestCase.vue @@ -66,6 +66,7 @@ @importRefresh="importRefresh" @importChangeConfirm="importChangeConfirm" @createCase="handleCaseSimpleCreate($event, 'add')" + @nodeSelectEvent="handleCaseNodeSelect" ref="nodeTree"/> @@ -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); }, diff --git a/test-track/frontend/src/business/case/components/TestCasePreview.vue b/test-track/frontend/src/business/case/components/TestCasePreview.vue index 06751e909e..b8ad264402 100644 --- a/test-track/frontend/src/business/case/components/TestCasePreview.vue +++ b/test-track/frontend/src/business/case/components/TestCasePreview.vue @@ -9,7 +9,7 @@ -
+

{{$t('test_track.case.prerequisite')}}

diff --git a/test-track/frontend/src/business/module/TestCaseNodeTree.vue b/test-track/frontend/src/business/module/TestCaseNodeTree.vue index 71ce72e931..07d9248996 100644 --- a/test-track/frontend/src/business/module/TestCaseNodeTree.vue +++ b/test-track/frontend/src/business/module/TestCaseNodeTree.vue @@ -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); } - this.setCurrentKey(); + if (this.routeModuleId) { + if (this.$refs.nodeTree) { + this.$refs.nodeTree.setCurrentKeyById(this.routeModuleId); + } + } else { + this.setCurrentKey(); + } }); } },