【功能新增】工作流:支持审批人为空时,根据配置进行自动通过、自动拒绝、指定人审批的配置
parent
6b31a32a2d
commit
8b3c294e5c
|
@ -43,13 +43,16 @@
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import {
|
import {
|
||||||
SimpleFlowNode,
|
|
||||||
NodeType,
|
|
||||||
NODE_DEFAULT_NAME,
|
|
||||||
ApproveMethodType,
|
ApproveMethodType,
|
||||||
RejectHandlerType
|
AssignEmptyHandlerType,
|
||||||
|
AssignStartUserHandlerType,
|
||||||
|
NODE_DEFAULT_NAME,
|
||||||
|
NodeType,
|
||||||
|
RejectHandlerType,
|
||||||
|
SimpleFlowNode
|
||||||
} from './consts'
|
} from './consts'
|
||||||
import { generateUUID } from '@/utils'
|
import { generateUUID } from '@/utils'
|
||||||
|
|
||||||
defineOptions({
|
defineOptions({
|
||||||
name: 'NodeHandler'
|
name: 'NodeHandler'
|
||||||
})
|
})
|
||||||
|
@ -86,6 +89,10 @@ const addNode = (type: number) => {
|
||||||
timeoutHandler: {
|
timeoutHandler: {
|
||||||
enable: false
|
enable: false
|
||||||
},
|
},
|
||||||
|
assignEmptyHandler: {
|
||||||
|
type: AssignEmptyHandlerType.APPROVE
|
||||||
|
},
|
||||||
|
assignStartUserHandlerType: AssignStartUserHandlerType.START_USER_AUDIT,
|
||||||
childNode: props.childNode
|
childNode: props.childNode
|
||||||
}
|
}
|
||||||
emits('update:childNode', data)
|
emits('update:childNode', data)
|
||||||
|
|
|
@ -78,6 +78,8 @@ export interface SimpleFlowNode {
|
||||||
timeoutHandler?: TimeoutHandler
|
timeoutHandler?: TimeoutHandler
|
||||||
// 审批任务拒绝处理
|
// 审批任务拒绝处理
|
||||||
rejectHandler?: RejectHandler
|
rejectHandler?: RejectHandler
|
||||||
|
// 审批人为空的处理
|
||||||
|
assignEmptyHandler?: AssignEmptyHandler
|
||||||
// 审批节点的审批人与发起人相同时,对应的处理类型
|
// 审批节点的审批人与发起人相同时,对应的处理类型
|
||||||
assignStartUserHandlerType?: number
|
assignStartUserHandlerType?: number
|
||||||
}
|
}
|
||||||
|
@ -169,7 +171,7 @@ export type RejectHandler = {
|
||||||
* 审批超时结构定义
|
* 审批超时结构定义
|
||||||
*/
|
*/
|
||||||
export type TimeoutHandler = {
|
export type TimeoutHandler = {
|
||||||
//是否开启超时处理
|
// 是否开启超时处理
|
||||||
enable: boolean
|
enable: boolean
|
||||||
// 超时执行的动作
|
// 超时执行的动作
|
||||||
type?: number
|
type?: number
|
||||||
|
@ -178,6 +180,17 @@ export type TimeoutHandler = {
|
||||||
// 执行动作是自动提醒, 最大提醒次数
|
// 执行动作是自动提醒, 最大提醒次数
|
||||||
maxRemindCount?: number
|
maxRemindCount?: number
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 审批人为空的结构定义
|
||||||
|
*/
|
||||||
|
export type AssignEmptyHandler = {
|
||||||
|
// 审批人为空的处理类型
|
||||||
|
type: AssignEmptyHandlerType
|
||||||
|
// 指定用户的编号数组
|
||||||
|
userIds?: number[]
|
||||||
|
}
|
||||||
|
|
||||||
// 审批拒绝类型枚举
|
// 审批拒绝类型枚举
|
||||||
export enum RejectHandlerType {
|
export enum RejectHandlerType {
|
||||||
/**
|
/**
|
||||||
|
@ -204,6 +217,25 @@ export enum TimeoutHandlerType {
|
||||||
*/
|
*/
|
||||||
REJECT = 3
|
REJECT = 3
|
||||||
}
|
}
|
||||||
|
// 用户任务的审批人为空时,处理类型枚举
|
||||||
|
export enum AssignEmptyHandlerType {
|
||||||
|
/**
|
||||||
|
* 自动通过
|
||||||
|
*/
|
||||||
|
APPROVE = 1,
|
||||||
|
/**
|
||||||
|
* 自动拒绝
|
||||||
|
*/
|
||||||
|
REJECT = 2,
|
||||||
|
/**
|
||||||
|
* 指定人员审批
|
||||||
|
*/
|
||||||
|
ASSIGN_USER,
|
||||||
|
/**
|
||||||
|
* 转交给流程管理员
|
||||||
|
*/
|
||||||
|
ASSIGN_ADMIN = 4
|
||||||
|
}
|
||||||
// 用户任务的审批人与发起人相同时,处理类型枚举
|
// 用户任务的审批人与发起人相同时,处理类型枚举
|
||||||
export enum AssignStartUserHandlerType {
|
export enum AssignStartUserHandlerType {
|
||||||
/**
|
/**
|
||||||
|
@ -369,6 +401,12 @@ export const REJECT_HANDLER_TYPES: DictDataVO[] = [
|
||||||
{ label: '驳回到指定节点', value: RejectHandlerType.RETURN_USER_TASK }
|
{ label: '驳回到指定节点', value: RejectHandlerType.RETURN_USER_TASK }
|
||||||
// { label: '结束任务', value: RejectHandlerType.FINISH_TASK }
|
// { label: '结束任务', value: RejectHandlerType.FINISH_TASK }
|
||||||
]
|
]
|
||||||
|
export const ASSIGN_EMPTY_HANDLER_TYPES: DictDataVO[] = [
|
||||||
|
{ label: '自动通过', value: 1 },
|
||||||
|
{ label: '自动拒绝', value: 2 },
|
||||||
|
{ label: '指定成员审批', value: 3 },
|
||||||
|
{ label: '转交给流程管理员', value: 4 }
|
||||||
|
]
|
||||||
export const ASSIGN_START_USER_HANDLER_TYPES: DictDataVO[] = [
|
export const ASSIGN_START_USER_HANDLER_TYPES: DictDataVO[] = [
|
||||||
{ label: '由发起人对自己审批', value: 1 },
|
{ label: '由发起人对自己审批', value: 1 },
|
||||||
{ label: '自动跳过', value: 2 },
|
{ label: '自动跳过', value: 2 },
|
||||||
|
|
|
@ -12,7 +12,7 @@ import {
|
||||||
RejectHandlerType,
|
RejectHandlerType,
|
||||||
NODE_DEFAULT_NAME,
|
NODE_DEFAULT_NAME,
|
||||||
AssignStartUserHandlerType,
|
AssignStartUserHandlerType,
|
||||||
ASSIGN_START_USER_HANDLER_TYPES
|
AssignEmptyHandlerType
|
||||||
} from './consts'
|
} from './consts'
|
||||||
export function useWatchNode(props: { flowNode: SimpleFlowNode }): Ref<SimpleFlowNode> {
|
export function useWatchNode(props: { flowNode: SimpleFlowNode }): Ref<SimpleFlowNode> {
|
||||||
const node = ref<SimpleFlowNode>(props.flowNode)
|
const node = ref<SimpleFlowNode>(props.flowNode)
|
||||||
|
@ -57,7 +57,7 @@ export function useFormFieldsPermission() {
|
||||||
fieldsPermission: Array<Record<string, string>>,
|
fieldsPermission: Array<Record<string, string>>,
|
||||||
parentTitle: string = ''
|
parentTitle: string = ''
|
||||||
) => {
|
) => {
|
||||||
const { type, field, title: tempTitle, children } = rule
|
const { /**type,*/ field, title: tempTitle, children } = rule
|
||||||
if (field && tempTitle) {
|
if (field && tempTitle) {
|
||||||
let title = tempTitle
|
let title = tempTitle
|
||||||
if (parentTitle) {
|
if (parentTitle) {
|
||||||
|
@ -106,6 +106,8 @@ export type UserTaskFormType = {
|
||||||
returnNodeId?: string
|
returnNodeId?: string
|
||||||
timeoutHandlerEnable?: boolean
|
timeoutHandlerEnable?: boolean
|
||||||
timeoutHandlerType?: number
|
timeoutHandlerType?: number
|
||||||
|
assignEmptyHandlerType?: AssignEmptyHandlerType
|
||||||
|
assignEmptyHandlerUserIds?: number[]
|
||||||
assignStartUserHandlerType?: AssignStartUserHandlerType
|
assignStartUserHandlerType?: AssignStartUserHandlerType
|
||||||
timeDuration?: number
|
timeDuration?: number
|
||||||
maxRemindCount?: number
|
maxRemindCount?: number
|
||||||
|
|
|
@ -196,6 +196,7 @@
|
||||||
</div>
|
</div>
|
||||||
</el-radio-group>
|
</el-radio-group>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-divider content-position="left">审批人拒绝时</el-divider>
|
<el-divider content-position="left">审批人拒绝时</el-divider>
|
||||||
<el-form-item prop="rejectHandlerType">
|
<el-form-item prop="rejectHandlerType">
|
||||||
<el-radio-group v-model="configForm.rejectHandlerType">
|
<el-radio-group v-model="configForm.rejectHandlerType">
|
||||||
|
@ -206,7 +207,6 @@
|
||||||
</div>
|
</div>
|
||||||
</el-radio-group>
|
</el-radio-group>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item
|
<el-form-item
|
||||||
v-if="configForm.rejectHandlerType == RejectHandlerType.RETURN_USER_TASK"
|
v-if="configForm.rejectHandlerType == RejectHandlerType.RETURN_USER_TASK"
|
||||||
label="驳回节点"
|
label="驳回节点"
|
||||||
|
@ -221,6 +221,7 @@
|
||||||
/>
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-divider content-position="left">审批人超时未处理时</el-divider>
|
<el-divider content-position="left">审批人超时未处理时</el-divider>
|
||||||
<el-form-item label="启用开关" prop="timeoutHandlerEnable">
|
<el-form-item label="启用开关" prop="timeoutHandlerEnable">
|
||||||
<el-switch
|
<el-switch
|
||||||
|
@ -281,6 +282,37 @@
|
||||||
<el-input-number v-model="configForm.maxRemindCount" :min="1" :max="10" />
|
<el-input-number v-model="configForm.maxRemindCount" :min="1" :max="10" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-divider content-position="left">审批人为空时</el-divider>
|
||||||
|
<el-form-item prop="assignEmptyHandlerType">
|
||||||
|
<el-radio-group v-model="configForm.assignEmptyHandlerType">
|
||||||
|
<div class="flex-col">
|
||||||
|
<div v-for="(item, index) in ASSIGN_EMPTY_HANDLER_TYPES" :key="index">
|
||||||
|
<el-radio :key="item.value" :value="item.value" :label="item.label" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</el-radio-group>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item
|
||||||
|
v-if="configForm.assignEmptyHandlerType == AssignEmptyHandlerType.ASSIGN_USER"
|
||||||
|
label="指定用户"
|
||||||
|
prop="assignEmptyHandlerUserIds"
|
||||||
|
span="24"
|
||||||
|
>
|
||||||
|
<el-select
|
||||||
|
v-model="configForm.assignEmptyHandlerUserIds"
|
||||||
|
clearable
|
||||||
|
multiple
|
||||||
|
style="width: 100%"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="item in userOptions"
|
||||||
|
:key="item.id"
|
||||||
|
:label="item.nickname"
|
||||||
|
:value="item.id"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
<el-divider content-position="left">审批人与提交人为同一人时</el-divider>
|
<el-divider content-position="left">审批人与提交人为同一人时</el-divider>
|
||||||
<el-form-item prop="assignStartUserHandlerType">
|
<el-form-item prop="assignStartUserHandlerType">
|
||||||
<el-radio-group v-model="configForm.assignStartUserHandlerType">
|
<el-radio-group v-model="configForm.assignStartUserHandlerType">
|
||||||
|
@ -384,7 +416,9 @@ import {
|
||||||
MULTI_LEVEL_DEPT,
|
MULTI_LEVEL_DEPT,
|
||||||
CANDIDATE_STRATEGY,
|
CANDIDATE_STRATEGY,
|
||||||
ASSIGN_START_USER_HANDLER_TYPES,
|
ASSIGN_START_USER_HANDLER_TYPES,
|
||||||
TimeoutHandlerType
|
TimeoutHandlerType,
|
||||||
|
ASSIGN_EMPTY_HANDLER_TYPES,
|
||||||
|
AssignEmptyHandlerType
|
||||||
} from '../consts'
|
} from '../consts'
|
||||||
|
|
||||||
import {
|
import {
|
||||||
|
@ -450,7 +484,10 @@ const formRules = reactive({
|
||||||
timeoutHandlerEnable: [{ required: true }],
|
timeoutHandlerEnable: [{ required: true }],
|
||||||
timeoutHandlerType: [{ required: true }],
|
timeoutHandlerType: [{ required: true }],
|
||||||
timeDuration: [{ required: true, message: '超时时间不能为空', trigger: 'blur' }],
|
timeDuration: [{ required: true, message: '超时时间不能为空', trigger: 'blur' }],
|
||||||
maxRemindCount: [{ required: true, message: '提醒次数不能为空', trigger: 'blur' }]
|
maxRemindCount: [{ required: true, message: '提醒次数不能为空', trigger: 'blur' }],
|
||||||
|
assignEmptyHandlerType: [{ required: true }],
|
||||||
|
assignEmptyHandlerUserIds: [{ required: true, message: '用户不能为空', trigger: 'change' }],
|
||||||
|
assignStartUserHandlerType: [{ required: true }]
|
||||||
})
|
})
|
||||||
|
|
||||||
const {
|
const {
|
||||||
|
@ -549,7 +586,15 @@ const saveConfig = async () => {
|
||||||
timeDuration: isoTimeDuration.value,
|
timeDuration: isoTimeDuration.value,
|
||||||
maxRemindCount: cTimeoutMaxRemindCount.value
|
maxRemindCount: cTimeoutMaxRemindCount.value
|
||||||
}
|
}
|
||||||
// 设置用户任务的审批人与发起人相同时
|
// 设置审批人为空时
|
||||||
|
currentNode.value.assignEmptyHandler = {
|
||||||
|
type: configForm.value.assignEmptyHandlerType!,
|
||||||
|
userIds:
|
||||||
|
configForm.value.assignEmptyHandlerType === AssignEmptyHandlerType.ASSIGN_USER
|
||||||
|
? configForm.value.assignEmptyHandlerUserIds
|
||||||
|
: undefined
|
||||||
|
}
|
||||||
|
// 设置审批人与发起人相同时
|
||||||
currentNode.value.assignStartUserHandlerType = configForm.value.assignStartUserHandlerType
|
currentNode.value.assignStartUserHandlerType = configForm.value.assignStartUserHandlerType
|
||||||
// 设置表单权限
|
// 设置表单权限
|
||||||
currentNode.value.fieldsPermission = fieldsPermissionConfig.value
|
currentNode.value.fieldsPermission = fieldsPermissionConfig.value
|
||||||
|
@ -573,7 +618,7 @@ const showUserTaskNodeConfig = (node: SimpleFlowNode) => {
|
||||||
} else {
|
} else {
|
||||||
notAllowedMultiApprovers.value = false
|
notAllowedMultiApprovers.value = false
|
||||||
}
|
}
|
||||||
//1.2 设置审批方式
|
// 1.2 设置审批方式
|
||||||
configForm.value.approveMethod = node.approveMethod!
|
configForm.value.approveMethod = node.approveMethod!
|
||||||
if (node.approveMethod == ApproveMethodType.APPROVE_BY_RATIO) {
|
if (node.approveMethod == ApproveMethodType.APPROVE_BY_RATIO) {
|
||||||
configForm.value.approveRatio = node.approveRatio!
|
configForm.value.approveRatio = node.approveRatio!
|
||||||
|
@ -595,7 +640,10 @@ const showUserTaskNodeConfig = (node: SimpleFlowNode) => {
|
||||||
}
|
}
|
||||||
configForm.value.timeoutHandlerType = node.timeoutHandler?.type
|
configForm.value.timeoutHandlerType = node.timeoutHandler?.type
|
||||||
configForm.value.maxRemindCount = node.timeoutHandler?.maxRemindCount
|
configForm.value.maxRemindCount = node.timeoutHandler?.maxRemindCount
|
||||||
// 1.5 设置用户任务的审批人与发起人相同时
|
// 1.5 设置审批人为空时
|
||||||
|
configForm.value.assignEmptyHandlerType = node.assignEmptyHandler?.type
|
||||||
|
configForm.value.assignEmptyHandlerUserIds = node.assignEmptyHandler?.userIds
|
||||||
|
// 1.6 设置用户任务的审批人与发起人相同时
|
||||||
configForm.value.assignStartUserHandlerType = node.assignStartUserHandlerType
|
configForm.value.assignStartUserHandlerType = node.assignStartUserHandlerType
|
||||||
// 2. 操作按钮设置
|
// 2. 操作按钮设置
|
||||||
buttonsSetting.value = cloneDeep(node.buttonsSetting) || DEFAULT_BUTTON_SETTING
|
buttonsSetting.value = cloneDeep(node.buttonsSetting) || DEFAULT_BUTTON_SETTING
|
||||||
|
|
Loading…
Reference in New Issue