diff --git a/src/domains/hose/flow.test.ts b/src/domains/hose/flow.test.ts index 4184574..eb5f0be 100644 --- a/src/domains/hose/flow.test.ts +++ b/src/domains/hose/flow.test.ts @@ -20,7 +20,9 @@ import { getHoseCloseFlow, alignApprovalRunsWithHoseFlow, formatAiDecision, - formatHumanOpinionLines + formatHumanOpinionLines, + formatNumberedHumanOpinions, + formatRejectionComment } from "./flow.js"; import { searchCloseBacklogs, @@ -786,8 +788,8 @@ describe("Hose Flow Domain", () => { const aligned = alignApprovalRunsWithHoseFlow(runs, flow); const r1 = aligned.get("run-1")!; - expect(r1.eHumanAction).toBe("驳回"); - expect(r1.eHumanComment).toBe("发票不全缺少总经理审批,退回修改"); + expect(r1.eHumanAction).toBe("审批驳回"); + expect(r1.eHumanComment).toBe("主管B: 发票不全缺少总经理审批,退回修改"); expect(r1.operator?.name).toBe("主管B"); expect(r1.auditDrift).toBe(false); @@ -797,13 +799,13 @@ describe("Hose Flow Domain", () => { expect(r2.auditDrift).toBe(false); const r3 = aligned.get("run-3")!; - expect(r3.eHumanAction).toBe("通过"); - expect(r3.eHumanComment).toBe("财务C: 核销通过"); + expect(r3.eHumanAction).toBe("审批通过"); + expect(r3.eHumanComment).toBe("1. 财务C: 核销通过"); expect(r3.operator?.name).toBe("财务C"); expect(r3.auditDrift).toBe(false); }); - test("handles unfinished flow: pending on human node", () => { + test("handles unfinished flow: pending on human node with reverse order and badge", () => { const runs = [ { id: "run-3", @@ -825,8 +827,8 @@ describe("Hose Flow Domain", () => { const aligned = alignApprovalRunsWithHoseFlow(runs, flow); const r3 = aligned.get("run-3")!; - expect(r3.eHumanAction).toBe("审核中"); - expect(r3.eHumanComment).toBe("财务C审核:当前审核节点"); + expect(r3.eHumanAction).toBe("⏳ 审批中"); + expect(r3.eHumanComment).toBe("⏳ 1. 财务C审核: 待审批"); }); test("detects Post-AI Mutation (审计漂移 / 过审后中途被修改)", () => { @@ -853,7 +855,7 @@ describe("Hose Flow Domain", () => { const aligned = alignApprovalRunsWithHoseFlow(runs, flow); const r1 = aligned.get("run-1")!; - expect(r1.eHumanAction).toBe("通过 (⚠️ AI通过后被中途修改)"); + expect(r1.eHumanAction).toBe("审批通过"); expect(r1.auditDrift).toBe(true); expect(r1.auditDriftReason).toContain("AI通过后单据发生撤回/修改重提"); }); @@ -908,8 +910,8 @@ describe("Hose Flow Domain", () => { expect(r1.auditDrift).toBe(false); const r2 = aligned.get("run-active")!; - expect(r2.eHumanAction).toBe("审核中"); - expect(r2.eHumanComment).toBe("上级主管(张舒):当前审核节点"); + expect(r2.eHumanAction).toBe("⏳ 审批中"); + expect(r2.eHumanComment).toBe("⏳ 1. 上级主管(张舒): 待审批"); expect(r2.auditDrift).toBe(false); }); @@ -945,28 +947,84 @@ describe("Hose Flow Domain", () => { const aligned = alignApprovalRunsWithHoseFlow(runs, flow); const r = aligned.get("run-paid")!; expect(r.aiDecision).toBe("备注通过"); - expect(r.eHumanAction).toBe("通过"); + expect(r.eHumanAction).toBe("已支付"); expect(r.auditDrift).toBe(false); // Verify opinions: - // 1. Agree nodes present - expect(r.eHumanComment).toContain("上级主管(张舒): 同意"); - expect(r.eHumanComment).toContain("财务助理(熊雪倩): 同意"); - expect(r.eHumanComment).toContain("部门主管(张舒): 自动同意"); + // 1. Agree nodes present with sequence numbers + expect(r.eHumanComment).toContain("1. 上级主管(张舒): 同意"); + expect(r.eHumanComment).toContain("2. 财务助理(熊雪倩): 同意"); + expect(r.eHumanComment).toContain("3. 部门主管(张舒): 自动同意"); // 2. Duplicate comment deduplicated (appears only once) const matches = r.eHumanComment.match(/高思琦: ETA2026年家庭日费用报销/g); expect(matches?.length).toBe(1); // 3. freeflow.pay mapped to 支付成功 - expect(r.eHumanComment).toContain("高思琦: 支付成功"); + expect(r.eHumanComment).toContain("5. 高思琦: 支付成功"); // 4. freeflow.carbonCopy omitted expect(r.eHumanComment).not.toContain("freeflow.carbonCopy"); expect(r.eHumanComment).not.toContain("抄送单据"); expect(r.eHumanComment).not.toContain("抄送通知"); // 5. No pending node appended expect(r.eHumanComment).not.toContain("当前审核节点"); + expect(r.eHumanComment).not.toContain("待支付"); }); - test("handles AI approved run rejected by human operator before resubmission and payment: resolves to 驳回", () => { + test("handles cashier paying document (B26002283 scenario): resolves to ⏳ 支付中 with reverse order opinions", () => { + const runs = [ + { + id: "run-paying", + sourceDocumentSN: "B26002283", + taskMode: "assisted", + createdAt: 10000, + status: "completed", + manualApprovalRecord: { + status: { type: "PROCESSING", label: "处理中" } + }, + result: { decision: "REJECT" } + } + ] as any[]; + + const flow = { + state: "支付中", + rawState: "paying", + currentNode: "出纳支付", + history: [ + { time: 8000, action: "提交送审", rawAction: "freeflow.submit", operator: { name: "侯旭鹏" } }, + { time: 11000, action: "审批同意", rawAction: "freeflow.agree", nodeName: ".上级主管", operator: { name: "江辉华" }, comment: "同意" }, + { time: 12000, action: "审批同意", rawAction: "freeflow.agree", nodeName: "财务助理", operator: { name: "熊雪倩" }, comment: "同意" }, + { time: 13000, action: "自动同意", rawAction: "freeflow.autoAgree", nodeName: "部门主管", operator: { name: "江辉华" } }, + { time: 13001, action: "自动同意", rawAction: "freeflow.autoAgree", nodeName: "部门领导", operator: { name: "江辉华" } }, + { time: 14000, action: "审批同意", rawAction: "freeflow.agree", nodeName: "财务经理", operator: { name: "周晚容" }, comment: "同意" }, + { time: 15000, action: "审批同意", rawAction: "freeflow.agree", nodeName: "CFO", operator: { name: "张舒" }, comment: "同意" }, + { time: 16000, action: "打印单据", rawAction: "freeflow.print", nodeName: "打印提醒", operator: { name: "高思琦" } } + ], + pending: [ + { + name: "出纳支付", + type: "PAYING", + isCurrent: true, + approver: { name: "高思琦" } + } + ] + } as any; + + const aligned = alignApprovalRunsWithHoseFlow(runs, flow); + const r = aligned.get("run-paying")!; + expect(r.eHumanAction).toBe("⏳ 支付中"); + + // Verify reverse order: + // Line 1 is the pending cashier node with badge ⏳ and seq 7 + const lines = r.eHumanComment.split("\n"); + expect(lines[0]).toBe("⏳ 7. 出纳支付(高思琦): 待支付"); + // Line 2 is the most recent approval: CFO (seq 6) + expect(lines[1]).toBe("6. CFO(张舒): 同意"); + // Line 3 is 财务经理 (seq 5) + expect(lines[2]).toBe("5. 财务经理(周晚容): 同意"); + // Line 7 is .上级主管 (seq 1) + expect(lines[6]).toBe("1. .上级主管(江辉华): 同意"); + }); + + test("handles AI approved run rejected by human operator before resubmission and payment: resolves to 审批驳回 with node and operator prefix", () => { const runs = [ { id: "run-rejected-then-paid", @@ -990,7 +1048,7 @@ describe("Hose Flow Domain", () => { { time: 11000, action: "审批同意", rawAction: "freeflow.agree", nodeName: "上级主管", operator: { name: "刘苏宁" } }, { time: 15000, action: "审批驳回", rawAction: "freeflow.reject", nodeName: "提交人", comment: "修改附件", operator: { name: "熊雪倩" } }, { time: 20000, action: "提交送审", rawAction: "freeflow.submit", operator: { name: "张晶丰" } }, - { time: 25000, action: "审批同意", rawAction: "freeflow.agree", operator: { name: "熊雪倩" } }, + { time: 25000, action: "审批同意", rawAction: "freeflow.agree", nodeName: "财务助理", operator: { name: "熊雪倩" } }, { time: 30000, action: "支付完成", rawAction: "freeflow.pay", operator: { name: "高思琦" } } ], pending: [] @@ -999,8 +1057,9 @@ describe("Hose Flow Domain", () => { const aligned = alignApprovalRunsWithHoseFlow(runs, flow); const r = aligned.get("run-rejected-then-paid")!; expect(r.aiDecision).toBe("备注通过"); - expect(r.eHumanAction).toBe("驳回"); - expect(r.eHumanComment).toBe("修改附件"); + expect(r.eHumanAction).toBe("审批驳回"); + // Node prefix resolved from熊雪倩's approval node in history: 财务助理(熊雪倩): 修改附件 + expect(r.eHumanComment).toBe("财务助理(熊雪倩): 修改附件"); expect(r.auditDrift).toBe(false); expect(r.operator?.name).toBe("熊雪倩"); }); @@ -1040,5 +1099,55 @@ describe("Hose Flow Domain", () => { expect(formatAiDecision("REJECT")).toBe("驳回"); expect(formatAiDecision("REVIEW")).toBe("转交复核"); }); + + test("formatNumberedHumanOpinions formats forward order for completed flows", () => { + const history = ["上级主管(张舒): 同意", "财务助理(熊雪倩): 同意", "CFO(张舒): 自动同意"]; + const formatted = formatNumberedHumanOpinions(history, [], "forward"); + expect(formatted).toBe( + "1. 上级主管(张舒): 同意\n2. 财务助理(熊雪倩): 同意\n3. CFO(张舒): 自动同意" + ); + }); + + test("formatNumberedHumanOpinions formats reverse order with pending badge for in-progress flows", () => { + const history = ["上级主管(江辉华): 同意", "财务助理(熊雪倩): 同意"]; + const pending = ["财务经理(周晚容): 待审批", "CFO(张舒): 待审批"]; + const formatted = formatNumberedHumanOpinions(history, pending, "reverse"); + const lines = formatted.split("\n"); + // Pending nodes first, starting from seq 3, then 4. First pending has ⏳ badge. + expect(lines[0]).toBe("⏳ 3. 财务经理(周晚容): 待审批"); + expect(lines[1]).toBe("4. CFO(张舒): 待审批"); + // History approvals in reverse order + expect(lines[2]).toBe("2. 财务助理(熊雪倩): 同意"); + expect(lines[3]).toBe("1. 上级主管(江辉华): 同意"); + }); + + test("formatRejectionComment prepends node and operator name", () => { + const res1 = formatRejectionComment( + { + rawAction: "freeflow.reject", + action: "审批驳回", + nodeName: "提交人", + operator: { name: "熊雪倩" }, + comment: "修改附件" + } as any, + undefined, + undefined, + [ + { rawAction: "freeflow.agree", nodeName: "财务助理", operator: { name: "熊雪倩" } } as any + ] + ); + expect(res1.comment).toBe("财务助理(熊雪倩): 修改附件"); + expect(res1.operator?.name).toBe("熊雪倩"); + + const res2 = formatRejectionComment( + undefined, + { + nodeName: "财务经理", + operator: { name: "周晚容" }, + reason: "单据超标缺少说明" + } as any + ); + expect(res2.comment).toBe("财务经理(周晚容): 单据超标缺少说明"); + }); }); }); diff --git a/src/domains/hose/flow.ts b/src/domains/hose/flow.ts index 08d6901..8bd5cf2 100644 --- a/src/domains/hose/flow.ts +++ b/src/domains/hose/flow.ts @@ -737,6 +737,130 @@ export function formatHumanOpinionLines(events: HoseFlowTimelineEntry[]): string return lines; } +export function formatNumberedHumanOpinions( + historyLines: string[], + pendingLines: string[] = [], + mode: "forward" | "reverse" = "forward" +): string { + if (historyLines.length === 0 && pendingLines.length === 0) { + return "-"; + } + + if (mode === "forward") { + const all = [...historyLines, ...pendingLines]; + return all.map((line, idx) => `${idx + 1}. ${line}`).join("\n"); + } + + // Reverse chronological order for in-progress approvals: + // Pending node(s) appear at the top with badge (e.g. ⏳ 7. 出纳支付(高思琦): 待支付), + // followed by history approvals in reverse order (e.g. 6. CFO, 5. 财务经理...) + const result: string[] = []; + + pendingLines.forEach((line, idx) => { + const seq = historyLines.length + idx + 1; + const badge = idx === 0 ? "⏳ " : ""; + result.push(`${badge}${seq}. ${line}`); + }); + + for (let i = historyLines.length - 1; i >= 0; i--) { + const seq = i + 1; + result.push(`${seq}. ${historyLines[i]}`); + } + + return result.join("\n"); +} + +export function formatRejectionComment( + rejectEvent?: HoseFlowTimelineEntry, + rejectionDetail?: HoseRejectionDetail, + mar?: Record, + history?: HoseFlowTimelineEntry[] +): { comment: string; operator?: FlowPerson } { + const op = rejectEvent?.operator || rejectionDetail?.operator || (mar as any)?.operator; + const opName = op?.name || op?.id || (mar as any)?.operatorName || ""; + + let rawNodeName = ( + rejectEvent?.nodeName || + rejectionDetail?.nodeName || + (mar as any)?.nodeName || + "" + ).trim(); + + // In Hose, freeflow.reject often records target node "提交人" (meaning rejected back to submitter) + // If we have an operator name, lookup their actual approval nodeName in history + if ((!rawNodeName || rawNodeName === "提交人") && opName && history) { + const matchedLog = history.find( + (h) => + h.operator?.name === opName && + h.nodeName && + h.nodeName.trim() !== "提交人" && + !h.isEbot + ); + if (matchedLog?.nodeName) { + rawNodeName = matchedLog.nodeName.trim(); + } else if (rawNodeName === "提交人") { + rawNodeName = "驳回至提交人"; + } + } + + const rawComment = + rejectEvent?.comment || + rejectionDetail?.reason || + (mar as any)?.rejectComment || + "审批驳回"; + + let commentStr = rawComment; + if (rawNodeName && opName) { + if (!rawComment.startsWith(`${rawNodeName}(${opName}):`)) { + commentStr = `${rawNodeName}(${opName}): ${rawComment}`; + } + } else if (opName) { + if (!rawComment.startsWith(`${opName}:`)) { + commentStr = `${opName}: ${rawComment}`; + } + } else if (rawNodeName) { + if (!rawComment.startsWith(`${rawNodeName}:`)) { + commentStr = `${rawNodeName}: ${rawComment}`; + } + } + + return { + comment: commentStr, + operator: op + }; +} + +export function extractPendingLines(flow?: HoseFlowDetail): string[] { + if (!flow) return []; + const pendingNodes = flow.pending || []; + const rawStateUpper = String(flow.rawState || "").toUpperCase(); + const stateUpper = String(flow.state || "").toUpperCase(); + + const lines: string[] = []; + if (pendingNodes.length > 0) { + for (const p of pendingNodes) { + const pApprover = p.approver?.name || p.approver?.id || "待定"; + const pNodeName = (p.name || flow.currentNode || "").trim(); + const pPrefix = pNodeName ? `${pNodeName}(${pApprover})` : pApprover; + const isPayment = + p.type?.toUpperCase() === "PAYING" || + pNodeName.includes("支付") || + rawStateUpper === "PAYING" || + stateUpper === "支付中"; + const actionText = isPayment ? "待支付" : "待审批"; + lines.push(`${pPrefix}: ${actionText}`); + } + } else if (flow.currentNode?.trim()) { + const isPayment = + flow.currentNode.includes("支付") || + rawStateUpper === "PAYING" || + stateUpper === "支付中"; + const actionText = isPayment ? "待支付" : "待审批"; + lines.push(`${flow.currentNode.trim()}: ${actionText}`); + } + return lines; +} + export function alignApprovalRunsWithHoseFlow( runs: ApprovalRun[], flow?: HoseFlowDetail @@ -769,15 +893,56 @@ export function alignApprovalRunsWithHoseFlow( const history = flow.history || []; const rawStateUpper = String(flow.rawState || "").toUpperCase(); const stateUpper = String(flow.state || "").toUpperCase(); - const isFlowCompleted = - rawStateUpper === "COMPLETED" || - rawStateUpper === "APPROVED" || - rawStateUpper === "PAID" || - rawStateUpper === "PAYING" || - stateUpper === "已完成" || - stateUpper === "审批通过" || - stateUpper === "已支付" || - stateUpper === "支付中"; + + const isFlowRetractedOrCancelled = + rawStateUpper === "DRAFT" || + rawStateUpper === "REVOKED" || + rawStateUpper === "CANCELED" || + rawStateUpper === "CANCELLED" || + stateUpper === "草稿" || + stateUpper === "已撤回" || + stateUpper === "已取消"; + + const isFlowRejected = + rawStateUpper === "REJECTED" || + rawStateUpper === "TERMINATED" || + stateUpper === "审批驳回" || + stateUpper === "已驳回"; + + const isFlowPaid = + !isFlowRetractedOrCancelled && + !isFlowRejected && + (rawStateUpper === "PAID" || + stateUpper === "已支付" || + history.some( + (e) => + !e.isEbot && + (e.rawAction === "freeflow.pay" || e.action === "支付成功" || e.action === "支付完成") + )); + + const isFlowPaying = + !isFlowRetractedOrCancelled && + !isFlowRejected && + !isFlowPaid && + (rawStateUpper === "PAYING" || + stateUpper === "支付中" || + (flow.pending || []).some( + (p) => + p.isCurrent && + (p.type?.toUpperCase() === "PAYING" || p.name?.includes("支付")) + ) || + flow.currentNode?.includes("支付") === true); + + const isFlowApproved = + !isFlowRetractedOrCancelled && + !isFlowRejected && + !isFlowPaying && + (rawStateUpper === "COMPLETED" || + rawStateUpper === "APPROVED" || + stateUpper === "已完成" || + stateUpper === "审批通过"); + + const isFlowCompleted = isFlowPaid || isFlowApproved; for (let i = 0; i < sortedRuns.length; i++) { const run = sortedRuns[i]; @@ -902,29 +1067,15 @@ export function alignApprovalRunsWithHoseFlow( (e) => e.rawAction === "freeflow.reject" || e.action === "审批驳回" ); - const isFlowRetractedOrCancelled = - rawStateUpper === "DRAFT" || - rawStateUpper === "REVOKED" || - rawStateUpper === "CANCELED" || - rawStateUpper === "CANCELLED" || - stateUpper === "草稿" || - stateUpper === "已撤回" || - stateUpper === "已取消"; - - const isFlowRejected = - rawStateUpper === "REJECTED" || - rawStateUpper === "TERMINATED" || - stateUpper === "审批驳回" || - stateUpper === "已驳回"; - if (!isLatestRun) { // Historical run that has been superseded by a newer run if (rejectEvent || isRunRejectedInSeal) { - eHumanAction = "驳回"; + eHumanAction = "审批驳回"; auditDrift = false; auditDriftReason = undefined; - eHumanComment = rejectEvent?.comment || (mar as any)?.rejectComment || "驳回"; - operator = rejectEvent?.operator; + const rejInfo = formatRejectionComment(rejectEvent, undefined, mar, history); + eHumanComment = rejInfo.comment; + operator = rejInfo.operator; } else if (retractEvent || isRunCancelledInSeal) { eHumanAction = "已撤回"; operator = retractEvent?.operator; @@ -937,22 +1088,19 @@ export function alignApprovalRunsWithHoseFlow( for (const ev of subsequentHumanEvents) { if (!operator && ev.operator) operator = ev.operator; } - eHumanComment = opinionLines.length > 0 ? opinionLines.join("\n") : "-"; + eHumanComment = formatNumberedHumanOpinions(opinionLines, [], "forward"); } } else { // Latest run for this document - if (rejectEvent || isRunRejectedInSeal) { - eHumanAction = "驳回"; + if (rejectEvent || isRunRejectedInSeal || isFlowRejected) { + eHumanAction = "审批驳回"; auditDrift = false; auditDriftReason = undefined; - eHumanComment = rejectEvent?.comment || (mar as any)?.rejectComment || "驳回"; - operator = rejectEvent?.operator; + const rejInfo = formatRejectionComment(rejectEvent, flow.rejections?.[0], mar, history); + eHumanComment = rejInfo.comment; + operator = rejInfo.operator; } else if (isFlowCompleted || isRunApprovedInSeal) { - if (auditDrift) { - eHumanAction = "通过 (⚠️ AI通过后被中途修改)"; - } else { - eHumanAction = "通过"; - } + eHumanAction = isFlowPaid ? "已支付" : "审批通过"; const opinionLines = formatHumanOpinionLines(subsequentHumanEvents); for (const ev of subsequentHumanEvents) { @@ -960,16 +1108,18 @@ export function alignApprovalRunsWithHoseFlow( } if (opinionLines.length > 0) { - eHumanComment = opinionLines.join("\n"); + eHumanComment = formatNumberedHumanOpinions(opinionLines, [], "forward"); } else { const lastHumanApproval = [...windowEvents] .reverse() .find( (e) => !e.isEbot && - (e.rawAction === "freeflow.agree" || e.action === "审批同意" || e.rawAction === "freeflow.pay") + (e.rawAction === "freeflow.agree" || + e.action === "审批同意" || + e.rawAction === "freeflow.pay") ); - eHumanComment = lastHumanApproval?.comment || "-"; + eHumanComment = lastHumanApproval?.comment ? `1. ${lastHumanApproval.comment}` : "-"; if (!operator) operator = lastHumanApproval?.operator; } } else if (isFlowRetractedOrCancelled || (retractEvent && !hasPostAiResubmit) || isRunCancelledInSeal) { @@ -983,33 +1133,25 @@ export function alignApprovalRunsWithHoseFlow( opinionLines.push(`${retractEvent.operator?.name || "提交人"}: 单据撤回`); } eHumanComment = opinionLines.length > 0 ? opinionLines.join("\n") : "单据已撤回"; - } else if (isFlowRejected) { - eHumanAction = "驳回"; - const rej = flow.rejections?.[0]; - operator = rej?.operator; - eHumanComment = rej?.reason || rej?.nodeName || "审批驳回"; - } else { - // Flow is still actively approving - eHumanAction = auditDrift ? "审核中 (⚠️ AI通过后被修改重提)" : "审核中"; + } else if (isFlowPaying) { + eHumanAction = "⏳ 支付中"; const opinionLines = formatHumanOpinionLines(subsequentHumanEvents); for (const ev of subsequentHumanEvents) { if (!operator && ev.operator) operator = ev.operator; } + const pendingLines = extractPendingLines(flow); + eHumanComment = formatNumberedHumanOpinions(opinionLines, pendingLines, "reverse"); + } else { + // Flow is actively approving + eHumanAction = "⏳ 审批中"; - const pendingNodes = flow.pending || []; - const currentPending = pendingNodes.find((p) => p.isCurrent) || pendingNodes[0]; - if (currentPending) { - const pApprover = - currentPending.approver?.name || currentPending.approver?.id || "待定"; - const pNodeName = (currentPending.name || flow.currentNode || "").trim(); - const pPrefix = pNodeName ? `${pNodeName}(${pApprover})` : pApprover; - opinionLines.push(`${pPrefix}:当前审核节点`); - } else if (flow.currentNode?.trim()) { - opinionLines.push(`${flow.currentNode.trim()}:当前审核节点`); + const opinionLines = formatHumanOpinionLines(subsequentHumanEvents); + for (const ev of subsequentHumanEvents) { + if (!operator && ev.operator) operator = ev.operator; } - - eHumanComment = opinionLines.length > 0 ? opinionLines.join("\n") : "当前审核节点"; + const pendingLines = extractPendingLines(flow); + eHumanComment = formatNumberedHumanOpinions(opinionLines, pendingLines, "reverse"); } } } diff --git a/src/domains/seal/approval-runs-export.ts b/src/domains/seal/approval-runs-export.ts index 8da92e9..5b8e152 100644 --- a/src/domains/seal/approval-runs-export.ts +++ b/src/domains/seal/approval-runs-export.ts @@ -842,14 +842,20 @@ export async function exportApprovalRunsToExcel( if (val.includes("⚠️") || val.includes("修改")) { cell.font = { name: "Microsoft YaHei", size: 10, color: { argb: "FFD97706" }, bold: true }; cell.fill = { type: "pattern", pattern: "solid", fgColor: { argb: "FFFEF3C7" } }; - } else if (val.includes("驳回")) { + } else if (val.includes("驳回") || val.includes("退回")) { cell.font = { name: "Microsoft YaHei", size: 10, color: { argb: "FFDC2626" }, bold: true }; cell.fill = { type: "pattern", pattern: "solid", fgColor: { argb: "FFFEE2E2" } }; - } else if (val.includes("通过")) { + } else if (val.includes("通过") || val.includes("已支付") || val.includes("已完成")) { cell.font = { name: "Microsoft YaHei", size: 10, color: { argb: "FF16A34A" }, bold: true }; cell.fill = { type: "pattern", pattern: "solid", fgColor: { argb: "FFDCFCE7" } }; - } else if (val.includes("待处理") || val.includes("处理中") || val.includes("审核中")) { - cell.font = { name: "Microsoft YaHei", size: 10, color: { argb: "FF2563EB" } }; + } else if ( + val.includes("待处理") || + val.includes("处理中") || + val.includes("审核中") || + val.includes("审批中") || + val.includes("支付中") + ) { + cell.font = { name: "Microsoft YaHei", size: 10, color: { argb: "FF2563EB" }, bold: true }; cell.fill = { type: "pattern", pattern: "solid", fgColor: { argb: "FFEFF6FF" } }; } else if (val.includes("撤回") || val.includes("取消")) { cell.font = { name: "Microsoft YaHei", size: 10, color: { argb: "FF64748B" } };