164
164
<el-radio
165
165
v-for =" item in CHILD_PROCESS_START_USER_TYPE"
166
166
:key =" item.value"
167
- :value =" item.value" >
168
- {{ item.label }}</el-radio >
167
+ :value =" item.value"
168
+ >
169
+ {{ item.label }}</el-radio
170
+ >
169
171
</el-radio-group >
170
172
</el-form-item >
171
173
<el-form-item
177
179
<el-radio
178
180
v-for =" item in CHILD_PROCESS_START_USER_EMPTY_TYPE"
179
181
:key =" item.value"
180
- :value =" item.value" >
181
- {{ item.label }}</el-radio >
182
+ :value =" item.value"
183
+ >
184
+ {{ item.label }}</el-radio
185
+ >
182
186
</el-radio-group >
183
187
</el-form-item >
184
188
<el-form-item
249
253
<el-text >后进入下一节点</el-text >
250
254
</el-form-item >
251
255
</div >
256
+
257
+ <el-divider content-position =" left" >多实例设置</el-divider >
258
+ <el-form-item label =" 启用开关" prop =" multiInstanceEnable" >
259
+ <el-switch
260
+ v-model =" configForm.multiInstanceEnable"
261
+ active-text =" 开启"
262
+ inactive-text =" 关闭"
263
+ />
264
+ </el-form-item >
265
+ <div v-if =" configForm.multiInstanceEnable" >
266
+ <el-form-item prop =" sequential" >
267
+ <el-switch
268
+ v-model =" configForm.sequential"
269
+ active-text =" 串行"
270
+ inactive-text =" 并行"
271
+ />
272
+ </el-form-item >
273
+ <el-form-item prop =" completeRatio" >
274
+ <el-text >完成比例(%)</el-text >
275
+ <el-input-number
276
+ class =" ml-10px"
277
+ v-model =" configForm.completeRatio"
278
+ :min =" 10"
279
+ :max =" 100"
280
+ :step =" 10"
281
+ />
282
+ </el-form-item >
283
+ <el-form-item prop =" multiInstanceSourceType" >
284
+ <el-text >多实例来源</el-text >
285
+ <el-select class =" ml-10px w-200px!" v-model =" configForm.multiInstanceSourceType" @change =" handleMultiInstanceSourceTypeChange" >
286
+ <el-option
287
+ v-for =" item in CHILD_PROCESS_MULTI_INSTANCE_SOURCE_TYPE"
288
+ :key =" item.value"
289
+ :label =" item.label"
290
+ :value =" item.value"
291
+ />
292
+ </el-select >
293
+ </el-form-item >
294
+ <el-form-item v-if =" configForm.multiInstanceSourceType === 1" >
295
+ <el-input-number v-model =" configForm.multiInstanceSource" :min =" 1" />
296
+ </el-form-item >
297
+ <el-form-item v-if =" configForm.multiInstanceSourceType === 2" >
298
+ <el-select class =" w-200px!" v-model =" configForm.multiInstanceSource" >
299
+ <el-option
300
+ v-for =" (field, fIdx) in digitalFormFieldOptions"
301
+ :key =" fIdx"
302
+ :label =" field.title"
303
+ :value =" field.field"
304
+ />
305
+ </el-select >
306
+ </el-form-item >
307
+ <el-form-item v-if =" configForm.multiInstanceSourceType === 3" >
308
+ <el-select class =" w-200px!" v-model =" configForm.multiInstanceSource" >
309
+ <el-option
310
+ v-for =" (field, fIdx) in multiFormFieldOptions"
311
+ :key =" fIdx"
312
+ :label =" field.title"
313
+ :value =" field.field"
314
+ />
315
+ </el-select >
316
+ </el-form-item >
317
+ </div >
252
318
</el-form >
253
319
</div >
254
320
</el-tab-pane >
@@ -276,7 +342,9 @@ import {
276
342
ChildProcessStartUserTypeEnum ,
277
343
CHILD_PROCESS_START_USER_TYPE ,
278
344
ChildProcessStartUserEmptyTypeEnum ,
279
- CHILD_PROCESS_START_USER_EMPTY_TYPE
345
+ CHILD_PROCESS_START_USER_EMPTY_TYPE ,
346
+ CHILD_PROCESS_MULTI_INSTANCE_SOURCE_TYPE ,
347
+ ChildProcessMultiInstanceSourceTypeEnum
280
348
} from ' ../consts'
281
349
import { useWatchNode , useDrawer , useNodeName , useFormFieldsAndStartUser } from ' ../node'
282
350
import { parseFormFields } from ' @/components/FormCreate/src/utils'
@@ -315,7 +383,8 @@ const formRules = reactive({
315
383
timeoutEnable: [{ required: true , message: ' 超时设置是否开启不能为空' , trigger: ' change' }],
316
384
timeoutType: [{ required: true , message: ' 超时设置时间不能为空' , trigger: ' change' }],
317
385
timeDuration: [{ required: true , message: ' 超时设置时间不能为空' , trigger: ' change' }],
318
- dateTime: [{ required: true , message: ' 超时设置时间不能为空' , trigger: ' change' }]
386
+ dateTime: [{ required: true , message: ' 超时设置时间不能为空' , trigger: ' change' }],
387
+ multiInstanceEnable: [{ required: true , message: ' 多实例设置不能为空' , trigger: ' change' }]
319
388
})
320
389
type ChildProcessFormType = {
321
390
async: boolean
@@ -331,6 +400,11 @@ type ChildProcessFormType = {
331
400
timeDuration: number
332
401
timeUnit: TimeUnitType
333
402
dateTime: string
403
+ multiInstanceEnable: boolean
404
+ sequential: boolean
405
+ completeRatio: number
406
+ multiInstanceSourceType: ChildProcessMultiInstanceSourceTypeEnum
407
+ multiInstanceSource: string
334
408
}
335
409
const configForm = ref <ChildProcessFormType >({
336
410
async: false ,
@@ -345,10 +419,21 @@ const configForm = ref<ChildProcessFormType>({
345
419
timeoutType: DelayTypeEnum .FIXED_TIME_DURATION ,
346
420
timeDuration: 1 ,
347
421
timeUnit: TimeUnitType .HOUR ,
348
- dateTime: ' '
422
+ dateTime: ' ' ,
423
+ multiInstanceEnable: false ,
424
+ sequential: false ,
425
+ completeRatio: 100 ,
426
+ multiInstanceSourceType: ChildProcessMultiInstanceSourceTypeEnum .FIXED_QUANTITY ,
427
+ multiInstanceSource: ' '
349
428
})
350
429
const childProcessOptions = ref ()
351
430
const formFieldOptions = useFormFieldsAndStartUser ()
431
+ const digitalFormFieldOptions = computed (() => {
432
+ return formFieldOptions .filter ((item ) => item .type === ' inputNumber' )
433
+ })
434
+ const multiFormFieldOptions = computed (() => {
435
+ return formFieldOptions .filter ((item ) => item .type === ' select' || item .type === ' checkbox' )
436
+ })
352
437
const childFormFieldOptions = ref ()
353
438
354
439
// 保存配置
@@ -393,6 +478,19 @@ const saveConfig = async () => {
393
478
configForm .value .dateTime
394
479
}
395
480
}
481
+ // 8. 多实例设置
482
+ currentNode .value .childProcessSetting .multiInstanceSetting = {
483
+ enable: configForm .value .multiInstanceEnable
484
+ }
485
+ if (configForm .value .multiInstanceEnable ) {
486
+ currentNode .value .childProcessSetting .multiInstanceSetting .sequential = configForm .value .sequential
487
+ currentNode .value .childProcessSetting .multiInstanceSetting .completeRatio =
488
+ configForm .value .completeRatio
489
+ currentNode .value .childProcessSetting .multiInstanceSetting .sourceType =
490
+ configForm .value .multiInstanceSourceType
491
+ currentNode .value .childProcessSetting .multiInstanceSetting .source =
492
+ configForm .value .multiInstanceSource
493
+ }
396
494
}
397
495
398
496
currentNode .value .showText = ` 调用子流程:${childInfo .name } `
@@ -436,6 +534,16 @@ const showChildProcessNodeConfig = (node: SimpleFlowNode) => {
436
534
configForm .value .dateTime = node .childProcessSetting .timeoutSetting .timeExpression ?? ' '
437
535
}
438
536
}
537
+ // 8. 多实例设置
538
+ configForm .value .multiInstanceEnable =
539
+ node .childProcessSetting .multiInstanceSetting .enable ?? false
540
+ if (configForm .value .multiInstanceEnable ) {
541
+ configForm .value .sequential = node .childProcessSetting .multiInstanceSetting .sequential ?? false
542
+ configForm .value .completeRatio = node .childProcessSetting .multiInstanceSetting .completeRatio ?? 100
543
+ configForm .value .multiInstanceSourceType =
544
+ node .childProcessSetting .multiInstanceSetting .sourceType ?? ChildProcessMultiInstanceSourceTypeEnum .FIXED_QUANTITY
545
+ configForm .value .multiInstanceSource = node .childProcessSetting .multiInstanceSetting .source ?? ' '
546
+ }
439
547
}
440
548
loadFormInfo ()
441
549
}
@@ -481,6 +589,9 @@ const getIsoTimeDuration = () => {
481
589
}
482
590
return strTimeDuration
483
591
}
592
+ const handleMultiInstanceSourceTypeChange = () => {
593
+ configForm .value .multiInstanceSource = ' '
594
+ }
484
595
485
596
onMounted (async () => {
486
597
childProcessOptions .value = await getModelList (undefined )
0 commit comments