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} #{value}
</foreach> </foreach>
</when> </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'"> <when test="key=='report_type'">
and a_r.report_type in and a_r.report_type in
<foreach collection="values" item="value" separator="," open="(" close=")"> <foreach collection="values" item="value" separator="," open="(" close=")">

View File

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

View File

@ -456,6 +456,19 @@
(#{value}) (#{value})
</foreach> </foreach>
</when> </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> </choose>
</if> </if>
<if test="request.toUpdate == null || request.toUpdate == false "> <if test="request.toUpdate == null || request.toUpdate == false ">

View File

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

View File

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

View File

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