From 37231c5f92cb2fba1af8cf21e7af70c168a551db Mon Sep 17 00:00:00 2001
From: zhangwencui <1064582902@qq.com>
Date: 星期五, 13 三月 2026 14:03:27 +0800
Subject: [PATCH] Merge branch 'dev_银川_中盛建材' of http://114.132.189.42:9002/r/product-inventory-management into dev_银川_中盛建材

---
 src/views/productionPlan/summaryByProduct/index.vue |   91 ++++++++++++++++++++++++++++++++++++---------
 1 files changed, 73 insertions(+), 18 deletions(-)

diff --git a/src/views/productionPlan/summaryByProduct/index.vue b/src/views/productionPlan/summaryByProduct/index.vue
index 62b8010..2d54390 100644
--- a/src/views/productionPlan/summaryByProduct/index.vue
+++ b/src/views/productionPlan/summaryByProduct/index.vue
@@ -1,13 +1,33 @@
 <template>
   <div class="app-container">
+    <div class="search_form">
+      <div>
+        <span class="search_title ml10">鐗╂枡缂栫爜锛�</span>
+        <el-input v-model="searchForm.materialCode"
+                  style="width: 200px"
+                  placeholder="璇疯緭鍏ョ墿鏂欑紪鐮�"
+                  clearable />
+        <span class="search_title ml10">浜у搧鍚嶇О锛�</span>
+        <el-input v-model="searchForm.productName"
+                  style="width: 200px"
+                  placeholder="璇疯緭鍏ヤ骇鍝佸悕绉�"
+                  clearable />
+        <el-button type="primary"
+                   @click="handleQuery"
+                   style="margin-left: 10px">鎼滅储</el-button>
+        <el-button @click="handleReset">閲嶇疆</el-button>
+      </div>
+    </div>
     <div class="table_list">
       <PIMTable rowKey="materialCode"
                 :column="tableColumn"
                 :tableData="tableData"
                 :page="page"
-                height="calc(100vh - 200px)"
+                height="calc(100vh - 280px)"
                 :tableLoading="tableLoading"
                 :isSelection="false"
+                :isShowSummary="true"
+                :summaryMethod="summaryMethod"
                 @pagination="pagination">
       </PIMTable>
     </div>
@@ -23,49 +43,45 @@
     {
       label: "鐗╂枡缂栫爜",
       prop: "materialCode",
-      className: "code-cell",
     },
     {
       label: "浜у搧鍚嶇О",
       prop: "productName",
       dataType: "tag",
       formatType: params => {
-        const typeMap = {
-          鏉挎潗: "primary",
-          鐮屽潡: "info",
-        };
-        return typeMap[params] || "info";
+        return  "primary";
       },
     },
     {
       label: "浜у搧瑙勬牸",
-      prop: "productSpec",
+      prop: "specification",
       className: "spec-cell",
     },
     {
       label: "闀�",
       prop: "length",
-      className: "dimension-cell",
+      formatData: cell => (cell ? `${cell}mm` : ""),
     },
     {
       label: "瀹�",
       prop: "width",
-      className: "dimension-cell",
+      formatData: cell => (cell ? `${cell}mm` : ""),
     },
     {
       label: "楂�",
       prop: "height",
-      className: "dimension-cell",
+      formatData: cell => (cell ? `${cell}mm` : ""),
     },
     {
       label: "鍧楁暟",
       prop: "quantity",
-      className: "quantity-cell",
+      formatData: cell => (cell ? `${cell}鍧梎 : ""),
     },
     {
       label: "鏂规暟",
       prop: "volume",
       className: "volume-cell",
+      formatData: cell => (cell ? `${cell}鏂筦 : ""),
     },
   ]);
   const tableData = ref([]);
@@ -78,13 +94,21 @@
 
   // 鎼滅储琛ㄥ崟
   const searchForm = reactive({
+    materialCode: "",
     productName: "",
-    productSpec: "",
   });
 
   // 鏌ヨ鍒楄〃
   /** 鎼滅储鎸夐挳鎿嶄綔 */
   const handleQuery = () => {
+    page.current = 1;
+    getList();
+  };
+
+  /** 閲嶇疆鎸夐挳鎿嶄綔 */
+  const handleReset = () => {
+    searchForm.materialCode = "";
+    searchForm.productName = "";
     page.current = 1;
     getList();
   };
@@ -109,6 +133,31 @@
       .catch(() => {
         tableLoading.value = false;
       });
+  };
+
+  // 姹囨�绘柟娉�
+  const summaryMethod = ({ columns, data }) => {
+    const sums = [];
+    columns.forEach((column, index) => {
+      if (index === 0) {
+        sums[index] = "鎬昏";
+        return;
+      }
+      if (column.property === "quantity") {
+        const total = data.reduce((acc, item) => {
+          return acc + (Number(item.quantity) || 0);
+        }, 0);
+        sums[index] = `${total}鍧梎;
+      } else if (column.property === "volume") {
+        const total = data.reduce((acc, item) => {
+          return acc + (Number(item.volume) || 0);
+        }, 0);
+        sums[index] = `${total.toFixed(4)}鏂筦;
+      } else {
+        sums[index] = "";
+      }
+    });
+    return sums;
   };
 
   onMounted(() => {
@@ -137,6 +186,16 @@
     &:hover {
       box-shadow: 0 4px 16px 0 rgba(0, 0, 0, 0.08);
     }
+
+    .search_title {
+      color: #606266;
+      font-size: 14px;
+      font-weight: 500;
+    }
+
+    .ml10 {
+      margin-left: 10px;
+    }
   }
 
   .table_list {
@@ -144,7 +203,7 @@
     border-radius: 6px;
     box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.05);
     overflow: hidden;
-    height: calc(100vh - 150px);
+    height: calc(100vh - 230px);
   }
 
   :deep(.el-table) {
@@ -162,7 +221,6 @@
         color: #ffffff;
         border-bottom: none;
         padding: 16px 0;
-        font-size: 14px;
         letter-spacing: 0.5px;
       }
     }
@@ -185,7 +243,6 @@
           border-bottom: 1px solid #f0f0f0;
           padding: 14px 0;
           color: #303133;
-          font-size: 13px;
         }
       }
 
@@ -204,7 +261,6 @@
         font-weight: 600;
         color: #409eff;
         font-family: "Courier New", monospace;
-        font-size: 14px;
         text-shadow: 0 1px 2px rgba(64, 158, 255, 0.2);
       }
 
@@ -228,7 +284,6 @@
       // 鏃ユ湡瀛楁鏍峰紡
       .date-cell {
         color: #909399;
-        font-size: 12px;
         font-style: italic;
       }
     }

--
Gitblit v1.9.3