fix(用例管理): 评审详情页面自定义字段显示问题

--bug=1038461 --user=王旭 【用例评审】功能用例的基础信息里面的自定义字段未正确回显值 https://www.tapd.cn/55049933/s/1487322
This commit is contained in:
WangXu10 2024-04-03 14:31:46 +08:00 committed by 刘瑞斌
parent 12810bea13
commit 455b6a263b
1 changed files with 31 additions and 2 deletions

View File

@ -427,6 +427,35 @@
}
}
const caseDetailLoading = ref(false);
function getCustomField(customFields: any) {
const multipleExcludes = ['MULTIPLE_SELECT', 'CHECKBOX', 'MULTIPLE_MEMBER'];
const selectExcludes = ['MEMBER', 'RADIO', 'SELECT'];
let selectValue;
//
if (multipleExcludes.includes(customFields.type) && customFields.defaultValue) {
selectValue = JSON.parse(customFields.defaultValue);
return (
(customFields.options || [])
.filter((item: any) => selectValue.includes(item.value))
.map((it: any) => it.text)
.join(',') || '-'
);
}
if (customFields.type === 'MULTIPLE_INPUT') {
//
return JSON.parse(customFields.defaultValue).join('') || '-';
}
if (selectExcludes.includes(customFields.type)) {
return (
(customFields.options || [])
.filter((item: any) => customFields.defaultValue === item.value)
.map((it: any) => it.text)
.join() || '-'
);
}
return customFields.defaultValue || '-';
}
//
async function loadCaseDetail() {
try {
@ -445,7 +474,7 @@
typeof e.defaultValue === 'string' && e.defaultValue !== '' ? JSON.parse(e.defaultValue) : e.defaultValue;
return {
label: e.fieldName,
value: Array.isArray(val) ? val.join('、') : val,
value: getCustomField(e),
};
} catch (error) {
return {
@ -456,7 +485,7 @@
}),
{
label: t('caseManagement.caseReview.creator'),
value: res.createUser || '',
value: res.createUserName || '',
},
{
label: t('caseManagement.caseReview.createTime'),