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">
@@ -630,7 +631,7 @@ export default {
Promise.all([p1, p2]).then((data) => {
let template = data[1];
this.testCaseTemplate = template;
- this.fields = getTableHeaderWithCustomFields('TRACK_TEST_CASE', this.testCaseTemplate.customFields);
+ this.fields = getTableHeaderWithCustomFields('TRACK_TEST_CASE', this.testCaseTemplate.customFields, this.members);
// todo 处理高级搜索自定义字段部分
let comp = getAdvSearchCustomField(this.condition.components, this.testCaseTemplate.customFields);
this.condition.components.push(...comp);
@@ -671,12 +672,8 @@ export default {
return value ? value : '';
},
getCustomFieldFilter(field) {
- if (field.name === '用例等级') {
- return this.priorityFilters;
- } else if (field.name === '用例状态') {
- return this.statusFilters;
- }
- return null;
+ return !Array.isArray(field.options) ?
+ (field.options.length > 0 ? field.options : null) : null;
},
checkRedirectEditPage(redirectParam) {
if (redirectParam != null) {
diff --git a/frontend/src/business/components/track/issue/IssueList.vue b/frontend/src/business/components/track/issue/IssueList.vue
index 25f7bd853d..75496c09b2 100644
--- a/frontend/src/business/components/track/issue/IssueList.vue
+++ b/frontend/src/business/components/track/issue/IssueList.vue
@@ -128,9 +128,11 @@
diff --git a/frontend/src/common/js/tableUtils.js b/frontend/src/common/js/tableUtils.js
index bbdbc46a83..fcc51f3785 100644
--- a/frontend/src/common/js/tableUtils.js
+++ b/frontend/src/common/js/tableUtils.js
@@ -283,11 +283,18 @@ function getCustomTableHeaderByFiledSetting(key, fieldSetting) {
* @param customFields
* @returns {[]|*}
*/
-export function getTableHeaderWithCustomFields(key, customFields) {
+export function getTableHeaderWithCustomFields(key, customFields, projectMembers=[]) {
let fieldSetting = [...CUSTOM_TABLE_HEADER[key]];
fieldSetting = JSON.parse(JSON.stringify(fieldSetting)); // 复制,国际化
translateLabel(fieldSetting);
let keys = getCustomFieldsKeys(customFields);
+ projectMembers.forEach(member => {
+ member['text'] = member.name;
+ // 高级搜索使用
+ member['label'] = member.name;
+ member['value'] = member.id;
+ member['showLabel'] = member.name + "(" + member.id + ")";
+ })
customFields.forEach(item => {
if (!item.key) {
// 兼容旧版,更新key
@@ -301,6 +308,9 @@ export function getTableHeaderWithCustomFields(key, customFields) {
isCustom: true
}
fieldSetting.push(field);
+ if (item.type === 'member' && projectMembers && projectMembers.length > 0) {
+ item.options = projectMembers;
+ }
});
return getCustomTableHeaderByFiledSetting(key, fieldSetting);
}