fix: 修复场景引用案例不勾选直接全选卡死的问题

修复场景引用案例不勾选直接全选卡死的问题
This commit is contained in:
song-tianyang 2021-06-17 16:12:35 +08:00 committed by 刘瑞斌
parent c1cf34ad85
commit 8f064af023
4 changed files with 35 additions and 24 deletions

View File

@ -119,6 +119,9 @@ public class ApiDefinitionService {
public List<ApiDefinitionResult> listBatch(ApiBatchRequest request) { public List<ApiDefinitionResult> listBatch(ApiBatchRequest request) {
ServiceUtils.getSelectAllIds(request, request.getCondition(), ServiceUtils.getSelectAllIds(request, request.getCondition(),
(query) -> extApiDefinitionMapper.selectIds(query)); (query) -> extApiDefinitionMapper.selectIds(query));
if(CollectionUtils.isEmpty(request.getIds())){
return new ArrayList<>();
}
List<ApiDefinitionResult> resList = extApiDefinitionMapper.listByIds(request.getIds()); List<ApiDefinitionResult> resList = extApiDefinitionMapper.listByIds(request.getIds());
calculateResult(resList, request.getProjectId()); calculateResult(resList, request.getProjectId());
return resList; return resList;

View File

@ -699,7 +699,12 @@ public class ApiTestCaseService {
ids.removeAll(request.getUnSelectIds()); ids.removeAll(request.getUnSelectIds());
request.setIds(ids); request.setIds(ids);
} }
List<ApiTestCaseInfo> list = extApiTestCaseMapper.getCaseInfo(request); List<ApiTestCaseInfo> list = null;
if(StringUtils.isEmpty(request.getId()) && CollectionUtils.isEmpty(request.getIds())){
list = new ArrayList<>();
}else {
list = extApiTestCaseMapper.getCaseInfo(request);
}
for (ApiTestCaseInfo model : list) { for (ApiTestCaseInfo model : list) {
if (StringUtils.equalsIgnoreCase(model.getApiMethod(), "esb")) { if (StringUtils.equalsIgnoreCase(model.getApiMethod(), "esb")) {
esbApiParamService.handleApiEsbParams(model); esbApiParamService.handleApiEsbParams(model);

View File

@ -92,16 +92,25 @@ export default {
let params = this.$refs.apiList.getConditions(); let params = this.$refs.apiList.getConditions();
this.result = this.$post("/api/definition/list/batch", params, (response) => { this.result = this.$post("/api/definition/list/batch", params, (response) => {
let apis = response.data; let apis = response.data;
this.$emit('save', apis, 'API', reference); if(apis.length === 0){
this.$refs.baseRelevance.close(); this.$warning('请选择接口');
}else {
this.$emit('save', apis, 'API', reference);
this.$refs.baseRelevance.close();
}
}); });
} else { } else {
let params = this.$refs.apiCaseList.getConditions(); let params = this.$refs.apiCaseList.getConditions();
this.result = this.$post("/api/testcase/get/caseBLOBs/request", params, (response) => { this.result = this.$post("/api/testcase/get/caseBLOBs/request", params, (response) => {
let apiCases = response.data; let apiCases = response.data;
this.$emit('save', apiCases, 'CASE', reference); if(apiCases.length === 0) {
this.$refs.baseRelevance.close(); this.$warning('请选择案例');
}else{
this.$emit('save', apiCases, 'CASE', reference);
this.$refs.baseRelevance.close();
}
}); });
} }
}, },

View File

@ -2,7 +2,6 @@
<el-table-column v-if="isShow" width="1" :resizable="false" fixed="left" align="center"> <el-table-column v-if="isShow" width="1" :resizable="false" fixed="left" align="center">
<el-popover slot="header" placement="right" trigger="click" style="margin-right: 0px;"> <el-popover slot="header" placement="right" trigger="click" style="margin-right: 0px;">
<el-link <el-link
:class="{'selected-link': selectDataCounts === total}"
@click.native.stop="click('selectAll')" @click.native.stop="click('selectAll')"
ref="selectAllLink"> ref="selectAllLink">
<span :style="selectAllFontColor"> <span :style="selectAllFontColor">
@ -13,7 +12,6 @@
<br/> <br/>
<el-link <el-link
:class="{'selected-link': selectDataCounts === this.pageSize}"
@click.native.stop="click('selectPageAll')" @click.native.stop="click('selectPageAll')"
ref="selectPageAllLink"> ref="selectPageAllLink">
<span :style="selectPageFontColor"> <span :style="selectPageFontColor">
@ -58,7 +56,6 @@
}, },
data() { data() {
return { return {
selectType: "",
isShow: true, isShow: true,
selectAllFontColor: { selectAllFontColor: {
color: "gray", color: "gray",
@ -66,15 +63,14 @@
selectPageFontColor: { selectPageFontColor: {
color: "gray", color: "gray",
}, },
keyIndex:0,
}; };
}, },
methods: { methods: {
click(even) { click(even) {
if (even === 'selectPageAll') { if (even === 'selectPageAll') {
this.selectPageFontColor.color = document.body.style.getPropertyValue("--count_number");
this.selectAllFontColor.color = "gray"; this.selectAllFontColor.color = "gray";
this.selectPageFontColor.color = document.body.style.getPropertyValue("--count_number");
} else if (even === 'selectAll') { } else if (even === 'selectAll') {
this.selectAllFontColor.color = document.body.style.getPropertyValue("--count_number"); this.selectAllFontColor.color = document.body.style.getPropertyValue("--count_number");
this.selectPageFontColor.color = "gray"; this.selectPageFontColor.color = "gray";
@ -84,20 +80,18 @@
this.selectPageFontColor.color = "gray"; this.selectPageFontColor.color = "gray";
} }
this.$emit(even); this.$emit(even);
// this.isShow = false; //使keyIndex
// this.$nextTick(() => { if(this.keyIndex === 0){
// this.isShow = true; this.keyIndex++;
// }); this.reload();
}
}, },
// reload() { reload() {
// this.isShow = false; this.isShow = false;
// this.selectAllLinkType = "info"; this.$nextTick(() => {
// this.selectPageLinkType = "info"; this.isShow = true;
// this.$nextTick(() => { });
// this.isShow = true; }
// });
// }
} }
} }
</script> </script>