refactor: 优化代码

This commit is contained in:
AN 2025-06-03 21:48:38 +08:00
parent 394db6fec2
commit 56d6d77da5

View File

@ -119,9 +119,8 @@ function closeDrawer() {
visible.value = false;
}
async function handleSaveDraft() {
async function handleOperate() {
await validate();
// request
if (props.operateType === 'add') {
const { leaveType, startDate, endDate, leaveDays, remark } = model;
@ -138,10 +137,16 @@ async function handleSaveDraft() {
}
}
async function handleSaveDraft() {
await handleOperate();
window.$message?.success($t('common.updateSuccess'));
closeDrawer();
}
const taskVariables = ref<{ [key: string]: any }>({});
async function handleSubmit() {
await handleSaveDraft();
await handleOperate();
//
startWorkflowModel.businessId = respLeave.value?.id;
startWorkflowModel.flowCode = model.flowCode;
@ -200,7 +205,7 @@ watch(visible, () => {
<template #footer>
<NSpace :size="16">
<NButton @click="closeDrawer">{{ $t('common.cancel') }}</NButton>
<NButton @click="handleSaveDraft">暂存</NButton>
<NButton type="warning" @click="handleSaveDraft">暂存</NButton>
<NButton type="primary" @click="handleSubmit">{{ $t('common.confirm') }}</NButton>
</NSpace>
</template>