fix(接口测试): 用例数增加排序 用例状态增加筛选 用例通过率

This commit is contained in:
wenyann 2021-05-24 17:22:28 +08:00 committed by 刘瑞斌
parent dd79c1f3e2
commit e6dbe2a599
3 changed files with 23 additions and 4 deletions

View File

@ -113,6 +113,16 @@ public class ApiDefinitionService {
request = this.initRequest(request, true, true);
List<ApiDefinitionResult> resList = extApiDefinitionMapper.list(request);
calculateResult(resList, request.getProjectId());
ApiDefinitionRequest finalRequest = request;
if (finalRequest.getFilters().size() > 1) {
if (null != finalRequest.getFilters().get("case_status")) {
resList = resList.stream()
.filter((ApiDefinitionResult b) -> finalRequest.getFilters().get("case_status").contains(b.getCaseStatus()))
.collect(Collectors.toList());
}
}
return resList;
}

View File

@ -24,12 +24,13 @@
show-overflow-tooltip
min-width="80px"
sortable=true
:key="index">
:key="index"
>
<template slot-scope="scope">
<!-- 判断为只读用户的话不可点击ID进行编辑操作 -->
<!--<span style="cursor:pointer" v-if="isReadOnly"> {{ scope.row.num }} </span>-->
<!--<el-tooltip v-else content="编辑">-->
<!--<a style="cursor:pointer" @click="editApi(scope.row)"> {{ scope.row.num }} </a>-->
<!--<a style="cursor:pointer" @click="editApi(scope.row)"> {{ scope.row.num }} </a>-->
<!--</el-tooltip>-->
<el-tooltip content="编辑">
<a style="cursor:pointer" @click="editApi(scope.row)"> {{ scope.row.num }} </a>
@ -127,7 +128,7 @@
<ms-table-column
v-if="item.id == 'caseTotal'"
prop="caseTotal"
sortable="custom"
sortable
width="140px"
:label="$t('api_test.definition.api_case_number')"
show-overflow-tooltip
@ -141,12 +142,13 @@
:label="$t('api_test.definition.api_case_status')"
show-overflow-tooltip
:key="index"
:filter-method="filterHandler"
/>
<ms-table-column
v-if="item.id == 'casePassingRate'"
width="150px"
sortable="custom"
sortable
prop="casePassingRate"
:label="$t('api_test.definition.api_case_passing_rate')"
show-overflow-tooltip
@ -765,6 +767,10 @@ export default {
},
open() {
this.$refs.searchBar.open();
},
filterHandler(value, row, column) {
const property = column['property'];
return row[property] === value;
}
},
}

View File

@ -136,6 +136,9 @@ export function _sort(column, condition) {
hasProp = true;
}
});
if (column.prop === 'case_passing_rate' || column.prop === 'case_total') {
hasProp = true;
}
if (!hasProp) {
condition.orders.push({name: column.prop, type: column.order});
}