| name | bpmn |
| description | Create BPMN 2.0 compliant business process diagrams using Draw.io. Use this skill when users need to model business processes, workflows, orchestration flows, or any process automation tasks following BPMN standards. Supports events, activities, gateways, pools, lanes, and all BPMN notation elements. |
BPMN 业务流程建模技能
创建符合 BPMN 2.0 标准的业务流程图。支持事件、活动、网关、泳道等所有 BPMN 符号。
快速开始
基本模板
<mxfile host="app.diagrams.net">
<diagram id="bpmn-diagram" name="业务流程图">
<mxGraphModel dx="1422" dy="794" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="1169" pageHeight="827">
<root>
<mxCell id="0" />
<mxCell id="1" parent="0" />
</root>
</mxGraphModel>
</diagram>
</mxfile>
BPMN 核心元素
1. 事件 (Events)
开始事件 - 流程的起点:
<mxCell id="start-1" value="" style="ellipse;whiteSpace=wrap;html=1;aspect=fixed;strokeWidth=2;fillColor=#d5e8d4;strokeColor=#82b366;" vertex="1" parent="1">
<mxGeometry x="100" y="100" width="40" height="40" as="geometry" />
</mxCell>
结束事件 - 流程的终点:
<mxCell id="end-1" value="" style="ellipse;whiteSpace=wrap;html=1;aspect=fixed;strokeWidth=4;fillColor=#f8cecc;strokeColor=#b85450;" vertex="1" parent="1">
<mxGeometry x="600" y="100" width="40" height="40" as="geometry" />
</mxCell>
中间事件 - 流程中的等待或触发点:
<mxCell id="intermediate-1" value="" style="ellipse;whiteSpace=wrap;html=1;aspect=fixed;strokeWidth=2;fillColor=#fff2cc;strokeColor=#d6b656;double=1;" vertex="1" parent="1">
<mxGeometry x="300" y="100" width="40" height="40" as="geometry" />
</mxCell>
2. 活动 (Activities)
任务 (Task) - 原子级工作单元:
<mxCell id="task-1" value="处理订单" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#dae8fc;strokeColor=#6c8ebf;" vertex="1" parent="1">
<mxGeometry x="200" y="80" width="120" height="80" as="geometry" />
</mxCell>
用户任务 - 需要人工参与:
<mxCell id="user-task-1" value="审批申请" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#dae8fc;strokeColor=#6c8ebf;" vertex="1" parent="1">
<mxGeometry x="200" y="80" width="120" height="80" as="geometry" />
</mxCell>
<mxCell id="user-icon-1" value="" style="shape=actor;verticalAlign=top;html=1;strokeWidth=1;fillColor=#dae8fc;strokeColor=#6c8ebf;" vertex="1" parent="task-1">
<mxGeometry x="5" y="5" width="15" height="18" as="geometry" />
</mxCell>
服务任务 - 自动化执行:
<mxCell id="service-task-1" value="发送邮件" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#dae8fc;strokeColor=#6c8ebf;" vertex="1" parent="1">
<mxGeometry x="200" y="80" width="120" height="80" as="geometry" />
</mxCell>
子流程 - 可折叠的流程组:
<mxCell id="subprocess-1" value="子流程名称" style="swimlane;rounded=1;whiteSpace=wrap;html=1;fillColor=#e1d5e7;strokeColor=#9673a6;startSize=30;" vertex="1" parent="1">
<mxGeometry x="200" y="200" width="300" height="200" as="geometry" />
</mxCell>
3. 网关 (Gateways)
排他网关 (XOR) - 条件分支,只走一条路:
<mxCell id="xor-1" value="" style="rhombus;whiteSpace=wrap;html=1;fillColor=#fff2cc;strokeColor=#d6b656;" vertex="1" parent="1">
<mxGeometry x="300" y="85" width="50" height="50" as="geometry" />
</mxCell>
<mxCell id="xor-marker-1" value="X" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;fontStyle=1;fontSize=16;" vertex="1" parent="xor-1">
<mxGeometry width="50" height="50" as="geometry" />
</mxCell>
并行网关 (AND) - 所有分支同时执行:
<mxCell id="and-1" value="+" style="rhombus;whiteSpace=wrap;html=1;fillColor=#fff2cc;strokeColor=#d6b656;fontStyle=1;fontSize=20;" vertex="1" parent="1">
<mxGeometry x="300" y="85" width="50" height="50" as="geometry" />
</mxCell>
包容网关 (OR) - 一个或多个分支执行:
<mxCell id="or-1" value="○" style="rhombus;whiteSpace=wrap;html=1;fillColor=#fff2cc;strokeColor=#d6b656;fontStyle=1;fontSize=20;" vertex="1" parent="1">
<mxGeometry x="300" y="85" width="50" height="50" as="geometry" />
</mxCell>
事件网关 - 基于事件的分支:
<mxCell id="event-gw-1" value="" style="rhombus;whiteSpace=wrap;html=1;fillColor=#fff2cc;strokeColor=#d6b656;" vertex="1" parent="1">
<mxGeometry x="300" y="85" width="50" height="50" as="geometry" />
</mxCell>
<mxCell id="event-marker-1" value="" style="ellipse;whiteSpace=wrap;html=1;aspect=fixed;strokeWidth=1;fillColor=none;strokeColor=#d6b656;" vertex="1" parent="event-gw-1">
<mxGeometry x="15" y="15" width="20" height="20" as="geometry" />
</mxCell>
4. 泳道 (Swimlanes)
池 (Pool) - 表示参与者:
<mxCell id="pool-1" value="客户" style="swimlane;horizontal=0;whiteSpace=wrap;html=1;fillColor=#f5f5f5;strokeColor=#666666;fontColor=#333333;startSize=30;" vertex="1" parent="1">
<mxGeometry x="50" y="50" width="800" height="200" as="geometry" />
</mxCell>
泳道 (Lane) - 池内的角色分区:
<mxCell id="lane-1" value="销售部门" style="swimlane;horizontal=0;whiteSpace=wrap;html=1;fillColor=#dae8fc;strokeColor=#6c8ebf;startSize=30;" vertex="1" parent="pool-1">
<mxGeometry x="30" y="0" width="770" height="100" as="geometry" />
</mxCell>
<mxCell id="lane-2" value="财务部门" style="swimlane;horizontal=0;whiteSpace=wrap;html=1;fillColor=#d5e8d4;strokeColor=#82b366;startSize=30;" vertex="1" parent="pool-1">
<mxGeometry x="30" y="100" width="770" height="100" as="geometry" />
</mxCell>
5. 连接 (Connections)
顺序流 - 活动之间的执行顺序:
<mxCell id="flow-1" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;endArrow=block;endFill=1;" edge="1" parent="1" source="task-1" target="task-2">
<mxGeometry relative="1" as="geometry" />
</mxCell>
带条件的顺序流:
<mxCell id="cond-flow-1" value="金额>1000" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;endArrow=block;endFill=1;startArrow=diamond;startFill=0;startSize=12;" edge="1" parent="1" source="xor-1" target="task-3">
<mxGeometry relative="1" as="geometry" />
</mxCell>
消息流 - 跨池的通信:
<mxCell id="msg-flow-1" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;endArrow=open;endFill=0;dashed=1;strokeWidth=1;" edge="1" parent="1" source="task-a" target="task-b">
<mxGeometry relative="1" as="geometry" />
</mxCell>
关联 - 数据对象与活动的关联:
<mxCell id="assoc-1" value="" style="endArrow=none;dashed=1;html=1;rounded=0;" edge="1" parent="1" source="task-1" target="data-1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
6. 数据对象 (Artifacts)
数据对象:
<mxCell id="data-1" value="订单数据" style="shape=note;whiteSpace=wrap;html=1;size=14;verticalAlign=top;align=left;spacingTop=-6;fillColor=#fff2cc;strokeColor=#d6b656;" vertex="1" parent="1">
<mxGeometry x="400" y="200" width="80" height="60" as="geometry" />
</mxCell>
数据存储:
<mxCell id="datastore-1" value="数据库" style="shape=cylinder3;whiteSpace=wrap;html=1;boundedLbl=1;backgroundOutline=1;size=10;fillColor=#e1d5e7;strokeColor=#9673a6;" vertex="1" parent="1">
<mxGeometry x="400" y="300" width="60" height="80" as="geometry" />
</mxCell>
注释:
<mxCell id="annotation-1" value="重要说明:
此步骤需要在24小时内完成" style="shape=note;whiteSpace=wrap;html=1;size=14;verticalAlign=top;align=left;spacingTop=-6;fillColor=#ffe6cc;strokeColor=#d79b00;fontSize=10;" vertex="1" parent="1">
<mxGeometry x="500" y="50" width="150" height="60" as="geometry" />
</mxCell>
颜色规范
| 元素类型 | 填充色 | 边框色 | 用途 |
|---|
| 开始事件 | #d5e8d4 | #82b366 | 绿色表示起点 |
| 结束事件 | #f8cecc | #b85450 | 红色表示终点 |
| 中间事件 | #fff2cc | #d6b656 | 黄色表示中间状态 |
| 任务/活动 | #dae8fc | #6c8ebf | 蓝色表示工作单元 |
| 网关 | #fff2cc | #d6b656 | 黄色表示决策点 |
| 子流程 | #e1d5e7 | #9673a6 | 紫色表示嵌套流程 |
| 数据对象 | #fff2cc | #d6b656 | 黄色表示数据 |
| 泳道 | #f5f5f5 | #666666 | 灰色表示组织边界 |
布局原则
- 流向:从左到右或从上到下
- 间距:元素间保持 40-60 像素
- 对齐:同类元素水平或垂直对齐
- 泳道宽度:每条泳道至少 150 像素高
- 网关分支:条件标注在连线上
工作流程
创建 BPMN 图时按以下步骤:
- 识别参与者 → 创建池和泳道
- 确定起止点 → 添加开始和结束事件
- 梳理活动 → 添加任务和子流程
- 建立分支 → 添加网关处理条件
- 连接流程 → 添加顺序流和消息流
- 补充数据 → 添加数据对象和注释
详细参考
示例场景
场景 1:订单处理流程
- 创建包含客户、销售、仓库、财务的跨部门流程
- 使用排他网关处理库存检查和支付验证
场景 2:请假审批流程
- 创建员工提交 → 主管审批 → HR 备案的线性流程
- 使用并行网关处理多级审批
场景 3:客户服务流程
- 创建接收工单 → 分类处理 → 解决关闭的服务流程
- 使用事件网关处理客户响应等待
最佳实践
- 命名规范:活动用动词+名词(如"处理订单")
- 简化流程:避免超过 15 个活动的单一流程图
- 网关配对:分支网关应有对应的合并网关
- 事件边界:使用边界事件处理异常情况
- 验证完整性:确保每条路径都能到达结束事件