@mldong/jeeflow 1.8.5 → 1.8.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/engine.d.ts +4 -0
- package/dist/engine.js +8 -2
- package/dist/facade.d.ts +4 -0
- package/dist/facade.js +48 -2
- package/package.json +1 -1
package/dist/engine.d.ts
CHANGED
|
@@ -55,3 +55,7 @@ export declare class EngineImpl implements Engine {
|
|
|
55
55
|
private addUserInfo;
|
|
56
56
|
private nextId;
|
|
57
57
|
}
|
|
58
|
+
/** 会签判定(issue 42,对齐 Java ProcessTaskPerformTypeEnum.codeOf):
|
|
59
|
+
* '1' / 'ALL' / 'COUNTERSIGN'(大小写不敏感)→ 会签。
|
|
60
|
+
* 设计器属性面板保存 'ALL' 字符串符合 Java 契约,引擎必须兼容 */
|
|
61
|
+
export declare function isCountersign(v: any): boolean;
|
package/dist/engine.js
CHANGED
|
@@ -356,11 +356,10 @@ export class EngineImpl {
|
|
|
356
356
|
const actors = await this.resolveActors(node, inst, operator, vars);
|
|
357
357
|
if (!actors.length)
|
|
358
358
|
return;
|
|
359
|
-
const performType = parseInt(String(node.properties?.performType ?? '0'));
|
|
360
359
|
const ct = node.properties?.countersignType;
|
|
361
360
|
const now = new Date();
|
|
362
361
|
const form = node.properties?.form ?? '';
|
|
363
|
-
if (performType
|
|
362
|
+
if (isCountersign(node.properties?.performType) && ct) {
|
|
364
363
|
switch (ct) {
|
|
365
364
|
case 'PARALLEL':
|
|
366
365
|
for (const actor of actors)
|
|
@@ -513,6 +512,13 @@ function isTruthy(v) {
|
|
|
513
512
|
return v !== 0;
|
|
514
513
|
return v != null;
|
|
515
514
|
}
|
|
515
|
+
/** 会签判定(issue 42,对齐 Java ProcessTaskPerformTypeEnum.codeOf):
|
|
516
|
+
* '1' / 'ALL' / 'COUNTERSIGN'(大小写不敏感)→ 会签。
|
|
517
|
+
* 设计器属性面板保存 'ALL' 字符串符合 Java 契约,引擎必须兼容 */
|
|
518
|
+
export function isCountersign(v) {
|
|
519
|
+
const s = String(v ?? '').trim().toUpperCase();
|
|
520
|
+
return s === '1' || s === 'ALL' || s === 'COUNTERSIGN';
|
|
521
|
+
}
|
|
516
522
|
/** 办理提交的 f_ 字段按任务节点 field 权限过滤(issues/26)——
|
|
517
523
|
* 任务节点 properties.field 声明 PERMISSION_f_{全名}(前端约定,优先)或
|
|
518
524
|
* PERMISSION_{去前缀名}(兼容)的字段,值非 EDIT(2)(只读 1/隐藏 3 等)→ 剔除不入变量。
|
package/dist/facade.d.ts
CHANGED
|
@@ -46,6 +46,10 @@ export declare class JeeflowFacade {
|
|
|
46
46
|
private surrogateSave;
|
|
47
47
|
private getLastByName;
|
|
48
48
|
private highLight;
|
|
49
|
+
/** 节点成员进度(issue 41,对齐 boot3 highLight):按任务状态 + 会签变量组装
|
|
50
|
+
* nodeProgress——会签节点带 type(PARALLEL/SEQUENTIAL),成员 done/active 标记;
|
|
51
|
+
* 动态参与人节点(无静态 actorIds)不返回;name 缺省(引擎不持有宿主用户体系,前端降级显示 id) */
|
|
52
|
+
private buildNodeProgress;
|
|
49
53
|
private collectPath;
|
|
50
54
|
/** 决策输出边表达式求值(args = 实例变量 + 决策节点前置任务变量) */
|
|
51
55
|
private evalDecisionExpr;
|
package/dist/facade.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
// action(boot2/boot3 端点短名)路由。返回统一结构 {code, msg, data}
|
|
5
5
|
// (code=0 成功 / 99999999 失败)。操作人约定:args.operator 显式传入。
|
|
6
6
|
import { TaskState, } from './model.js';
|
|
7
|
-
import { KeyNextNodeOperator, KeyProcessStartNextNodeOperator } from './engine.js';
|
|
7
|
+
import { KeyNextNodeOperator, KeyProcessStartNextNodeOperator, isCountersign } from './engine.js';
|
|
8
8
|
// submitType 枚举(对齐 boot3)
|
|
9
9
|
const SUBMIT_APPLY = 0;
|
|
10
10
|
const SUBMIT_AGREE = 1;
|
|
@@ -603,14 +603,60 @@ export class JeeflowFacade {
|
|
|
603
603
|
history.push(t.taskName);
|
|
604
604
|
// 路径补全:start 沿边递归(遇活跃节点停止);决策分支按表达式求值过滤(issues/06)
|
|
605
605
|
const def = await this.repo.findDefineById(inst.defineId);
|
|
606
|
+
let nodeProgress = {};
|
|
606
607
|
if (def) {
|
|
607
608
|
try {
|
|
608
609
|
const flow = JSON.parse(toStr(def.content));
|
|
610
|
+
nodeProgress = this.buildNodeProgress(flow, his);
|
|
609
611
|
await this.collectPath(flow, 'start', '', active, history, edges, new Set(), inst.variables ?? {}, his);
|
|
610
612
|
}
|
|
611
613
|
catch { /* ignore */ }
|
|
612
614
|
}
|
|
613
|
-
return { activeNodeNames: active, historyNodeNames: history, historyEdgeNames: edges };
|
|
615
|
+
return { activeNodeNames: active, historyNodeNames: history, historyEdgeNames: edges, nodeProgress };
|
|
616
|
+
}
|
|
617
|
+
/** 节点成员进度(issue 41,对齐 boot3 highLight):按任务状态 + 会签变量组装
|
|
618
|
+
* nodeProgress——会签节点带 type(PARALLEL/SEQUENTIAL),成员 done/active 标记;
|
|
619
|
+
* 动态参与人节点(无静态 actorIds)不返回;name 缺省(引擎不持有宿主用户体系,前端降级显示 id) */
|
|
620
|
+
buildNodeProgress(flow, his) {
|
|
621
|
+
const progress = {};
|
|
622
|
+
const names = [...new Set(his.map(t => t.taskName))];
|
|
623
|
+
for (const name of names) {
|
|
624
|
+
const tasks = his.filter(t => t.taskName === name);
|
|
625
|
+
const vars = tasks[0]?.variables ?? {};
|
|
626
|
+
// 完整办理人列表:会签变量 operatorList_{node} 优先(顺序会签全量),否则任务 actorIds 并集
|
|
627
|
+
let members = Array.isArray(vars[`operatorList_${name}`]) ? vars[`operatorList_${name}`] : null;
|
|
628
|
+
if (!members || members.length === 0) {
|
|
629
|
+
members = [...new Set(tasks.flatMap(t => t.actorIds ?? []))];
|
|
630
|
+
}
|
|
631
|
+
if (!members || members.length === 0)
|
|
632
|
+
continue; // 动态参与人:无静态成员,不返回
|
|
633
|
+
const doneSet = new Set();
|
|
634
|
+
for (const t of tasks) {
|
|
635
|
+
if (t.taskState === TaskState.Done)
|
|
636
|
+
for (const a of t.actorIds ?? [])
|
|
637
|
+
doneSet.add(a);
|
|
638
|
+
}
|
|
639
|
+
const activeActor = tasks.find(t => t.taskState === TaskState.Doing)?.actorIds?.[0];
|
|
640
|
+
const node = (flow.nodes ?? []).find((n) => n.id === name);
|
|
641
|
+
// 会签判定:定义节点属性(引擎创建任务时 performType 未落任务表,取模型为准)
|
|
642
|
+
const nodeProps = node?.properties ?? {};
|
|
643
|
+
const isCs = isCountersign(nodeProps.performType) || nodeProps.countersignType != null;
|
|
644
|
+
const item = {
|
|
645
|
+
members: members.map((id) => {
|
|
646
|
+
const m = { id, name: '' };
|
|
647
|
+
if (doneSet.has(id))
|
|
648
|
+
m.done = true;
|
|
649
|
+
else if (id === activeActor)
|
|
650
|
+
m.active = true;
|
|
651
|
+
return m;
|
|
652
|
+
}),
|
|
653
|
+
};
|
|
654
|
+
if (isCs && nodeProps.countersignType) {
|
|
655
|
+
item.type = nodeProps.countersignType;
|
|
656
|
+
}
|
|
657
|
+
progress[name] = item;
|
|
658
|
+
}
|
|
659
|
+
return progress;
|
|
614
660
|
}
|
|
615
661
|
async collectPath(flow, nodeId, edgeName, active, history, edges, visited, vars, historyTasks) {
|
|
616
662
|
if (visited.has(nodeId))
|