【代码重构】将审批超时的 action 统一换成 handlerType,保持一致
parent
2dae231afc
commit
0ce9ececc6
|
@ -159,7 +159,7 @@ export type TimeoutHandler = {
|
||||||
//是否开启超时处理
|
//是否开启超时处理
|
||||||
enable: boolean
|
enable: boolean
|
||||||
// 超时执行的动作
|
// 超时执行的动作
|
||||||
action?: number
|
type?: number
|
||||||
// 超时时间设置
|
// 超时时间设置
|
||||||
timeDuration?: string
|
timeDuration?: string
|
||||||
// 执行动作是自动提醒, 最大提醒次数
|
// 执行动作是自动提醒, 最大提醒次数
|
||||||
|
@ -176,6 +176,21 @@ export enum RejectHandlerType {
|
||||||
*/
|
*/
|
||||||
RETURN_USER_TASK = 2
|
RETURN_USER_TASK = 2
|
||||||
}
|
}
|
||||||
|
// 用户任务超时处理类型枚举
|
||||||
|
export enum TimeoutHandlerType {
|
||||||
|
/**
|
||||||
|
* 自动提醒
|
||||||
|
*/
|
||||||
|
REMINDER = 1,
|
||||||
|
/**
|
||||||
|
* 自动同意
|
||||||
|
*/
|
||||||
|
APPROVE = 2,
|
||||||
|
/**
|
||||||
|
* 自动拒绝
|
||||||
|
*/
|
||||||
|
REJECT = 3
|
||||||
|
}
|
||||||
// 用户任务的审批人与发起人相同时,处理类型枚举
|
// 用户任务的审批人与发起人相同时,处理类型枚举
|
||||||
export enum AssignStartUserHandlerType {
|
export enum AssignStartUserHandlerType {
|
||||||
/**
|
/**
|
||||||
|
@ -316,7 +331,7 @@ export const TIME_UNIT_TYPES: DictDataVO[] = [
|
||||||
{ label: '天', value: TimeUnitType.DAY }
|
{ label: '天', value: TimeUnitType.DAY }
|
||||||
]
|
]
|
||||||
// 超时处理执行动作类型
|
// 超时处理执行动作类型
|
||||||
export const TIMEOUT_HANDLER_ACTION_TYPES: DictDataVO[] = [
|
export const TIMEOUT_HANDLER_TYPES: DictDataVO[] = [
|
||||||
{ label: '自动提醒', value: 1 },
|
{ label: '自动提醒', value: 1 },
|
||||||
{ label: '自动同意', value: 2 },
|
{ label: '自动同意', value: 2 },
|
||||||
{ label: '自动拒绝', value: 3 }
|
{ label: '自动拒绝', value: 3 }
|
||||||
|
|
|
@ -98,7 +98,7 @@ export type UserTaskFormType = {
|
||||||
rejectHandlerType?: RejectHandlerType
|
rejectHandlerType?: RejectHandlerType
|
||||||
returnNodeId?: string
|
returnNodeId?: string
|
||||||
timeoutHandlerEnable?: boolean
|
timeoutHandlerEnable?: boolean
|
||||||
timeoutHandlerAction?: number
|
timeoutHandlerType?: number
|
||||||
assignStartUserHandlerType?: AssignStartUserHandlerType
|
assignStartUserHandlerType?: AssignStartUserHandlerType
|
||||||
timeDuration?: number
|
timeDuration?: number
|
||||||
maxRemindCount?: number
|
maxRemindCount?: number
|
||||||
|
@ -131,7 +131,7 @@ export function useNodeForm(nodeType: NodeType) {
|
||||||
assignStartUserHandlerType: AssignStartUserHandlerType.START_USER_AUDIT,
|
assignStartUserHandlerType: AssignStartUserHandlerType.START_USER_AUDIT,
|
||||||
returnNodeId: '',
|
returnNodeId: '',
|
||||||
timeoutHandlerEnable: false,
|
timeoutHandlerEnable: false,
|
||||||
timeoutHandlerAction: 1,
|
timeoutHandlerType: 1,
|
||||||
timeDuration: 6, // 默认 6小时
|
timeDuration: 6, // 默认 6小时
|
||||||
maxRemindCount: 1, // 默认 提醒 1次
|
maxRemindCount: 1, // 默认 提醒 1次
|
||||||
buttonsSetting: []
|
buttonsSetting: []
|
||||||
|
|
|
@ -227,15 +227,15 @@
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item
|
<el-form-item
|
||||||
label="执行动作"
|
label="执行动作"
|
||||||
prop="timeoutHandlerAction"
|
prop="timeoutHandlerType"
|
||||||
v-if="configForm.timeoutHandlerEnable"
|
v-if="configForm.timeoutHandlerEnable"
|
||||||
>
|
>
|
||||||
<el-radio-group
|
<el-radio-group
|
||||||
v-model="configForm.timeoutHandlerAction"
|
v-model="configForm.timeoutHandlerType"
|
||||||
@change="timeoutActionChanged"
|
@change="timeoutHandlerTypeChanged"
|
||||||
>
|
>
|
||||||
<el-radio-button
|
<el-radio-button
|
||||||
v-for="item in TIMEOUT_HANDLER_ACTION_TYPES"
|
v-for="item in TIMEOUT_HANDLER_TYPES"
|
||||||
:key="item.value"
|
:key="item.value"
|
||||||
:value="item.value"
|
:value="item.value"
|
||||||
:label="item.label"
|
:label="item.label"
|
||||||
|
@ -271,7 +271,7 @@
|
||||||
<el-form-item
|
<el-form-item
|
||||||
label="最大提醒次数"
|
label="最大提醒次数"
|
||||||
prop="maxRemindCount"
|
prop="maxRemindCount"
|
||||||
v-if="configForm.timeoutHandlerEnable && configForm.timeoutHandlerAction === 1"
|
v-if="configForm.timeoutHandlerEnable && configForm.timeoutHandlerType === 1"
|
||||||
>
|
>
|
||||||
<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>
|
||||||
|
@ -370,13 +370,14 @@ import {
|
||||||
ApproveMethodType,
|
ApproveMethodType,
|
||||||
TimeUnitType,
|
TimeUnitType,
|
||||||
RejectHandlerType,
|
RejectHandlerType,
|
||||||
TIMEOUT_HANDLER_ACTION_TYPES,
|
TIMEOUT_HANDLER_TYPES,
|
||||||
TIME_UNIT_TYPES,
|
TIME_UNIT_TYPES,
|
||||||
REJECT_HANDLER_TYPES,
|
REJECT_HANDLER_TYPES,
|
||||||
DEFAULT_BUTTON_SETTING,
|
DEFAULT_BUTTON_SETTING,
|
||||||
OPERATION_BUTTON_NAME,
|
OPERATION_BUTTON_NAME,
|
||||||
ButtonSetting,
|
ButtonSetting,
|
||||||
ASSIGN_START_USER_HANDLER_TYPES
|
ASSIGN_START_USER_HANDLER_TYPES,
|
||||||
|
TimeoutHandlerType
|
||||||
} from '../consts'
|
} from '../consts'
|
||||||
import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
|
import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
|
||||||
import {
|
import {
|
||||||
|
@ -426,7 +427,7 @@ const formRules = reactive({
|
||||||
approveRatio: [{ required: true, message: '通过比例不能为空', trigger: 'blur' }],
|
approveRatio: [{ required: true, message: '通过比例不能为空', trigger: 'blur' }],
|
||||||
returnNodeId: [{ required: true, message: '驳回节点不能为空', trigger: 'change' }],
|
returnNodeId: [{ required: true, message: '驳回节点不能为空', trigger: 'change' }],
|
||||||
timeoutHandlerEnable: [{ required: true }],
|
timeoutHandlerEnable: [{ required: true }],
|
||||||
timeoutHandlerAction: [{ 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' }]
|
||||||
})
|
})
|
||||||
|
@ -482,8 +483,8 @@ const returnTaskList = ref<SimpleFlowNode[]>([])
|
||||||
// 审批人超时未处理设置
|
// 审批人超时未处理设置
|
||||||
const {
|
const {
|
||||||
timeoutHandlerChange,
|
timeoutHandlerChange,
|
||||||
cTimeoutAction,
|
cTimeoutType,
|
||||||
timeoutActionChanged,
|
timeoutHandlerTypeChanged,
|
||||||
timeUnit,
|
timeUnit,
|
||||||
timeUnitChange,
|
timeUnitChange,
|
||||||
isoTimeDuration,
|
isoTimeDuration,
|
||||||
|
@ -514,7 +515,7 @@ const saveConfig = async () => {
|
||||||
// 设置超时处理
|
// 设置超时处理
|
||||||
currentNode.value.timeoutHandler = {
|
currentNode.value.timeoutHandler = {
|
||||||
enable: configForm.value.timeoutHandlerEnable!,
|
enable: configForm.value.timeoutHandlerEnable!,
|
||||||
action: cTimeoutAction.value,
|
type: cTimeoutType.value,
|
||||||
timeDuration: isoTimeDuration.value,
|
timeDuration: isoTimeDuration.value,
|
||||||
maxRemindCount: cTimeoutMaxRemindCount.value
|
maxRemindCount: cTimeoutMaxRemindCount.value
|
||||||
}
|
}
|
||||||
|
@ -572,7 +573,7 @@ const showUserTaskNodeConfig = (node: SimpleFlowNode) => {
|
||||||
configForm.value.timeDuration = parseInt(parseTime)
|
configForm.value.timeDuration = parseInt(parseTime)
|
||||||
timeUnit.value = convertTimeUnit(parseTimeUnit)
|
timeUnit.value = convertTimeUnit(parseTimeUnit)
|
||||||
}
|
}
|
||||||
configForm.value.timeoutHandlerAction = node.timeoutHandler?.action
|
configForm.value.timeoutHandlerType = node.timeoutHandler?.type
|
||||||
configForm.value.maxRemindCount = node.timeoutHandler?.maxRemindCount
|
configForm.value.maxRemindCount = node.timeoutHandler?.maxRemindCount
|
||||||
// 1.5 设置用户任务的审批人与发起人相同时
|
// 1.5 设置用户任务的审批人与发起人相同时
|
||||||
configForm.value.assignStartUserHandlerType = node.assignStartUserHandlerType
|
configForm.value.assignStartUserHandlerType = node.assignStartUserHandlerType
|
||||||
|
@ -619,21 +620,21 @@ function useTimeoutHandler() {
|
||||||
if (configForm.value.timeoutHandlerEnable) {
|
if (configForm.value.timeoutHandlerEnable) {
|
||||||
timeUnit.value = 2
|
timeUnit.value = 2
|
||||||
configForm.value.timeDuration = 6
|
configForm.value.timeDuration = 6
|
||||||
configForm.value.timeoutHandlerAction = 1
|
configForm.value.timeoutHandlerType = 1
|
||||||
configForm.value.maxRemindCount = 1
|
configForm.value.maxRemindCount = 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 超时执行的动作
|
// 超时执行的动作
|
||||||
const cTimeoutAction = computed(() => {
|
const cTimeoutType = computed(() => {
|
||||||
if (!configForm.value.timeoutHandlerEnable) {
|
if (!configForm.value.timeoutHandlerEnable) {
|
||||||
return undefined
|
return undefined
|
||||||
}
|
}
|
||||||
return configForm.value.timeoutHandlerAction
|
return configForm.value.timeoutHandlerType
|
||||||
})
|
})
|
||||||
|
|
||||||
// 超时处理动作改变
|
// 超时处理动作改变
|
||||||
const timeoutActionChanged = () => {
|
const timeoutHandlerTypeChanged = () => {
|
||||||
if (configForm.value.timeoutHandlerAction === 1) {
|
if (configForm.value.timeoutHandlerType === TimeoutHandlerType.REMINDER) {
|
||||||
configForm.value.maxRemindCount = 1 // 超时提醒次数,默认为1
|
configForm.value.maxRemindCount = 1 // 超时提醒次数,默认为1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -676,7 +677,7 @@ function useTimeoutHandler() {
|
||||||
if (!configForm.value.timeoutHandlerEnable) {
|
if (!configForm.value.timeoutHandlerEnable) {
|
||||||
return undefined
|
return undefined
|
||||||
}
|
}
|
||||||
if (configForm.value.timeoutHandlerAction !== 1) {
|
if (configForm.value.timeoutHandlerType !== TimeoutHandlerType.REMINDER) {
|
||||||
return undefined
|
return undefined
|
||||||
}
|
}
|
||||||
return configForm.value.maxRemindCount
|
return configForm.value.maxRemindCount
|
||||||
|
@ -684,8 +685,8 @@ function useTimeoutHandler() {
|
||||||
|
|
||||||
return {
|
return {
|
||||||
timeoutHandlerChange,
|
timeoutHandlerChange,
|
||||||
cTimeoutAction,
|
cTimeoutType,
|
||||||
timeoutActionChanged,
|
timeoutHandlerTypeChanged,
|
||||||
timeUnit,
|
timeUnit,
|
||||||
timeUnitChange,
|
timeUnitChange,
|
||||||
isoTimeDuration,
|
isoTimeDuration,
|
||||||
|
|
Loading…
Reference in New Issue