Merge remote-tracking branch 'origin/dev_pro2.0' into dev_pro2.0
| | |
| | | return requestClient.get<any[]>('/erp/purchase-order/approve-process-list'); |
| | | } |
| | | |
| | | /** 反审批(协同办公已办任务中撤回已审核订单,回退为未审核) */ |
| | | export function reverseApprove(processInstanceId: string) { |
| | | return requestClient.post('/erp/purchase-order/reverse-approve', null, { |
| | | params: { processInstanceId }, |
| | | }); |
| | | } |
| | | |
| | | /** 获取采购审核流程列表响应 */ |
| | | export interface ProcessDefinition { |
| | | id: string; // 流程定义ID |
| | |
| | | }, |
| | | { |
| | | title: '操作', |
| | | width: 120, |
| | | width: 180, |
| | | fixed: 'right', |
| | | slots: { default: 'actions' }, |
| | | }, |
| | |
| | | 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(); |
| | |
| | | <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), |
| | |
| | | deletePurchaseOrder, |
| | | exportPurchaseOrder, |
| | | getPurchaseOrderPage, |
| | | updatePurchaseOrderStatus, |
| | | } from '#/api/erp/purchase/order'; |
| | | import { $t } from '#/locales'; |
| | | |
| | |
| | | try { |
| | | await deletePurchaseOrder(ids); |
| | | message.success($t('ui.actionMessage.deleteSuccess')); |
| | | handleRefresh(); |
| | | } finally { |
| | | hideLoading(); |
| | | } |
| | | } |
| | | |
| | | /** 审批/反审批操作 */ |
| | | async function handleUpdateStatus( |
| | | row: ErpPurchaseOrderApi.PurchaseOrder, |
| | | status: number, |
| | | ) { |
| | | const hideLoading = message.loading({ |
| | | content: `确定${status === 20 ? '审批' : '反审批'}该订单吗?`, |
| | | duration: 0, |
| | | }); |
| | | try { |
| | | await updatePurchaseOrderStatus(row.id!, status); |
| | | message.success(`${status === 20 ? '审批' : '反审批'}成功`); |
| | | handleRefresh(); |
| | | } finally { |
| | | hideLoading(); |
| | |
| | | </script> |
| | | |
| | | <template> |
| | | <Page auto-content-height><FormModal @success="handleRefresh" /> |
| | | <Page auto-content-height> |
| | | <FormModal @success="handleRefresh" /> |
| | | <Grid table-title="采购订单列表"> |
| | | <template #toolbar-tools> |
| | | <TableAction |
| | |
| | | auth: ['erp:purchase-order:update'], |
| | | ifShow: () => row.status !== 20, |
| | | onClick: handleEdit.bind(null, row), |
| | | }, |
| | | { |
| | | label: row.status === 10 ? '审批' : '反审批', |
| | | type: 'link', |
| | | icon: ACTION_ICON.AUDIT, |
| | | auth: ['erp:purchase-order:update-status'], |
| | | popConfirm: { |
| | | title: `确认${row.status === 10 ? '审批' : '反审批'}${row.no}吗?`, |
| | | confirm: handleUpdateStatus.bind( |
| | | null, |
| | | row, |
| | | row.status === 10 ? 20 : 10, |
| | | ), |
| | | }, |
| | | }, |
| | | { |
| | | label: '确认收货', |