Skip to content

Commit 357955c

Browse files
committed
feat: 子流程
1 parent b2ddefe commit 357955c

File tree

14 files changed

+571
-23
lines changed

14 files changed

+571
-23
lines changed
Lines changed: 1 addition & 0 deletions
Loading

src/assets/svgs/bpm/child-process.svg

Lines changed: 1 addition & 0 deletions
Loading

src/components/SimpleProcessDesignerV2/src/NodeHandler.vue

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,18 @@
6363
</div>
6464
<div class="handler-item-text">触发器</div>
6565
</div>
66+
<div class="handler-item" @click="addNode(NodeType.CHILD_PROCESS_NODE)">
67+
<div class="handler-item-icon child-process">
68+
<span class="iconfont icon-size icon-child-process"></span>
69+
</div>
70+
<div class="handler-item-text">子流程</div>
71+
</div>
72+
<div class="handler-item" @click="addNode(NodeType.ASYNC_CHILD_PROCESS_NODE)">
73+
<div class="handler-item-icon async-child-process">
74+
<span class="iconfont icon-size icon-async-child-process"></span>
75+
</div>
76+
<div class="handler-item-text">异步子流程</div>
77+
</div>
6678
</div>
6779
<template #reference>
6880
<div class="add-icon"><Icon icon="ep:plus" /></div>
@@ -283,6 +295,25 @@ const addNode = (type: number) => {
283295
}
284296
emits('update:childNode', data)
285297
}
298+
if (type === NodeType.CHILD_PROCESS_NODE) {
299+
const data: SimpleFlowNode = {
300+
id: 'Activity_' + generateUUID(),
301+
name: NODE_DEFAULT_NAME.get(NodeType.CHILD_PROCESS_NODE) as string,
302+
showText: '',
303+
type: NodeType.CHILD_PROCESS_NODE,
304+
childNode: props.childNode,
305+
childProcessSetting: {
306+
calledElement: '',
307+
calledElementName: '',
308+
async: false,
309+
skipStartUserNode: false,
310+
startUserSetting: {
311+
type: 1
312+
}
313+
}
314+
}
315+
emits('update:childNode', data)
316+
}
286317
}
287318
</script>
288319

src/components/SimpleProcessDesignerV2/src/ProcessNodeTree.vue

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,18 @@
5454
:flow-node="currentNode"
5555
@update:flow-node="handleModelValueUpdate"
5656
/>
57-
<!-- 触发器节点 -->
58-
<TriggerNode
57+
<!-- 触发器节点 -->
58+
<TriggerNode
5959
v-if="currentNode && currentNode.type === NodeType.TRIGGER_NODE"
6060
:flow-node="currentNode"
6161
@update:flow-node="handleModelValueUpdate"
6262
/>
63+
<!-- 子流程节点 -->
64+
<ChildProcessNode
65+
v-if="currentNode && currentNode.type === NodeType.CHILD_PROCESS_NODE"
66+
:flow-node="currentNode"
67+
@update:flow-node="handleModelValueUpdate"
68+
/>
6369
<!-- 递归显示孩子节点 -->
6470
<ProcessNodeTree
6571
v-if="currentNode && currentNode.childNode"
@@ -85,6 +91,7 @@ import InclusiveNode from './nodes/InclusiveNode.vue'
8591
import DelayTimerNode from './nodes/DelayTimerNode.vue'
8692
import RouterNode from './nodes/RouterNode.vue'
8793
import TriggerNode from './nodes/TriggerNode.vue'
94+
import ChildProcessNode from './nodes/ChildProcessNode.vue'
8895
import { SimpleFlowNode, NodeType } from './consts'
8996
import { useWatchNode } from './node'
9097
defineOptions({

src/components/SimpleProcessDesignerV2/src/consts.ts

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,16 @@ export enum NodeType {
3838
*/
3939
TRIGGER_NODE = 15,
4040

41+
/**
42+
* 触发器节点
43+
*/
44+
CHILD_PROCESS_NODE = 20,
45+
46+
/**
47+
* 触发器节点
48+
*/
49+
ASYNC_CHILD_PROCESS_NODE = 21,
50+
4151
/**
4252
* 条件节点
4353
*/
@@ -128,6 +138,8 @@ export interface SimpleFlowNode {
128138
reasonRequire?: boolean
129139
// 触发器设置
130140
triggerSetting?: TriggerSetting
141+
// 子流程
142+
childProcessSetting?: ChildProcessSetting
131143
}
132144
// 候选人策略枚举 ( 用于审批节点。抄送节点 )
133145
export enum CandidateStrategy {
@@ -512,6 +524,7 @@ NODE_DEFAULT_TEXT.set(NodeType.DELAY_TIMER_NODE, '请设置延迟器')
512524
NODE_DEFAULT_TEXT.set(NodeType.ROUTER_BRANCH_NODE, '请设置路由节点')
513525
NODE_DEFAULT_TEXT.set(NodeType.TRIGGER_NODE, '请设置触发器')
514526
NODE_DEFAULT_TEXT.set(NodeType.TRANSACTOR_NODE, '请设置办理人')
527+
NODE_DEFAULT_TEXT.set(NodeType.CHILD_PROCESS_NODE, '请设置子流程')
515528

516529
export const NODE_DEFAULT_NAME = new Map<number, string>()
517530
NODE_DEFAULT_NAME.set(NodeType.USER_TASK_NODE, '审批人')
@@ -522,6 +535,7 @@ NODE_DEFAULT_NAME.set(NodeType.DELAY_TIMER_NODE, '延迟器')
522535
NODE_DEFAULT_NAME.set(NodeType.ROUTER_BRANCH_NODE, '路由分支')
523536
NODE_DEFAULT_NAME.set(NodeType.TRIGGER_NODE, '触发器')
524537
NODE_DEFAULT_NAME.set(NodeType.TRANSACTOR_NODE, '办理人')
538+
NODE_DEFAULT_NAME.set(NodeType.CHILD_PROCESS_NODE, '子流程')
525539

526540
// 候选人策略。暂时不从字典中取。 后续可能调整。控制显示顺序
527541
export const CANDIDATE_STRATEGY: DictDataVO[] = [
@@ -750,7 +764,7 @@ export enum TriggerTypeEnum {
750764
/**
751765
* 流程表单更新触发器
752766
*/
753-
FORM_UPDATE = 2
767+
FORM_UPDATE = 2
754768
}
755769

756770
/**
@@ -785,3 +799,29 @@ export const TRIGGER_TYPES: DictDataVO[] = [
785799
{ label: 'HTTP 请求', value: TriggerTypeEnum.HTTP_REQUEST },
786800
{ label: '修改表单数据', value: TriggerTypeEnum.FORM_UPDATE }
787801
]
802+
803+
/**
804+
* 子流程节点结构定义
805+
*/
806+
export type ChildProcessSetting = {
807+
calledElement: string
808+
calledElementName: string
809+
async: boolean,
810+
inVariable?: IOParameter[],
811+
outVariable?: IOParameter[],
812+
skipStartUserNode: boolean,
813+
startUserSetting: StartUserSetting,
814+
}
815+
816+
export type IOParameter = {
817+
source: string
818+
sourceExpression: string
819+
target: string
820+
targetExpression: string
821+
}
822+
823+
export type StartUserSetting = {
824+
type: number
825+
formField?: string
826+
emptyHandleType?: number
827+
}

0 commit comments

Comments
 (0)