众所周知,NodeJS做为后端开发语言和运行环境,样样都好,就差一个NodeJS工做流引擎
。CabloyJS 4.0重点开发了NodeJS工做流引擎
,并做为内置的基础核心模块,近一步拓展了NodeJS在后端的应用场景,为深刻研发各种商业业务逻辑,提供了基础支撑javascript
JSON
进行流程定义的配置,告别XML配置文件的冗杂模块名称 | 说明 |
---|---|
a-flow | 流程定义、流程实例 |
a-flownode | 流程节点(活动节点) |
a-flowtask | 流程任务 |
业务流程
和审批流程
Atom三生三世
结合,内置了一套基于Atom的审批工做流
。参见:原子阶段(三生三世)表单验证
结合,支持分别配置不一样流程节点的读取字段权限
和修改字段权限
。参见:表单验证AOP
机制定制工做流逻辑Listener
机制定制工做流逻辑流程节点
的定制开发测试驱动
代码,可快速上手使用工做流采购订单
流程定义
,而后提交,草稿进入相应的审批流程
归档
src/module/test-flow/backend/src/config/static/flowDef/set00_simple.js
html
{ listener: null, process: { nodes: [ { id: 'startEvent_1', name: 'Start', type: 'startEventNone', }, { id: 'endEvent_1', name: 'End', type: 'endEventNone', }, ], edges: [ { id: 'edge_1', source: 'startEvent_1', target: 'endEvent_1', }, ], }, }
名称 | 说明 |
---|---|
listener | 监听器,可监听flow/node/task各种事件 |
process.nodes | 流程节点 |
process.nodes.type | 流程节点类型 |
process.edges | 流程转移线 |
process.edges.source | 来源 |
process.edges.target | 去向 |
src/module/test-flow/backend/src/config/static/flowDef/set01_atomUserTask.js
java
{ listener: null, process: { nodes: [ { id: 'startEvent_1', name: 'Drafting', type: 'startEventAtom', options: { atom: { module: moduleInfo.relativeName, atomClassName: 'purchaseOrder', }, conditionExpression: 'atom._flowDefKey==='set01_atomUserTask'', }, }, { id: 'activity_1', name: 'Review', type: 'activityUserTask', options: { assignees: { // users: '1,2', // roles: '1,2', vars: 'flowUser', }, confirmation: false, bidding: false, completionCondition: { // passed: 1, // rejected: '100%', }, // rejectedNode:null, // allowRejectTask: true, // allowCancelFlow: false, schema: { write: [ 'atomName', { name: 'description', property: { type: 'string', ebType: 'text', ebTitle: 'Description', }, }, ], }, }, }, { id: 'endEvent_1', name: 'End', type: 'endEventNone', }, ], edges: [ { id: 'edge_1', source: 'startEvent_1', target: 'activity_1', }, { id: 'edge_2', source: 'activity_1', target: 'endEvent_1', }, ], }, }
名称 | 说明 |
---|---|
startEventAtom | 开始事件节点(起草) :经过options.atom和options.conditionExpression与指定的Atom类型绑定。当指定的Atom提交时自动启动相匹配的工做流定义 |
activityUserTask | 用户任务节点 :可指定参与人、是否竞签、完成条件、读字段权限、写字段权限,等等 |
endEventNone | 结束事件节点 |