diff --git a/backend/src/main/java/io/metersphere/api/service/ApiDefinitionService.java b/backend/src/main/java/io/metersphere/api/service/ApiDefinitionService.java index ca682daf27..dd76449b9a 100644 --- a/backend/src/main/java/io/metersphere/api/service/ApiDefinitionService.java +++ b/backend/src/main/java/io/metersphere/api/service/ApiDefinitionService.java @@ -120,6 +120,9 @@ public class ApiDefinitionService { public List listBatch(ApiBatchRequest request) { ServiceUtils.getSelectAllIds(request, request.getCondition(), (query) -> extApiDefinitionMapper.selectIds(query)); + if(CollectionUtils.isEmpty(request.getIds())){ + return new ArrayList<>(); + } List resList = extApiDefinitionMapper.listByIds(request.getIds()); calculateResult(resList, request.getProjectId()); return resList; diff --git a/backend/src/main/java/io/metersphere/api/service/ApiTestCaseService.java b/backend/src/main/java/io/metersphere/api/service/ApiTestCaseService.java index c8fc7179d1..8a9f88b317 100644 --- a/backend/src/main/java/io/metersphere/api/service/ApiTestCaseService.java +++ b/backend/src/main/java/io/metersphere/api/service/ApiTestCaseService.java @@ -699,7 +699,12 @@ public class ApiTestCaseService { ids.removeAll(request.getUnSelectIds()); request.setIds(ids); } - List list = extApiTestCaseMapper.getCaseInfo(request); + List list = null; + if(StringUtils.isEmpty(request.getId()) && CollectionUtils.isEmpty(request.getIds())){ + list = new ArrayList<>(); + }else { + list = extApiTestCaseMapper.getCaseInfo(request); + } for (ApiTestCaseInfo model : list) { if (StringUtils.equalsIgnoreCase(model.getApiMethod(), "esb")) { esbApiParamService.handleApiEsbParams(model); diff --git a/frontend/src/business/components/api/automation/scenario/api/ApiRelevance.vue b/frontend/src/business/components/api/automation/scenario/api/ApiRelevance.vue index 17342de729..683a6d2243 100644 --- a/frontend/src/business/components/api/automation/scenario/api/ApiRelevance.vue +++ b/frontend/src/business/components/api/automation/scenario/api/ApiRelevance.vue @@ -92,16 +92,25 @@ export default { let params = this.$refs.apiList.getConditions(); this.result = this.$post("/api/definition/list/batch", params, (response) => { let apis = response.data; - this.$emit('save', apis, 'API', reference); - this.$refs.baseRelevance.close(); + if(apis.length === 0){ + this.$warning('请选择接口'); + }else { + this.$emit('save', apis, 'API', reference); + this.$refs.baseRelevance.close(); + } }); } else { let params = this.$refs.apiCaseList.getConditions(); this.result = this.$post("/api/testcase/get/caseBLOBs/request", params, (response) => { let apiCases = response.data; - this.$emit('save', apiCases, 'CASE', reference); - this.$refs.baseRelevance.close(); + if(apiCases.length === 0) { + this.$warning('请选择案例'); + }else{ + this.$emit('save', apiCases, 'CASE', reference); + this.$refs.baseRelevance.close(); + } + }); } }, diff --git a/frontend/src/business/components/common/components/table/MsTableHeaderSelectPopover.vue b/frontend/src/business/components/common/components/table/MsTableHeaderSelectPopover.vue index c8ef7ad027..995e9544cd 100644 --- a/frontend/src/business/components/common/components/table/MsTableHeaderSelectPopover.vue +++ b/frontend/src/business/components/common/components/table/MsTableHeaderSelectPopover.vue @@ -2,7 +2,6 @@ @@ -13,7 +12,6 @@
@@ -58,7 +56,6 @@ }, data() { return { - selectType: "", isShow: true, selectAllFontColor: { color: "gray", @@ -66,15 +63,14 @@ selectPageFontColor: { color: "gray", }, - + keyIndex:0, }; }, methods: { click(even) { if (even === 'selectPageAll') { - this.selectPageFontColor.color = document.body.style.getPropertyValue("--count_number"); this.selectAllFontColor.color = "gray"; - + this.selectPageFontColor.color = document.body.style.getPropertyValue("--count_number"); } else if (even === 'selectAll') { this.selectAllFontColor.color = document.body.style.getPropertyValue("--count_number"); this.selectPageFontColor.color = "gray"; @@ -84,20 +80,18 @@ this.selectPageFontColor.color = "gray"; } this.$emit(even); - // this.isShow = false; - // this.$nextTick(() => { - // this.isShow = true; - // }); - + //首次渲染之后,该组件不会重新渲染样式,使用keyIndex判断强制刷新一次,激活它的重新渲染功能 + if(this.keyIndex === 0){ + this.keyIndex++; + this.reload(); + } }, - // reload() { - // this.isShow = false; - // this.selectAllLinkType = "info"; - // this.selectPageLinkType = "info"; - // this.$nextTick(() => { - // this.isShow = true; - // }); - // } + reload() { + this.isShow = false; + this.$nextTick(() => { + this.isShow = true; + }); + } } }