From 455b6a263b4f6c7bc9d918f80bb77ef8ec6c8392 Mon Sep 17 00:00:00 2001 From: WangXu10 Date: Wed, 3 Apr 2024 14:31:46 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E7=94=A8=E4=BE=8B=E7=AE=A1=E7=90=86):=20?= =?UTF-8?q?=E8=AF=84=E5=AE=A1=E8=AF=A6=E6=83=85=E9=A1=B5=E9=9D=A2=E8=87=AA?= =?UTF-8?q?=E5=AE=9A=E4=B9=89=E5=AD=97=E6=AE=B5=E6=98=BE=E7=A4=BA=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1038461 --user=王旭 【用例评审】功能用例的基础信息里面的自定义字段未正确回显值 https://www.tapd.cn/55049933/s/1487322 --- .../case-management/caseReview/caseDetail.vue | 33 +++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/frontend/src/views/case-management/caseReview/caseDetail.vue b/frontend/src/views/case-management/caseReview/caseDetail.vue index 2ad161f8b5..029c18698e 100644 --- a/frontend/src/views/case-management/caseReview/caseDetail.vue +++ b/frontend/src/views/case-management/caseReview/caseDetail.vue @@ -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'),