Skip to content

Commit 6b31a32

Browse files
committed
Merge branch 'feature/bpm' of https://gitee.com/yudaocode/yudao-ui-admin-vue3 into feature/bpm
2 parents ab9ce93 + 0ce9ece commit 6b31a32

File tree

3 files changed

+84
-26
lines changed

3 files changed

+84
-26
lines changed

src/components/SimpleProcessDesignerV2/src/consts.ts

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,8 @@ export interface SimpleFlowNode {
7878
timeoutHandler?: TimeoutHandler
7979
// 审批任务拒绝处理
8080
rejectHandler?: RejectHandler
81+
// 审批节点的审批人与发起人相同时,对应的处理类型
82+
assignStartUserHandlerType?: number
8183
}
8284
// 候选人策略枚举 ( 用于审批节点。抄送节点 )
8385
export enum CandidateStrategy {
@@ -170,7 +172,7 @@ export type TimeoutHandler = {
170172
//是否开启超时处理
171173
enable: boolean
172174
// 超时执行的动作
173-
action?: number
175+
type?: number
174176
// 超时时间设置
175177
timeDuration?: string
176178
// 执行动作是自动提醒, 最大提醒次数
@@ -187,6 +189,36 @@ export enum RejectHandlerType {
187189
*/
188190
RETURN_USER_TASK = 2
189191
}
192+
// 用户任务超时处理类型枚举
193+
export enum TimeoutHandlerType {
194+
/**
195+
* 自动提醒
196+
*/
197+
REMINDER = 1,
198+
/**
199+
* 自动同意
200+
*/
201+
APPROVE = 2,
202+
/**
203+
* 自动拒绝
204+
*/
205+
REJECT = 3
206+
}
207+
// 用户任务的审批人与发起人相同时,处理类型枚举
208+
export enum AssignStartUserHandlerType {
209+
/**
210+
* 由发起人对自己审批
211+
*/
212+
START_USER_AUDIT = 1,
213+
/**
214+
* 自动跳过【参考飞书】:1)如果当前节点还有其他审批人,则交由其他审批人进行审批;2)如果当前节点没有其他审批人,则该节点自动通过
215+
*/
216+
SKIP = 2,
217+
/**
218+
* 转交给部门负责人审批
219+
*/
220+
ASSIGN_DEPT_LEADER
221+
}
190222

191223
// 时间单位枚举
192224
export enum TimeUnitType {
@@ -327,7 +359,7 @@ export const TIME_UNIT_TYPES: DictDataVO[] = [
327359
{ label: '天', value: TimeUnitType.DAY }
328360
]
329361
// 超时处理执行动作类型
330-
export const TIMEOUT_HANDLER_ACTION_TYPES: DictDataVO[] = [
362+
export const TIMEOUT_HANDLER_TYPES: DictDataVO[] = [
331363
{ label: '自动提醒', value: 1 },
332364
{ label: '自动同意', value: 2 },
333365
{ label: '自动拒绝', value: 3 }
@@ -337,6 +369,11 @@ export const REJECT_HANDLER_TYPES: DictDataVO[] = [
337369
{ label: '驳回到指定节点', value: RejectHandlerType.RETURN_USER_TASK }
338370
// { label: '结束任务', value: RejectHandlerType.FINISH_TASK }
339371
]
372+
export const ASSIGN_START_USER_HANDLER_TYPES: DictDataVO[] = [
373+
{ label: '由发起人对自己审批', value: 1 },
374+
{ label: '自动跳过', value: 2 },
375+
{ label: '转交给部门负责人审批', value: 3 }
376+
]
340377

341378
// 比较运算符
342379
export const COMPARISON_OPERATORS: DictDataVO = [

src/components/SimpleProcessDesignerV2/src/node.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@ import {
1010
NodeType,
1111
ApproveMethodType,
1212
RejectHandlerType,
13-
NODE_DEFAULT_NAME
13+
NODE_DEFAULT_NAME,
14+
AssignStartUserHandlerType,
15+
ASSIGN_START_USER_HANDLER_TYPES
1416
} from './consts'
1517
export function useWatchNode(props: { flowNode: SimpleFlowNode }): Ref<SimpleFlowNode> {
1618
const node = ref<SimpleFlowNode>(props.flowNode)
@@ -103,7 +105,8 @@ export type UserTaskFormType = {
103105
rejectHandlerType?: RejectHandlerType
104106
returnNodeId?: string
105107
timeoutHandlerEnable?: boolean
106-
timeoutHandlerAction?: number
108+
timeoutHandlerType?: number
109+
assignStartUserHandlerType?: AssignStartUserHandlerType
107110
timeDuration?: number
108111
maxRemindCount?: number
109112
buttonsSetting: any[]
@@ -139,9 +142,10 @@ export function useNodeForm(nodeType: NodeType) {
139142
approveMethod: ApproveMethodType.RRANDOM_SELECT_ONE_APPROVE,
140143
approveRatio: 100,
141144
rejectHandlerType: RejectHandlerType.FINISH_PROCESS,
145+
assignStartUserHandlerType: AssignStartUserHandlerType.START_USER_AUDIT,
142146
returnNodeId: '',
143147
timeoutHandlerEnable: false,
144-
timeoutHandlerAction: 1,
148+
timeoutHandlerType: 1,
145149
timeDuration: 6, // 默认 6小时
146150
maxRemindCount: 1, // 默认 提醒 1次
147151
buttonsSetting: []

src/components/SimpleProcessDesignerV2/src/nodes-config/UserTaskNodeConfig.vue

Lines changed: 38 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -232,15 +232,15 @@
232232
</el-form-item>
233233
<el-form-item
234234
label="执行动作"
235-
prop="timeoutHandlerAction"
235+
prop="timeoutHandlerType"
236236
v-if="configForm.timeoutHandlerEnable"
237237
>
238238
<el-radio-group
239-
v-model="configForm.timeoutHandlerAction"
240-
@change="timeoutActionChanged"
239+
v-model="configForm.timeoutHandlerType"
240+
@change="timeoutHandlerTypeChanged"
241241
>
242242
<el-radio-button
243-
v-for="item in TIMEOUT_HANDLER_ACTION_TYPES"
243+
v-for="item in TIMEOUT_HANDLER_TYPES"
244244
:key="item.value"
245245
:value="item.value"
246246
:label="item.label"
@@ -276,10 +276,21 @@
276276
<el-form-item
277277
label="最大提醒次数"
278278
prop="maxRemindCount"
279-
v-if="configForm.timeoutHandlerEnable && configForm.timeoutHandlerAction === 1"
279+
v-if="configForm.timeoutHandlerEnable && configForm.timeoutHandlerType === 1"
280280
>
281281
<el-input-number v-model="configForm.maxRemindCount" :min="1" :max="10" />
282282
</el-form-item>
283+
284+
<el-divider content-position="left">审批人与提交人为同一人时</el-divider>
285+
<el-form-item prop="assignStartUserHandlerType">
286+
<el-radio-group v-model="configForm.assignStartUserHandlerType">
287+
<div class="flex-col">
288+
<div v-for="(item, index) in ASSIGN_START_USER_HANDLER_TYPES" :key="index">
289+
<el-radio :key="item.value" :value="item.value" :label="item.label" />
290+
</div>
291+
</div>
292+
</el-radio-group>
293+
</el-form-item>
283294
</el-form>
284295
</div>
285296
</el-tab-pane>
@@ -364,14 +375,16 @@ import {
364375
ApproveMethodType,
365376
TimeUnitType,
366377
RejectHandlerType,
367-
TIMEOUT_HANDLER_ACTION_TYPES,
378+
TIMEOUT_HANDLER_TYPES,
368379
TIME_UNIT_TYPES,
369380
REJECT_HANDLER_TYPES,
370381
DEFAULT_BUTTON_SETTING,
371382
OPERATION_BUTTON_NAME,
372383
ButtonSetting,
373384
MULTI_LEVEL_DEPT,
374-
CANDIDATE_STRATEGY
385+
CANDIDATE_STRATEGY,
386+
ASSIGN_START_USER_HANDLER_TYPES,
387+
TimeoutHandlerType
375388
} from '../consts'
376389
377390
import {
@@ -435,7 +448,7 @@ const formRules = reactive({
435448
approveRatio: [{ required: true, message: '通过比例不能为空', trigger: 'blur' }],
436449
returnNodeId: [{ required: true, message: '驳回节点不能为空', trigger: 'change' }],
437450
timeoutHandlerEnable: [{ required: true }],
438-
timeoutHandlerAction: [{ required: true }],
451+
timeoutHandlerType: [{ required: true }],
439452
timeDuration: [{ required: true, message: '超时时间不能为空', trigger: 'blur' }],
440453
maxRemindCount: [{ required: true, message: '提醒次数不能为空', trigger: 'blur' }]
441454
})
@@ -499,8 +512,8 @@ const returnTaskList = ref<SimpleFlowNode[]>([])
499512
// 审批人超时未处理设置
500513
const {
501514
timeoutHandlerChange,
502-
cTimeoutAction,
503-
timeoutActionChanged,
515+
cTimeoutType,
516+
timeoutHandlerTypeChanged,
504517
timeUnit,
505518
timeUnitChange,
506519
isoTimeDuration,
@@ -532,10 +545,12 @@ const saveConfig = async () => {
532545
// 设置超时处理
533546
currentNode.value.timeoutHandler = {
534547
enable: configForm.value.timeoutHandlerEnable!,
535-
action: cTimeoutAction.value,
548+
type: cTimeoutType.value,
536549
timeDuration: isoTimeDuration.value,
537550
maxRemindCount: cTimeoutMaxRemindCount.value
538551
}
552+
// 设置用户任务的审批人与发起人相同时
553+
currentNode.value.assignStartUserHandlerType = configForm.value.assignStartUserHandlerType
539554
// 设置表单权限
540555
currentNode.value.fieldsPermission = fieldsPermissionConfig.value
541556
// 设置按钮权限
@@ -553,7 +568,7 @@ const showUserTaskNodeConfig = (node: SimpleFlowNode) => {
553568
configForm.value.candidateStrategy = node.candidateStrategy!
554569
// 解析候选人参数
555570
parseCandidateParam(node.candidateStrategy!, node?.candidateParam)
556-
if (configForm.value.deptIds && configForm.value.deptIds.length > 1) {
571+
if (configForm.value.userIds && configForm.value.userIds.length > 1) {
557572
notAllowedMultiApprovers.value = true
558573
} else {
559574
notAllowedMultiApprovers.value = false
@@ -578,8 +593,10 @@ const showUserTaskNodeConfig = (node: SimpleFlowNode) => {
578593
configForm.value.timeDuration = parseInt(parseTime)
579594
timeUnit.value = convertTimeUnit(parseTimeUnit)
580595
}
581-
configForm.value.timeoutHandlerAction = node.timeoutHandler?.action
596+
configForm.value.timeoutHandlerType = node.timeoutHandler?.type
582597
configForm.value.maxRemindCount = node.timeoutHandler?.maxRemindCount
598+
// 1.5 设置用户任务的审批人与发起人相同时
599+
configForm.value.assignStartUserHandlerType = node.assignStartUserHandlerType
583600
// 2. 操作按钮设置
584601
buttonsSetting.value = cloneDeep(node.buttonsSetting) || DEFAULT_BUTTON_SETTING
585602
// 3. 表单字段权限配置
@@ -623,21 +640,21 @@ function useTimeoutHandler() {
623640
if (configForm.value.timeoutHandlerEnable) {
624641
timeUnit.value = 2
625642
configForm.value.timeDuration = 6
626-
configForm.value.timeoutHandlerAction = 1
643+
configForm.value.timeoutHandlerType = 1
627644
configForm.value.maxRemindCount = 1
628645
}
629646
}
630647
// 超时执行的动作
631-
const cTimeoutAction = computed(() => {
648+
const cTimeoutType = computed(() => {
632649
if (!configForm.value.timeoutHandlerEnable) {
633650
return undefined
634651
}
635-
return configForm.value.timeoutHandlerAction
652+
return configForm.value.timeoutHandlerType
636653
})
637654
638655
// 超时处理动作改变
639-
const timeoutActionChanged = () => {
640-
if (configForm.value.timeoutHandlerAction === 1) {
656+
const timeoutHandlerTypeChanged = () => {
657+
if (configForm.value.timeoutHandlerType === TimeoutHandlerType.REMINDER) {
641658
configForm.value.maxRemindCount = 1 // 超时提醒次数,默认为1
642659
}
643660
}
@@ -680,16 +697,16 @@ function useTimeoutHandler() {
680697
if (!configForm.value.timeoutHandlerEnable) {
681698
return undefined
682699
}
683-
if (configForm.value.timeoutHandlerAction !== 1) {
700+
if (configForm.value.timeoutHandlerType !== TimeoutHandlerType.REMINDER) {
684701
return undefined
685702
}
686703
return configForm.value.maxRemindCount
687704
})
688705
689706
return {
690707
timeoutHandlerChange,
691-
cTimeoutAction,
692-
timeoutActionChanged,
708+
cTimeoutType,
709+
timeoutHandlerTypeChanged,
693710
timeUnit,
694711
timeUnitChange,
695712
isoTimeDuration,

0 commit comments

Comments
 (0)