src/views/inventoryManagement/stockManagement/index.vue
@@ -47,38 +47,27 @@
                             label="序号"
                             type="index"
                             width="60" />
            <el-table-column label="入库日期"
                             prop="createTime"
                             width="100"
                             show-overflow-tooltip />
            <el-table-column label="销售合同号"
                             prop="salesContractNo"
            <el-table-column label="产品名称"
                             prop="productName"
                             width="180"
                             show-overflow-tooltip />
            <el-table-column label="产品大类"
                             prop="productCategory"
            <el-table-column label="产品编号"
                             prop="productCode"
                             width="180"
                             show-overflow-tooltip />
            <el-table-column label="规格型号"
                             prop="specificationModel"
            <el-table-column label="产品规格"
                             prop="model"
                             show-overflow-tooltip />
            <el-table-column label="单位"
                             prop="unit"
                             width="80"
                             show-overflow-tooltip />
            <el-table-column label="已出库数量"
                             prop="totalInboundNum"
                             width="100"
                             prop="outboundNum"
                             show-overflow-tooltip />
            <el-table-column label="剩余库存"
                             prop="inboundNum0"
                             width="100"
                             prop="stockQuantity"
                             show-overflow-tooltip />
            <el-table-column label="单价(元)"
                             prop="unitPrice"
                             width="150"></el-table-column>
            <el-table-column label="总价(元)"
                             prop="totalPrice"
                             width="150"></el-table-column>
            <!-- <el-table-column fixed="right" label="操作" min-width="60" align="center">
              <template #default="scope">
                <el-button link type="primary" size="small" @click="openForm('edit', scope.row);">编辑</el-button>
@@ -203,7 +192,7 @@
  import {
    getStockManagePage,
    getStockManagePageByProduction,
    delStockManage,
    delStockManage, getStockManageProduction,
  } from "@/api/inventoryManagement/stockManage.js";
  import {
    updateManagement,
@@ -337,7 +326,7 @@
    const params = buildQueryParams();
    const apiCall =
      activeTab.value === "production"
        ? getStockManagePageByProduction(params)
        ? getStockManageProduction(params)
        : getStockManagePage(params);
    apiCall
      .then(res => {
@@ -345,28 +334,28 @@
        tableData.value = res.data.records;
        // 为表格数据自动计算总价
        tableData.value = tableData.value.map(item => {
          // 计算剩余库存
          const stockQuantity = parseFloat(item.inboundNum) || 0;
          const outboundQuantity = parseFloat(item.totalInboundNum) || 0;
          const remainingStock = Math.max(stockQuantity - outboundQuantity, 0);
          // 根据标签页类型计算总价
          if (activeTab.value === "production") {
            // 成品库存:总价 = 单价 × 剩余库存
            const unitPrice = parseFloat(item.unitPrice) || 0;
            item.totalPrice = (unitPrice * remainingStock).toFixed(2);
          } else if (activeTab.value === "purchase") {
            // 原料库存:含税总价 = 含税单价 × 剩余库存
            const taxInclusiveUnitPrice =
              parseFloat(item.taxInclusiveUnitPrice) || 0;
            item.taxInclusiveTotalPrice = (
              taxInclusiveUnitPrice * remainingStock
            ).toFixed(2);
          }
          return item;
        });
        // tableData.value = tableData.value.map(item => {
        //   // 计算剩余库存
        //   const stockQuantity = parseFloat(item.inboundNum) || 0;
        //   const outboundQuantity = parseFloat(item.totalInboundNum) || 0;
        //   const remainingStock = Math.max(stockQuantity - outboundQuantity, 0);
        //
        //   // 根据标签页类型计算总价
        //   if (activeTab.value === "production") {
        //     // 成品库存:总价 = 单价 × 剩余库存
        //     const unitPrice = parseFloat(item.unitPrice) || 0;
        //     item.totalPrice = (unitPrice * remainingStock).toFixed(2);
        //   } else if (activeTab.value === "purchase") {
        //     // 原料库存:含税总价 = 含税单价 × 剩余库存
        //     const taxInclusiveUnitPrice =
        //       parseFloat(item.taxInclusiveUnitPrice) || 0;
        //     item.taxInclusiveTotalPrice = (
        //       taxInclusiveUnitPrice * remainingStock
        //     ).toFixed(2);
        //   }
        //
        //   return item;
        // });
        total.value = res.data.total;
        // 数据加载完成后检查库存