src/views/bpm/task/done/index.vue
@@ -7,6 +7,7 @@
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';
@@ -34,6 +35,28 @@
  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();
@@ -77,10 +100,22 @@
        <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),