fix(用例管理): 评审详情页面自定义字段显示问题
--bug=1038461 --user=王旭 【用例评审】功能用例的基础信息里面的自定义字段未正确回显值 https://www.tapd.cn/55049933/s/1487322
This commit is contained in:
parent
12810bea13
commit
455b6a263b
|
@ -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'),
|
||||
|
|
Loading…
Reference in New Issue