
众所周知,NodeJS 作为后端开发语言和运行环境,样样都好,就差一个NodeJS工作流引擎。CabloyJS 4.0 重点开发了NodeJS工作流引擎,并作为内置的基础核心模块,近一步拓展了 NodeJS 在后端的应用场景,为深入研发各类商业业务逻辑,提供了基础支撑
JSON进行流程定义的配置,告别 XML 配置文件的冗杂| 模块名称 | 说明 | 
|---|---|
| a-flow | 流程定义、流程实例 | 
| a-flownode | 流程节点(活动节点) | 
| a-flowtask | 流程任务 | 
业务流程和审批流程 Atom三生三世结合,内置了一套基于 Atom 的审批工作流。参见:原子阶段(三生三世)表单验证结合,支持分别配置不同流程节点的读取字段权限和修改字段权限。参见:表单验证
AOP机制定制工作流逻辑Listener机制定制工作流逻辑流程节点的定制开发测试驱动代码,可快速上手使用工作流采购订单
流程定义,然后提交,草稿进入相应的审批流程
归档

src/module/test-flow/backend/src/config/static/flowDef/set00_simple.js
{
  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
{
  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 | 结束事件节点 |