liu
3 天以前 0127fd119fe2a349fbfee92b375a5680e10d3275
src/views/erp/sale/order/index.vue
@@ -16,8 +16,9 @@
  deleteSaleOrder,
  enableSaleOrder,
  exportSaleOrder,
  getSaleOrderApproveProcessList,
  getSaleOrderPage,
  updateSaleOrderStatus,
  submitSaleOrder,
} from '#/api/erp/sale/order';
import { generateFromSaleOrder } from '#/api/mes/wm/salesnotice';
import { $t } from '#/locales';
@@ -79,21 +80,34 @@
  }
}
/** 审批/反审批操作 */
async function handleUpdateStatus(
  row: ErpSaleOrderApi.SaleOrder,
  status: number,
) {
/** 提交销售订单审批(协同办公) */
async function handleSubmit(row: ErpSaleOrderApi.SaleOrder) {
  // 获取可用的审批流程定义
  const processList = await getSaleOrderApproveProcessList();
  if (isEmpty(processList)) {
    message.error('销售订单审批流程未配置,请先在「协同办公→流程管理」中创建并发布销售订单审批流程');
    return;
  }
  const hideLoading = message.loading({
    content: `确定${status === 20 ? '审批' : '反审批'}该订单吗?`,
    content: '正在提交审批...',
    duration: 0,
  });
  try {
    await updateSaleOrderStatus(row.id!, status);
    message.success(`${status === 20 ? '审批' : '反审批'}成功`);
    await submitSaleOrder(row.id!, processList[0].key);
    message.success('提交审批成功,请到协同办公中处理');
    handleRefresh();
  } finally {
    hideLoading();
  }
}
/** 查看审批进度(跳转协同办公流程详情,只读模式,不显示审批操作) */
function handleViewApproval(row: ErpSaleOrderApi.SaleOrder) {
  if (row.processInstanceId) {
    router.push({
      name: 'BpmProcessInstanceDetail',
      query: { id: row.processInstanceId, viewOnly: '1' },
    });
  }
}
@@ -278,8 +292,10 @@
        <span v-else>-</span>
      </template>
      <template #status="{ row }">
        <Tag v-if="row.status === 10" color="warning">未审核</Tag>
        <Tag v-if="row.status === 0" color="default">未提交</Tag>
        <Tag v-if="row.status === 15" color="processing">审批中</Tag>
        <Tag v-if="row.status === 20" color="success">已审核</Tag>
        <Tag v-if="row.status === 35" color="warning">已驳回</Tag>
        <Tag v-if="row.status === 30" color="error">已作废</Tag>
      </template>
      <template #needProduction="{ row }">
@@ -323,30 +339,27 @@
              type: 'link',
              icon: ACTION_ICON.EDIT,
              auth: ['erp:sale-order:update'],
              ifShow: () => row.status === 10,
              ifShow: () => row.status === 0 || row.status === 35,
              onClick: handleEdit.bind(null, row),
            },
            {
              label: '审批',
              label: '提交审批',
              type: 'link',
              icon: ACTION_ICON.AUDIT,
              auth: ['erp:sale-order:update-status'],
              ifShow: () => row.status === 10,
              ifShow: () => row.status === 0 || row.status === 35,
              popConfirm: {
                title: `确认审批${row.no}吗?`,
                confirm: handleUpdateStatus.bind(null, row, 20),
                title: `确认提交${row.no}的审批吗?提交后审批将在协同办公中完成`,
                confirm: handleSubmit.bind(null, row),
              },
            },
            {
              label: '反审批',
              label: '审批进度',
              type: 'link',
              icon: ACTION_ICON.AUDIT,
              auth: ['erp:sale-order:update-status'],
              ifShow: () => row.status === 20,
              popConfirm: {
                title: `确认反审批${row.no}吗?`,
                confirm: handleUpdateStatus.bind(null, row, 10),
              },
              icon: 'lucide:file-clock',
              auth: ['erp:sale-order:query'],
              ifShow: () => row.status === 15 && !!row.processInstanceId,
              onClick: handleViewApproval.bind(null, row),
            },
            {
              label: '作废',
@@ -384,7 +397,7 @@
              danger: true,
              icon: ACTION_ICON.DELETE,
              auth: ['erp:sale-order:delete'],
              ifShow: () => row.status === 10,
              ifShow: () => row.status === 0 || row.status === 35,
              popConfirm: {
                title: $t('ui.actionMessage.deleteConfirm', [row.no]),
                confirm: handleDelete.bind(null, [row.id!]),