gbflowengine 0.1.0 → 0.1.1

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.
Files changed (79) hide show
  1. package/README.md +271 -271
  2. package/dist/gbflowengine.css +1 -1
  3. package/dist/gbflowengine.js +8232 -6913
  4. package/dist/gbflowengine.js.map +1 -1
  5. package/dist/gbflowengine.umd.cjs +2 -2
  6. package/dist/gbflowengine.umd.cjs.map +1 -1
  7. package/package.json +85 -84
  8. package/src/center/DefinitionInspect.vue +291 -291
  9. package/src/center/FlowCenter.vue +33 -33
  10. package/src/center/index.js +29 -29
  11. package/src/center/storage.js +748 -748
  12. package/src/core/flow/condition.js +160 -160
  13. package/src/core/flow/customNode.js +385 -385
  14. package/src/core/flow/defaults.js +124 -124
  15. package/src/core/flow/flowConstant.js +265 -265
  16. package/src/core/flow/flowNodeUtils.js +29 -29
  17. package/src/core/flow/index.js +47 -47
  18. package/src/core/flow/node.js +44 -44
  19. package/src/core/flow/nodeFactory.js +58 -58
  20. package/src/core/flow/prediction.js +325 -325
  21. package/src/core/flow/schema.js +864 -864
  22. package/src/definition/FlowDefinitionDesigner.vue +338 -338
  23. package/src/definition/index.js +9 -9
  24. package/src/index.js +39 -39
  25. package/src/storage.js +200 -200
  26. package/src/testing/FlowTestPanel.vue +2502 -2502
  27. package/src/testing/UserConfigDrawer.vue +376 -376
  28. package/src/testing/diagram/FlowProgressDiagram.vue +318 -318
  29. package/src/testing/diagramModel.js +517 -517
  30. package/src/testing/index.js +23 -23
  31. package/src/testing/mock.js +246 -246
  32. package/src/testing/oaExecutors.js +51 -51
  33. package/src/testing/oaSeed.js +467 -467
  34. package/src/testing/sample.js +412 -412
  35. package/src/testing/seed.js +122 -122
  36. package/src/utils/format.js +27 -27
  37. package/src/visual/FlowCanvas.vue +440 -440
  38. package/src/visual/NodeProgressDetail.vue +43 -43
  39. package/src/visual/NodeStatusBadge.vue +17 -17
  40. package/src/visual/NodeWrap.vue +46 -46
  41. package/src/visual/ScWorkflow.vue +49 -49
  42. package/src/visual/SelectDialog.vue +459 -459
  43. package/src/visual/conditionHelpers.js +116 -116
  44. package/src/visual/index.js +6 -6
  45. package/src/visual/nodes/AddNode.vue +222 -222
  46. package/src/visual/nodes/ApproverNode.vue +347 -347
  47. package/src/visual/nodes/BranchNode.vue +441 -441
  48. package/src/visual/nodes/CustomNode.vue +339 -339
  49. package/src/visual/nodes/EndNode.vue +21 -21
  50. package/src/visual/nodes/PassNode.vue +100 -100
  51. package/src/visual/nodes/PromoterNode.vue +134 -134
  52. package/src/visual/nodes/RejectNode.vue +100 -100
  53. package/src/visual/nodes/SendNode.vue +151 -151
  54. package/src/visual/styles.scss +879 -879
  55. package/src/visual/useScNodeStatus.js +18 -18
  56. package/src/workbench/OaWorkbench.vue +1341 -1341
  57. package/src/workbench/components/ApprovalWorkspace.vue +2090 -2090
  58. package/src/workbench/components/CategoryIcon.vue +74 -74
  59. package/src/workbench/components/NotificationIcon.vue +73 -73
  60. package/src/workbench/components/ProcessSteps.vue +557 -557
  61. package/src/workbench/components/ResubmitDialog.vue +227 -227
  62. package/src/workbench/components/SidebarNav.vue +138 -138
  63. package/src/workbench/components/StartFlowDialog.vue +1058 -1058
  64. package/src/workbench/components/UserAvatar.vue +68 -68
  65. package/src/workbench/model.js +1080 -1080
  66. package/src/workbench/pages/DesignPage.vue +798 -798
  67. package/src/workbench/pages/HomePage.vue +1050 -1050
  68. package/src/workbench/pages/MonitorPage.vue +1029 -1029
  69. package/src/workbench/pages/NotificationsPage.vue +554 -554
  70. package/src/workbench/pages/RequestsPage.vue +644 -644
  71. package/src/workbench/pages/TaskCenterPage.vue +1155 -1155
  72. package/src/workbench/pages/TemplatesPage.vue +680 -680
  73. package/src/workbench/styles.scss +555 -555
  74. package/types/center.d.ts +5 -5
  75. package/types/core.d.ts +479 -479
  76. package/types/definition.d.ts +4 -4
  77. package/types/index.d.ts +34 -34
  78. package/types/testing.d.ts +20 -20
  79. package/types/visual.d.ts +20 -20
@@ -1,412 +1,412 @@
1
- import { createDefinition, normalizeDefinition } from '../core/flow/schema.js'
2
-
3
- function condition(variable, variableName, operator, value, fieldType, logic = 'AND') {
4
- return { variable, variableName, operator, value, fieldType, logic }
5
- }
6
-
7
- function approve(nodeId, nodeName, userList, userNickNames, deptNameMap, extra = {}) {
8
- return {
9
- nodeId,
10
- nodeName,
11
- type: 'approve',
12
- signMode: 'and',
13
- approverType: 'user',
14
- userList,
15
- userNickNames,
16
- deptNameMap,
17
- roleList: [],
18
- roleNameMap: {},
19
- superiorLevel: 1,
20
- allowTransfer: true,
21
- rejectStrategy: 'to_initiator',
22
- rejectTargetNodeId: null,
23
- childNode: null,
24
- ...extra
25
- }
26
- }
27
-
28
- export function createSampleDefinition() {
29
- const workflow = {
30
- nodeId: 100,
31
- nodeName: '发起人',
32
- type: 'start',
33
- childNode: approve(
34
- 101,
35
- '部门主管审批',
36
- [1, 2],
37
- { 1: '张明', 2: '李婷' },
38
- { 1: '产品中心', 2: '设计部' },
39
- { signMode: 'and' }
40
- )
41
- }
42
-
43
- const manager = workflow.childNode
44
- manager.childNode = {
45
- nodeId: 102,
46
- nodeName: '条件分支',
47
- type: 'branch',
48
- branchList: [
49
- {
50
- nodeId: 103,
51
- nodeName: '大额采购',
52
- type: 'condition',
53
- conditions: [
54
- condition('amount', '申请金额', '>', 1000, 'integer')
55
- ],
56
- childNode: {
57
- nodeId: 104,
58
- nodeName: '财务审批',
59
- type: 'approve',
60
- approverType: 'role',
61
- roleList: [1],
62
- roleNameMap: { 1: '财务专员' },
63
- userList: [],
64
- signMode: 'or',
65
- superiorLevel: 1,
66
- allowTransfer: false,
67
- rejectStrategy: 'to_initiator',
68
- rejectTargetNodeId: null,
69
- childNode: null
70
- }
71
- },
72
- {
73
- nodeId: 105,
74
- nodeName: '特殊合同',
75
- type: 'condition',
76
- conditions: [
77
- condition('category', '申请类型', '==', 'special', 'string')
78
- ],
79
- childNode: {
80
- nodeId: 106,
81
- nodeName: '直接拒绝',
82
- type: 'reject',
83
- childNode: null
84
- }
85
- },
86
- {
87
- nodeId: 107,
88
- nodeName: '加急申请',
89
- type: 'condition',
90
- conditions: [
91
- condition('urgent', '是否加急', '==', 'yes', 'string')
92
- ],
93
- childNode: {
94
- nodeId: 108,
95
- nodeName: '直接通过',
96
- type: 'pass',
97
- childNode: null
98
- }
99
- },
100
- {
101
- nodeId: 122,
102
- nodeName: '需要发票',
103
- type: 'condition',
104
- conditions: [
105
- condition('needInvoice', '是否需要发票', '==', true, 'boolean')
106
- ],
107
- childNode: {
108
- nodeId: 123,
109
- nodeName: '抄送税务',
110
- type: 'cc',
111
- userList: [8],
112
- userNickNames: { 8: '吴军' },
113
- deptNameMap: { 8: '技术支持部' },
114
- allowInitiatorAddUsers: false,
115
- childNode: null
116
- }
117
- },
118
- {
119
- nodeId: 109,
120
- nodeName: '其他条件',
121
- type: 'condition',
122
- isDefaultCondition: true,
123
- childNode: null
124
- }
125
- ],
126
- childNode: {
127
- nodeId: 110,
128
- nodeName: '抄送人力资源',
129
- type: 'cc',
130
- userList: [3],
131
- userNickNames: { 3: '王芳' },
132
- deptNameMap: { 3: '人力资源部' },
133
- allowInitiatorAddUsers: true,
134
- childNode: {
135
- nodeId: 111,
136
- nodeName: '并行会签',
137
- type: 'parallel',
138
- branchList: [
139
- {
140
- nodeId: 112,
141
- nodeName: '法务分支',
142
- type: 'parallel_branch',
143
- branchIndex: 0,
144
- childNode: approve(
145
- 113,
146
- '法务审批',
147
- [4],
148
- { 4: '陈浩' },
149
- { 4: '法务部' },
150
- { rejectStrategy: 'to_previous' }
151
- )
152
- },
153
- {
154
- nodeId: 114,
155
- nodeName: '人事分支',
156
- type: 'parallel_branch',
157
- branchIndex: 1,
158
- childNode: approve(
159
- 115,
160
- '人事审批',
161
- [5],
162
- { 5: '赵磊' },
163
- { 5: '人事部' },
164
- { signMode: 'or' }
165
- )
166
- }
167
- ],
168
- childNode: {
169
- nodeId: 116,
170
- nodeName: '包容分支',
171
- type: 'inclusive',
172
- branchList: [
173
- {
174
- nodeId: 117,
175
- nodeName: '需财务归档',
176
- type: 'inclusive_branch',
177
- branchIndex: 0,
178
- conditions: [
179
- condition('amount', '申请金额', '>=', 500, 'integer')
180
- ],
181
- isDefaultBranch: false,
182
- childNode: {
183
- nodeId: 118,
184
- nodeName: '抄送财务',
185
- type: 'cc',
186
- userList: [6],
187
- userNickNames: { 6: '孙丽' },
188
- deptNameMap: { 6: '财务部' },
189
- allowInitiatorAddUsers: false,
190
- childNode: null
191
- }
192
- },
193
- {
194
- nodeId: 119,
195
- nodeName: '其他分支',
196
- type: 'inclusive_branch',
197
- branchIndex: 1,
198
- conditions: [],
199
- isDefaultBranch: true,
200
- childNode: approve(
201
- 120,
202
- '行政备案',
203
- [7],
204
- { 7: '周琪' },
205
- { 7: '行政部' },
206
- { signMode: 'or' }
207
- )
208
- }
209
- ],
210
- childNode: {
211
- nodeId: 121,
212
- nodeName: '流程结束',
213
- type: 'end',
214
- childNode: null
215
- }
216
- }
217
- }
218
- }
219
- }
220
-
221
- const form = [
222
- {
223
- id: 'cmp_reason',
224
- type: 'input',
225
- value: '',
226
- required: true,
227
- defaultValue: '',
228
- props: {
229
- label: '申请事由',
230
- variableName: 'reason',
231
- placeholder: '请输入申请事由'
232
- },
233
- style: { width: '100%' }
234
- },
235
- {
236
- id: 'cmp_amount',
237
- type: 'input-number',
238
- value: null,
239
- required: true,
240
- min: 0,
241
- max: 100000,
242
- defaultValue: 500,
243
- props: {
244
- label: '申请金额',
245
- variableName: 'amount',
246
- placeholder: '请输入金额'
247
- },
248
- style: { width: '50%' }
249
- },
250
- {
251
- id: 'cmp_category',
252
- type: 'radio-group',
253
- value: '',
254
- required: true,
255
- defaultValue: 'normal',
256
- props: {
257
- label: '申请类型',
258
- variableName: 'category',
259
- options: [
260
- { label: '普通采购', value: 'normal' },
261
- { label: '特殊合同', value: 'special' }
262
- ]
263
- },
264
- style: { width: '50%' }
265
- },
266
- {
267
- id: 'cmp_urgent',
268
- type: 'radio-group',
269
- value: '',
270
- required: true,
271
- defaultValue: 'no',
272
- props: {
273
- label: '是否加急',
274
- variableName: 'urgent',
275
- options: [
276
- { label: '否', value: 'no' },
277
- { label: '是', value: 'yes' }
278
- ]
279
- },
280
- style: { width: '50%' }
281
- },
282
- {
283
- id: 'cmp_date',
284
- type: 'date-picker',
285
- value: null,
286
- required: true,
287
- defaultValue: null,
288
- props: {
289
- label: '期望日期',
290
- variableName: 'applyDate',
291
- placeholder: '请选择日期'
292
- },
293
- style: { width: '50%' }
294
- },
295
- {
296
- id: 'cmp_budget_type',
297
- type: 'select',
298
- value: '',
299
- required: false,
300
- defaultValue: '',
301
- props: {
302
- label: '预算科目',
303
- variableName: 'budgetType',
304
- placeholder: '请选择预算科目',
305
- options: [
306
- { label: '市场推广', value: 'marketing' },
307
- { label: '研发投入', value: 'rd' },
308
- { label: '行政支出', value: 'admin' }
309
- ]
310
- },
311
- style: { width: '50%' }
312
- },
313
- {
314
- id: 'cmp_invoice',
315
- type: 'switch',
316
- value: false,
317
- required: false,
318
- defaultValue: false,
319
- props: {
320
- label: '是否需要发票',
321
- variableName: 'needInvoice',
322
- activeText: '是',
323
- inactiveText: '否'
324
- },
325
- style: { width: '50%' }
326
- },
327
- {
328
- id: 'cmp_attachments',
329
- type: 'checkbox-group',
330
- value: [],
331
- required: false,
332
- defaultValue: [],
333
- props: {
334
- label: '随附材料',
335
- variableName: 'attachments',
336
- options: [
337
- { label: '报价单', value: 'quote' },
338
- { label: '合同草稿', value: 'contract' },
339
- { label: '资质证明', value: 'certificate' }
340
- ]
341
- },
342
- style: { width: '100%' }
343
- },
344
- {
345
- id: 'cmp_remark',
346
- type: 'textarea',
347
- value: '',
348
- required: false,
349
- defaultValue: '',
350
- props: {
351
- label: '补充说明',
352
- variableName: 'remark',
353
- placeholder: '请输入补充说明',
354
- rows: 3
355
- },
356
- style: { width: '100%' }
357
- },
358
- {
359
- id: 'cmp_row',
360
- type: 'row',
361
- required: false,
362
- props: {
363
- gutter: 20,
364
- columns: [{ span: 12 }, { span: 12 }]
365
- },
366
- children: [
367
- [
368
- {
369
- id: 'cmp_dept',
370
- type: 'input',
371
- value: '',
372
- required: false,
373
- defaultValue: '',
374
- props: { label: '需求部门', variableName: 'dept', placeholder: '请输入部门' },
375
- style: { width: '100%' }
376
- }
377
- ],
378
- [
379
- {
380
- id: 'cmp_contact',
381
- type: 'input',
382
- value: '',
383
- required: false,
384
- defaultValue: '',
385
- props: { label: '联系人', variableName: 'contact', placeholder: '请输入联系人' },
386
- style: { width: '100%' }
387
- }
388
- ]
389
- ]
390
- }
391
- ]
392
-
393
- return normalizeDefinition(
394
- createDefinition({
395
- workflow,
396
- form,
397
- meta: {
398
- name: '采购申请流程',
399
- description: '演示全部节点类型的示例模板',
400
- tags: ['demo', 'purchase']
401
- }
402
- })
403
- )
404
- }
405
-
406
- export function createSampleWorkflow() {
407
- return createSampleDefinition().workflow
408
- }
409
-
410
- export function createSampleForm() {
411
- return createSampleDefinition().form.components
412
- }
1
+ import { createDefinition, normalizeDefinition } from '../core/flow/schema.js'
2
+
3
+ function condition(variable, variableName, operator, value, fieldType, logic = 'AND') {
4
+ return { variable, variableName, operator, value, fieldType, logic }
5
+ }
6
+
7
+ function approve(nodeId, nodeName, userList, userNickNames, deptNameMap, extra = {}) {
8
+ return {
9
+ nodeId,
10
+ nodeName,
11
+ type: 'approve',
12
+ signMode: 'and',
13
+ approverType: 'user',
14
+ userList,
15
+ userNickNames,
16
+ deptNameMap,
17
+ roleList: [],
18
+ roleNameMap: {},
19
+ superiorLevel: 1,
20
+ allowTransfer: true,
21
+ rejectStrategy: 'to_initiator',
22
+ rejectTargetNodeId: null,
23
+ childNode: null,
24
+ ...extra
25
+ }
26
+ }
27
+
28
+ export function createSampleDefinition() {
29
+ const workflow = {
30
+ nodeId: 100,
31
+ nodeName: '发起人',
32
+ type: 'start',
33
+ childNode: approve(
34
+ 101,
35
+ '部门主管审批',
36
+ [1, 2],
37
+ { 1: '张明', 2: '李婷' },
38
+ { 1: '产品中心', 2: '设计部' },
39
+ { signMode: 'and' }
40
+ )
41
+ }
42
+
43
+ const manager = workflow.childNode
44
+ manager.childNode = {
45
+ nodeId: 102,
46
+ nodeName: '条件分支',
47
+ type: 'branch',
48
+ branchList: [
49
+ {
50
+ nodeId: 103,
51
+ nodeName: '大额采购',
52
+ type: 'condition',
53
+ conditions: [
54
+ condition('amount', '申请金额', '>', 1000, 'integer')
55
+ ],
56
+ childNode: {
57
+ nodeId: 104,
58
+ nodeName: '财务审批',
59
+ type: 'approve',
60
+ approverType: 'role',
61
+ roleList: [1],
62
+ roleNameMap: { 1: '财务专员' },
63
+ userList: [],
64
+ signMode: 'or',
65
+ superiorLevel: 1,
66
+ allowTransfer: false,
67
+ rejectStrategy: 'to_initiator',
68
+ rejectTargetNodeId: null,
69
+ childNode: null
70
+ }
71
+ },
72
+ {
73
+ nodeId: 105,
74
+ nodeName: '特殊合同',
75
+ type: 'condition',
76
+ conditions: [
77
+ condition('category', '申请类型', '==', 'special', 'string')
78
+ ],
79
+ childNode: {
80
+ nodeId: 106,
81
+ nodeName: '直接拒绝',
82
+ type: 'reject',
83
+ childNode: null
84
+ }
85
+ },
86
+ {
87
+ nodeId: 107,
88
+ nodeName: '加急申请',
89
+ type: 'condition',
90
+ conditions: [
91
+ condition('urgent', '是否加急', '==', 'yes', 'string')
92
+ ],
93
+ childNode: {
94
+ nodeId: 108,
95
+ nodeName: '直接通过',
96
+ type: 'pass',
97
+ childNode: null
98
+ }
99
+ },
100
+ {
101
+ nodeId: 122,
102
+ nodeName: '需要发票',
103
+ type: 'condition',
104
+ conditions: [
105
+ condition('needInvoice', '是否需要发票', '==', true, 'boolean')
106
+ ],
107
+ childNode: {
108
+ nodeId: 123,
109
+ nodeName: '抄送税务',
110
+ type: 'cc',
111
+ userList: [8],
112
+ userNickNames: { 8: '吴军' },
113
+ deptNameMap: { 8: '技术支持部' },
114
+ allowInitiatorAddUsers: false,
115
+ childNode: null
116
+ }
117
+ },
118
+ {
119
+ nodeId: 109,
120
+ nodeName: '其他条件',
121
+ type: 'condition',
122
+ isDefaultCondition: true,
123
+ childNode: null
124
+ }
125
+ ],
126
+ childNode: {
127
+ nodeId: 110,
128
+ nodeName: '抄送人力资源',
129
+ type: 'cc',
130
+ userList: [3],
131
+ userNickNames: { 3: '王芳' },
132
+ deptNameMap: { 3: '人力资源部' },
133
+ allowInitiatorAddUsers: true,
134
+ childNode: {
135
+ nodeId: 111,
136
+ nodeName: '并行会签',
137
+ type: 'parallel',
138
+ branchList: [
139
+ {
140
+ nodeId: 112,
141
+ nodeName: '法务分支',
142
+ type: 'parallel_branch',
143
+ branchIndex: 0,
144
+ childNode: approve(
145
+ 113,
146
+ '法务审批',
147
+ [4],
148
+ { 4: '陈浩' },
149
+ { 4: '法务部' },
150
+ { rejectStrategy: 'to_previous' }
151
+ )
152
+ },
153
+ {
154
+ nodeId: 114,
155
+ nodeName: '人事分支',
156
+ type: 'parallel_branch',
157
+ branchIndex: 1,
158
+ childNode: approve(
159
+ 115,
160
+ '人事审批',
161
+ [5],
162
+ { 5: '赵磊' },
163
+ { 5: '人事部' },
164
+ { signMode: 'or' }
165
+ )
166
+ }
167
+ ],
168
+ childNode: {
169
+ nodeId: 116,
170
+ nodeName: '包容分支',
171
+ type: 'inclusive',
172
+ branchList: [
173
+ {
174
+ nodeId: 117,
175
+ nodeName: '需财务归档',
176
+ type: 'inclusive_branch',
177
+ branchIndex: 0,
178
+ conditions: [
179
+ condition('amount', '申请金额', '>=', 500, 'integer')
180
+ ],
181
+ isDefaultBranch: false,
182
+ childNode: {
183
+ nodeId: 118,
184
+ nodeName: '抄送财务',
185
+ type: 'cc',
186
+ userList: [6],
187
+ userNickNames: { 6: '孙丽' },
188
+ deptNameMap: { 6: '财务部' },
189
+ allowInitiatorAddUsers: false,
190
+ childNode: null
191
+ }
192
+ },
193
+ {
194
+ nodeId: 119,
195
+ nodeName: '其他分支',
196
+ type: 'inclusive_branch',
197
+ branchIndex: 1,
198
+ conditions: [],
199
+ isDefaultBranch: true,
200
+ childNode: approve(
201
+ 120,
202
+ '行政备案',
203
+ [7],
204
+ { 7: '周琪' },
205
+ { 7: '行政部' },
206
+ { signMode: 'or' }
207
+ )
208
+ }
209
+ ],
210
+ childNode: {
211
+ nodeId: 121,
212
+ nodeName: '流程结束',
213
+ type: 'end',
214
+ childNode: null
215
+ }
216
+ }
217
+ }
218
+ }
219
+ }
220
+
221
+ const form = [
222
+ {
223
+ id: 'cmp_reason',
224
+ type: 'input',
225
+ value: '',
226
+ required: true,
227
+ defaultValue: '',
228
+ props: {
229
+ label: '申请事由',
230
+ variableName: 'reason',
231
+ placeholder: '请输入申请事由'
232
+ },
233
+ style: { width: '100%' }
234
+ },
235
+ {
236
+ id: 'cmp_amount',
237
+ type: 'input-number',
238
+ value: null,
239
+ required: true,
240
+ min: 0,
241
+ max: 100000,
242
+ defaultValue: 500,
243
+ props: {
244
+ label: '申请金额',
245
+ variableName: 'amount',
246
+ placeholder: '请输入金额'
247
+ },
248
+ style: { width: '50%' }
249
+ },
250
+ {
251
+ id: 'cmp_category',
252
+ type: 'radio-group',
253
+ value: '',
254
+ required: true,
255
+ defaultValue: 'normal',
256
+ props: {
257
+ label: '申请类型',
258
+ variableName: 'category',
259
+ options: [
260
+ { label: '普通采购', value: 'normal' },
261
+ { label: '特殊合同', value: 'special' }
262
+ ]
263
+ },
264
+ style: { width: '50%' }
265
+ },
266
+ {
267
+ id: 'cmp_urgent',
268
+ type: 'radio-group',
269
+ value: '',
270
+ required: true,
271
+ defaultValue: 'no',
272
+ props: {
273
+ label: '是否加急',
274
+ variableName: 'urgent',
275
+ options: [
276
+ { label: '否', value: 'no' },
277
+ { label: '是', value: 'yes' }
278
+ ]
279
+ },
280
+ style: { width: '50%' }
281
+ },
282
+ {
283
+ id: 'cmp_date',
284
+ type: 'date-picker',
285
+ value: null,
286
+ required: true,
287
+ defaultValue: null,
288
+ props: {
289
+ label: '期望日期',
290
+ variableName: 'applyDate',
291
+ placeholder: '请选择日期'
292
+ },
293
+ style: { width: '50%' }
294
+ },
295
+ {
296
+ id: 'cmp_budget_type',
297
+ type: 'select',
298
+ value: '',
299
+ required: false,
300
+ defaultValue: '',
301
+ props: {
302
+ label: '预算科目',
303
+ variableName: 'budgetType',
304
+ placeholder: '请选择预算科目',
305
+ options: [
306
+ { label: '市场推广', value: 'marketing' },
307
+ { label: '研发投入', value: 'rd' },
308
+ { label: '行政支出', value: 'admin' }
309
+ ]
310
+ },
311
+ style: { width: '50%' }
312
+ },
313
+ {
314
+ id: 'cmp_invoice',
315
+ type: 'switch',
316
+ value: false,
317
+ required: false,
318
+ defaultValue: false,
319
+ props: {
320
+ label: '是否需要发票',
321
+ variableName: 'needInvoice',
322
+ activeText: '是',
323
+ inactiveText: '否'
324
+ },
325
+ style: { width: '50%' }
326
+ },
327
+ {
328
+ id: 'cmp_attachments',
329
+ type: 'checkbox-group',
330
+ value: [],
331
+ required: false,
332
+ defaultValue: [],
333
+ props: {
334
+ label: '随附材料',
335
+ variableName: 'attachments',
336
+ options: [
337
+ { label: '报价单', value: 'quote' },
338
+ { label: '合同草稿', value: 'contract' },
339
+ { label: '资质证明', value: 'certificate' }
340
+ ]
341
+ },
342
+ style: { width: '100%' }
343
+ },
344
+ {
345
+ id: 'cmp_remark',
346
+ type: 'textarea',
347
+ value: '',
348
+ required: false,
349
+ defaultValue: '',
350
+ props: {
351
+ label: '补充说明',
352
+ variableName: 'remark',
353
+ placeholder: '请输入补充说明',
354
+ rows: 3
355
+ },
356
+ style: { width: '100%' }
357
+ },
358
+ {
359
+ id: 'cmp_row',
360
+ type: 'row',
361
+ required: false,
362
+ props: {
363
+ gutter: 20,
364
+ columns: [{ span: 12 }, { span: 12 }]
365
+ },
366
+ children: [
367
+ [
368
+ {
369
+ id: 'cmp_dept',
370
+ type: 'input',
371
+ value: '',
372
+ required: false,
373
+ defaultValue: '',
374
+ props: { label: '需求部门', variableName: 'dept', placeholder: '请输入部门' },
375
+ style: { width: '100%' }
376
+ }
377
+ ],
378
+ [
379
+ {
380
+ id: 'cmp_contact',
381
+ type: 'input',
382
+ value: '',
383
+ required: false,
384
+ defaultValue: '',
385
+ props: { label: '联系人', variableName: 'contact', placeholder: '请输入联系人' },
386
+ style: { width: '100%' }
387
+ }
388
+ ]
389
+ ]
390
+ }
391
+ ]
392
+
393
+ return normalizeDefinition(
394
+ createDefinition({
395
+ workflow,
396
+ form,
397
+ meta: {
398
+ name: '采购申请流程',
399
+ description: '演示全部节点类型的示例模板',
400
+ tags: ['demo', 'purchase']
401
+ }
402
+ })
403
+ )
404
+ }
405
+
406
+ export function createSampleWorkflow() {
407
+ return createSampleDefinition().workflow
408
+ }
409
+
410
+ export function createSampleForm() {
411
+ return createSampleDefinition().form.components
412
+ }