fix: 缺陷列表自定义字段多选框显示id列表

This commit is contained in:
chenjianxing 2021-08-27 16:52:56 +08:00 committed by jianxing
parent 7f7832e986
commit 88dc368ba7
1 changed files with 33 additions and 2 deletions

View File

@ -425,14 +425,29 @@ export function getCustomFieldValue(row, field, members) {
for (let i = 0; i < row.customFields.length; i++) { for (let i = 0; i < row.customFields.length; i++) {
let item = row.customFields[i]; let item = row.customFields[i];
if (item.name === field.name) { if (item.name === field.name) {
if (field.type === 'member' || field.type === 'multipleMember') { if (field.type === 'member') {
for (let j = 0; j < members.length; j++) { for (let j = 0; j < members.length; j++) {
let member = members[j]; let member = members[j];
if (member.id === item.value) { if (member.id === item.value) {
return member.name; return member.name;
} }
} }
} else if (['radio', 'select', 'multipleSelect', 'checkbox'].indexOf(field.type) > -1) { } else if (field.type === 'multipleMember') {
if (item.value) {
let values = '';
item.value.forEach(v => {
for (let j = 0; j < members.length; j++) {
let member = members[j];
if (member.id === v) {
values += member.name;
values += " ";
break;
}
}
});
return values;
}
} else if (['radio', 'select'].indexOf(field.type) > -1) {
for (let j = 0; j < field.options.length; j++) { for (let j = 0; j < field.options.length; j++) {
let option = field.options[j]; let option = field.options[j];
if (option.value === item.value) { if (option.value === item.value) {
@ -440,6 +455,22 @@ export function getCustomFieldValue(row, field, members) {
} }
} }
} }
else if (['multipleSelect', 'checkbox'].indexOf(field.type) > -1) {
if (item.value) {
let values = '';
item.value.forEach(v => {
for (let j = 0; j < field.options.length; j++) {
let option = field.options[j];
if (option.value === v) {
values += (field.system ? i18n.t(option.text) : option.text);
values += " ";
break;
}
}
});
return values;
}
}
return item.value; return item.value;
} }
} }