5 小时以前 3f7a1f34aff16f12de093a9579201e518b0c309b
refactor(erp): 将文件上传字段从 fileUrl 改为 blobIds 并支持多附件上传

- 将数据表单中的 fieldName 从 fileUrl 更改为 blobIds
- 为 FileUpload 组件添加 valueKey、maxNumber 和 multiple 配置
- 移除表单数据模型中的 fileUrl 属性定义
- 在表单加载时将 attachmentList 数据转换为 blobIds 格式
- 将 API 接口中的 fileUrl 字段替换为 attachmentList 对象数组
- 支持最多 10 个附件的批量上传功能
已修改31个文件
183 ■■■■ 文件已修改
src/api/erp/finance/payment/index.ts 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/erp/finance/receipt/index.ts 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/erp/purchase/order/index.ts 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/erp/purchase/request/index.ts 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/erp/sale/order/index.ts 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/erp/sale/out/index.ts 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/erp/sale/return/index.ts 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/erp/stock/check/index.ts 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/erp/stock/in/index.ts 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/erp/stock/move/index.ts 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/erp/stock/out/index.ts 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/erp/finance/payment/data.ts 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/erp/finance/payment/modules/form.vue 15 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/erp/finance/receipt/data.ts 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/erp/finance/receipt/modules/form.vue 15 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/erp/purchase/in/data.ts 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/erp/purchase/in/modules/form.vue 13 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/erp/purchase/order/data.ts 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/erp/purchase/order/modules/form.vue 13 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/erp/purchase/request/data.ts 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/erp/purchase/return/data.ts 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/erp/purchase/return/modules/form.vue 13 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/erp/sale/order/data.ts 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/erp/sale/out/data.ts 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/erp/sale/out/modules/form.vue 13 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/erp/sale/return/data.ts 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/erp/sale/return/modules/form.vue 13 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/erp/stock/check/data.ts 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/erp/stock/in/data.ts 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/erp/stock/move/data.ts 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/erp/stock/out/data.ts 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/erp/finance/payment/index.ts
@@ -15,7 +15,7 @@
    paymentPrice: number; // 实际付款金额
    status: number; // 状态
    remark: string; // 备注
    fileUrl?: string; // 附件
    attachmentList?: { id: number; name?: string; url?: string }[]; // 附件列表
    accountId?: number; // 付款账户
    accountName?: string; // 账户名称
    financeUserId?: number; // 财务人员
src/api/erp/finance/receipt/index.ts
@@ -28,7 +28,7 @@
    receiptPrice: number; // 实际收款金额
    status: number; // 状态
    remark: string; // 备注
    fileUrl?: string; // 附件
    attachmentList?: { id: number; name?: string; url?: string }[]; // 附件列表
    accountId?: number; // 收款账户
    accountName?: string; // 账户名称
    financeUserId?: number; // 财务人员
src/api/erp/purchase/order/index.ts
@@ -19,7 +19,7 @@
    accountId?: number; // 结算账户编号
    status?: number; // 状态
    remark?: string; // 备注
    fileUrl?: string; // 附件地址
    attachmentList?: { id: number; name?: string; url?: string }[]; // 附件列表
    inCount?: number; // 采购入库数量
    count?: number; // 数量
    returnCount?: number; // 采购退货数量
src/api/erp/purchase/request/index.ts
@@ -17,7 +17,7 @@
    supplierId?: number; // 供应商编号
    supplierName?: string; // 供应商名称
    discountPercent?: number; // 优惠率
    fileUrl?: string; // 附件地址
    attachmentList?: { id: number; name?: string; url?: string }[]; // 附件列表
    remark?: string; // 备注
    totalCount?: number; // 总数量
    totalPrice?: number; // 总金额
src/api/erp/sale/order/index.ts
@@ -17,7 +17,7 @@
    remark: string; // 备注
    outCount: number; // 销售出库数量
    outStatus?: number; // 出库状态:0-未出库,1-部分出库,2-全部出库
    fileUrl?: string; // 附件地址
    attachmentList?: { id: number; name?: string; url?: string }[]; // 附件列表
    inCount?: number; // 采购入库数量
    returnCount: number; // 销售退货数量
    totalProductPrice?: number; // 产品金额,单位:元
src/api/erp/sale/out/index.ts
@@ -21,7 +21,7 @@
    totalProductPrice?: number; // 合计商品金额
    taxPrice?: number; // 合计税额
    totalTaxPrice?: number; // 合计税额
    fileUrl?: string; // 附件地址
    attachmentList?: { id: number; name?: string; url?: string }[]; // 附件列表
    items?: SaleOutItem[];
  }
src/api/erp/sale/return/index.ts
@@ -20,7 +20,7 @@
    totalProductPrice?: number; // 合计商品金额
    taxPrice?: number; // 合计税额
    totalTaxPrice?: number; // 合计税额
    fileUrl?: string; // 附件地址
    attachmentList?: { id: number; name?: string; url?: string }[]; // 附件列表
    items?: SaleReturnItem[];
  }
src/api/erp/stock/check/index.ts
@@ -12,7 +12,7 @@
    totalPrice: number; // 合计金额,单位:元
    status: number; // 状态
    remark: string; // 备注
    fileUrl?: string; // 附件
    attachmentList?: { id: number; name?: string; url?: string }[]; // 附件列表
    productNames?: string; // 产品信息
    creatorName?: string; // 创建人
    items?: StockCheckItem[]; // 盘点产品清单
src/api/erp/stock/in/index.ts
@@ -14,7 +14,7 @@
    totalPrice: number; // 合计金额,单位:元
    status: number; // 状态
    remark: string; // 备注
    fileUrl?: string; // 附件
    attachmentList?: { id: number; name?: string; url?: string }[]; // 附件列表
    productNames?: string; // 产品信息
    creatorName?: string; // 创建人
    items?: StockInItem[]; // 入库产品清单
src/api/erp/stock/move/index.ts
@@ -12,7 +12,7 @@
    totalPrice: number; // 合计金额,单位:元
    status: number; // 状态
    remark: string; // 备注
    fileUrl?: string; // 附件
    attachmentList?: { id: number; name?: string; url?: string }[]; // 附件列表
    fromWarehouseId?: number; // 来源仓库编号
    createTime: Date; // 创建时间
    creator: string; // 创建人
src/api/erp/stock/out/index.ts
@@ -13,7 +13,7 @@
    totalPrice: number; // 合计金额,单位:元
    status: number; // 状态
    remark: string; // 备注
    fileUrl?: string; // 附件
    attachmentList?: { id: number; name?: string; url?: string }[]; // 附件列表
    items?: StockOutItem[]; // 出库产品清单
  }
src/views/erp/finance/payment/data.ts
@@ -86,10 +86,13 @@
      formItemClass: 'col-span-2',
    },
    {
      fieldName: 'fileUrl',
      fieldName: 'blobIds',
      label: '附件',
      component: 'FileUpload',
      componentProps: {
        valueKey: 'id',
        maxNumber: 10,
        multiple: true,
        showDescription: formType !== 'detail',
        disabled: formType === 'detail',
      },
src/views/erp/finance/payment/modules/form.vue
@@ -23,9 +23,7 @@
const emit = defineEmits(['success']);
const formData = ref<
  ErpFinancePaymentApi.FinancePayment & {
    fileUrl?: string;
  }
  ErpFinancePaymentApi.FinancePayment
>({
  id: undefined,
  no: '',
@@ -34,7 +32,6 @@
  financeUserId: undefined,
  paymentTime: undefined,
  remark: '',
  fileUrl: undefined,
  totalPrice: 0,
  discountPrice: 0,
  paymentPrice: 0,
@@ -163,6 +160,16 @@
    modalApi.lock();
    try {
      formData.value = await getFinancePayment(data.id);
      if (formData.value?.attachmentList?.length) {
        const blobIds = formData.value.attachmentList.map((item) => ({
          uid: String(item.id),
          name: item.name || '',
          url: item.url || '',
          status: 'done',
          id: item.id,
        }));
        formApi.setFieldValue('blobIds', blobIds);
      }
      // 设置到 values
      await formApi.setValues(formData.value, false);
    } finally {
src/views/erp/finance/receipt/data.ts
@@ -86,10 +86,13 @@
      formItemClass: 'col-span-2',
    },
    {
      fieldName: 'fileUrl',
      fieldName: 'blobIds',
      label: '附件',
      component: 'FileUpload',
      componentProps: {
        valueKey: 'id',
        maxNumber: 10,
        multiple: true,
        showDescription: formType !== 'detail',
        disabled: formType === 'detail',
      },
src/views/erp/finance/receipt/modules/form.vue
@@ -23,9 +23,7 @@
const emit = defineEmits(['success']);
const formData = ref<
  ErpFinanceReceiptApi.FinanceReceipt & {
    fileUrl?: string;
  }
  ErpFinanceReceiptApi.FinanceReceipt
>({
  id: undefined,
  no: '',
@@ -34,7 +32,6 @@
  financeUserId: 0,
  receiptTime: new Date(),
  remark: '',
  fileUrl: undefined,
  totalPrice: 0,
  discountPrice: 0,
  receiptPrice: 0,
@@ -177,6 +174,16 @@
    modalApi.lock();
    try {
      formData.value = await getFinanceReceipt(data.id);
      if (formData.value?.attachmentList?.length) {
        const blobIds = formData.value.attachmentList.map((item) => ({
          uid: String(item.id),
          name: item.name || '',
          url: item.url || '',
          status: 'done',
          id: item.id,
        }));
        formApi.setFieldValue('blobIds', blobIds);
      }
      // 设置到 values
      await formApi.setValues(formData.value, false);
    } finally {
src/views/erp/purchase/in/data.ts
@@ -87,10 +87,13 @@
      formItemClass: 'col-span-2',
    },
    {
      fieldName: 'fileUrl',
      fieldName: 'blobIds',
      label: '附件',
      component: 'FileUpload',
      componentProps: {
        valueKey: 'id',
        maxNumber: 10,
        multiple: true,
        showDescription: formType !== 'detail',
        disabled: formType === 'detail',
      },
src/views/erp/purchase/in/modules/form.vue
@@ -29,7 +29,6 @@
    accountId?: number;
    customerId?: number;
    discountPercent?: number;
    fileUrl?: string;
    order?: ErpPurchaseOrderApi.PurchaseOrder;
    orderId?: number;
    orderNo?: string;
@@ -40,7 +39,6 @@
  accountId: undefined,
  inTime: undefined,
  remark: undefined,
  fileUrl: undefined,
  discountPercent: 0,
  supplierId: undefined,
  discountPrice: 0,
@@ -124,7 +122,6 @@
    accountId: order.accountId!,
    remark: order.remark!,
    discountPercent: order.discountPercent!,
    fileUrl: order.fileUrl!,
  };
  // 将订单项设置到入库单项
  order.items!.forEach((item: any) => {
@@ -193,6 +190,16 @@
    modalApi.lock();
    try {
      formData.value = await getPurchaseIn(data.id);
      if (formData.value?.attachmentList?.length) {
        const blobIds = formData.value.attachmentList.map((item) => ({
          uid: String(item.id),
          name: item.name || '',
          url: item.url || '',
          status: 'done',
          id: item.id,
        }));
        formApi.setFieldValue('blobIds', blobIds);
      }
      // 设置到 values
      await formApi.setValues(formData.value, false);
    } finally {
src/views/erp/purchase/order/data.ts
@@ -87,10 +87,13 @@
      formItemClass: 'col-span-2',
    },
    {
      fieldName: 'fileUrl',
      fieldName: 'blobIds',
      label: '附件',
      component: 'FileUpload',
      componentProps: {
        valueKey: 'id',
        maxNumber: 10,
        multiple: true,
        showDescription: formType !== 'detail',
        disabled: formType === 'detail',
      },
src/views/erp/purchase/order/modules/form.vue
@@ -85,9 +85,6 @@
    ...item,
    id: undefined,
  }));
  if (data.fileUrl && Array.isArray(data.fileUrl)) {
    data.fileUrl = data.fileUrl.length > 0 ? data.fileUrl[0] : '';
  }
  await (formType.value === 'create'
    ? createPurchaseOrder(data)
    : updatePurchaseOrder(data));
@@ -154,6 +151,16 @@
    modalApi.lock();
    try {
      formData.value = await getPurchaseOrder(data.id);
      if (formData.value?.attachmentList?.length) {
        const blobIds = formData.value.attachmentList.map((item) => ({
          uid: String(item.id),
          name: item.name || '',
          url: item.url || '',
          status: 'done',
          id: item.id,
        }));
        formApi.setFieldValue('blobIds', blobIds);
      }
      await formApi.setValues(formData.value);
    } finally {
      modalApi.unlock();
src/views/erp/purchase/request/data.ts
@@ -103,11 +103,13 @@
      formItemClass: 'col-span-2',
    },
    {
      fieldName: 'fileUrl',
      fieldName: 'blobIds',
      label: '附件',
      component: 'FileUpload',
      componentProps: {
        placeholder: '请上传附件',
        valueKey: 'id',
        maxNumber: 10,
        multiple: true,
        disabled: formType === 'detail',
      },
      formItemClass: 'col-span-2',
src/views/erp/purchase/return/data.ts
@@ -87,10 +87,13 @@
      formItemClass: 'col-span-2',
    },
    {
      fieldName: 'fileUrl',
      fieldName: 'blobIds',
      label: '附件',
      component: 'FileUpload',
      componentProps: {
        valueKey: 'id',
        maxNumber: 10,
        multiple: true,
        showDescription: formType !== 'detail',
        disabled: formType === 'detail',
      },
src/views/erp/purchase/return/modules/form.vue
@@ -28,7 +28,6 @@
  ErpPurchaseReturnApi.PurchaseReturn & {
    accountId?: number;
    discountPercent?: number;
    fileUrl?: string;
    order?: ErpPurchaseOrderApi.PurchaseOrder;
    orderId?: number;
    orderNo?: string;
@@ -40,7 +39,6 @@
  accountId: undefined,
  returnTime: undefined,
  remark: undefined,
  fileUrl: undefined,
  discountPercent: 0,
  supplierId: undefined,
  discountPrice: 0,
@@ -123,7 +121,6 @@
    accountId: order.accountId!,
    remark: order.remark!,
    discountPercent: order.discountPercent!,
    fileUrl: order.fileUrl!,
  };
  // 将订单项设置到退货单项
  order.items!.forEach((item: any) => {
@@ -193,6 +190,16 @@
    modalApi.lock();
    try {
      formData.value = await getPurchaseReturn(data.id);
      if (formData.value?.attachmentList?.length) {
        const blobIds = formData.value.attachmentList.map((item) => ({
          uid: String(item.id),
          name: item.name || '',
          url: item.url || '',
          status: 'done',
          id: item.id,
        }));
        formApi.setFieldValue('blobIds', blobIds);
      }
      // 设置到 values
      await formApi.setValues(formData.value, false);
    } finally {
src/views/erp/sale/order/data.ts
@@ -111,10 +111,13 @@
      formItemClass: 'col-span-2',
    },
    {
      fieldName: 'fileUrl',
      fieldName: 'blobIds',
      label: '附件',
      component: 'FileUpload',
      componentProps: {
        valueKey: 'id',
        maxNumber: 10,
        multiple: true,
        showDescription: formType !== 'detail',
        disabled: formType === 'detail',
      },
src/views/erp/sale/out/data.ts
@@ -104,10 +104,13 @@
      formItemClass: 'col-span-2',
    },
    {
      fieldName: 'fileUrl',
      fieldName: 'blobIds',
      label: '附件',
      component: 'FileUpload',
      componentProps: {
        valueKey: 'id',
        maxNumber: 10,
        multiple: true,
        showDescription: formType !== 'detail',
        disabled: formType === 'detail',
      },
src/views/erp/sale/out/modules/form.vue
@@ -25,7 +25,6 @@
    accountId?: number;
    customerId?: number;
    discountPercent?: number;
    fileUrl?: string;
    order?: ErpSaleOrderApi.SaleOrder;
    orderId?: number;
    orderNo?: string;
@@ -36,7 +35,6 @@
  accountId: undefined,
  outTime: undefined,
  remark: undefined,
  fileUrl: undefined,
  discountPercent: 0,
  customerId: undefined,
  discountPrice: 0,
@@ -119,7 +117,6 @@
    accountId: order.accountId!,
    remark: order.remark!,
    discountPercent: order.discountPercent!,
    fileUrl: order.fileUrl!,
  };
  // 将订单项设置到出库单项
  order.items!.forEach((item: any) => {
@@ -188,6 +185,16 @@
    modalApi.lock();
    try {
      formData.value = await getSaleOut(data.id);
      if (formData.value?.attachmentList?.length) {
        const blobIds = formData.value.attachmentList.map((item) => ({
          uid: String(item.id),
          name: item.name || '',
          url: item.url || '',
          status: 'done',
          id: item.id,
        }));
        formApi.setFieldValue('blobIds', blobIds);
      }
      // 设置到 values
      await formApi.setValues(formData.value, false);
    } finally {
src/views/erp/sale/return/data.ts
@@ -100,10 +100,13 @@
      formItemClass: 'col-span-2',
    },
    {
      fieldName: 'fileUrl',
      fieldName: 'blobIds',
      label: '附件',
      component: 'FileUpload',
      componentProps: {
        valueKey: 'id',
        maxNumber: 10,
        multiple: true,
        showDescription: formType !== 'detail',
        disabled: formType === 'detail',
      },
src/views/erp/sale/return/modules/form.vue
@@ -29,7 +29,6 @@
    accountId?: number;
    customerId?: number;
    discountPercent?: number;
    fileUrl?: string;
    order?: ErpSaleOrderApi.SaleOrder;
    orderId?: number;
    orderNo?: string;
@@ -40,7 +39,6 @@
  accountId: undefined,
  returnTime: undefined,
  remark: undefined,
  fileUrl: undefined,
  discountPercent: 0,
  customerId: undefined,
  discountPrice: 0,
@@ -124,7 +122,6 @@
    accountId: order.accountId!,
    remark: order.remark!,
    discountPercent: order.discountPercent!,
    fileUrl: order.fileUrl!,
  };
  // 将订单项设置到退货单项
  order.items!.forEach((item: any) => {
@@ -193,6 +190,16 @@
    modalApi.lock();
    try {
      formData.value = await getSaleReturn(data.id);
      if (formData.value?.attachmentList?.length) {
        const blobIds = formData.value.attachmentList.map((item) => ({
          uid: String(item.id),
          name: item.name || '',
          url: item.url || '',
          status: 'done',
          id: item.id,
        }));
        formApi.setFieldValue('blobIds', blobIds);
      }
      // 设置到 values
      await formApi.setValues(formData.value, false);
    } finally {
src/views/erp/stock/check/data.ts
@@ -56,10 +56,13 @@
      formItemClass: 'col-span-2',
    },
    {
      fieldName: 'fileUrl',
      fieldName: 'blobIds',
      label: '附件',
      component: 'FileUpload',
      componentProps: {
        valueKey: 'id',
        maxNumber: 10,
        multiple: true,
        showDescription: formType !== 'detail',
        disabled: formType === 'detail',
      },
src/views/erp/stock/in/data.ts
@@ -71,10 +71,13 @@
      formItemClass: 'col-span-2',
    },
    {
      fieldName: 'fileUrl',
      fieldName: 'blobIds',
      label: '附件',
      component: 'FileUpload',
      componentProps: {
        valueKey: 'id',
        maxNumber: 10,
        multiple: true,
        showDescription: formType !== 'detail',
        disabled: formType === 'detail',
      },
src/views/erp/stock/move/data.ts
@@ -56,10 +56,13 @@
      formItemClass: 'col-span-2',
    },
    {
      fieldName: 'fileUrl',
      fieldName: 'blobIds',
      label: '附件',
      component: 'FileUpload',
      componentProps: {
        valueKey: 'id',
        maxNumber: 10,
        multiple: true,
        showDescription: formType !== 'detail',
        disabled: formType === 'detail',
      },
src/views/erp/stock/out/data.ts
@@ -73,10 +73,13 @@
      formItemClass: 'col-span-2',
    },
    {
      fieldName: 'fileUrl',
      fieldName: 'blobIds',
      label: '附件',
      component: 'FileUpload',
      componentProps: {
        valueKey: 'id',
        maxNumber: 10,
        multiple: true,
        showDescription: formType !== 'detail',
        disabled: formType === 'detail',
      },