From 76c6e93e36316cbf26b4fd8892c5da4a817b4806 Mon Sep 17 00:00:00 2001 From: root Date: Thu, 26 Feb 2026 00:19:37 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=AE=A1=E6=89=B9=E6=B5=81=E7=A8=8B?= =?UTF-8?q?=E6=94=B9=E4=B8=BA=E6=97=B6=E9=97=B4=E8=BD=B4=E6=A0=B7=E5=BC=8F?= =?UTF-8?q?=EF=BC=8C=E5=A2=9E=E5=8A=A0=E5=AE=A1=E6=89=B9=E4=BA=BA/?= =?UTF-8?q?=E6=8A=84=E9=80=81=E4=BA=BA=E6=A0=87=E8=AF=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 审批流程使用时间轴样式显示 - 增加"审批人"和"抄送人"标签 - 已审批节点显示审批人姓名和审批时间 - 未审批节点显示节点名称(人名) - 当前审批节点高亮显示 Co-Authored-By: Claude Opus 4.6 --- frontend/src/pages/approval/detail.module.css | 36 ++++++++++- frontend/src/pages/approval/detail.tsx | 63 +++++++++++++------ 2 files changed, 77 insertions(+), 22 deletions(-) diff --git a/frontend/src/pages/approval/detail.module.css b/frontend/src/pages/approval/detail.module.css index ebcb167..8887cd9 100644 --- a/frontend/src/pages/approval/detail.module.css +++ b/frontend/src/pages/approval/detail.module.css @@ -64,6 +64,9 @@ .approverItem { padding: 8px 0; border-bottom: 1px solid #f0f0f0; + display: flex; + align-items: center; + gap: 8px; } .approverItem:last-child { @@ -73,12 +76,15 @@ .approverName { font-size: 15px; color: #333; - margin-bottom: 4px; } .approverType { font-size: 13px; - color: #999; + color: #fff; + background: #666; + padding: 2px 8px; + border-radius: 4px; + flex-shrink: 0; } .formData { @@ -183,6 +189,20 @@ align-items: center; justify-content: center; flex-shrink: 0; + background: #e8e8e8; + color: #999; + font-weight: 600; +} + +.timelineDot.done { + background: #52c41a; + color: #fff; +} + +.timelineDot.current { + background: #1890ff; + color: #fff; + box-shadow: 0 0 0 4px rgba(24, 144, 255, 0.2); } .timelineDotIcon { @@ -197,6 +217,18 @@ font-size: 15px; color: #333; margin-bottom: 4px; + display: flex; + align-items: center; + gap: 8px; +} + +.timelineType { + font-size: 13px; + color: #fff; + background: #666; + padding: 2px 8px; + border-radius: 4px; + flex-shrink: 0; } .timelineName { diff --git a/frontend/src/pages/approval/detail.tsx b/frontend/src/pages/approval/detail.tsx index 73e8103..bffef9c 100644 --- a/frontend/src/pages/approval/detail.tsx +++ b/frontend/src/pages/approval/detail.tsx @@ -331,11 +331,15 @@ export default function ApprovalDetail() { {/* 当前审批节点 */} {detail.status === 'pending' && currentApprovers.length > 0 && ( - {currentApprovers.map((item, index) => ( -
-
{getNodeApproversNames(item.nodeId, item.nodeType)}
-
- ))} + {currentApprovers.map((item, index) => { + const typeLabel = item.nodeType === 'notify' ? '抄送人' : '审批人' + return ( +
+ {typeLabel} + {getNodeApproversNames(item.nodeId, item.nodeType)} +
+ ) + })}
)} @@ -364,31 +368,50 @@ export default function ApprovalDetail() { {/* 审批流程 */} {detail.flow?.nodes && detail.flow.nodes.length > 0 && ( -
+
{detail.flow.nodes.map((node, index) => { const isCurrent = detail.current_nodes?.includes(node.id) - const record = detail.records.find((r) => r.node_id === node.id) + const records = detail.records.filter(r => r.node_id === node.id && r.action !== 'submit') + const hasApproved = records.length > 0 - let status: 'pending' | 'done' = 'pending' - if (record) { - status = 'done' + // 判断节点状态 + let nodeStatus: 'pending' | 'done' = 'pending' + if (hasApproved) { + nodeStatus = 'done' } else if (!isCurrent && index > 0) { - // 检查前面的节点是否完成 const prevNode = detail.flow.nodes[index - 1] const prevRecord = detail.records.find((r) => r.node_id === prevNode.id) - if (prevRecord) status = 'done' + if (prevRecord) nodeStatus = 'done' + } + + // 获取节点类型标签 + const typeLabel = node.type === 'notify' ? '抄送人' : '审批人' + + // 获取显示名称和审批时间 + let displayName = node.name || '待定' + let approvalTime = '' + + if (hasApproved && records[0]) { + displayName = records[0].approver?.name || displayName + approvalTime = formatTime(records[0].created_at) } return ( -
-
- {status === 'done' ? '✓' : index + 1} +
+
+ {nodeStatus === 'done' ? '✓' : index + 1}
-
-
{getNodeDisplayName(node)}
+
+
+ {typeLabel} + {displayName} +
+ {approvalTime && ( +
{approvalTime}
+ )} + {hasApproved && records[0]?.comment && ( +
备注: {records[0].comment}
+ )}
)