forked from ChaiHao/BPOS-MVP
三面拆分⑲:审批点卸岗位 —— 负责人一律运营时分配,绑员工组,实例记 assignee
模型(用户定):审批点不绑岗位;节点负责人是运营时分配的,绑定到员工组。 - 契约:approval 节点删 approver(功能属性只剩驳回走向/催办/委托消息); CLOSURE_VIOLATION_KINDS 删 missing-owner-position(岗位不入编排,无岗可核); 治理审批列表删 approverPosition 字段 - 运行时统一口径(活动点=审批点):工作流绑了员工组按组轮值(组员并集最闲者先), 没绑组全员轮值;staffId 稳定排序保证确定性,组员全不在岗退回全员。 ADR-011「绑定先于策略」随岗位退场 —— 工作组快照的成员集合成为轮值池 - 实例记 assignee(迁移 0014 node_instance.assignee_id):分派结果是流转事实 —— 审批箱收件(i.assigneeId === me)、裁决权(同一判据)、员工面链条报实际承接人、 治理台审批列表报人,全部按它认,不再有岗位比对 - closure 卸 positions 入参;desk/desk-approval/governance-ops 三路由改口; web 属性卡删「审批岗位」选择与警示、positions 管线拆除;种子 A5 卸 PM; 导出依赖文件审批段只留编排语义 测试:closure 25、save-package 6、seed 8、graph-to-pkg 5、端到端八例真库全绿; 五闸退出码全过。库:迁移 + v4 就地同步(唯一生效版)。 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KeDBx2PHLavbURXB8LJJ7m
This commit is contained in:
@@ -123,31 +123,22 @@ export function createProcessService(deps: ProcessServiceDeps): ProcessService {
|
||||
}
|
||||
|
||||
/*
|
||||
* 谁来干:**活动契约不带岗位**(纯编排,2026-07-28 第三轮)—— 分派是运营的事。
|
||||
* 运营分派机制未建前,活动任务默认**全员轮值**(在岗候选并集,最闲者先,
|
||||
* staffId 稳定排序保证同输入必同结果);审批点例外,「卡到人的工位」是它的
|
||||
* 功能语义,仍按 approver 岗位解析,工作组绑定(ADR-011)也只对它生效。
|
||||
* 谁来干:**编排不带岗位**(2026-07-28 第五轮,活动点与审批点同一口径)——
|
||||
* 负责人是**运营时分配**的:工作流绑了员工组就按组轮值(组员并集里最闲者先),
|
||||
* 没绑组就全员轮值;staffId 稳定排序保证同输入必同结果。
|
||||
* 分派结果记在节点实例上(assignee)—— 审批箱、链条、治理列表都按它认人。
|
||||
*/
|
||||
let spec;
|
||||
let candidates;
|
||||
let bound;
|
||||
if (dispatch.kind === 'start-task') {
|
||||
spec = { position: '(全员轮值)', strategy: 'sole' as const };
|
||||
const seen = new Map<string, { staffId: string; name: string; openTasks: number }>();
|
||||
for (const position of await deps.org.positions()) {
|
||||
for (const c of await deps.org.candidates(position)) if (!seen.has(c.staffId)) seen.set(c.staffId, c);
|
||||
}
|
||||
candidates = [...seen.values()];
|
||||
bound = undefined;
|
||||
} else {
|
||||
spec = dispatch.node.approver;
|
||||
candidates = await deps.org.candidates(spec.position);
|
||||
// 绑定先于策略:工作组说了这个岗位是谁,策略就无从发问(ADR-011)。
|
||||
// 在岗与否在这里核 —— 绑定是**跨岗位**指派,拿该岗位的候选集核不了它。
|
||||
const boundTo = record.workGroup?.[spec.position];
|
||||
bound = boundTo !== undefined && (await deps.org.isActive(boundTo)) ? boundTo : undefined;
|
||||
const seen = new Map<string, { staffId: string; name: string; openTasks: number }>();
|
||||
for (const position of await deps.org.positions()) {
|
||||
for (const c of await deps.org.candidates(position)) if (!seen.has(c.staffId)) seen.set(c.staffId, c);
|
||||
}
|
||||
const resolution = resolveOwner(spec, { candidates, ...(bound === undefined ? {} : { bound }) });
|
||||
const everyone = [...seen.values()];
|
||||
const group = new Set(Object.values(record.workGroup ?? {}));
|
||||
const groupPool = everyone.filter((c) => group.has(c.staffId));
|
||||
// 组员全不在岗时退回全员 —— 单不能没人接
|
||||
const pool = groupPool.length > 0 ? groupPool : everyone;
|
||||
const spec = { position: groupPool.length > 0 ? '(员工组轮值)' : '(全员轮值)', strategy: 'sole' as const };
|
||||
const resolution = resolveOwner(spec, { candidates: pool });
|
||||
if (resolution.kind === 'vacant') throw new PositionVacantError(spec.position);
|
||||
|
||||
await deps.events.publish({
|
||||
@@ -173,6 +164,7 @@ export function createProcessService(deps: ProcessServiceDeps): ProcessService {
|
||||
waiting: false,
|
||||
activated: true,
|
||||
taskId: task.id,
|
||||
assigneeId: resolution.staffId,
|
||||
});
|
||||
await deps.events.publish({ workflowId: record.id, kind: 'task-started', detail: { nodeId: node.id, taskId: task.id } });
|
||||
return;
|
||||
@@ -192,6 +184,7 @@ export function createProcessService(deps: ProcessServiceDeps): ProcessService {
|
||||
waiting: true,
|
||||
activated: true,
|
||||
approvalId: approval.id,
|
||||
assigneeId: resolution.staffId,
|
||||
});
|
||||
await deps.events.publish({ workflowId: record.id, kind: 'approval-raised', detail: { nodeId: node.id, approvalId: approval.id } });
|
||||
}
|
||||
@@ -368,7 +361,6 @@ export function createProcessService(deps: ProcessServiceDeps): ProcessService {
|
||||
return checkClosure({
|
||||
pkg,
|
||||
contracts: await deps.activities.faces(),
|
||||
positions: await deps.org.positions(),
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user