From de3a3f8b4d0ff3275fd3175648757f8902628911 Mon Sep 17 00:00:00 2001
From: yyb <995253665@qq.com>
Date: 星期四, 02 四月 2026 09:57:22 +0800
Subject: [PATCH] Merge branch 'dev_银川_中盛建材' of http://114.132.189.42:9002/r/product-inventory-management into dev_银川_中盛建材

---
 src/views/index.vue                                                    |  355 ++++++++++++++++++++++++++++++++++++++------------
 src/views/productionManagement/productionProcess/index.vue             |    4 
 src/views/productionManagement/processRoute/index.vue                  |    1 
 src/views/productionManagement/processRoute/processRouteItem/index.vue |   16 +
 src/views/productionManagement/productionOrder/index.vue               |    5 
 5 files changed, 284 insertions(+), 97 deletions(-)

diff --git a/src/views/index.vue b/src/views/index.vue
index 65babe5..2e8ed36 100644
--- a/src/views/index.vue
+++ b/src/views/index.vue
@@ -2,9 +2,9 @@
   <div class="home-page">
     <div class="top-bar">
       <div class="user-box">
-        <!-- <img :src="userStore.avatar"
+        <img :src="userStore.avatar"
              class="avatar"
-             alt="" /> -->
+             alt="" />
         <div>
           <div class="hello">{{ userStore.roleName || "绯荤粺绠$悊鍛�" }}锛屼綘濂�</div>
           <div class="sub">鐧诲綍鏃堕棿锛歿{ userStore.currentLoginTime }}</div>
@@ -61,33 +61,25 @@
         </section>
         <section class="section-card flex-fill-card">
           <div class="section-title-row">
-            <div class="section-title">浠婃棩寰呭鐞�</div>
-            <el-radio-group v-model="pendingFilter"
-                            size="small">
-              <el-radio-button label="all">鍏ㄩ儴</el-radio-button>
-              <el-radio-button label="mine">鎴戠殑</el-radio-button>
-              <el-radio-button label="high">楂樹紭鍏�</el-radio-button>
+            <div class="section-title">鍖哄煙閿�鍞噾棰濆垎鏋�</div>
+            <el-radio-group v-model="chartProductType2"
+                            size="small"
+                            @change="fetchSalesAmountChartData">
+              <el-radio-button label="鏉挎潗">鏉挎潗</el-radio-button>
+              <el-radio-button label="鐮屽潡">鐮屽潡</el-radio-button>
             </el-radio-group>
           </div>
-          <div class="task-row"
-               v-for="task in filteredPendingTasks"
-               :key="task.id">
-            <div class="task-left">
-              <el-tag size="small"
-                      :type="task.type">{{ task.level }}</el-tag>
-              <span class="task-title">{{ task.title }}</span>
-            </div>
-            <el-button link
-                       type="primary"
-                       @click="goTo(task.path)">鍘诲鐞�</el-button>
-          </div>
-          <el-empty v-if="filteredPendingTasks.length === 0"
-                    description="鏆傛棤寰呭鐞嗕簨椤�"
-                    :image-size="80" />
+          <Echarts :chartStyle="chartStyle"
+                   :grid="grid"
+                   :tooltip="barTooltip"
+                   :xAxis="salesAmountXAxis"
+                   :yAxis="salesAmountYAxis"
+                   :series="salesAmountSeries"
+                   style="height: 300px" />
         </section>
       </div>
       <div class="right-col">
-        <section class="section-card"
+        <!-- <section class="section-card"
                  v-if="isSectionVisible('trendCards')">
           <div class="section-title">鏈�杩�7澶╁叧閿寚鏍囪秼鍔�</div>
           <div class="trend-cards">
@@ -111,7 +103,7 @@
               </div>
             </div>
           </div>
-        </section>
+        </section> -->
         <section class="section-card"
                  v-if="isSectionVisible('planTrend')">
           <div class="section-title-row">
@@ -137,34 +129,25 @@
              v-if="isSectionVisible('qualityChart') || isSectionVisible('costChart')">
           <section class="section-card"
                    v-if="isSectionVisible('qualityChart')">
-            <div class="section-title-row">
-              <div class="section-title">璐ㄦ寮傚父鍒嗗竷</div>
-              <el-radio-group v-model="chartRangeQuality"
-                              size="small"
-                              @change="loadQualityData">
-                <el-radio-button :label="1">鍛�</el-radio-button>
-                <el-radio-button :label="2">鏈�</el-radio-button>
-                <el-radio-button :label="3">瀛e害</el-radio-button>
-              </el-radio-group>
-            </div>
+            <div class="section-title">浠婂勾鑳借�楃敤閲忚秼鍔�</div>
             <Echarts :chartStyle="chartStyle"
                      :grid="grid"
                      :tooltip="barTooltip"
-                     :xAxis="qualityXAxis"
+                     :xAxis="energyConsumptionXAxis"
                      :yAxis="valueYAxis"
-                     :series="qualitySeries"
+                     :series="energyConsumptionSeries"
                      style="height: 260px" />
           </section>
           <section class="section-card"
                    v-if="isSectionVisible('costChart')">
-            <div class="section-title">鑳借�楃被鍨嬪崰姣�</div>
+            <div class="section-title">浠婂勾鑳借�楃被鍨嬪崰姣�</div>
             <Echarts :chartStyle="chartStyle"
                      :tooltip="pieTooltip"
                      :series="energyTypeSeries"
                      style="height: 260px" />
           </section>
         </div>
-        <section class="section-card"
+        <!-- <section class="section-card"
                  v-if="isSectionVisible('warningCenter')">
           <div class="section-title">寮傚父棰勮涓績</div>
           <div class="warning-row"
@@ -182,42 +165,31 @@
           <el-empty v-if="warningList.length === 0"
                     description="鏆傛棤寮傚父棰勮"
                     :image-size="80" />
-        </section>
+        </section> -->
         <section class="section-card mini-table-wrap"
                  v-if="isSectionVisible('planTable')">
-          <div class="section-title">鐢熶骇璁″垝鎵ц鏄庣粏</div>
+          <div class="section-title">鏈�杩戞姤宸�</div>
           <el-table :data="planTable"
                     size="small"
                     stripe>
             <el-table-column prop="planNo"
-                             label="璁″垝鍗曞彿"
+                             label="鐝"
                              min-width="150" />
             <el-table-column prop="product"
-                             label="浜у搧"
+                             label="鍒涘缓浜�"
+                             min-width="120" />
+            <el-table-column prop="product"
+                             label="鎶ュ伐鏃堕棿"
                              min-width="120" />
             <el-table-column prop="qty"
-                             label="璁″垝閲�"
+                             label="浜у搧"
                              min-width="90" />
             <el-table-column prop="issued"
-                             label="宸蹭笅鍙�"
+                             label="鐢熶骇鏁伴噺"
                              min-width="90" />
-            <el-table-column prop="status"
-                             label="鐘舵��"
-                             min-width="100" />
-            <el-table-column label="鎿嶄綔"
-                             min-width="120">
-              <template #default="{ row }">
-                <el-button link
-                           type="primary"
-                           @click="goTo(routePathMap.plan)">鏌ョ湅</el-button>
-                <el-button v-if="row.status !== '宸插畬鎴�'"
-                           link
-                           type="success"
-                           @click="goTo(routePathMap.dispatch)">
-                  涓嬪彂
-                </el-button>
-              </template>
-            </el-table-column>
+            <el-table-column prop="issued"
+                             label="鍚堟牸鏁伴噺"
+                             min-width="90" />
           </el-table>
         </section>
       </div>
@@ -298,6 +270,8 @@
     qualityInspectionStatistics,
     nonComplianceWarning,
   } from "@/api/viewIndex.js";
+  import { energyConsumptionDetailStatistics } from "@/api/energyManagement/energyType";
+  import { getSalesAmountAnalysis } from "@/api/reportAnalysis/salesStatistics";
 
   const router = useRouter();
   const userStore = useUserStore();
@@ -566,6 +540,149 @@
     },
   ]);
 
+  // 鑳借�楃敤閲忚秼鍔垮浘琛�
+  const energyConsumptionXAxis = reactive({
+    type: "category",
+    data: [],
+    axisLabel: {
+      rotate: 45,
+    },
+  });
+
+  const energyConsumptionSeries = reactive([
+    {
+      name: "鐢ㄦ按閲�",
+      type: "bar",
+      data: [],
+      itemStyle: { color: "#409EFF" },
+    },
+    {
+      name: "鐢ㄧ數閲�",
+      type: "bar",
+      data: [],
+      itemStyle: { color: "#E6A23C" },
+    },
+    {
+      name: "鐢ㄦ皵閲�",
+      type: "bar",
+      data: [],
+      itemStyle: { color: "#67C23A" },
+    },
+  ]);
+
+  // 閿�鍞噾棰濆浘琛�
+  const chartProductType2 = ref("鐮屽潡");
+  const salesAmountChartData = ref({
+    dates: [],
+    customerTrends: [],
+  });
+
+  const salesAmountXAxis = reactive({
+    type: "value",
+    axisLabel: {
+      interval: "auto",
+      formatter: value => {
+        // 鏍煎紡鍖栭噾棰濓紝鏄剧ず涓烘洿鏄撹鐨勫舰寮�
+        if (value >= 10000) {
+          return (value / 10000).toFixed(0) + "涓�";
+        }
+        return value;
+      },
+    },
+    axisTick: {
+      interval: "auto",
+    },
+  });
+
+  const salesAmountYAxis = reactive({
+    type: "category",
+    data: [],
+    axisLabel: {
+      rotate: 0,
+    },
+  });
+
+  const salesAmountSeries = reactive([]);
+
+  // 鑾峰彇閿�鍞噾棰濆垎鏋愬浘琛ㄦ暟鎹�
+  const fetchSalesAmountChartData = async () => {
+    try {
+      const response = await getSalesAmountAnalysis({
+        type: chartProductType2.value,
+        days: "骞�", // 榛樿骞�
+      });
+      if (response?.data) {
+        salesAmountChartData.value = response.data;
+        updateSalesAmountChart();
+      }
+    } catch (error) {
+      console.error("鑾峰彇閿�鍞噾棰濆垎鏋愬浘琛ㄦ暟鎹け璐�:", error);
+      // 浣跨敤妯℃嫙鏁版嵁
+      salesAmountChartData.value = {
+        dates: [
+          "2026-01-01",
+          "2025-01-01",
+          "2024-01-01",
+          "2023-01-01",
+          "2022-01-01",
+        ],
+        customerTrends: [
+          { 鍐呰挋鍙�: 100, 閾跺窛: 200, 鑷彁: 300, 鍏朵粬: 150, 鍏ㄩ儴: 750 },
+          { 鍐呰挋鍙�: 80, 閾跺窛: 180, 鑷彁: 280, 鍏朵粬: 130, 鍏ㄩ儴: 670 },
+          { 鍐呰挋鍙�: 90, 閾跺窛: 190, 鑷彁: 290, 鍏朵粬: 140, 鍏ㄩ儴: 710 },
+          { 鍐呰挋鍙�: 70, 閾跺窛: 170, 鑷彁: 270, 鍏朵粬: 120, 鍏ㄩ儴: 630 },
+          { 鍐呰挋鍙�: 110, 閾跺窛: 210, 鑷彁: 310, 鍏朵粬: 160, 鍏ㄩ儴: 790 },
+        ],
+      };
+      updateSalesAmountChart();
+    }
+  };
+
+  // 鏇存柊閿�鍞噾棰濆浘琛�
+  const updateSalesAmountChart = () => {
+    const { customerTrends = [] } = salesAmountChartData.value;
+
+    // 璁$畻姣忎釜閿�鍞尯鍩熺殑鎬婚攢鍞锛堣繃婊ゆ帀"鍏ㄩ儴"锛�
+    const areaTotalMap = new Map();
+    customerTrends.forEach(item => {
+      Object.keys(item).forEach(key => {
+        // 杩囨护鎺�"鍏ㄩ儴"閿�鍞尯鍩�
+        if (key !== "鍏ㄩ儴") {
+          const value = item[key] || 0;
+          if (areaTotalMap.has(key)) {
+            areaTotalMap.set(key, areaTotalMap.get(key) + value);
+          } else {
+            areaTotalMap.set(key, value);
+          }
+        }
+      });
+    });
+
+    // 杞崲涓烘暟缁�
+    const salesAreas = Array.from(areaTotalMap.keys());
+
+    const colors = [
+      "#00A4ED",
+      "#34D8F7",
+      "#4A8BFF",
+      "#8A6BFF",
+      "#C8C447",
+      "#FF6B6B",
+    ];
+
+    // 鏇存柊Y杞存暟鎹紙鐜板湪鏄攢鍞尯鍩燂級
+    salesAmountYAxis.data = salesAreas;
+
+    // 鏇存柊绯诲垪鏁版嵁锛堟瘡涓攢鍞尯鍩熺殑鎬婚攢鍞锛�
+    salesAmountSeries.splice(0, salesAmountSeries.length);
+    salesAmountSeries.push({
+      name: "閿�鍞噾棰�",
+      data: salesAreas.map(area => areaTotalMap.get(area)),
+      type: "bar",
+      itemStyle: { color: "#00A4ED" },
+    });
+  };
+
   // 妯℃嫙鑳借�楁暟鎹�
   const energyData = reactive({
     water: 120,
@@ -573,28 +690,87 @@
     gas: 80,
   });
 
-  // 鏇存柊鑳借�楃被鍨嬪崰姣斿浘琛�
+  // 鏇存柊鑳借�楃被鍨嬪崰姣斿浘琛ㄥ拰鑳借�楃敤閲忚秼鍔垮浘琛�
   const updateEnergyTypeChart = () => {
-    const { water, electricity, gas } = energyData;
-    const total = water + electricity + gas;
+    // 鏋勫缓鍙傛暟锛氫粖骞寸殑骞村垵鍒板勾鏈互鍙婂ぉ鏁�
+    const currentYear = new Date().getFullYear();
+    const params = {
+      startDate: `${currentYear}-01-01`,
+      endDate: `${currentYear}-12-31`,
+      days: 365,
+      state: "骞�",
+    };
 
-    energyTypeSeries[0].data = [
-      {
-        value: total > 0 ? ((water / total) * 100).toFixed(2) : 0,
-        name: "姘�",
-        itemStyle: { color: "#409EFF" },
-      },
-      {
-        value: total > 0 ? ((electricity / total) * 100).toFixed(2) : 0,
-        name: "鐢�",
-        itemStyle: { color: "#E6A23C" },
-      },
-      {
-        value: total > 0 ? ((gas / total) * 100).toFixed(2) : 0,
-        name: "姘�",
-        itemStyle: { color: "#F56C6C" },
-      },
-    ];
+    // 璋冪敤鎺ュ彛鑾峰彇鏁版嵁
+    energyConsumptionDetailStatistics(params)
+      .then(res => {
+        if (res.code === 200) {
+          const data = res.data;
+          // 澶勭悊鑳借�楃被鍨嬪崰姣旀暟鎹�
+          const energyTypeData = data.energyCostDtos || [];
+
+          // 璁$畻鍚勮兘鑰楃被鍨嬬殑鎬绘秷鑰楅噺
+          let total = 0;
+          const typeMap = {
+            姘�: 0,
+            鐢�: 0,
+            姘�: 0,
+          };
+
+          // 鍑嗗鑳借�楃敤閲忚秼鍔垮浘琛ㄦ暟鎹�
+          const dates = [];
+          const waterConsumptionData = [];
+          const electricityConsumptionData = [];
+          const gasConsumptionData = [];
+
+          energyTypeData.forEach(item => {
+            // 鏀堕泦鏃ユ湡鍜屽悇鑳借�楃被鍨嬫暟鎹�
+            if (item.meterReadingDate) {
+              dates.push(item.meterReadingDate);
+              waterConsumptionData.push(item.waterConsumption || 0);
+              electricityConsumptionData.push(item.electricityConsumption || 0);
+              gasConsumptionData.push(item.gasConsumption || 0);
+            }
+
+            // 璁$畻鎬绘秷鑰楅噺
+            if (item.waterConsumption)
+              typeMap.姘� += Number(item.waterConsumption);
+            if (item.electricityConsumption)
+              typeMap.鐢� += Number(item.electricityConsumption);
+            if (item.gasConsumption) typeMap.姘� += Number(item.gasConsumption);
+          });
+
+          total = typeMap.姘� + typeMap.鐢� + typeMap.姘�;
+
+          // 鏇存柊鑳借�楃被鍨嬪崰姣斿浘琛ㄦ暟鎹�
+          energyTypeSeries[0].data = [
+            {
+              value: total > 0 ? ((typeMap.姘� / total) * 100).toFixed(2) : 0,
+              name: "姘�",
+              itemStyle: { color: "#409EFF" },
+            },
+            {
+              value: total > 0 ? ((typeMap.鐢� / total) * 100).toFixed(2) : 0,
+              name: "鐢�",
+              itemStyle: { color: "#E6A23C" },
+            },
+            {
+              value: total > 0 ? ((typeMap.姘� / total) * 100).toFixed(2) : 0,
+              name: "姘�",
+              itemStyle: { color: "#F56C6C" },
+            },
+          ];
+
+          // 鏇存柊鑳借�楃敤閲忚秼鍔垮浘琛ㄦ暟鎹�
+          energyConsumptionXAxis.data = dates;
+          energyConsumptionSeries[0].data = waterConsumptionData;
+          energyConsumptionSeries[1].data = electricityConsumptionData;
+          energyConsumptionSeries[2].data = gasConsumptionData;
+        }
+      })
+      .catch(err => {
+        console.error("鑾峰彇鑳借�楁暟鎹紓甯革細", err);
+      });
   };
 
   const planTable = reactive([]);
@@ -1030,19 +1206,20 @@
   };
 
   const refreshDashboardData = () => {
-    loadHomeTodos();
-    loadOrderAndProgress();
-    loadPlanTrend();
-    loadQualityData();
-    loadCostComposition();
-    loadWarningCenter();
+    // loadHomeTodos();
+    // loadOrderAndProgress();
+    // loadPlanTrend();
+    // loadQualityData();
+    // loadCostComposition();
+    // loadWarningCenter();
     updateEnergyTypeChart();
+    fetchSalesAmountChartData();
     lastUpdatedAt.value = new Date().toLocaleString();
   };
 
   onMounted(() => {
     // initSectionConfig();
-    // refreshDashboardData();
+    refreshDashboardData();
   });
 </script>
 
diff --git a/src/views/productionManagement/processRoute/index.vue b/src/views/productionManagement/processRoute/index.vue
index f907915..d066a54 100644
--- a/src/views/productionManagement/processRoute/index.vue
+++ b/src/views/productionManagement/processRoute/index.vue
@@ -247,6 +247,7 @@
         bomId: row.bomId || null,
         description: row.description || "",
         type: "route",
+        status: row.status || false,
       },
     });
   };
diff --git a/src/views/productionManagement/processRoute/processRouteItem/index.vue b/src/views/productionManagement/processRoute/processRouteItem/index.vue
index d7fadd3..a2c5ce5 100644
--- a/src/views/productionManagement/processRoute/processRouteItem/index.vue
+++ b/src/views/productionManagement/processRoute/processRouteItem/index.vue
@@ -47,13 +47,15 @@
          class="section-header">
       <div class="section-title">宸ヨ壓璺嚎椤圭洰鍒楄〃</div>
       <div class="section-actions">
-        <div class="sort-tip">鎷栨嫿琛ㄦ牸鎺掑簭</div>
+        <div v-if="!routeInfo.status"
+             class="sort-tip">鎷栨嫿琛ㄦ牸鎺掑簭</div>
         <el-button icon="Grid"
                    @click="toggleView"
                    style="margin-right: 10px;">
           鍗$墖瑙嗗浘
         </el-button>
-        <el-button type="primary"
+        <el-button v-if="!routeInfo.status"
+                   type="primary"
                    @click="handleAdd">鏂板</el-button>
       </div>
     </div>
@@ -97,6 +99,7 @@
         </template>
       </el-table-column>
       <el-table-column label="鎿嶄綔"
+                       v-if="!routeInfo.status"
                        align="center"
                        fixed="right"
                        width="150">
@@ -119,13 +122,15 @@
       <div class="section-header">
         <div class="section-title">宸ヨ壓璺嚎椤圭洰鍒楄〃</div>
         <div class="section-actions">
-          <div class="sort-tip">闀挎寜鎷栨嫿鍗$墖鎺掑簭</div>
+          <div v-if="!routeInfo.status"
+               class="sort-tip">闀挎寜鎷栨嫿鍗$墖鎺掑簭</div>
           <el-button icon="Menu"
                      @click="toggleView"
                      style="margin-right: 10px;">
             琛ㄦ牸瑙嗗浘
           </el-button>
           <el-button type="primary"
+                     v-if="!routeInfo.status"
                      @click="handleAdd">鏂板</el-button>
         </div>
       </div>
@@ -150,6 +155,7 @@
               <el-button type="primary"
                          link
                          size="small"
+                         v-if="!routeInfo.status"
                          @click="handleEdit(item)"
                          :disabled="item.isComplete">缂栬緫</el-button>
               <el-button type="info"
@@ -159,6 +165,7 @@
               <el-button type="danger"
                          link
                          size="small"
+                         v-if="!routeInfo.status"
                          @click="handleDelete(item)"
                          :disabled="item.isComplete">鍒犻櫎</el-button>
             </div>
@@ -262,7 +269,7 @@
                       <span v-else>{{ row.unit }}</span>
                     </template>
                   </el-table-column>
-                   <el-table-column prop="unitPrice"
+                  <el-table-column prop="unitPrice"
                                    label="鍗曚环">
                     <template #default="{ row }">
                       <el-form-item v-if="bomDataValue.isEdit"
@@ -541,6 +548,7 @@
       dictLabel: route.query.dictLabel || "",
       bomId: route.query.bomId || null,
       description: route.query.description || "",
+      status: route.query.status === "true" ? true : false,
     };
     if (pageType.value === "order") {
       queryList2(route.query.orderId)
diff --git a/src/views/productionManagement/productionOrder/index.vue b/src/views/productionManagement/productionOrder/index.vue
index 2182126..3827f39 100644
--- a/src/views/productionManagement/productionOrder/index.vue
+++ b/src/views/productionManagement/productionOrder/index.vue
@@ -212,7 +212,7 @@
                   </div>
                   <div class="info-item">
                     <div class="info-label">宸蹭笅鍙戞柟鏁�</div>
-                    <div class="info-value">{{ item.assignedQuantity ? `${item.assignedQuantity}` : 0 }}<span style="color:rgba(214, 134, 22, 0.76)"> 鏂�</span></div>
+                    <div class="info-value">{{ item.totalAssignedQuantity ? `${item.totalAssignedQuantity}` : 0 }}<span style="color:rgba(214, 134, 22, 0.76)"> 鏂�</span></div>
                   </div>
                   <div class="info-item">
                     <div class="info-label">灏哄</div>
@@ -539,7 +539,7 @@
     },
     {
       label: "宸蹭笅鍙戞柟鏁�",
-      prop: "assignedQuantity",
+      prop: "totalAssignedQuantity",
       width: "150px",
       className: "spec-cell",
       formatData: cell => (cell ? `${cell}鏂筦 : 0),
@@ -870,6 +870,7 @@
                   volume: plan.volume,
                   status: plan.status,
                   assignedQuantity: plan.assignedQuantity,
+                  totalAssignedQuantity: plan.totalAssignedQuantity,
                   length: plan.length,
                   width: plan.width,
                   height: plan.height,
diff --git a/src/views/productionManagement/productionProcess/index.vue b/src/views/productionManagement/productionProcess/index.vue
index d813d7d..18387d6 100644
--- a/src/views/productionManagement/productionProcess/index.vue
+++ b/src/views/productionManagement/productionProcess/index.vue
@@ -492,8 +492,8 @@
       label: "鍙傛暟妯″紡",
       prop: "valueMode",
       dataType: "tag",
-      formatType: row => (row.valueMode === "1" ? "success" : "warning"),
-      formatData: row => (row.valueMode === "1" ? "鍗曞��" : "鍖洪棿"),
+      formatType: row => (row == "1" ? "success" : "warning"),
+      formatData: row => (row == "1" ? "鍗曞��" : "鍖洪棿"),
     },
     {
       label: "鍙傛暟绫诲瀷",

--
Gitblit v1.9.3