From 8cf4fd444d440297f35093915398f7ffb7f8e818 Mon Sep 17 00:00:00 2001 From: chenjianxing Date: Tue, 8 Nov 2022 11:44:54 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=B5=8B=E8=AF=95=E8=B7=9F=E8=B8=AA):=20?= =?UTF-8?q?=E5=8A=9F=E8=83=BD=E7=94=A8=E4=BE=8B=E9=AB=98=E7=BA=A7=E6=90=9C?= =?UTF-8?q?=E7=B4=A2=EF=BC=8C=E7=94=A8=E4=BE=8B=E7=8A=B6=E6=80=81=E6=90=9C?= =?UTF-8?q?=E7=B4=A2=E7=BB=93=E6=9E=9C=E4=B8=8D=E5=87=86=E7=A1=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1019476 --user=陈建星 【测试跟踪】github #19529,在使用功能用例列表的“高级搜索”的时候,按自定义的用例状态进行搜索,只能查询到一条数据 https://www.tapd.cn/55049933/s/1291489 --- .../components/search/search-components.js | 15 ++++- .../base/mapper/ext/ExtTestCaseMapper.xml | 6 ++ .../business/case/components/TestCaseList.vue | 65 ++++++++++++------- 3 files changed, 60 insertions(+), 26 deletions(-) diff --git a/framework/sdk-parent/frontend/src/components/search/search-components.js b/framework/sdk-parent/frontend/src/components/search/search-components.js index 70a79f5939..3567557c80 100644 --- a/framework/sdk-parent/frontend/src/components/search/search-components.js +++ b/framework/sdk-parent/frontend/src/components/search/search-components.js @@ -637,6 +637,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 = { key: "planCaseStatus", name: 'MsTableSearchSelect', @@ -850,7 +863,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 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]; diff --git a/test-track/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestCaseMapper.xml b/test-track/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestCaseMapper.xml index 2611c3458a..8cadaa92c5 100644 --- a/test-track/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestCaseMapper.xml +++ b/test-track/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestCaseMapper.xml @@ -46,6 +46,12 @@ + + and test_case.status + + + + and test_case.create_time diff --git a/test-track/frontend/src/business/case/components/TestCaseList.vue b/test-track/frontend/src/business/case/components/TestCaseList.vue index 668defa72d..736c22b063 100644 --- a/test-track/frontend/src/business/case/components/TestCaseList.vue +++ b/test-track/frontend/src/business/case/components/TestCaseList.vue @@ -536,31 +536,7 @@ export default { let template = data[1]; this.testCaseTemplate = template; this.fields = getTableHeaderWithCustomFields(this.tableHeaderKey, this.testCaseTemplate.customFields, this.members); - // todo 处理高级搜索自定义字段部分 - 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.initConditionComponents() this.setTestCaseDefaultValue(template); this.typeArr = []; 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) { let testCaseDefaultValue = {}; template.customFields.forEach(item => {