yyb
10 小时以前 7ffee77a904f9d314d917db6c0a9424c6305dcdd
生产成本核算增加用量字段
已修改1个文件
36 ■■■■■ 文件已修改
src/views/costAccounting/productionCostAccounting/index.vue 36 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/costAccounting/productionCostAccounting/index.vue
@@ -121,6 +121,14 @@
          </template>
          <el-table :data="categorySummary" stripe class="lux-table" height="260">
            <el-table-column prop="category" label="产品类别" min-width="140" />
            <el-table-column prop="totalQuantity" label="用量" align="right" min-width="120">
              <template #default="scope">
                <span class="quantity-cell">
                  <span class="quantity-value">{{ formatNumber(scope.row.totalQuantity, 2) }}</span>
                  <span class="quantity-unit">{{ scope.row.unit || "-" }}</span>
                </span>
              </template>
            </el-table-column>
            <el-table-column prop="totalCost" label="成本(元)" align="right">
              <template #default="scope">
                <span class="cost-value">¥{{ formatMoney(scope.row.totalCost) }}</span>
@@ -139,6 +147,14 @@
          <el-table :data="orderSummary" stripe class="lux-table" height="260">
            <el-table-column prop="orderNo" label="生产订单" min-width="150" />
            <el-table-column prop="category" label="产品类别" min-width="120" />
            <el-table-column prop="totalQuantity" label="用量" align="right" min-width="120">
              <template #default="scope">
                <span class="quantity-cell">
                  <span class="quantity-value">{{ formatNumber(scope.row.totalQuantity, 2) }}</span>
                  <span class="quantity-unit">{{ scope.row.unit || "-" }}</span>
                </span>
              </template>
            </el-table-column>
            <el-table-column prop="totalCost" label="总成本(元)" align="right">
              <template #default="scope">
                <span class="cost-value">¥{{ formatMoney(scope.row.totalCost) }}</span>
@@ -161,6 +177,14 @@
        <el-table-column prop="timeLabel" :label="timeColumnLabel" min-width="110" />
        <el-table-column prop="category" label="产品类别" min-width="120" />
        <el-table-column prop="orderNo" label="生产订单" min-width="150" />
        <el-table-column prop="totalQuantity" label="用量" align="right" min-width="130">
          <template #default="scope">
            <span class="quantity-cell">
              <span class="quantity-value">{{ formatNumber(scope.row.totalQuantity, 2) }}</span>
              <span class="quantity-unit">{{ scope.row.unit || "-" }}</span>
            </span>
          </template>
        </el-table-column>
        <el-table-column prop="totalCost" label="成本(元)" align="right">
          <template #default="scope">
            <span class="cost-value">¥{{ formatMoney(scope.row.totalCost) }}</span>
@@ -361,11 +385,13 @@
    if (!map.has(key)) {
      map.set(key, {
        totalCost: 0,
        totalQuantity: 0,
        materials: [],
      });
    }
    const bucket = map.get(key);
    bucket.totalCost += item.cost;
    bucket.totalQuantity += Number(item.quantity) || 0;
    bucket.materials.push(item);
  }
  return map;
@@ -387,6 +413,8 @@
      timeLabel,
      category,
      orderNo,
      totalQuantity: val.totalQuantity,
      unit: val.materials[0]?.unit || "",
      totalCost: val.totalCost,
      materials: val.materials,
    });
@@ -410,6 +438,8 @@
  for (const [category, val] of map) {
    rows.push({
      category,
      totalQuantity: val.totalQuantity,
      unit: val.materials[0]?.unit || "",
      totalCost: val.totalCost,
    });
  }
@@ -423,6 +453,8 @@
    rows.push({
      orderNo,
      category: val.materials[0]?.category || "-",
      totalQuantity: val.totalQuantity,
      unit: val.materials[0]?.unit || "",
      totalCost: val.totalCost,
    });
  }
@@ -482,12 +514,14 @@
};
const handleExport = () => {
  const headers = [timeColumnLabel.value, "产品类别", "生产订单", "成本(元)"];
  const headers = [timeColumnLabel.value, "产品类别", "生产订单", "用量", "单位", "成本(元)"];
  const lines = tableData.value.map((row) =>
    [
      row.timeLabel,
      row.category,
      row.orderNo,
      row.totalQuantity.toFixed(2),
      row.unit || "",
      row.totalCost.toFixed(2),
    ].join(",")
  );