diff --git a/src/domains/hose/flow.test.ts b/src/domains/hose/flow.test.ts index aebf63a..c161b13 100644 --- a/src/domains/hose/flow.test.ts +++ b/src/domains/hose/flow.test.ts @@ -1168,7 +1168,7 @@ describe("Hose Flow Domain", () => { const r = aligned.get("run-2144")!; expect(r.eHumanAction).toBe("已支付 (中途修改)"); expect(r.eHumanComment).toBe( - "1. 财务助理(熊雪倩): 修改了单据\n2. 上级主管(孙麓): 同意\n3. 财务助理(熊雪倩): 同意\n4. 董事长(甘戈): 同意\n5. 财务经理(周晚容): 同意\n6. CFO(张舒): 同意\n7. 高思琦: 支付成功" + "2. 财务助理(熊雪倩): 修改了单据\n1. 上级主管(孙麓): 同意\n3. 财务助理(熊雪倩): 同意\n4. 董事长(甘戈): 同意\n5. 财务经理(周晚容): 同意\n6. CFO(张舒): 同意\n7. 高思琦: 支付成功" ); }); }); diff --git a/src/domains/hose/flow.ts b/src/domains/hose/flow.ts index 2dfc20b..79664bc 100644 --- a/src/domains/hose/flow.ts +++ b/src/domains/hose/flow.ts @@ -930,11 +930,13 @@ export function formatNumberedHumanOpinions( } if (mode === "forward") { - // If any history line records document modification ("修改了单据"), place all modification lines at the top - const modLines = historyLines.filter((l) => l.includes("修改了单据")); - const normalHistory = historyLines.filter((l) => !l.includes("修改了单据")); - const all = [...modLines, ...normalHistory, ...pendingLines]; - return all.map((line, idx) => `${idx + 1}. ${line}`).join("\n"); + const all = [...historyLines, ...pendingLines]; + const numbered = all.map((line, idx) => `${idx + 1}. ${line}`); + // If any history line records document modification ("修改了单据"), hoist all modification lines to the top + // while strictly preserving each item's true chronological sequence number from the flow + const modLines = numbered.filter((l) => l.includes("修改了单据")); + const normalLines = numbered.filter((l) => !l.includes("修改了单据")); + return [...modLines, ...normalLines].join("\n"); } // Reverse chronological order for in-progress approvals: