| | |
| | | import type { VxeTableGridOptions } from '#/adapter/vxe-table'; |
| | | import type { HrmLeaveApi } from '#/api/hrm/leave'; |
| | | |
| | | import { ref } from 'vue'; |
| | | |
| | | import { Page, useVbenModal } from '#/packages/effects/common-ui/src'; |
| | | |
| | | import { message, Tag } from 'ant-design-vue'; |
| | | import { message, Modal, Select, Tag } from 'ant-design-vue'; |
| | | |
| | | import { DICT_TYPE } from '#/packages/constants/src'; |
| | | import { getDictLabel } from '#/packages/effects/hooks/src'; |
| | |
| | | import { |
| | | cancelLeave, |
| | | deleteLeave, |
| | | getLeaveApproveProcessDefinitionList, |
| | | getLeavePage, |
| | | submitLeave, |
| | | } from '#/api/hrm/leave'; |
| | |
| | | } |
| | | } |
| | | |
| | | /** 提交请假申请 */ |
| | | const submitModalVisible = ref(false); |
| | | const currentRow = ref<HrmLeaveApi.Leave>(); |
| | | const processList = ref<HrmLeaveApi.ApproveProcess[]>([]); |
| | | const selectedProcessKey = ref<string>(); |
| | | const submitLoading = ref(false); |
| | | |
| | | /** 提交请假申请(先选择审批流程) */ |
| | | async function handleSubmit(row: HrmLeaveApi.Leave) { |
| | | await submitLeave(row.id!); |
| | | message.success('提交成功'); |
| | | handleRefresh(); |
| | | processList.value = await getLeaveApproveProcessDefinitionList(); |
| | | currentRow.value = row; |
| | | selectedProcessKey.value = undefined; |
| | | submitModalVisible.value = true; |
| | | } |
| | | |
| | | async function confirmSubmit() { |
| | | if (!selectedProcessKey.value) { |
| | | message.warning('请选择请假审批流程'); |
| | | return; |
| | | } |
| | | submitLoading.value = true; |
| | | try { |
| | | await submitLeave(currentRow.value!.id!, selectedProcessKey.value); |
| | | message.success('提交成功'); |
| | | submitModalVisible.value = false; |
| | | handleRefresh(); |
| | | } finally { |
| | | submitLoading.value = false; |
| | | } |
| | | } |
| | | |
| | | /** 撤销请假申请 */ |
| | |
| | | /> |
| | | </template> |
| | | </Grid> |
| | | <Modal |
| | | v-model:open="submitModalVisible" |
| | | title="提交至协同办公" |
| | | width="420px" |
| | | :confirm-loading="submitLoading" |
| | | @ok="confirmSubmit" |
| | | > |
| | | <Select |
| | | v-model:value="selectedProcessKey" |
| | | class="w-full" |
| | | placeholder="请选择请假审批流程" |
| | | :options="processList.map((item) => ({ label: item.name, value: item.key }))" |
| | | /> |
| | | </Modal> |
| | | </Page> |
| | | </template> |