fix(测试跟踪): 用例评审关联用例切换项目时高级搜索模块加载有误

--bug=1018289 --user=宋昌昌 【测试跟踪】用例评审-关联功能用例-高级搜索-所属模块和所选项目模块不一致 https://www.tapd.cn/55049933/s/1271485
This commit is contained in:
song-cc-rock 2022-10-21 19:28:32 +08:00 committed by jianxing
parent db354eb0ab
commit 88eee1d3f6
4 changed files with 25 additions and 0 deletions

View File

@ -181,6 +181,7 @@ export default {
this.isInit = true; this.isInit = true;
this.init(); this.init();
} else { } else {
this.setModulesParam();
this.refreshComponentOption(); this.refreshComponentOption();
} }
}, },
@ -189,6 +190,10 @@ export default {
let comps = this.optional.components.filter(cp => cp.init && cp.init instanceof Function); let comps = this.optional.components.filter(cp => cp.init && cp.init instanceof Function);
comps.forEach(comp => comp.init()); 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() { addFilter() {
const index = _findIndexByKey(this.optional.components, this.nullFilterKey); const index = _findIndexByKey(this.optional.components, this.nullFilterKey);
if (index > -1) { if (index > -1) {

View File

@ -39,6 +39,10 @@ public class TestCaseNodeController {
@PostMapping("/list/{projectId}") @PostMapping("/list/{projectId}")
public List<TestCaseNodeDTO> getNodeByCondition(@PathVariable String projectId, @RequestBody(required = false) QueryTestCaseRequest request) { public List<TestCaseNodeDTO> getNodeByCondition(@PathVariable String projectId, @RequestBody(required = false) QueryTestCaseRequest request) {
// 高级搜索所属模块搜索时, 切换项目时需替换projectId为参数中切换项目
if (request != null && request.getProjectId() != null) {
projectId = request.getProjectId();
}
baseCheckPermissionService.checkProjectOwner(projectId); baseCheckPermissionService.checkProjectOwner(projectId);
return testCaseNodeService.getNodeTreeByProjectId(projectId, Optional.ofNullable(request).orElse(new QueryTestCaseRequest())); return testCaseNodeService.getNodeTreeByProjectId(projectId, Optional.ofNullable(request).orElse(new QueryTestCaseRequest()));
} }

View File

@ -200,6 +200,7 @@ export default {
this.getTestCases(); this.getTestCases();
}, },
projectId() { projectId() {
this.setConditionModuleIdParam();
this.page.condition.projectId = this.projectId; this.page.condition.projectId = this.projectId;
this.page.condition.versionId = null; this.page.condition.versionId = null;
this.getProjectNode(); this.getProjectNode();
@ -223,6 +224,13 @@ export default {
setProject(projectId) { setProject(projectId) {
this.projectId = projectId; this.projectId = projectId;
}, },
setConditionModuleIdParam() {
this.page.condition.components.forEach(component => {
if (component.key === 'moduleIds') {
component.options.params = {"projectId": this.projectId};
}
});
},
getCustomNum() { getCustomNum() {
getProjectApplicationConfig('CASE_CUSTOM_NUM') getProjectApplicationConfig('CASE_CUSTOM_NUM')
.then(result => { .then(result => {

View File

@ -215,6 +215,7 @@ export default {
} }
}, },
projectId() { projectId() {
this.setConditionModuleIdParam();
this.condition.projectId = this.projectId; this.condition.projectId = this.projectId;
this.condition.versionId = null; this.condition.versionId = null;
this.getVersionOptions(); this.getVersionOptions();
@ -230,6 +231,13 @@ export default {
this.toggleSelection(this.testReviews); this.toggleSelection(this.testReviews);
}, },
methods: { methods: {
setConditionModuleIdParam() {
this.condition.components.forEach(component => {
if (component.key === 'moduleIds') {
component.options.params = {"projectId": this.projectId};
}
});
},
openTestReviewRelevanceDialog() { openTestReviewRelevanceDialog() {
this.getProject(); this.getProject();
this.dialogFormVisible = true; this.dialogFormVisible = true;