diff --git a/src/utils/flowTrace.ts b/src/utils/flowTrace.ts new file mode 100644 index 0000000..5011475 --- /dev/null +++ b/src/utils/flowTrace.ts @@ -0,0 +1,38 @@ +/** + * 轨迹口径工具(三视图 + 嵌入页共用,2026-10-12): + * 抄送(CC)在库里与轨迹里是"逐接收人一条"(FlowEngine.notifyReceivers 逐人落 flw_cc)。 + * 人员视图下正需如此(能看出抄送给了谁);但科室视图不列姓名,N 个接收人若逐行渲染就是 + * N 行一模一样的文案,故 dept 档按「节点 + 轮次」折叠为一行并记人数——口径对齐 + * /oapi/flow/progress 的 ccSteps(本就按 nodeId 聚合)。 + */ + +/** dept 档折叠抄送行:同 nodeId + 同轮次的 CC 行合并为一行(ccCount 记人数);其余行原样、顺序不变。 */ +export function collapseCcRows(trace: any[], mode?: string): any[] { + if (mode !== "dept") return trace; + const out: any[] = []; + const at: Record = {}; + for (const r of trace) { + if (r.kind !== "CC") { + out.push(r); + continue; + } + const key = `${r.nodeId}#${r.round || 1}`; + const i = at[key]; + if (i === undefined) { + at[key] = out.length; + out.push({ ...r, ccCount: 1 }); + } else { + out[i].ccCount += 1; + } + } + return out; +} + +/** dept 档抄送行角色词:科室抄送显科室名(解析不出退短码)、指定人抄送显"抄送对象",多人加人数后缀。 + * ⚠️ 刻意不回落 assigneeName——本函数存在的意义就是不出现人名。 */ +export function ccActorText(row: any): string { + const base = row.assigneeType === "DEPT_KEY" + ? (row.deptName || row.deptKey || "抄送对象") + : "抄送对象"; + return (row.ccCount || 1) > 1 ? `${base} ${row.ccCount} 人` : base; +} diff --git a/src/views/flow/EmbedInstance.vue b/src/views/flow/EmbedInstance.vue index cc3c12c..0a28d48 100644 --- a/src/views/flow/EmbedInstance.vue +++ b/src/views/flow/EmbedInstance.vue @@ -60,8 +60,13 @@ onMounted(async () => {