From 2dae231afc74952a28cdf79171350b09fd3a91d0 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Sat, 17 Aug 2024 10:18:50 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E3=80=90=E5=8A=9F=E8=83=BD=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E3=80=91=E5=AE=A1=E6=89=B9=E8=8A=82=E7=82=B9=E7=9A=84?= =?UTF-8?q?=E5=AE=A1=E6=89=B9=E4=BA=BA=E4=B8=8E=E5=8F=91=E8=B5=B7=E4=BA=BA?= =?UTF-8?q?=E7=9B=B8=E5=90=8C=E6=97=B6=EF=BC=8C=E5=AF=B9=E5=BA=94=E7=9A=84?= =?UTF-8?q?=E5=A4=84=E7=90=86=E7=B1=BB=E5=9E=8B=E7=9A=84=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../SimpleProcessDesignerV2/src/consts.ts | 22 +++++++++++++++++++ .../SimpleProcessDesignerV2/src/node.ts | 6 ++++- .../src/nodes-config/UserTaskNodeConfig.vue | 18 ++++++++++++++- 3 files changed, 44 insertions(+), 2 deletions(-) diff --git a/src/components/SimpleProcessDesignerV2/src/consts.ts b/src/components/SimpleProcessDesignerV2/src/consts.ts index 449e193e..9265d8b6 100644 --- a/src/components/SimpleProcessDesignerV2/src/consts.ts +++ b/src/components/SimpleProcessDesignerV2/src/consts.ts @@ -77,6 +77,8 @@ export interface SimpleFlowNode { timeoutHandler?: TimeoutHandler // 审批任务拒绝处理 rejectHandler?: RejectHandler + // 审批节点的审批人与发起人相同时,对应的处理类型 + assignStartUserHandlerType?: number } // 候选人策略枚举 ( 用于审批节点。抄送节点 ) export enum CandidateStrategy { @@ -174,6 +176,21 @@ export enum RejectHandlerType { */ RETURN_USER_TASK = 2 } +// 用户任务的审批人与发起人相同时,处理类型枚举 +export enum AssignStartUserHandlerType { + /** + * 由发起人对自己审批 + */ + START_USER_AUDIT = 1, + /** + * 自动跳过【参考飞书】:1)如果当前节点还有其他审批人,则交由其他审批人进行审批;2)如果当前节点没有其他审批人,则该节点自动通过 + */ + SKIP = 2, + /** + * 转交给部门负责人审批 + */ + ASSIGN_DEPT_LEADER +} // 时间单位枚举 export enum TimeUnitType { @@ -309,6 +326,11 @@ export const REJECT_HANDLER_TYPES: DictDataVO[] = [ { label: '驳回到指定节点', value: RejectHandlerType.RETURN_USER_TASK } // { label: '结束任务', value: RejectHandlerType.FINISH_TASK } ] +export const ASSIGN_START_USER_HANDLER_TYPES: DictDataVO[] = [ + { label: '由发起人对自己审批', value: 1 }, + { label: '自动跳过', value: 2 }, + { label: '转交给部门负责人审批', value: 3 } +] // 比较运算符 export const COMPARISON_OPERATORS: DictDataVO = [ diff --git a/src/components/SimpleProcessDesignerV2/src/node.ts b/src/components/SimpleProcessDesignerV2/src/node.ts index e41c9b83..abb3510e 100644 --- a/src/components/SimpleProcessDesignerV2/src/node.ts +++ b/src/components/SimpleProcessDesignerV2/src/node.ts @@ -10,7 +10,9 @@ import { NodeType, ApproveMethodType, RejectHandlerType, - NODE_DEFAULT_NAME + NODE_DEFAULT_NAME, + AssignStartUserHandlerType, + ASSIGN_START_USER_HANDLER_TYPES } from './consts' export function useWatchNode(props: { flowNode: SimpleFlowNode }): Ref { const node = ref(props.flowNode) @@ -97,6 +99,7 @@ export type UserTaskFormType = { returnNodeId?: string timeoutHandlerEnable?: boolean timeoutHandlerAction?: number + assignStartUserHandlerType?: AssignStartUserHandlerType timeDuration?: number maxRemindCount?: number buttonsSetting: any[] @@ -125,6 +128,7 @@ export function useNodeForm(nodeType: NodeType) { approveMethod: ApproveMethodType.RRANDOM_SELECT_ONE_APPROVE, approveRatio: 100, rejectHandlerType: RejectHandlerType.FINISH_PROCESS, + assignStartUserHandlerType: AssignStartUserHandlerType.START_USER_AUDIT, returnNodeId: '', timeoutHandlerEnable: false, timeoutHandlerAction: 1, diff --git a/src/components/SimpleProcessDesignerV2/src/nodes-config/UserTaskNodeConfig.vue b/src/components/SimpleProcessDesignerV2/src/nodes-config/UserTaskNodeConfig.vue index 75af7ba7..77497e7f 100644 --- a/src/components/SimpleProcessDesignerV2/src/nodes-config/UserTaskNodeConfig.vue +++ b/src/components/SimpleProcessDesignerV2/src/nodes-config/UserTaskNodeConfig.vue @@ -275,6 +275,17 @@ > + + 审批人与提交人为同一人时 + + +
+
+ +
+
+
+
@@ -364,7 +375,8 @@ import { REJECT_HANDLER_TYPES, DEFAULT_BUTTON_SETTING, OPERATION_BUTTON_NAME, - ButtonSetting + ButtonSetting, + ASSIGN_START_USER_HANDLER_TYPES } from '../consts' import { DICT_TYPE, getIntDictOptions } from '@/utils/dict' import { @@ -506,6 +518,8 @@ const saveConfig = async () => { timeDuration: isoTimeDuration.value, maxRemindCount: cTimeoutMaxRemindCount.value } + // 设置用户任务的审批人与发起人相同时 + currentNode.value.assignStartUserHandlerType = configForm.value.assignStartUserHandlerType // 设置表单权限 currentNode.value.fieldsPermission = fieldsPermissionConfig.value // 设置按钮权限 @@ -560,6 +574,8 @@ const showUserTaskNodeConfig = (node: SimpleFlowNode) => { } configForm.value.timeoutHandlerAction = node.timeoutHandler?.action configForm.value.maxRemindCount = node.timeoutHandler?.maxRemindCount + // 1.5 设置用户任务的审批人与发起人相同时 + configForm.value.assignStartUserHandlerType = node.assignStartUserHandlerType // 2. 操作按钮设置 buttonsSetting.value = cloneDeep(node.buttonsSetting) || DEFAULT_BUTTON_SETTING // 3. 表单字段权限配置 From 0ce9ececc614a0b5b1fd486f79d72ffa64ddc774 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Sat, 17 Aug 2024 12:09:47 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E3=80=90=E4=BB=A3=E7=A0=81=E9=87=8D?= =?UTF-8?q?=E6=9E=84=E3=80=91=E5=B0=86=E5=AE=A1=E6=89=B9=E8=B6=85=E6=97=B6?= =?UTF-8?q?=E7=9A=84=20action=20=E7=BB=9F=E4=B8=80=E6=8D=A2=E6=88=90=20han?= =?UTF-8?q?dlerType=EF=BC=8C=E4=BF=9D=E6=8C=81=E4=B8=80=E8=87=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../SimpleProcessDesignerV2/src/consts.ts | 19 ++++++++- .../SimpleProcessDesignerV2/src/node.ts | 4 +- .../src/nodes-config/UserTaskNodeConfig.vue | 41 ++++++++++--------- 3 files changed, 40 insertions(+), 24 deletions(-) diff --git a/src/components/SimpleProcessDesignerV2/src/consts.ts b/src/components/SimpleProcessDesignerV2/src/consts.ts index 9265d8b6..17ea37d2 100644 --- a/src/components/SimpleProcessDesignerV2/src/consts.ts +++ b/src/components/SimpleProcessDesignerV2/src/consts.ts @@ -159,7 +159,7 @@ export type TimeoutHandler = { //是否开启超时处理 enable: boolean // 超时执行的动作 - action?: number + type?: number // 超时时间设置 timeDuration?: string // 执行动作是自动提醒, 最大提醒次数 @@ -176,6 +176,21 @@ export enum RejectHandlerType { */ RETURN_USER_TASK = 2 } +// 用户任务超时处理类型枚举 +export enum TimeoutHandlerType { + /** + * 自动提醒 + */ + REMINDER = 1, + /** + * 自动同意 + */ + APPROVE = 2, + /** + * 自动拒绝 + */ + REJECT = 3 +} // 用户任务的审批人与发起人相同时,处理类型枚举 export enum AssignStartUserHandlerType { /** @@ -316,7 +331,7 @@ export const TIME_UNIT_TYPES: DictDataVO[] = [ { label: '天', value: TimeUnitType.DAY } ] // 超时处理执行动作类型 -export const TIMEOUT_HANDLER_ACTION_TYPES: DictDataVO[] = [ +export const TIMEOUT_HANDLER_TYPES: DictDataVO[] = [ { label: '自动提醒', value: 1 }, { label: '自动同意', value: 2 }, { label: '自动拒绝', value: 3 } diff --git a/src/components/SimpleProcessDesignerV2/src/node.ts b/src/components/SimpleProcessDesignerV2/src/node.ts index abb3510e..b4b3b37d 100644 --- a/src/components/SimpleProcessDesignerV2/src/node.ts +++ b/src/components/SimpleProcessDesignerV2/src/node.ts @@ -98,7 +98,7 @@ export type UserTaskFormType = { rejectHandlerType?: RejectHandlerType returnNodeId?: string timeoutHandlerEnable?: boolean - timeoutHandlerAction?: number + timeoutHandlerType?: number assignStartUserHandlerType?: AssignStartUserHandlerType timeDuration?: number maxRemindCount?: number @@ -131,7 +131,7 @@ export function useNodeForm(nodeType: NodeType) { assignStartUserHandlerType: AssignStartUserHandlerType.START_USER_AUDIT, returnNodeId: '', timeoutHandlerEnable: false, - timeoutHandlerAction: 1, + timeoutHandlerType: 1, timeDuration: 6, // 默认 6小时 maxRemindCount: 1, // 默认 提醒 1次 buttonsSetting: [] diff --git a/src/components/SimpleProcessDesignerV2/src/nodes-config/UserTaskNodeConfig.vue b/src/components/SimpleProcessDesignerV2/src/nodes-config/UserTaskNodeConfig.vue index 77497e7f..b565fd37 100644 --- a/src/components/SimpleProcessDesignerV2/src/nodes-config/UserTaskNodeConfig.vue +++ b/src/components/SimpleProcessDesignerV2/src/nodes-config/UserTaskNodeConfig.vue @@ -227,15 +227,15 @@ @@ -370,13 +370,14 @@ import { ApproveMethodType, TimeUnitType, RejectHandlerType, - TIMEOUT_HANDLER_ACTION_TYPES, + TIMEOUT_HANDLER_TYPES, TIME_UNIT_TYPES, REJECT_HANDLER_TYPES, DEFAULT_BUTTON_SETTING, OPERATION_BUTTON_NAME, ButtonSetting, - ASSIGN_START_USER_HANDLER_TYPES + ASSIGN_START_USER_HANDLER_TYPES, + TimeoutHandlerType } from '../consts' import { DICT_TYPE, getIntDictOptions } from '@/utils/dict' import { @@ -426,7 +427,7 @@ const formRules = reactive({ approveRatio: [{ required: true, message: '通过比例不能为空', trigger: 'blur' }], returnNodeId: [{ required: true, message: '驳回节点不能为空', trigger: 'change' }], timeoutHandlerEnable: [{ required: true }], - timeoutHandlerAction: [{ required: true }], + timeoutHandlerType: [{ required: true }], timeDuration: [{ required: true, message: '超时时间不能为空', trigger: 'blur' }], maxRemindCount: [{ required: true, message: '提醒次数不能为空', trigger: 'blur' }] }) @@ -482,8 +483,8 @@ const returnTaskList = ref([]) // 审批人超时未处理设置 const { timeoutHandlerChange, - cTimeoutAction, - timeoutActionChanged, + cTimeoutType, + timeoutHandlerTypeChanged, timeUnit, timeUnitChange, isoTimeDuration, @@ -514,7 +515,7 @@ const saveConfig = async () => { // 设置超时处理 currentNode.value.timeoutHandler = { enable: configForm.value.timeoutHandlerEnable!, - action: cTimeoutAction.value, + type: cTimeoutType.value, timeDuration: isoTimeDuration.value, maxRemindCount: cTimeoutMaxRemindCount.value } @@ -572,7 +573,7 @@ const showUserTaskNodeConfig = (node: SimpleFlowNode) => { configForm.value.timeDuration = parseInt(parseTime) timeUnit.value = convertTimeUnit(parseTimeUnit) } - configForm.value.timeoutHandlerAction = node.timeoutHandler?.action + configForm.value.timeoutHandlerType = node.timeoutHandler?.type configForm.value.maxRemindCount = node.timeoutHandler?.maxRemindCount // 1.5 设置用户任务的审批人与发起人相同时 configForm.value.assignStartUserHandlerType = node.assignStartUserHandlerType @@ -619,21 +620,21 @@ function useTimeoutHandler() { if (configForm.value.timeoutHandlerEnable) { timeUnit.value = 2 configForm.value.timeDuration = 6 - configForm.value.timeoutHandlerAction = 1 + configForm.value.timeoutHandlerType = 1 configForm.value.maxRemindCount = 1 } } // 超时执行的动作 - const cTimeoutAction = computed(() => { + const cTimeoutType = computed(() => { if (!configForm.value.timeoutHandlerEnable) { return undefined } - return configForm.value.timeoutHandlerAction + return configForm.value.timeoutHandlerType }) // 超时处理动作改变 - const timeoutActionChanged = () => { - if (configForm.value.timeoutHandlerAction === 1) { + const timeoutHandlerTypeChanged = () => { + if (configForm.value.timeoutHandlerType === TimeoutHandlerType.REMINDER) { configForm.value.maxRemindCount = 1 // 超时提醒次数,默认为1 } } @@ -676,7 +677,7 @@ function useTimeoutHandler() { if (!configForm.value.timeoutHandlerEnable) { return undefined } - if (configForm.value.timeoutHandlerAction !== 1) { + if (configForm.value.timeoutHandlerType !== TimeoutHandlerType.REMINDER) { return undefined } return configForm.value.maxRemindCount @@ -684,8 +685,8 @@ function useTimeoutHandler() { return { timeoutHandlerChange, - cTimeoutAction, - timeoutActionChanged, + cTimeoutType, + timeoutHandlerTypeChanged, timeUnit, timeUnitChange, isoTimeDuration,