From 7ffee77a904f9d314d917db6c0a9424c6305dcdd Mon Sep 17 00:00:00 2001
From: yyb <995253665@qq.com>
Date: 星期二, 24 三月 2026 09:56:03 +0800
Subject: [PATCH] 生产成本核算增加用量字段

---
 src/views/costAccounting/productionCostAccounting/index.vue |   36 +++++++++++++++++++++++++++++++++++-
 1 files changed, 35 insertions(+), 1 deletions(-)

diff --git a/src/views/costAccounting/productionCostAccounting/index.vue b/src/views/costAccounting/productionCostAccounting/index.vue
index 6efd289..372a490 100644
--- a/src/views/costAccounting/productionCostAccounting/index.vue
+++ b/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(",")
   );

--
Gitblit v1.9.3