fix(测试跟踪): 功能用例高级搜索,用例状态搜索结果不准确

--bug=1019476 --user=陈建星 【测试跟踪】github #19529,在使用功能用例列表的“高级搜索”的时候,按自定义的用例状态进行搜索,只能查询到一条数据 https://www.tapd.cn/55049933/s/1291489
This commit is contained in:
chenjianxing 2022-11-08 11:44:54 +08:00 committed by jianxing
parent 0bba27983a
commit 30a533159c
3 changed files with 60 additions and 26 deletions

View File

@ -654,6 +654,19 @@ export const CASE_REVIEW_STATUS = {
} }
} }
export const CASE_STATUS = {
key: "status",
name: 'MsTableSearchSelect',
label: "custom_field.case_status",
operator: {
options: [OPERATORS.IN, OPERATORS.NOT_IN]
},
options: [],
props: {
multiple: true
}
}
export const PLAN_CASE_STATUS = { export const PLAN_CASE_STATUS = {
key: "planCaseStatus", key: "planCaseStatus",
name: 'MsTableSearchSelect', name: 'MsTableSearchSelect',
@ -867,7 +880,7 @@ export const UI_CUSTOM_COMMAND_CONFIGS = [NAME, CREATE_TIME, PROJECT_CREATOR, UI
export const UI_CUSTOM_COMMAND_CONFIGS_TRASH = [NAME, CREATE_TIME, PROJECT_CREATOR, UI_CUSTOM_COMMAND_TRASH_MODULE_TREE]; export const UI_CUSTOM_COMMAND_CONFIGS_TRASH = [NAME, CREATE_TIME, PROJECT_CREATOR, UI_CUSTOM_COMMAND_TRASH_MODULE_TREE];
// 测试跟踪-测试用例 列表 // 测试跟踪-测试用例 列表
export const TEST_CASE_CONFIGS = [ID, NAME, TAGS, TEST_CASE_MODULE_TREE, CREATE_TIME, UPDATE_TIME, CREATOR, CASE_REVIEW_STATUS, FOLLOW_PEOPLE, CASE_DEMAND]; export const TEST_CASE_CONFIGS = [ID, NAME, TAGS, TEST_CASE_MODULE_TREE, CREATE_TIME, UPDATE_TIME, CREATOR, CASE_REVIEW_STATUS, FOLLOW_PEOPLE, CASE_DEMAND, CASE_STATUS];
export const TEST_PLAN_CONFIGS = [NAME, UPDATE_TIME, CREATE_TIME, PRINCIPAL, TEST_PLAN_STATUS, STAGE, TAGS, FOLLOW_PEOPLE, ACTUAL_START_TIME, ACTUAL_END_TIME, PLAN_START_TIME, PLAN_END_TIME]; export const TEST_PLAN_CONFIGS = [NAME, UPDATE_TIME, CREATE_TIME, PRINCIPAL, TEST_PLAN_STATUS, STAGE, TAGS, FOLLOW_PEOPLE, ACTUAL_START_TIME, ACTUAL_END_TIME, PLAN_START_TIME, PLAN_END_TIME];

View File

@ -46,6 +46,12 @@
<property name="object" value="${condition}.priority"/> <property name="object" value="${condition}.priority"/>
</include> </include>
</if> </if>
<if test="${condition}.status != null">
and test_case.status
<include refid="io.metersphere.base.mapper.ext.ExtBaseMapper.condition">
<property name="object" value="${condition}.status"/>
</include>
</if>
<if test="${condition}.createTime != null"> <if test="${condition}.createTime != null">
and test_case.create_time and test_case.create_time
<include refid="io.metersphere.base.mapper.ext.ExtBaseMapper.condition"> <include refid="io.metersphere.base.mapper.ext.ExtBaseMapper.condition">

View File

@ -536,31 +536,7 @@ export default {
let template = data[1]; let template = data[1];
this.testCaseTemplate = template; this.testCaseTemplate = template;
this.fields = getTableHeaderWithCustomFields(this.tableHeaderKey, this.testCaseTemplate.customFields, this.members); this.fields = getTableHeaderWithCustomFields(this.tableHeaderKey, this.testCaseTemplate.customFields, this.members);
// todo this.initConditionComponents()
this.condition.components = this.condition.components.filter(item => item.custom !== true);
let comp = getAdvSearchCustomField(this.condition, this.testCaseTemplate.customFields);
//
comp.filter(element => {
if (element.label === '责任人') {
element.label = this.$t('custom_field.case_maintainer')
}
if (element.label === '用例等级') {
element.label = this.$t('custom_field.case_priority')
}
if (element.label === '用例状态') {
element.label = this.$t('custom_field.case_status')
// TAB
if (this.trashEnable) {
element.operator.options = [OPERATORS.IN];
element.options = [{text: this.$t('test_track.plan.plan_status_trash'), value: 'Trash'}];
} else {
element.options.forEach(option => {
option.text = this.$t(option.text);
});
}
}
})
this.condition.components.push(...comp);
this.setTestCaseDefaultValue(template); this.setTestCaseDefaultValue(template);
this.typeArr = []; this.typeArr = [];
this.typeArr.push({ this.typeArr.push({
@ -577,6 +553,45 @@ export default {
}); });
}); });
}, },
initConditionComponents() {
this.condition.components = this.condition.components.filter(item => item.custom !== true);
let comp = getAdvSearchCustomField(this.condition, this.testCaseTemplate.customFields);
let statusOption = null;
//
comp = comp.filter(element => {
if (element.label === '责任人') {
element.label = this.$t('custom_field.case_maintainer')
}
if (element.label === '用例等级') {
element.label = this.$t('custom_field.case_priority')
}
if (element.label === '用例状态') {
element.label = this.$t('custom_field.case_status')
// TAB
if (this.trashEnable) {
element.operator.options = [OPERATORS.IN];
element.options = [{text: this.$t('test_track.plan.plan_status_trash'), value: 'Trash'}];
} else {
element.options.forEach(option => option.text = this.$t(option.text));
}
statusOption = element.options;
// status
return false;
}
return true;
});
if (statusOption) {
this.condition.components.forEach((item) => {
if (item.key === 'status') {
item .options = statusOption;
}
});
} else {
// statusOption
this.condition.components = this.condition.components.filter((item) => item.key !== 'status');
}
this.condition.components.push(...comp);
},
setTestCaseDefaultValue(template) { setTestCaseDefaultValue(template) {
let testCaseDefaultValue = {}; let testCaseDefaultValue = {};
template.customFields.forEach(item => { template.customFields.forEach(item => {