diff --git a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtIssuesMapper.xml b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtIssuesMapper.xml index 39676d1e5a..288c787e91 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtIssuesMapper.xml +++ b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtIssuesMapper.xml @@ -196,6 +196,15 @@ #{value} + + and issues.id in ( + select resource_id from custom_field_issues where concat('custom',field_id) = #{key} + and trim(both '"' from value) in + + #{value} + + ) + diff --git a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestCaseMapper.xml b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestCaseMapper.xml index 38d03e2ed6..73b15054aa 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestCaseMapper.xml +++ b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestCaseMapper.xml @@ -505,6 +505,15 @@ #{value} + + and test_case.id in ( + select resource_id from custom_field_test_case where concat('custom',field_id) = #{key} + and trim(both '"' from value) in + + #{value} + + ) + diff --git a/backend/src/main/java/io/metersphere/service/CustomFieldResourceService.java b/backend/src/main/java/io/metersphere/service/CustomFieldResourceService.java index 023e7dacd2..1e1179985a 100644 --- a/backend/src/main/java/io/metersphere/service/CustomFieldResourceService.java +++ b/backend/src/main/java/io/metersphere/service/CustomFieldResourceService.java @@ -72,7 +72,7 @@ public class CustomFieldResourceService { if (CollectionUtils.isNotEmpty(addFields)) { this.checkInit(); addFields.forEach(field -> { - if (StringUtils.isNotBlank(field.getValue()) && StringUtils.isNotBlank(field.getTextValue())) { + if (StringUtils.isNotBlank(field.getValue()) || StringUtils.isNotBlank(field.getTextValue())) { createOrUpdateFields(tableName, resourceId, field); } }); diff --git a/frontend/src/business/components/common/components/search/MsTableSearchSelect.vue b/frontend/src/business/components/common/components/search/MsTableSearchSelect.vue index 219050852e..02519fdd70 100644 --- a/frontend/src/business/components/common/components/search/MsTableSearchSelect.vue +++ b/frontend/src/business/components/common/components/search/MsTableSearchSelect.vue @@ -42,7 +42,12 @@ if (this.component.options.showLabel) { return this.component.options.showLabel(op); } - return op.label.indexOf(".") !== -1 ? this.$t(op.label) : op.label; + if (op.label) { + return op.label.indexOf(".") !== -1 ? this.$t(op.label) : op.label; + } else { + // 自定义字段 + return op.text; + } } } } diff --git a/frontend/src/business/components/common/components/search/custom-component.js b/frontend/src/business/components/common/components/search/custom-component.js index 25a93cfc44..8b8fb9caee 100644 --- a/frontend/src/business/components/common/components/search/custom-component.js +++ b/frontend/src/business/components/common/components/search/custom-component.js @@ -28,32 +28,7 @@ export function getAdvSearchCustomField(componentArr, fields) { } function getComponentOptions(field) { - const fieldOptions = field.options ? field.options : []; - let type = field.type; - let options = []; - if (fieldOptions.length === 0 && field.type !== 'member' && field.type !== 'multipleMember') { - return options; - } - - if (type === 'member' || type === 'multipleMember') { - options = { // 异步获取候选项 - url: "/user/list", - labelKey: "name", - valueKey: "id", - showLabel: option => { - return option.label + "(" + option.value + ")"; - } - } - } - - for (let option of fieldOptions) { - let temp = { - value: option.value, - label: option.text - } - options.push(temp); - } - return options; + return Array.isArray(field.options) ? (field.options.length > 0 ? field.options : []) : []; } function getComponentName(type) { diff --git a/frontend/src/business/components/track/case/components/TestCaseList.vue b/frontend/src/business/components/track/case/components/TestCaseList.vue index 475e5a4a1c..defb51b387 100644 --- a/frontend/src/business/components/track/case/components/TestCaseList.vue +++ b/frontend/src/business/components/track/case/components/TestCaseList.vue @@ -189,6 +189,7 @@ :fields-width="fieldsWidth" :label="field.system ? $t(systemFiledMap[field.name]) :field.name" :min-width="120" + :column-key="'custom' + field.id" :prop="field.name">