深色模式
流程图预览
待办预览
点击查看代码
vue
<template>
<bpmn-preview ref="bpmnPreviewRef" :graphJson="graphJson" activeNodeId="7a98fcfb-08ea-4246-a262-6e9606c3b4c8" border />
</template>
<script setup lang="ts">
import { ref, onMounted } from "vue";
import type { BpmnPreviewInstance } from "@easyui/bpmn-builder";
const bpmnPreviewRef = ref<BpmnPreviewInstance | null>(null);
const graphJson = ref<Record<string, any>>({
"nodes": [
{
"id": "1d352767-0609-4268-a478-c77154af5a7e",
"shape": "bpmn-event-start",
"zIndex": 1,
"name": "start-basic",
"label": "开始事件",
"sortOrder": 0,
"x": -330,
"y": -80,
"width": 40,
"height": 40,
"status": "done"
},
{
"id": "7a98fcfb-08ea-4246-a262-6e9606c3b4c8",
"shape": "bpmn-task",
"zIndex": 2,
"name": "task-user",
"label": "用户任务",
"sortOrder": 0,
"x": -163,
"y": -90,
"width": 100,
"height": 60,
"tooltip": "审批中: 张三",
"status": "todo"
},
{
"id": "b0f289c3-3019-4d16-9ded-8157ccff51a2",
"shape": "bpmn-event-over",
"zIndex": 3,
"name": "over-basic",
"label": "结束事件",
"sortOrder": 0,
"x": 58,
"y": -80,
"width": 40,
"height": 40
}
],
"edges": [
{
"id": "a5f66697-d52c-475b-a202-031df939e4fc",
"shape": "bpmn-edge",
"zIndex": -1,
"source": {
"cell": "1d352767-0609-4268-a478-c77154af5a7e",
"port": "right"
},
"target": {
"cell": "7a98fcfb-08ea-4246-a262-6e9606c3b4c8",
"port": "left"
},
"vertices": []
},
{
"id": "44499e72-c5f3-4e65-a288-fdbf09ee788d",
"shape": "bpmn-edge",
"zIndex": -1,
"source": {
"cell": "7a98fcfb-08ea-4246-a262-6e9606c3b4c8",
"port": "right"
},
"target": {
"cell": "b0f289c3-3019-4d16-9ded-8157ccff51a2",
"port": "left"
},
"vertices": []
}
]
});
onMounted(() => {
bpmnPreviewRef.value?.init();
});
</script>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
已办预览
点击查看代码
vue
<template>
<bpmn-preview ref="bpmnPreviewRef" :graphJson="graphJson" activeNodeId="d3a78ea2-cb8c-4439-920a-7e3c5b032986"
:nextStepNodeIds="['8fd179cd-b1d8-490f-9a76-b4e7b599dc36']" border />
</template>
<script setup lang="ts">
import { ref, onMounted } from "vue";
import type { BpmnPreviewInstance } from "@easyui/bpmn-builder";
const bpmnPreviewRef = ref<BpmnPreviewInstance | null>(null);
const graphJson = ref<Record<string, any>>({
"nodes": [
{
"id": "14fec423-31f0-4c79-8b33-86564b7771ca",
"shape": "bpmn-event-start",
"zIndex": 1,
"name": "start-basic",
"label": "开始事件",
"sortOrder": 0,
"x": -400,
"y": -100,
"width": 40,
"height": 40,
"status": "done"
},
{
"id": "d3a78ea2-cb8c-4439-920a-7e3c5b032986",
"shape": "bpmn-gateway",
"zIndex": 2,
"name": "gateway-exclusive",
"label": "条件网关",
"sortOrder": 0,
"x": -280,
"y": -105,
"width": 50,
"height": 50,
"status": "done"
},
{
"id": "8fd179cd-b1d8-490f-9a76-b4e7b599dc36",
"shape": "bpmn-task",
"zIndex": 14,
"name": "task-user",
"label": "用户任务1",
"sortOrder": 0,
"x": -100,
"y": -160,
"width": 100,
"height": 60,
"status": "done"
},
{
"id": "85e639b4-5c09-4924-b7e9-f78ae898a0b8",
"shape": "bpmn-task",
"zIndex": 8,
"name": "task-user",
"label": "用户任务2",
"sortOrder": 0,
"x": -100,
"y": -60,
"width": 100,
"height": 60,
"status": "todo"
},
{
"id": "dd6061f0-87d5-4efb-8d8d-9aef00aeb3f8",
"shape": "bpmn-gateway",
"zIndex": 20,
"name": "gateway-confluent",
"label": "合流网关",
"sortOrder": 0,
"x": 120,
"y": -105,
"width": 50,
"height": 50
},
{
"id": "ae42e437-6897-4bb1-945b-6f58d063b50c",
"shape": "bpmn-event-over",
"zIndex": 18,
"name": "over-basic",
"label": "结束事件",
"sortOrder": 0,
"x": 260,
"y": -100,
"width": 40,
"height": 40
}
],
"edges": [
{
"id": "eedc1d71-0036-49ba-b122-7078658e689c",
"shape": "bpmn-edge",
"zIndex": -1,
"source": {
"cell": "14fec423-31f0-4c79-8b33-86564b7771ca",
"port": "right"
},
"target": {
"cell": "d3a78ea2-cb8c-4439-920a-7e3c5b032986",
"port": "left"
},
"vertices": []
},
{
"id": "dd13605f-b4a7-4793-be8a-066f20fb034d",
"shape": "bpmn-edge",
"zIndex": -1,
"source": {
"cell": "dd6061f0-87d5-4efb-8d8d-9aef00aeb3f8",
"port": "right"
},
"target": {
"cell": "ae42e437-6897-4bb1-945b-6f58d063b50c",
"port": "left"
},
"vertices": []
},
{
"id": "b4940d27-d707-4342-b73f-0da017785a53",
"shape": "bpmn-edge",
"zIndex": -1,
"source": {
"cell": "8fd179cd-b1d8-490f-9a76-b4e7b599dc36",
"port": "right"
},
"target": {
"cell": "dd6061f0-87d5-4efb-8d8d-9aef00aeb3f8",
"port": "left"
},
"vertices": [
{
"x": 60,
"y": -130
},
{
"x": 60,
"y": -80
}
]
},
{
"id": "d6e8d372-4403-42e2-b9ad-8d2c0b1aa5ba",
"shape": "bpmn-edge",
"zIndex": -1,
"source": {
"cell": "85e639b4-5c09-4924-b7e9-f78ae898a0b8",
"port": "right"
},
"target": {
"cell": "dd6061f0-87d5-4efb-8d8d-9aef00aeb3f8",
"port": "left"
},
"vertices": [
{
"x": 60,
"y": -30
},
{
"x": 60,
"y": -80
}
]
},
{
"id": "5526b6c7-d0a8-4f4d-bc18-84aadb7e1647",
"shape": "bpmn-edge",
"zIndex": 1,
"source": {
"port": "right",
"cell": "d3a78ea2-cb8c-4439-920a-7e3c5b032986"
},
"target": {
"port": "left",
"cell": "8fd179cd-b1d8-490f-9a76-b4e7b599dc36"
},
"vertices": [
{
"x": -160,
"y": -80
},
{
"x": -160,
"y": -130
}
]
},
{
"id": "ec38a99d-af01-4c88-93a6-7e33f654f4f4",
"shape": "bpmn-edge",
"zIndex": 1,
"source": {
"port": "right",
"cell": "d3a78ea2-cb8c-4439-920a-7e3c5b032986"
},
"target": {
"port": "left",
"cell": "85e639b4-5c09-4924-b7e9-f78ae898a0b8"
},
"vertices": [
{
"x": -160,
"y": -80
},
{
"x": -160,
"y": -30
}
]
}
]
});
onMounted(() => {
bpmnPreviewRef.value?.init();
});
</script>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218