diff --git a/framework/sdk-parent/frontend/src/components/search/MsTableAdvSearchBar.vue b/framework/sdk-parent/frontend/src/components/search/MsTableAdvSearchBar.vue index 4c4abbeeb4..2c247881e7 100644 --- a/framework/sdk-parent/frontend/src/components/search/MsTableAdvSearchBar.vue +++ b/framework/sdk-parent/frontend/src/components/search/MsTableAdvSearchBar.vue @@ -181,6 +181,7 @@ export default { this.isInit = true; this.init(); } else { + this.setModulesParam(); this.refreshComponentOption(); } }, @@ -189,6 +190,10 @@ export default { let comps = this.optional.components.filter(cp => cp.init && cp.init instanceof Function); comps.forEach(comp => comp.init()); }, + setModulesParam() { + let comps = this.optional.components.filter(c => c.key === 'moduleIds'); + comps.forEach(comp => comp.options.params = {"projectId": this.condition.projectId}); + }, addFilter() { const index = _findIndexByKey(this.optional.components, this.nullFilterKey); if (index > -1) { diff --git a/test-track/backend/src/main/java/io/metersphere/controller/TestCaseNodeController.java b/test-track/backend/src/main/java/io/metersphere/controller/TestCaseNodeController.java index c84d6e9d47..66261a5c6c 100644 --- a/test-track/backend/src/main/java/io/metersphere/controller/TestCaseNodeController.java +++ b/test-track/backend/src/main/java/io/metersphere/controller/TestCaseNodeController.java @@ -39,6 +39,10 @@ public class TestCaseNodeController { @PostMapping("/list/{projectId}") public List getNodeByCondition(@PathVariable String projectId, @RequestBody(required = false) QueryTestCaseRequest request) { + // 高级搜索所属模块搜索时, 切换项目时需替换projectId为参数中切换项目 + if (request != null && request.getProjectId() != null) { + projectId = request.getProjectId(); + } baseCheckPermissionService.checkProjectOwner(projectId); return testCaseNodeService.getNodeTreeByProjectId(projectId, Optional.ofNullable(request).orElse(new QueryTestCaseRequest())); } diff --git a/test-track/frontend/src/business/plan/view/comonents/functional/FunctionalRelevance.vue b/test-track/frontend/src/business/plan/view/comonents/functional/FunctionalRelevance.vue index 3574a6a7dc..eb1014e581 100644 --- a/test-track/frontend/src/business/plan/view/comonents/functional/FunctionalRelevance.vue +++ b/test-track/frontend/src/business/plan/view/comonents/functional/FunctionalRelevance.vue @@ -200,6 +200,7 @@ export default { this.getTestCases(); }, projectId() { + this.setConditionModuleIdParam(); this.page.condition.projectId = this.projectId; this.page.condition.versionId = null; this.getProjectNode(); @@ -223,6 +224,13 @@ export default { setProject(projectId) { this.projectId = projectId; }, + setConditionModuleIdParam() { + this.page.condition.components.forEach(component => { + if (component.key === 'moduleIds') { + component.options.params = {"projectId": this.projectId}; + } + }); + }, getCustomNum() { getProjectApplicationConfig('CASE_CUSTOM_NUM') .then(result => { diff --git a/test-track/frontend/src/business/review/view/components/TestReviewRelevance.vue b/test-track/frontend/src/business/review/view/components/TestReviewRelevance.vue index 46434bfc70..df8637f52b 100644 --- a/test-track/frontend/src/business/review/view/components/TestReviewRelevance.vue +++ b/test-track/frontend/src/business/review/view/components/TestReviewRelevance.vue @@ -215,6 +215,7 @@ export default { } }, projectId() { + this.setConditionModuleIdParam(); this.condition.projectId = this.projectId; this.condition.versionId = null; this.getVersionOptions(); @@ -230,6 +231,13 @@ export default { this.toggleSelection(this.testReviews); }, methods: { + setConditionModuleIdParam() { + this.condition.components.forEach(component => { + if (component.key === 'moduleIds') { + component.options.params = {"projectId": this.projectId}; + } + }); + }, openTestReviewRelevanceDialog() { this.getProject(); this.dialogFormVisible = true;