diff --git a/src/domains/hose/flow.test.ts b/src/domains/hose/flow.test.ts index 6eb3891..6e3f1f7 100644 --- a/src/domains/hose/flow.test.ts +++ b/src/domains/hose/flow.test.ts @@ -906,7 +906,7 @@ describe("Hose Flow Domain", () => { const r1 = aligned.get("run-retracted")!; expect(r1.eHumanAction).toBe("已撤回"); - expect(r1.eHumanComment).toBe("刘佳琼: 单据撤回"); + expect(r1.eHumanComment).toBe("提交人(刘佳琼): 单据撤回"); expect(r1.auditDrift).toBe(false); const r2 = aligned.get("run-active")!; @@ -1204,7 +1204,7 @@ describe("Hose Flow Domain", () => { const r1 = aligned.get("run-round-1")!; expect(r1.eHumanAction).toBe("已撤回"); expect(r1.eHumanComment).toBe( - "1. 费用类型是研发费(宁艳楠): 同意\n2. 袁锦: 单据撤回" + "1. 费用类型是研发费(宁艳楠): 同意\n2. 提交人(袁锦): 单据撤回" ); expect(r1.eHumanComment).not.toContain("合思审批节点"); expect(r1.eHumanComment).not.toContain("审批驳回"); diff --git a/src/domains/hose/flow.ts b/src/domains/hose/flow.ts index 9463358..992c4a6 100644 --- a/src/domains/hose/flow.ts +++ b/src/domains/hose/flow.ts @@ -707,7 +707,13 @@ export function formatHumanOpinionLines(events: HoseFlowTimelineEntry[]): string } const opName = ev.operator?.name || ev.operator?.id || "未知"; - const nodePrefix = ev.nodeName?.trim() ? `${ev.nodeName.trim()}(${opName})` : opName; + // freeflow.retract has no nodeName in Hose; the actor is always the submitter + const isRetractAction = ev.rawAction === "freeflow.retract" || ev.action === "单据撤回"; + const nodePrefix = ev.nodeName?.trim() + ? `${ev.nodeName.trim()}(${opName})` + : isRetractAction + ? `提交人(${opName})` + : opName; let comment = ev.comment; if (!comment) { if (ev.rawAction === "freeflow.agree" || ev.action === "审批同意") { @@ -1109,14 +1115,14 @@ export function alignApprovalRunsWithHoseFlow( if (!operator && ev.operator) operator = ev.operator; } if (retractEvent && !opinionLines.some((l) => l.includes("单据撤回"))) { - opinionLines.push(`${retractEvent.operator?.name || "提交人"}: 单据撤回`); + opinionLines.push(`提交人(${retractEvent.operator?.name || "提交人"}): 单据撤回`); } eHumanComment = opinionLines.length > 1 ? formatNumberedHumanOpinions(opinionLines, [], "forward") : opinionLines.length === 1 ? opinionLines[0]! - : (retractEvent ? `${retractEvent.operator?.name || "提交人"}: 单据撤回` : "单据已撤回"); + : (retractEvent ? `提交人(${retractEvent.operator?.name || "提交人"}): 单据撤回` : "单据已撤回"); } else { eHumanAction = "已修改重提"; const opinionLines = formatHumanOpinionLines(subsequentHumanEvents); @@ -1175,7 +1181,7 @@ export function alignApprovalRunsWithHoseFlow( if (!operator && ev.operator) operator = ev.operator; } if (retractEvent && !opinionLines.some((l) => l.includes("单据撤回"))) { - opinionLines.push(`${retractEvent.operator?.name || "提交人"}: 单据撤回`); + opinionLines.push(`提交人(${retractEvent.operator?.name || "提交人"}): 单据撤回`); } eHumanComment = opinionLines.length > 1