fix: 修复第二次提交流程时,表单校验错误依然会触发审批流的bug

This commit is contained in:
gaoyunqi
2024-08-23 14:08:52 +08:00
parent 9001db04ff
commit 20c6ada48a

View File

@ -80,6 +80,7 @@
import ProcessInformation from '/@/views/workflow/task/components/flow/ProcessInformation.vue'; import ProcessInformation from '/@/views/workflow/task/components/flow/ProcessInformation.vue';
import { useI18n } from '/@/hooks/web/useI18n'; import { useI18n } from '/@/hooks/web/useI18n';
import { useMessage } from '/@/hooks/web/useMessage'; import { useMessage } from '/@/hooks/web/useMessage';
const { t } = useI18n(); const { t } = useI18n();
const { notification } = useMessage(); const { notification } = useMessage();
@ -106,7 +107,7 @@
const hasBtnApprove = ref(true); const hasBtnApprove = ref(true);
const hasBtnReject = ref(false); const hasBtnReject = ref(false);
const hasBtnFinish = ref(false); const hasBtnFinish = ref(false);
const drawNode = ref('') const drawNode = ref('');
let approvalData = reactive({ let approvalData = reactive({
isCountersign: false, isCountersign: false,
@ -140,7 +141,7 @@
}); });
} else if (key === 'transfer') { } else if (key === 'transfer') {
onTransferClick(); onTransferClick();
} else if(key === 'drawBack') { } else if (key === 'drawBack') {
Modal.confirm({ Modal.confirm({
title: t('提示'), title: t('提示'),
icon: createVNode(ExclamationCircleOutlined), icon: createVNode(ExclamationCircleOutlined),
@ -149,23 +150,23 @@
okType: 'danger', okType: 'danger',
cancelText: t('取消'), cancelText: t('取消'),
onOk() { onOk() {
withdraw(processId.value, drawNode.value).then(res => { withdraw(processId.value, drawNode.value).then((res) => {
if (res) { if (res) {
notification.open({ notification.open({
type: 'success', type: 'success',
message: t('撤回'), message: t('撤回'),
description: t('撤回成功'), description: t('撤回成功')
}); });
} else { } else {
notification.open({ notification.open({
type: 'error', type: 'error',
message: t('撤回'), message: t('撤回'),
description: t('撤回失败'), description: t('撤回失败')
}); });
} }
}) });
}, },
onCancel() {}, onCancel() {}
}); });
} }
} }
@ -184,6 +185,9 @@
async function onApproveClick() { async function onApproveClick() {
await submit(); await submit();
if (!validateSuccess.value) {
return;
}
const params = await getApproveParams(); const params = await getApproveParams();
const nextNodes = await postGetNextTaskMaybeArrival(params); const nextNodes = await postGetNextTaskMaybeArrival(params);
approvalData.approvedType = ApproveType.AGREE; approvalData.approvedType = ApproveType.AGREE;
@ -333,18 +337,18 @@
approvalData.circulateConfigs = []; approvalData.circulateConfigs = [];
} }
renderKey.value = Math.random() + ''; renderKey.value = Math.random() + '';
getBackNode() getBackNode();
} catch (error) {} } catch (error) {}
}); });
function getBackNode() { function getBackNode() {
getDrawNode(processId.value).then(res => { getDrawNode(processId.value).then((res) => {
if (res.length) { if (res.length) {
drawNode.value = res[0].activityId drawNode.value = res[0].activityId;
} else { } else {
drawNode.value = '' drawNode.value = '';
} }
}) });
} }
async function submit() { async function submit() {