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

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

View File

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

View File

@ -699,7 +699,12 @@ public class ApiTestCaseService {
ids.removeAll(request.getUnSelectIds());
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) {
if (StringUtils.equalsIgnoreCase(model.getApiMethod(), "esb")) {
esbApiParamService.handleApiEsbParams(model);

View File

@ -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;
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;
if(apiCases.length === 0) {
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-popover slot="header" placement="right" trigger="click" style="margin-right: 0px;">
<el-link
:class="{'selected-link': selectDataCounts === total}"
@click.native.stop="click('selectAll')"
ref="selectAllLink">
<span :style="selectAllFontColor">
@ -13,7 +12,6 @@
<br/>
<el-link
:class="{'selected-link': selectDataCounts === this.pageSize}"
@click.native.stop="click('selectPageAll')"
ref="selectPageAllLink">
<span :style="selectPageFontColor">
@ -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;
});
}
}
}
</script>