2026-08-10 f630e7e4d50ba22da8f42336196a02dbae850ced
refactor(erp): 优化采购发票和财务付款审核流程

- 将采购发票的"审批状态"字段改为"审核状态",简化状态选项
- 采购发票表格操作列最小宽度从200调整为280
- 文件上传组件在禁用状态下隐藏移除图标和拖拽区域
- 回款管理中的提交审核功能改为更新状态功能,支持审核/反审核
- 财务付款单新增工作流编号字段,重构审批流程实现
- 移除未使用的router import并优化相关代码结构
- 更新API函数命名,统一使用updateStatus模式替代submit模式
已修改9个文件
244 ■■■■■ 文件已修改
src/api/crm/receivable/index.ts 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/erp/finance/payment/index.ts 14 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/erp/purchase/invoice/index.ts 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/upload/file-upload.vue 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/crm/backlog/modules/receivable-audit-list.vue 31 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/crm/receivable/index.vue 38 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/erp/finance/payment/index.vue 69 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/erp/purchase/invoice/data.ts 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/erp/purchase/invoice/index.vue 55 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/crm/receivable/index.ts
@@ -98,9 +98,11 @@
  return requestClient.download('/crm/receivable/export-excel', { params });
}
/** 提交审核 */
export function submitReceivable(id: number) {
  return requestClient.put(`/crm/receivable/submit?id=${id}`);
/** 更新回款的状态(审核/反审核) */
export function updateReceivableStatus(id: number, status: number) {
  return requestClient.put('/crm/receivable/update-status', null, {
    params: { id, status },
  });
}
/** 获得待审核回款数量 */
src/api/erp/finance/payment/index.ts
@@ -18,6 +18,7 @@
    discountPrice: number; // 优惠金额
    paymentPrice: number; // 实际付款金额
    status: number; // 状态
    processInstanceId?: string; // 工作流编号
    remark: string; // 备注
    attachmentList?: { id: number; name?: string; url?: string }[]; // 附件列表
    accountId?: number; // 付款账户
@@ -75,13 +76,18 @@
  return requestClient.put('/erp/finance-payment/update', data);
}
/** 更新付款单的状态 */
export function updateFinancePaymentStatus(id: number, status: number) {
  return requestClient.put('/erp/finance-payment/update-status', null, {
    params: { id, status },
/** 提交付款单审批 */
export function submitFinancePayment(id: number, processDefinitionKey: string) {
  return requestClient.post('/erp/finance-payment/submit', null, {
    params: { id, processDefinitionKey },
  });
}
/** 获取付款单审批流程列表 */
export function getFinancePaymentApproveProcessList() {
  return requestClient.get('/erp/finance-payment/approve-process-list');
}
/** 删除付款单 */
export function deleteFinancePayment(ids: number[]) {
  return requestClient.delete('/erp/finance-payment/delete', {
src/api/erp/purchase/invoice/index.ts
@@ -89,9 +89,11 @@
  return requestClient.download('/erp/purchase-invoice/export-excel', { params });
}
/** 提交来票审核 */
export function submitPurchaseInvoice(id: number) {
  return requestClient.put(`/erp/purchase-invoice/submit?id=${id}`);
/** 更新来票的状态(审核/反审核) */
export function updatePurchaseInvoiceStatus(id: number, status: number) {
  return requestClient.put('/erp/purchase-invoice/update-status', null, {
    params: { id, status },
  });
}
/** 获得待审核来票数量 */
src/components/upload/file-upload.vue
@@ -292,14 +292,14 @@
      :progress="{ showInfo: true }"
      :show-upload-list="{
        showPreviewIcon: true,
        showRemoveIcon: true,
        showRemoveIcon: !disabled,
        showDownloadIcon,
      }"
      @remove="handleRemove"
      @preview="handlePreview"
      @reject="handleExceed"
    >
      <div v-if="drag" class="upload-drag-area">
      <div v-if="drag && !disabled" class="upload-drag-area">
        <p class="ant-upload-drag-icon">
          <IconifyIcon icon="lucide:cloud-upload" />
        </p>
@@ -308,7 +308,9 @@
          支持{{ accept.join('/') }}格式文件,不超过{{ maxSize }}MB
        </p>
      </div>
      <div v-else-if="fileList && fileList.length < maxNumber">
      <div
        v-else-if="!disabled && fileList && fileList.length < maxNumber"
      >
        <Button>
          <IconifyIcon icon="lucide:cloud-upload" />
          {{ $t('ui.upload.upload') }}
src/views/crm/backlog/modules/receivable-audit-list.vue
@@ -5,22 +5,29 @@
import { useRouter } from 'vue-router';
import { Button } from 'ant-design-vue';
import { Button, message } from 'ant-design-vue';
import { useVbenVxeGrid } from '#/adapter/vxe-table';
import { getReceivablePage } from '#/api/crm/receivable';
import { getReceivablePage, updateReceivableStatus } from '#/api/crm/receivable';
import { useGridColumns } from '#/views/crm/receivable/data';
import { AUDIT_STATUS } from '../data';
const { push } = useRouter();
/** 查看审批 */
function handleProcessDetail(row: CrmReceivableApi.Receivable) {
  push({
    name: 'BpmProcessInstanceDetail',
    query: { id: row.processInstanceId },
/** 审核 */
async function handleAudit(row: CrmReceivableApi.Receivable) {
  const hideLoading = message.loading({
    content: '审核中...',
    duration: 0,
  });
  try {
    await updateReceivableStatus(row.id!, 20);
    message.success('审核成功');
    gridApi.query();
  } finally {
    hideLoading();
  }
}
/** 打开回款详情 */
@@ -38,7 +45,7 @@
  push({ name: 'CrmContractDetail', params: { id: row.contractId } });
}
const [Grid] = useVbenVxeGrid({
const [Grid, gridApi] = useVbenVxeGrid({
  formOptions: {
    schema: [
      {
@@ -98,7 +105,13 @@
      </Button>
    </template>
    <template #actions="{ row }">
      <Button type="link" @click="handleProcessDetail(row)">查看审批</Button>
      <Button
        v-if="row.auditStatus === 10"
        type="link"
        @click="handleAudit(row)"
      >
        审核
      </Button>
    </template>
  </Grid>
</template>
src/views/crm/receivable/index.vue
@@ -15,7 +15,7 @@
  deleteReceivable,
  exportReceivable,
  getReceivablePage,
  submitReceivable,
  updateReceivableStatus,
} from '#/api/crm/receivable';
import { $t } from '#/locales';
@@ -76,15 +76,18 @@
  }
}
/** 提交审核 */
async function handleSubmit(row: CrmReceivableApi.Receivable) {
/** 更新回款状态(审核/反审核) */
async function handleUpdateStatus(
  row: CrmReceivableApi.Receivable,
  status: number,
) {
  const hideLoading = message.loading({
    content: '提交审核中...',
    content: '更新状态中...',
    duration: 0,
  });
  try {
    await submitReceivable(row.id!);
    message.success('提交审核成功');
    await updateReceivableStatus(row.id!, status);
    message.success('更新状态成功');
    handleRefresh();
  } finally {
    hideLoading();
@@ -109,14 +112,6 @@
/** 查看开票详情 */
function handleInvoiceDetail(row: CrmReceivableApi.Receivable) {
  push({ name: 'CrmInvoiceDetail', params: { id: row.invoiceId } });
}
/** 查看审批详情 */
function handleProcessDetail(row: CrmReceivableApi.Receivable) {
  push({
    name: 'BpmProcessInstanceDetail',
    query: { id: row.processInstanceId },
  });
}
const [Grid, gridApi] = useVbenVxeGrid({
@@ -221,21 +216,24 @@
              type: 'link',
              icon: ACTION_ICON.EDIT,
              auth: ['crm:receivable:update'],
              ifShow: row.auditStatus === 10,
              onClick: handleEdit.bind(null, row),
            },
            {
              label: '提交审核',
              label: '审核',
              type: 'link',
              icon: ACTION_ICON.AUDIT,
              auth: ['crm:receivable:update'],
              onClick: handleSubmit.bind(null, row),
              ifShow: row.auditStatus === 0,
              ifShow: row.auditStatus === 10,
              onClick: handleUpdateStatus.bind(null, row, 20),
            },
            {
              label: '查看审批',
              label: '反审核',
              type: 'link',
              icon: ACTION_ICON.VIEW,
              auth: ['crm:receivable:update'],
              onClick: handleProcessDetail.bind(null, row),
              ifShow: row.auditStatus !== 0,
              ifShow: row.auditStatus === 20,
              onClick: handleUpdateStatus.bind(null, row, 10),
            },
            {
              label: $t('common.delete'),
src/views/erp/finance/payment/index.vue
@@ -3,6 +3,7 @@
import type { ErpFinancePaymentApi } from '#/api/erp/finance/payment';
import { ref } from 'vue';
import { useRouter } from 'vue-router';
import { Page, useVbenModal } from '@vben/common-ui';
import { downloadFileFromBlobPart, isEmpty } from '@vben/utils';
@@ -13,19 +14,27 @@
import {
  deleteFinancePayment,
  exportFinancePayment,
  getFinancePaymentApproveProcessList,
  getFinancePaymentPage,
  updateFinancePaymentStatus,
} from '#/api/erp/finance/payment';
import { $t } from '#/locales';
import { useGridColumns, useGridFormSchema } from './data';
import Form from './modules/form.vue';
import ProcessSelectModal from './modules/process-select-modal.vue';
/** ERP 付款单列表 */
defineOptions({ name: 'ErpFinancePayment' });
const router = useRouter();
const [FormModal, formModalApi] = useVbenModal({
  connectedComponent: Form,
  destroyOnClose: true,
});
const [ProcessModal, processModalApi] = useVbenModal({
  connectedComponent: ProcessSelectModal,
  destroyOnClose: true,
});
@@ -65,22 +74,36 @@
  }
}
/** 审批/反审批操作 */
async function handleUpdateStatus(
  row: ErpFinancePaymentApi.FinancePayment,
  status: number,
) {
/** 提交审批 - 先获取流程列表 */
async function handleSubmit(row: ErpFinancePaymentApi.FinancePayment) {
  const hideLoading = message.loading({
    content: `确定${status === 20 ? '审批' : '反审批'}该付款单吗?`,
    content: '获取审批流程...',
    duration: 0,
  });
  try {
    await updateFinancePaymentStatus(row.id!, status);
    message.success(`${status === 20 ? '审批' : '反审批'}成功`);
    handleRefresh();
  } finally {
    const processList = await getFinancePaymentApproveProcessList();
    hideLoading();
    if (!processList || processList.length === 0) {
      message.warning('暂无可用审批流程,请先配置 BPM 流程');
      return;
    }
    // 打开流程选择弹窗
    processModalApi.setData({ id: row.id, processList }).open();
  } catch {
    hideLoading();
  }
}
/** 查看审批详情 */
function handleProcessDetail(row: ErpFinancePaymentApi.FinancePayment) {
  if (!row.processInstanceId) {
    message.warning('该付款单尚未提交审批');
    return;
  }
  router.push({
    name: 'BpmProcessInstanceDetail',
    query: { id: row.processInstanceId },
  });
}
const checkedIds = ref<number[]>([]);
@@ -134,6 +157,7 @@
<template>
  <Page auto-content-height><FormModal @success="handleRefresh" />
    <ProcessModal @success="handleRefresh" />
    <Grid table-title="付款单列表">
      <template #toolbar-tools>
        <TableAction
@@ -189,22 +213,24 @@
              type: 'link',
              icon: ACTION_ICON.EDIT,
              auth: ['erp:finance-payment:update'],
              ifShow: () => row.status !== 20,
              ifShow: () => row.status !== 20 && row.status !== 15,
              onClick: handleEdit.bind(null, row),
            },
            {
              label: row.status === 10 ? '审批' : '反审批',
              label: '提交审核',
              type: 'link',
              icon: ACTION_ICON.AUDIT,
              auth: ['erp:finance-payment:update-status'],
              popConfirm: {
                title: `确认${row.status === 10 ? '审批' : '反审批'}${row.no}吗?`,
                confirm: handleUpdateStatus.bind(
                  null,
                  row,
                  row.status === 10 ? 20 : 10,
                ),
              auth: ['erp:finance-payment:update'],
              ifShow: () => row.status === 10,
              onClick: handleSubmit.bind(null, row),
              },
            {
              label: '查看审批',
              type: 'link',
              icon: ACTION_ICON.VIEW,
              auth: ['erp:finance-payment:query'],
              ifShow: () => row.status !== 10 && !!row.processInstanceId,
              onClick: handleProcessDetail.bind(null, row),
            },
            {
              label: $t('common.delete'),
@@ -212,6 +238,7 @@
              danger: true,
              icon: ACTION_ICON.DELETE,
              auth: ['erp:finance-payment:delete'],
              ifShow: () => row.status !== 15,
              popConfirm: {
                title: $t('ui.actionMessage.deleteConfirm', [row.no]),
                confirm: handleDelete.bind(null, [row.id!]),
src/views/erp/purchase/invoice/data.ts
@@ -150,17 +150,14 @@
    },
    {
      fieldName: 'auditStatus',
      label: '审批状态',
      label: '审核状态',
      component: 'Select',
      componentProps: {
        options: [
          { label: '未提交', value: 0 },
          { label: '审批中', value: 10 },
          { label: '审核通过', value: 20 },
          { label: '审核不通过', value: 30 },
          { label: '已作废', value: 40 },
          { label: '未审核', value: 10 },
          { label: '已审核', value: 20 },
        ],
        placeholder: '请选择审批状态',
        placeholder: '请选择审核状态',
        allowClear: true,
      },
    },
@@ -233,7 +230,7 @@
    {
      title: '操作',
      field: 'actions',
      minWidth: 200,
      minWidth: 280,
      fixed: 'right',
      slots: { default: 'actions' },
    },
src/views/erp/purchase/invoice/index.vue
@@ -2,8 +2,6 @@
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
import type { ErpPurchaseInvoiceApi } from '#/api/erp/purchase/invoice';
import { useRouter } from 'vue-router';
import { Page, useVbenModal } from '@vben/common-ui';
import { downloadFileFromBlobPart } from '@vben/utils';
@@ -14,7 +12,7 @@
  deletePurchaseInvoice,
  exportPurchaseInvoice,
  getPurchaseInvoicePage,
  submitPurchaseInvoice,
  updatePurchaseInvoiceStatus,
} from '#/api/erp/purchase/invoice';
import { $t } from '#/locales';
@@ -22,8 +20,6 @@
import Form from './modules/form.vue';
defineOptions({ name: 'ErpPurchaseInvoice' });
const { push } = useRouter();
const [FormModal, formModalApi] = useVbenModal({
  connectedComponent: Form,
@@ -72,27 +68,22 @@
  }
}
/** 提交审核 */
async function handleSubmit(row: ErpPurchaseInvoiceApi.PurchaseInvoice) {
/** 更新来票状态(审核/反审核) */
async function handleUpdateStatus(
  row: ErpPurchaseInvoiceApi.PurchaseInvoice,
  status: number,
) {
  const hideLoading = message.loading({
    content: '提交审核中...',
    content: '更新状态中...',
    duration: 0,
  });
  try {
    await submitPurchaseInvoice(row.id!);
    message.success('提交审核成功');
    await updatePurchaseInvoiceStatus(row.id!, status);
    message.success('更新状态成功');
    handleRefresh();
  } finally {
    hideLoading();
  }
}
/** 查看审批详情 */
function handleProcessDetail(row: ErpPurchaseInvoiceApi.PurchaseInvoice) {
  push({
    name: 'BpmProcessInstanceDetail',
    query: { id: row.processInstanceId },
  });
}
const [Grid, gridApi] = useVbenVxeGrid({
@@ -163,11 +154,9 @@
        <Tag v-else color="success">已上传</Tag>
      </template>
      <template #auditStatus="{ row }">
        <Tag v-if="row.auditStatus === 0" color="default">未提交</Tag>
        <Tag v-else-if="row.auditStatus === 10" color="warning">审批中</Tag>
        <Tag v-else-if="row.auditStatus === 20" color="success">审核通过</Tag>
        <Tag v-else-if="row.auditStatus === 30" color="error">审核不通过</Tag>
        <Tag v-else-if="row.auditStatus === 40" color="default">已作废</Tag>
        <Tag v-if="row.auditStatus === 10" color="warning">未审核</Tag>
        <Tag v-else-if="row.auditStatus === 20" color="success">已审核</Tag>
        <Tag v-else color="default">--</Tag>
      </template>
      <template #actions="{ row }">
        <TableAction
@@ -184,22 +173,24 @@
              type: 'link',
              icon: ACTION_ICON.EDIT,
              auth: ['erp:purchase-invoice:update'],
              ifShow: row.auditStatus === 0,
              ifShow: row.auditStatus === 10,
              onClick: handleEdit.bind(null, row),
            },
            {
              label: '提交审核',
              label: '审核',
              type: 'link',
              auth: ['erp:purchase-invoice:update'],
              onClick: handleSubmit.bind(null, row),
              ifShow: row.auditStatus === 0,
              icon: ACTION_ICON.AUDIT,
              auth: ['erp:purchase-invoice:update-status'],
              ifShow: row.auditStatus === 10,
              onClick: handleUpdateStatus.bind(null, row, 20),
            },
            {
              label: '查看审批',
              label: '反审核',
              type: 'link',
              auth: ['erp:purchase-invoice:query'],
              onClick: handleProcessDetail.bind(null, row),
              ifShow: row.auditStatus !== 0 && !!row.processInstanceId,
              icon: ACTION_ICON.VIEW,
              auth: ['erp:purchase-invoice:update-status'],
              ifShow: row.auditStatus === 20,
              onClick: handleUpdateStatus.bind(null, row, 10),
            },
            {
              label: $t('common.delete'),