gaoluyang
2026-06-02 4e591bd0b0042c4bc28f7a999ceea064f8ed5d43
src/views/procurementManagement/procurementInvoiceLedger/index.vue
@@ -1,7 +1,7 @@
<template>
  <div class="app-container">
    <el-form :model="filters" :inline="true">
      <el-form-item label="采购合同号">
      <el-form-item label="采购单号">
        <el-input
          v-model="filters.purchaseContractNumber"
          style="width: 240px"
@@ -62,16 +62,16 @@
          <el-button
            type="primary"
            link
            @click="downLoadFile(row)"
            @click="openEdit(row)"
          >
            附件
            编辑
          </el-button>
          <el-button
            type="primary"
            link
            @click="openEdit(row)"
            @click="downLoadFile(row)"
          >
            编辑
            附件
          </el-button>
          <el-button
            type="primary"
@@ -83,8 +83,8 @@
        </template>
      </PIMTable>
    </div>
    <FileListDialog
      ref="fileListRef"
    <FileListDialog
      ref="fileListRef"
      v-model="fileListDialogVisible"
      title="附件列表"
      :showUploadButton="true"
@@ -140,18 +140,18 @@
} = usePaginationApi(
  productRecordPage,
  {
    purchaseContractNumber: undefined, // 采购合同号
    purchaseContractNumber: undefined, // 采购单号
    supplierName: undefined, // 供应商
    createdAt: [], // 来票日期
  },
  [
    {
      label: "采购合同号",
      label: "采购单号",
      prop: "purchaseContractNumber",
      width: 150,
    },
    {
      label: "销售合同号",
      label: "销售单号",
      prop: "salesContractNo",
      width: 150,
    },
@@ -164,6 +164,11 @@
      label: "供应商名称",
      prop: "supplierName",
      width: 240,
    },
    {
      label: "产品大类",
      prop: "productCategory",
      width: 150,
    },
    {
      label: "规格型号",
@@ -232,21 +237,32 @@
  }
);
// 主表合计方法
const summarizeMainTable = (param) => {
  return proxy.summarizeTable(
  const sums = proxy.summarizeTable(
    param,
    [
      "taxInclusiveTotalPrice",
      "ticketsAmount",
      "unTicketsPrice",
      "invoiceAmount",
    ],
    ["ticketsAmount", "unTicketsPrice", "invoiceAmount"],
    {
      ticketsNum: { noDecimal: true }, // 不保留小数
      futureTickets: { noDecimal: true }, // 不保留小数
      ticketsNum: { noDecimal: true },
      futureTickets: { noDecimal: true },
    }
  );
  const keySet = new Set();
  let taxInclusiveSum = 0;
  (param.data || []).forEach((row) => {
    const key = `${row.purchaseContractNumber ?? ""}\n${row.salesContractNo ?? ""}\n${row.productCategory ?? ""}\n${row.specificationModel ?? ""}`;
    if (keySet.has(key)) return;
    keySet.add(key);
    const val = Number(row.taxInclusiveTotalPrice);
    if (!isNaN(val)) taxInclusiveSum += val;
  });
  const taxInclusiveIndex = (param.columns || []).findIndex(
    (c) => c.property === "taxInclusiveTotalPrice"
  );
  if (taxInclusiveIndex !== -1) {
    sums[taxInclusiveIndex] = taxInclusiveSum.toFixed(2);
  }
  return sums;
};
const handleSelectionChange = (val) => {
@@ -287,7 +303,7 @@
    proxy.$modal.msgWarning("缺少登记ID,无法保存附件");
    return;
  }
  return new Promise((resolve) => {
    // 创建一个隐藏的文件输入元素
    const input = document.createElement('input');
@@ -299,14 +315,14 @@
        resolve(null);
        return;
      }
      try {
        // 使用 FormData 上传文件
        const formData = new FormData();
        formData.append('file', file);
        formData.append('type', '4'); // type 参数,用户未指定具体值,先传空字符串
        formData.append('id', currentRowId.value); // 当前行的 id
        const uploadRes = await request({
          url: '/file/uploadByCommon',
          method: 'post',
@@ -316,10 +332,10 @@
            Authorization: `Bearer ${getToken()}`
          }
        });
        if (uploadRes.code === 200) {
          proxy.$modal.msgSuccess("附件上传成功");
          // 刷新列表获取最新数据
          await new Promise((resolveRefresh) => {
            // 调用 API 获取最新列表数据
@@ -332,7 +348,7 @@
                // 更新数据列表
                dataList.value = data.records;
                pagination.total = data.total;
                // 从外部数据获取 commonFiles
                const currentRow = dataList.value.find(row => row.id === currentRowId.value);
                if (currentRow && fileListRef.value) {
@@ -347,7 +363,7 @@
              resolveRefresh();
            });
          });
          resolve({
            name: uploadRes.data?.originalName || file.name,
            url: uploadRes.data?.tempPath || uploadRes.data?.url,
@@ -365,7 +381,7 @@
        document.body.removeChild(input);
      }
    };
    document.body.appendChild(input);
    input.click();
  });
@@ -376,7 +392,7 @@
  try {
    await delCommonFile([file.id]);
    proxy.$modal.msgSuccess("删除成功");
    // 刷新列表获取最新数据
    await new Promise((resolveRefresh) => {
      // 调用 API 获取最新列表数据
@@ -389,7 +405,7 @@
          // 更新数据列表
          dataList.value = data.records;
          pagination.total = data.total;
          // 从外部数据获取 commonFiles
          const currentRow = dataList.value.find(row => row.id === currentRowId.value);
          if (currentRow && fileListRef.value) {
@@ -404,7 +420,7 @@
        resolveRefresh();
      });
    });
    return true;
  } catch (error) {
    proxy.$modal.msgError("删除失败");