zhangwencui
2 天以前 f670b79094c95d791fc43c8fc8b5858ebf8426dc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
/**
 * 协同审批:审批节点 → 流程步骤(与 Web approvalDia 一致)
 * @param {Array} list approveProcessDetails 返回的节点数组
 * @returns {Array<{
 *   title: string, approverName: string, status: string, statusText: string,
 *   approveTime: string|null, opinion: string, urlTem: string, isShen: boolean
 * }>}
 */
export function mapApprovalSteps(list) {
  const rows = Array.isArray(list) ? list : [];
  return rows.map((it, idx) => {
    let status = "pending";
    if (it.approveNodeStatus === 1) status = "completed";
    else if (it.approveNodeStatus === 2) status = "rejected";
    else if (it.isShen) status = "current";
 
    let statusText = "未审批";
    if (it.approveNodeStatus === 2) statusText = "已驳回";
    else if (it.approveNodeStatus === 1) statusText = "已同意";
 
    return {
      title: `第${idx + 1}步审批`,
      approverName: it.approveNodeUser || "未知用户",
      status,
      statusText,
      approveTime: it.approveTime || null,
      opinion: it.approveNodeReason || "",
      urlTem:
        it.urlTem || (it.url ? String(it.url).replace(/word/g, "img") : ""),
      isShen: !!it.isShen,
    };
  });
}