From 09ccc05b83a3a0333aa7f892f6142821ec4941b8 Mon Sep 17 00:00:00 2001 From: root Date: Thu, 26 Feb 2026 00:06:19 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=AE=A1=E6=89=B9=E8=AF=A6=E6=83=85?= =?UTF-8?q?=E9=A1=B5=E8=A1=A8=E5=8D=95=E5=AD=97=E6=AE=B5=E6=A0=87=E7=AD=BE?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E4=B8=AD=E6=96=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 添加表单字段映射表(formFieldLabelMap) - 将英文key(如reason)翻译成中文标签(如"出差事由") Co-Authored-By: Claude Opus 4.6 --- frontend/src/pages/approval/detail.tsx | 34 ++++++++++++++++++++------ 1 file changed, 26 insertions(+), 8 deletions(-) diff --git a/frontend/src/pages/approval/detail.tsx b/frontend/src/pages/approval/detail.tsx index 991f5a3..4d603fb 100644 --- a/frontend/src/pages/approval/detail.tsx +++ b/frontend/src/pages/approval/detail.tsx @@ -39,6 +39,20 @@ const businessTypeConfig: Record = { purchase: '采购申请', } +// 表单字段映射(英文key -> 中文label) +const formFieldLabelMap: Record = { + reason: '出差事由', + itineraries: '行程安排', + destination: '目的地', + start_date: '开始日期', + end_date: '结束日期', + estimated_cost: '预计费用', + approvers: '审批人', + cc_users: '抄送人', + attachment: '附件', + remark: '备注', +} + interface ApprovalRecord { id: number node_id: number @@ -312,14 +326,18 @@ export default function ApprovalDetail() {
{Object.entries(detail.form_data) .filter(([key]) => !['approvers', 'cc_users'].includes(key)) - .map(([key, value]) => ( -
- {key}: - - {Array.isArray(value) ? value.join(', ') : String(value)} - -
- ))} + .map(([key, value]) => { + // 获取字段标签,优先使用映射表,没有则使用原始key + const label = formFieldLabelMap[key] || key + return ( +
+ {label}: + + {Array.isArray(value) ? value.join(', ') : String(value)} + +
+ ) + })}
)}