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

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

View File

@ -428,14 +428,29 @@ export function getCustomFieldValue(row, field, members) {
for (let i = 0; i < row.customFields.length; i++) {
let item = row.customFields[i];
if (item.name === field.name) {
if (field.type === 'member' || field.type === 'multipleMember') {
if (field.type === 'member') {
for (let j = 0; j < members.length; j++) {
let member = members[j];
if (member.id === item.value) {
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++) {
let option = field.options[j];
if (option.value === item.value) {
@ -443,6 +458,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;
}
}