refactor(用例管理): 用例管理表头过滤&排序代码调整

This commit is contained in:
WangXu10 2024-02-23 15:26:20 +08:00 committed by 刘瑞斌
parent 9c92512608
commit aa162399c4
3 changed files with 34 additions and 12 deletions

View File

@ -196,33 +196,51 @@
<foreach collection="${filter}.entrySet()" index="key" item="values">
<if test="values != null and values.size() > 0">
<choose>
<when test="key=='review_status'">
<!-- 评审状态 -->
<when test="key=='reviewStatus'">
and functional_case.review_status in
<include refid="io.metersphere.system.mapper.BaseMapper.filterInWrapper"/>
</when>
<when test="key=='last_execute_result'">
<!-- 执行结果 -->
<when test="key=='lastExecuteResult'">
and functional_case.last_execute_result in
<include refid="io.metersphere.system.mapper.BaseMapper.filterInWrapper"/>
</when>
<!-- 版本 -->
<when test="key=='version_id'">
and functional_case.version_id in
<include refid="io.metersphere.system.mapper.BaseMapper.filterInWrapper"/>
</when>
<!-- 自定义单选 -->
<when test="key.startsWith('custom_single')">
and functional_case.id in (
select resource_id from custom_field_test_case where concat('custom_single-',field_id) =
select field_id from functional_case_custom_field where concat('custom_single-',field_id) =
#{key}
and trim(both '"' from `value`) in
<include refid="io.metersphere.system.mapper.BaseMapper.filterInWrapper"/>
)
</when>
<!-- 自定义多选 -->
<when test="key.startsWith('custom_multiple')">
and functional_case.id in (
select resource_id from custom_field_test_case where concat('custom_multiple-',field_id) =
select field_id from functional_case_custom_field where concat('custom_multiple-',field_id) =
#{key}
and JSON_CONTAINS(`value`, json_array(#{value}))
</when>
<when test="key=='create_user'">
<!-- 用例等级 -->
<when test="key=='caseLevel'">
and functional_case.id in (
select case_id from functional_case_custom_field where `value` in
<include refid="io.metersphere.system.mapper.BaseMapper.filterInWrapper"/>
)
</when>
<!-- 创建人 -->
<when test="key=='updateUserName'">
and functional_case.update_user in
<include refid="io.metersphere.system.mapper.BaseMapper.filterInWrapper"/>
</when>
<!-- 创建人 -->
<when test="key=='createUserName'">
and functional_case.create_user in
<include refid="io.metersphere.system.mapper.BaseMapper.filterInWrapper"/>
</when>

View File

@ -93,7 +93,7 @@
<template #createUserFilter="{ columnConfig }">
<TableFilter
v-model:visible="createUserFilterVisible"
v-model:status-filters="updateUserFilters"
v-model:status-filters="createUserFilters"
:title="(columnConfig.title as string)"
:list="memberOptions"
@search="initData()"
@ -848,6 +848,7 @@
const executeResultFilters = ref(Object.keys(executionResultMap));
const updateUserFilters = ref(memberOptions.value.map((item) => item.value));
const createUserFilters = ref(memberOptions.value.map((item) => item.value));
function getExecuteResultList() {
const list: any = [];
@ -872,9 +873,10 @@
keyword: keyword.value,
filter: {
reviewStatus: statusFilters.value,
[caseLevelFields.value.fieldId]: caseFilters.value,
caseLevel: caseFilters.value,
lastExecuteResult: executeResultFilters.value,
updateUserName: updateUserFilters.value,
createUserName: createUserFilters.value,
},
});
}

View File

@ -135,7 +135,7 @@
<template #createUserFilter="{ columnConfig }">
<TableFilter
v-model:visible="createUserFilterVisible"
v-model:status-filters="updateUserFilters"
v-model:status-filters="createUserFilters"
:title="(columnConfig.title as string)"
:list="memberOptions"
@search="initRecycleList()"
@ -196,7 +196,7 @@
<span class="one-line-text inline-block">{{ getModules(record.moduleId) }}</span>
</a-tooltip>
</template>
<template #updateUserName="{ record }">
<template #updateUser="{ record }">
<span type="text" class="px-0">{{ record.updateUserName || '-' }}</span>
</template>
<!-- 回收站自定义字段 -->
@ -395,8 +395,8 @@
},
{
title: 'caseManagement.featureCase.tableColumnUpdateUser',
slotName: 'updateUserName',
dataIndex: 'updateUserName',
slotName: 'updateUser',
dataIndex: 'updateUser',
titleSlotName: 'updateUserFilter',
sortable: {
sortDirections: ['ascend', 'descend'],
@ -578,6 +578,7 @@
const executeResultFilters = ref(Object.keys(executionResultMap));
const updateUserFilters = ref(memberOptions.value.map((item) => item.value));
const createUserFilters = ref(memberOptions.value.map((item) => item.value));
function getExecuteResultList() {
const list: any = [];
@ -637,9 +638,10 @@
keyword: keyword.value,
filter: {
reviewStatus: statusFilters.value,
[caseLevelFields.value.fieldId]: caseFilters.value,
caseLevel: caseFilters.value,
lastExecuteResult: executeResultFilters.value,
updateUserName: updateUserFilters.value,
createUserName: createUserFilters.value,
},
});
}