From b4b0eba2284d24a82732f01eab6bedb370cc4342 Mon Sep 17 00:00:00 2001 From: gssong <1742057357@qq.com> Date: 星期六, 06 四月 2024 21:06:59 +0800 Subject: [PATCH] update 调整流程定义配置逻辑 --- src/views/workflow/leave/leaveEdit.vue | 82 ++++++++++++++++++++++------------------ 1 files changed, 45 insertions(+), 37 deletions(-) diff --git a/src/views/workflow/leave/leaveEdit.vue b/src/views/workflow/leave/leaveEdit.vue index 83d5cd6..a57614a 100644 --- a/src/views/workflow/leave/leaveEdit.vue +++ b/src/views/workflow/leave/leaveEdit.vue @@ -85,7 +85,7 @@ import SubmitVerify from '@/components/Process/submitVerify.vue'; import ApprovalRecord from '@/components/Process/approvalRecord.vue'; import { AxiosResponse } from 'axios'; - +import { StartProcessBo } from '@/api/workflow/workflowCommon/types'; const { proxy } = getCurrentInstance() as ComponentInternalInstance; const buttonLoading = ref(false); @@ -120,9 +120,9 @@ const leaveFormRef = ref<ElFormInstance>(); -const submitFormData = ref<Record<string, any>>({ +const submitFormData = ref<StartProcessBo>({ businessKey: '', - processKey: '', + tableName: '', variables: {} }); const taskVariables = ref<Record<string, any>>({}); @@ -191,46 +191,54 @@ proxy?.$modal.msgError('璇峰亣鏃堕棿涓嶈兘涓虹┖'); return; } - leaveFormRef.value?.validate(async (valid: boolean) => { - form.value.startDate = leaveTime.value[0]; - form.value.endDate = leaveTime.value[1]; - if (valid) { - buttonLoading.value = true; - let res: AxiosResponse<LeaveVO>; - if (form.value.id) { - res = await updateLeave(form.value); - } else { - res = await addLeave(form.value); + try { + leaveFormRef.value?.validate(async (valid: boolean) => { + form.value.startDate = leaveTime.value[0]; + form.value.endDate = leaveTime.value[1]; + if (valid) { + buttonLoading.value = true; + let res: AxiosResponse<LeaveVO>; + if (form.value.id) { + res = await updateLeave(form.value); + } else { + res = await addLeave(form.value); + } + form.value = res.data; + if (status === 'draft') { + buttonLoading.value = false; + proxy?.$modal.msgSuccess('鏆傚瓨鎴愬姛'); + proxy.$tab.closePage(proxy.$route); + proxy.$router.go(-1); + } else { + await handleStartWorkFlow(res.data); + } } - form.value = res.data; - if (status === 'draft') { - buttonLoading.value = false; - proxy?.$modal.msgSuccess('鏆傚瓨鎴愬姛'); - proxy.$tab.closePage(proxy.$route); - proxy.$router.go(-1); - } else { - await handleStartWorkFlow(res.data); - } - } - }); + }); + } finally { + buttonLoading.value = false; + } }; //鎻愪氦鐢宠 const handleStartWorkFlow = async (data: LeaveVO) => { - submitFormData.value.processKey = 'leave1'; - submitFormData.value.businessKey = data.id; - //娴佺▼鍙橀噺 - taskVariables.value = { - entity: data, - leaveDays: data.leaveDays, - userList: [1, 2], - userList2: [1, 2] - }; - submitFormData.value.variables = taskVariables.value; - const resp = await startWorkFlow(submitFormData.value); - if (submitVerifyRef.value) { + try { + submitFormData.value.tableName = 'test_leave'; + submitFormData.value.businessKey = data.id; + //娴佺▼鍙橀噺 + taskVariables.value = { + entity: data, + leaveDays: data.leaveDays, + userList: [1, 2], + userList2: [1, 2] + }; + submitFormData.value.variables = taskVariables.value; + const resp = await startWorkFlow(submitFormData.value); + if (submitVerifyRef.value) { + buttonLoading.value = false; + submitVerifyRef.value.openDialog(resp.data.taskId); + } + } finally { buttonLoading.value = false; - submitVerifyRef.value.openDialog(resp.data.taskId); } }; //瀹℃壒璁板綍 -- Gitblit v1.9.3