feat(接口测试): 接口定义列表增加相关筛选

--story=1007020 --user=王孝刚 #12422测试用例自定义字段没有筛选功能
https://www.tapd.cn/55049933/s/1192720
This commit is contained in:
wxg0103 2022-07-01 10:06:06 +08:00 committed by f2c-ci-robot[bot]
parent 725be95ca7
commit a2a13b8f47
6 changed files with 58 additions and 5 deletions

View File

@ -207,6 +207,12 @@
#{value}
</foreach>
</when>
<when test="key=='user_name'">
and a_r.user_id in
<foreach collection="values" item="value" separator="," open="(" close=")">
#{value}
</foreach>
</when>
<when test="key=='report_type'">
and a_r.report_type in
<foreach collection="values" item="value" separator="," open="(" close=")">

View File

@ -213,6 +213,12 @@
#{value}
</foreach>
</when>
<when test="key=='user_name'">
and s_r.user_id in
<foreach collection="values" item="value" separator="," open="(" close=")">
#{value}
</foreach>
</when>
<otherwise>
and s_r.trigger_mode in
<foreach collection="values" item="value" separator="," open="(" close=")">

View File

@ -456,6 +456,19 @@
(#{value})
</foreach>
</when>
<when test="key=='create_user' or key=='createUser'">
and t1.create_user_id in
<foreach collection="values" item="value" separator="," open="(" close=")">
(#{value})
</foreach>
</when>
<when test="key=='environment'">
and JSON_UNQUOTE(JSON_EXTRACT(t1.request, '$.useEnvironment')) in
<foreach collection="values" item="value" separator="," open="(" close=")">
(#{value})
</foreach>
</when>
</choose>
</if>
<if test="request.toUpdate == null || request.toUpdate == false ">

View File

@ -90,7 +90,8 @@
</div>
</template>
</el-table-column>
<el-table-column prop="userName" :label="$t('api_test.creator')" width="150" show-overflow-tooltip/>
<ms-table-column prop="userName" :label="$t('api_test.creator')" width="150" show-overflow-tooltip
:filters="userFilters"/>
<el-table-column prop="createTime" min-width="120" :label="$t('commons.create_time')" sortable>
<template v-slot:default="scope">
<span>{{ scope.row.createTime | timestampFormatDate }}</span>
@ -224,7 +225,8 @@ export default {
unSelection: [],
selectDataCounts: 0,
screenHeight: 'calc(100vh - 160px)',
trashActiveDom:'left'
trashActiveDom: 'left',
userFilters: []
}
},
watch: {
@ -243,6 +245,13 @@ export default {
},
},
methods: {
getMaintainerOptions() {
this.$get('/user/project/member/list', response => {
this.userFilters = response.data.map(u => {
return {text: u.name, value: u.id};
});
});
},
search() {
if (this.testId !== 'all') {
this.condition.testId = this.testId;
@ -434,6 +443,7 @@ export default {
created() {
this.init();
this.getMaintainerOptions();
}
}
</script>

View File

@ -171,6 +171,7 @@
<ms-table-column
prop="environment"
:field="item"
:filters="environmentsFilters"
:fields-width="fieldsWidth"
:label="$t('commons.environment')"
>
@ -180,6 +181,7 @@
prop="createUser"
:field="item"
:fields-width="fieldsWidth"
:filters="userFilters"
:label="$t('commons.create_user')"/>
<ms-table-column
@ -455,6 +457,8 @@ export default {
versionName: '',
runCaseIds: [],
versionEnable: false,
userFilters: [],
environmentsFilters: [],
};
},
props: {
@ -502,6 +506,8 @@ export default {
this.initTable();
this.getVersionOptions();
this.checkVersionEnable();
this.getMaintainerOptions();
this.showEnvironment();
},
mounted() {
//
@ -575,6 +581,13 @@ export default {
}
},
methods: {
getMaintainerOptions() {
this.$get('/user/project/member/list', response => {
this.userFilters = response.data.map(u => {
return {text: u.name, value: u.id};
});
});
},
openHis(row) {
this.$refs.taskCenter.openHistory(row.id);
},
@ -689,7 +702,6 @@ export default {
}
}
this.initCondition();
let isNext = false;
if (this.condition.projectId) {
this.result = this.$post('/api/testcase/list/' + this.currentPage + "/" + this.pageSize, this.condition, response => {
@ -1141,12 +1153,17 @@ export default {
this.environments.forEach(environment => {
parseEnvironment(environment);
});
this.environmentsFilters = response.data.map(u => {
return {text: u.name, value: u.id};
});
});
} else {
this.environment = undefined;
}
this.clickRow = row;
this.$refs.setEnvironment.open(row);
if (row) {
this.clickRow = row;
this.$refs.setEnvironment.open(row);
}
},
headerDragend(newWidth, oldWidth, column, event) {
let finalWidth = newWidth;

View File

@ -181,6 +181,7 @@
prop="caseStatus"
:fields-width="fieldsWidth"
min-width="100px"
:filters="caseStatusFilters"
:label="$t('api_test.definition.api_case_status')"/>
<ms-table-column