| | |
| | | import type { VxeTableGridOptions } from '#/adapter/vxe-table'; |
| | | import type { BpmTaskApi } from '#/api/bpm/task'; |
| | | |
| | | import { DocAlert, Page } from '../../../../packages/effects/common-ui/src'; |
| | | import { Page } from '@vben/common-ui'; |
| | | |
| | | import { message } from 'ant-design-vue'; |
| | | |
| | | import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table'; |
| | | import { reverseApprove } from '#/api/erp/purchase/order'; |
| | | import { getTaskDonePage, withdrawTask } from '#/api/bpm/task'; |
| | | import { router } from '#/router'; |
| | | |
| | |
| | | try { |
| | | await withdrawTask(row.id); |
| | | message.success('撤回成功'); |
| | | await gridApi.query(); |
| | | } finally { |
| | | hideLoading(); |
| | | } |
| | | } |
| | | |
| | | /** 是否采购订单审批任务(用于显示"反审批"、隐藏通用"撤回") */ |
| | | function isPurchaseOrderApprove(row: BpmTaskApi.Task) { |
| | | return (row.processInstance?.processDefinitionId || '').startsWith( |
| | | 'purchase_order_approve', |
| | | ); |
| | | } |
| | | |
| | | /** 反审批采购订单(已审核 -> 未审核,在协同办公已办任务中操作) */ |
| | | async function handleReverseApprove(row: BpmTaskApi.Task) { |
| | | const hideLoading = message.loading({ |
| | | content: '反审批中...', |
| | | duration: 0, |
| | | }); |
| | | try { |
| | | await reverseApprove(row.processInstance.id); |
| | | message.success('反审批成功,订单已重新进入待办审批'); |
| | | await gridApi.query(); |
| | | } finally { |
| | | hideLoading(); |
| | |
| | | </script> |
| | | |
| | | <template> |
| | | <Page auto-content-height> |
| | | <template #doc> |
| | | <DocAlert |
| | | title="审批通过、不通过、驳回" |
| | | url="https://doc.iocoder.cn/bpm/task-todo-done/" |
| | | /> |
| | | <DocAlert title="审批加签、减签" url="https://doc.iocoder.cn/bpm/sign/" /> |
| | | <DocAlert |
| | | title="审批转办、委派、抄送" |
| | | url="https://doc.iocoder.cn/bpm/task-delegation-and-cc/" |
| | | /> |
| | | <DocAlert title="审批加签、减签" url="https://doc.iocoder.cn/bpm/sign/" /> |
| | | </template> |
| | | |
| | | <Grid table-title="已办任务"> |
| | | <Page auto-content-height><Grid table-title="已办任务"> |
| | | <template #actions="{ row }"> |
| | | <TableAction |
| | | :actions="[ |
| | | { |
| | | label: '反审批', |
| | | type: 'link', |
| | | danger: true, |
| | | icon: ACTION_ICON.AUDIT, |
| | | ifShow: () => isPurchaseOrderApprove(row), |
| | | popConfirm: { |
| | | title: '确定要反审批该采购订单吗?订单将重新进入待办审批', |
| | | confirm: handleReverseApprove.bind(null, row), |
| | | }, |
| | | }, |
| | | { |
| | | label: '撤回', |
| | | type: 'link', |
| | | danger: true, |
| | | icon: ACTION_ICON.DELETE, |
| | | ifShow: () => !isPurchaseOrderApprove(row), |
| | | popConfirm: { |
| | | title: '确定要撤回该任务吗?', |
| | | confirm: handleWithdraw.bind(null, row), |