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

---
 src/views/index.vue |  253 +++++++++++++++++++++++++++++++++++++++++++------
 1 files changed, 219 insertions(+), 34 deletions(-)

diff --git a/src/views/index.vue b/src/views/index.vue
index bd0d274..cf17886 100644
--- a/src/views/index.vue
+++ b/src/views/index.vue
@@ -61,13 +61,21 @@
         </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="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>
+          <Echarts :chartStyle="chartStyle"
+                   :grid="grid"
+                   :tooltip="barTooltip"
+                   :xAxis="salesAmountXAxis"
+                   :yAxis="salesAmountYAxis"
+                   :series="salesAmountSeries"
+                   style="height: 90%" />
         </section>
       </div>
       <div class="right-col">
@@ -160,37 +168,50 @@
         </section> -->
         <section class="section-card mini-table-wrap"
                  v-if="isSectionVisible('planTable')">
-          <div class="section-title">鐢熶骇璁″垝鎵ц鏄庣粏</div>
-          <el-table :data="planTable"
+          <div class="section-title">鏈�杩戞姤宸�</div>
+          <el-table :data="reportingTable"
                     size="small"
-                    stripe>
-            <el-table-column prop="planNo"
-                             label="璁″垝鍗曞彿"
+                    stripe
+                    :loading="reportingTableLoading">
+            <el-table-column prop="productNo"
+                             label="鎶ュ伐缂栧彿"
                              min-width="150" />
-            <el-table-column prop="product"
-                             label="浜у搧"
-                             min-width="120" />
-            <el-table-column prop="qty"
-                             label="璁″垝閲�"
-                             min-width="90" />
-            <el-table-column prop="issued"
-                             label="宸蹭笅鍙�"
-                             min-width="90" />
-            <el-table-column prop="status"
-                             label="鐘舵��"
+            <el-table-column prop="schedule"
+                             label="鐝粍"
+                             min-width="80">
+              <template #default="{ row }">
+                <el-tag :type="row.schedule === '鐧界彮' ? 'primary' : 'warning'">{{ row.schedule || '-' }}</el-tag>
+              </template>
+            </el-table-column>
+            <el-table-column prop="postName"
+                             label="鍒涘缓浜�"
                              min-width="100" />
-            <el-table-column label="鎿嶄綔"
+            <el-table-column prop="createTime"
+                             label="鎶ュ伐鏃堕棿"
+                             min-width="150">
+              <template #default="{ row }">
+                {{ row.createTime ? dayjs(row.createTime).format('YYYY-MM-DD HH:mm:ss') : '' }}
+              </template>
+            </el-table-column>
+            <el-table-column prop="productName"
+                             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>
+                <el-tag :type="row.productName === '鐮屽潡' ? 'primary' : 'warning'">{{ row.productName || '-' }}</el-tag>
+              </template>
+            </el-table-column>
+            <el-table-column prop="totalQuantity"
+                             label="鐢熶骇鏁伴噺"
+                             min-width="100">
+              <template #default="{ row }">
+                <span style="color:rgba(18, 148, 212, 0.8);">{{ row.totalQuantity || '-' }}</span> 鏂�
+              </template>
+            </el-table-column>
+            <el-table-column prop="quantity"
+                             label="鍚堟牸鏁伴噺"
+                             min-width="100">
+              <template #default="{ row }">
+                <span style="color:rgba(0, 228, 99, 0.8);">{{ row.quantity || '-' }}</span> 鏂�
               </template>
             </el-table-column>
           </el-table>
@@ -272,8 +293,12 @@
     processDataProductionStatistics,
     qualityInspectionStatistics,
     nonComplianceWarning,
+    getManageStatistics,
   } from "@/api/viewIndex.js";
   import { energyConsumptionDetailStatistics } from "@/api/energyManagement/energyType";
+  import { getSalesAmountAnalysis } from "@/api/reportAnalysis/salesStatistics";
+  import { productionReportListPage } from "@/api/productionManagement/productionReporting.js";
+  import dayjs from "dayjs";
 
   const router = useRouter();
   const userStore = useUserStore();
@@ -456,8 +481,8 @@
     { name: "宸插畬鎴愯鍗曟暟", value: "-" },
     { name: "鏈畬鎴愯鍗曟暟", value: "-" },
     { name: "閮ㄥ垎瀹屾垚璁㈠崟鏁�", value: "-" },
-    { name: "璐ㄦ鎬绘暟", value: "-" },
-    { name: "杩囩▼妫�鎬绘暟", value: "-" },
+    { name: "鏉ユ枡妫�鎬绘暟", value: "-" },
+    // { name: "杩囩▼妫�鎬绘暟", value: "-" },
   ]);
 
   const pendingTasks = reactive([]);
@@ -572,6 +597,119 @@
     },
   ]);
 
+  // 閿�鍞噾棰濆浘琛�
+  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,
@@ -662,7 +800,33 @@
       });
   };
 
-  const planTable = reactive([]);
+  // 鎶ュ伐琛ㄦ牸鏁版嵁
+  const reportingTable = ref([]);
+  const reportingTableLoading = ref(false);
+
+  // 鑾峰彇鏈�杩戞姤宸ユ暟鎹�
+  const fetchReportingData = () => {
+    reportingTableLoading.value = true;
+    productionReportListPage({
+      current: 1,
+      size: 5, // 鍙樉绀烘渶杩�5鏉�
+    })
+      .then(res => {
+        if (res.code === 200) {
+          console.log(res.data.records || []);
+          reportingTable.value = res.data.records || [];
+        } else {
+          reportingTable.value = [];
+        }
+      })
+      .catch(error => {
+        console.error("鑾峰彇鎶ュ伐鏁版嵁澶辫触:", error);
+        reportingTable.value = [];
+      })
+      .finally(() => {
+        reportingTableLoading.value = false;
+      });
+  };
   const recentTrendCards = reactive([
     {
       key: "planIssued",
@@ -1093,6 +1257,24 @@
     //   console.error("expenseCompositionAnalysis鎺ュ彛鑾峰彇澶辫触:", error);
     // }
   };
+  const loadManageStatistics = async () => {
+    try {
+      const res = await getManageStatistics();
+      const data = res?.data || {};
+      businessFocus[0].value = `${pickFirstNumber(data, ["total"])} 鏉;
+      businessFocus[1].value = `${pickFirstNumber(data, ["completed"])} 鏉;
+      businessFocus[2].value = `${pickFirstNumber(data, ["uncompleted"])} 鏉;
+      businessFocus[3].value = `${pickFirstNumber(data, [
+        "partialCompleted",
+      ])} 鏉;
+      businessFocus[4].value = `${pickFirstNumber(data, [
+        "materialInspection",
+      ])} 鏉;
+      // businessFocus[5].value = `${pickFirstNumber(data, [""])} 鏉;
+    } catch (error) {
+      console.error("manageStatistics鎺ュ彛鑾峰彇澶辫触:", error);
+    }
+  };
 
   const refreshDashboardData = () => {
     // loadHomeTodos();
@@ -1101,7 +1283,10 @@
     // loadQualityData();
     // loadCostComposition();
     // loadWarningCenter();
+    loadManageStatistics();
     updateEnergyTypeChart();
+    fetchSalesAmountChartData();
+    fetchReportingData();
     lastUpdatedAt.value = new Date().toLocaleString();
   };
 

--
Gitblit v1.9.3