From 5bd6b1f66c29b099c3dca5855607a16e9e18f0ea Mon Sep 17 00:00:00 2001
From: zhangwencui <1064582902@qq.com>
Date: 星期三, 01 四月 2026 16:40:19 +0800
Subject: [PATCH] el-empty文字修改

---
 src/views/index.vue |  475 +++++++++++++++++++++++++++++++++--------------------------
 1 files changed, 264 insertions(+), 211 deletions(-)

diff --git a/src/views/index.vue b/src/views/index.vue
index 03bda77..65babe5 100644
--- a/src/views/index.vue
+++ b/src/views/index.vue
@@ -16,9 +16,9 @@
                    type="primary"
                    plain
                    @click="refreshDashboardData">鍒锋柊鏁版嵁</el-button>
-        <el-button size="small"
+        <!-- <el-button size="small"
                    plain
-                   @click="configDialogVisible = true">棣栭〉閰嶇疆</el-button>
+                   @click="configDialogVisible = true">棣栭〉閰嶇疆</el-button> -->
       </div>
     </div>
     <div class="content-grid">
@@ -40,7 +40,7 @@
             </el-button>
           </div>
         </section>
-        <section class="section-card">
+        <!-- <section class="section-card">
           <div class="section-title">閲嶇偣寰呭姙</div>
           <div class="todo-row"
                v-for="todo in todos"
@@ -49,7 +49,7 @@
                     :type="todo.type">{{ todo.level }}</el-tag>
             <span>{{ todo.title }}</span>
           </div>
-        </section>
+        </section> -->
         <section class="section-card">
           <div class="section-title">缁忚惀鍏虫敞</div>
           <div class="focus-row"
@@ -157,11 +157,10 @@
           </section>
           <section class="section-card"
                    v-if="isSectionVisible('costChart')">
-            <div class="section-title">鑳借�椾笌鎴愭湰缁撴瀯</div>
+            <div class="section-title">鑳借�楃被鍨嬪崰姣�</div>
             <Echarts :chartStyle="chartStyle"
-                     :legend="costLegend"
                      :tooltip="pieTooltip"
-                     :series="costSeries"
+                     :series="energyTypeSeries"
                      style="height: 260px" />
           </section>
         </div>
@@ -543,6 +542,61 @@
     },
   ]);
 
+  // 鑳借�楃被鍨嬪崰姣旀暟鎹�
+  const energyTypeSeries = reactive([
+    {
+      type: "pie",
+      radius: ["40%", "70%"],
+      center: ["50%", "50%"],
+      avoidLabelOverlap: false,
+      itemStyle: {
+        borderRadius: 10,
+        borderColor: "#fff",
+        borderWidth: 2,
+      },
+      label: {
+        show: true,
+        formatter: "{b}: {d}%",
+      },
+      data: [
+        { value: 0, name: "姘�", itemStyle: { color: "#409EFF" } },
+        { value: 0, name: "鐢�", itemStyle: { color: "#E6A23C" } },
+        { value: 0, name: "姘�", itemStyle: { color: "#F56C6C" } },
+      ],
+    },
+  ]);
+
+  // 妯℃嫙鑳借�楁暟鎹�
+  const energyData = reactive({
+    water: 120,
+    electricity: 350,
+    gas: 80,
+  });
+
+  // 鏇存柊鑳借�楃被鍨嬪崰姣斿浘琛�
+  const updateEnergyTypeChart = () => {
+    const { water, electricity, gas } = energyData;
+    const total = water + electricity + gas;
+
+    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" },
+      },
+    ];
+  };
+
   const planTable = reactive([]);
   const recentTrendCards = reactive([
     {
@@ -715,102 +769,100 @@
   };
 
   const loadHomeTodos = async () => {
-    try {
-      const res = await homeTodos();
-      const list = Array.isArray(res?.data) ? res.data : [];
-      const mapped = list.slice(0, 4).map((item, idx) => {
-        const text =
-          item?.approveReason || item?.approveTypeName || `寰呭鐞嗕簨椤� ${idx + 1}`;
-        const levelType = idx === 0 ? "danger" : idx <= 2 ? "warning" : "success";
-        const level = idx === 0 ? "楂�" : idx <= 2 ? "涓�" : "浣�";
-        return { level, title: text, type: levelType };
-      });
-      updateArray(todos, mapped);
-      const pendingMapped = list.slice(0, 4).map((item, idx) => {
-        const title =
-          item?.approveReason || item?.approveTypeName || `寰呭鐞嗕簨椤� ${idx + 1}`;
-        const path = inferTodoPath(item);
-        return {
-          id: item?.id || `${idx}-${title}`,
-          title,
-          level: idx === 0 ? "楂�" : idx <= 2 ? "涓�" : "浣�",
-          type: idx === 0 ? "danger" : idx <= 2 ? "warning" : "success",
-          path,
-          ownerId: item?.approveUserId || item?.userId || "",
-          ownerName: item?.approveUserName || item?.userName || "",
-        };
-      });
-      updateArray(pendingTasks, pendingMapped);
-    } catch (error) {
-      console.error("homeTodos鎺ュ彛鑾峰彇澶辫触:", error);
-    }
+    // try {
+    //   const res = await homeTodos();
+    //   const list = Array.isArray(res?.data) ? res.data : [];
+    //   const mapped = list.slice(0, 4).map((item, idx) => {
+    //     const text =
+    //       item?.approveReason || item?.approveTypeName || `寰呭鐞嗕簨椤� ${idx + 1}`;
+    //     const levelType = idx === 0 ? "danger" : idx <= 2 ? "warning" : "success";
+    //     const level = idx === 0 ? "楂�" : idx <= 2 ? "涓�" : "浣�";
+    //     return { level, title: text, type: levelType };
+    //   });
+    //   updateArray(todos, mapped);
+    //   const pendingMapped = list.slice(0, 4).map((item, idx) => {
+    //     const title =
+    //       item?.approveReason || item?.approveTypeName || `寰呭鐞嗕簨椤� ${idx + 1}`;
+    //     const path = inferTodoPath(item);
+    //     return {
+    //       id: item?.id || `${idx}-${title}`,
+    //       title,
+    //       level: idx === 0 ? "楂�" : idx <= 2 ? "涓�" : "浣�",
+    //       type: idx === 0 ? "danger" : idx <= 2 ? "warning" : "success",
+    //       path,
+    //       ownerId: item?.approveUserId || item?.userId || "",
+    //       ownerName: item?.approveUserName || item?.userName || "",
+    //     };
+    //   });
+    //   updateArray(pendingTasks, pendingMapped);
+    // } catch (error) {
+    //   console.error("homeTodos鎺ュ彛鑾峰彇澶辫触:", error);
+    // }
   };
 
   const loadOrderAndProgress = async () => {
-    try {
-      const [orderRes, progressRes] = await Promise.allSettled([
-        orderCount(),
-        getProgressStatistics(),
-      ]);
-
-      if (orderRes.status === "fulfilled") {
-        const items = Array.isArray(orderRes.value?.data)
-          ? orderRes.value.data
-          : [];
-        const byName = Object.fromEntries(
-          items.map(i => [String(i?.name || "").replace(/\s/g, ""), i?.value])
-        );
-        businessFocus[0].value = `${
-          pickFirstNumber(byName, ["鐢熶骇璁㈠崟鏁�", "鐢熶骇璁㈠崟鎬绘暟", "鎬昏鍗曟暟"]) || 0
-        } 鍗昤;
-        businessFocus[1].value = `${
-          pickFirstNumber(byName, ["宸插畬鎴愯鍗曟暟"]) || 0
-        } 鍗昤;
-        businessFocus[2].value = `${
-          pickFirstNumber(byName, ["寰呯敓浜ц鍗曟暟", "鏈畬鎴愯鍗曟暟"]) || 0
-        } 鍗昤;
-        businessFocus[3].value = `${
-          pickFirstNumber(byName, ["閮ㄥ垎瀹屾垚璁㈠崟鏁�"]) || 0
-        } 鍗昤;
-      }
-
-      if (progressRes.status === "fulfilled") {
-        const p = progressRes.value?.data || {};
-        const detail = Array.isArray(p.completedOrderDetails)
-          ? p.completedOrderDetails
-          : [];
-        const rows = detail.slice(0, 6).map((item, index) => {
-          const qty = pickFirstNumber(item, ["quantity", "planQuantity"]);
-          const done = pickFirstNumber(item, [
-            "completeQuantity",
-            "completedQuantity",
-          ]);
-          return {
-            planNo: item.npsNo || item.productionPlanNo || `NO-${index + 1}`,
-            product: item.productCategory || item.productName || "-",
-            qty,
-            issued: done,
-            status:
-              qty > 0 && done >= qty ? "宸插畬鎴�" : done > 0 ? "鎵ц涓�" : "寰呬笅鍙�",
-          };
-        });
-        updateArray(planTable, rows);
-        setTrendCard(
-          "planIssued",
-          detail
-            .slice(-7)
-            .map(i =>
-              pickFirstNumber(i, [
-                "completeQuantity",
-                "completedQuantity",
-                "issueNum",
-              ])
-            )
-        );
-      }
-    } catch (error) {
-      console.error("orderCount/getProgressStatistics鎺ュ彛鑾峰彇澶辫触:", error);
-    }
+    // try {
+    //   const [orderRes, progressRes] = await Promise.allSettled([
+    //     orderCount(),
+    //     getProgressStatistics(),
+    //   ]);
+    //   if (orderRes.status === "fulfilled") {
+    //     const items = Array.isArray(orderRes.value?.data)
+    //       ? orderRes.value.data
+    //       : [];
+    //     const byName = Object.fromEntries(
+    //       items.map(i => [String(i?.name || "").replace(/\s/g, ""), i?.value])
+    //     );
+    //     businessFocus[0].value = `${
+    //       pickFirstNumber(byName, ["鐢熶骇璁㈠崟鏁�", "鐢熶骇璁㈠崟鎬绘暟", "鎬昏鍗曟暟"]) || 0
+    //     } 鍗昤;
+    //     businessFocus[1].value = `${
+    //       pickFirstNumber(byName, ["宸插畬鎴愯鍗曟暟"]) || 0
+    //     } 鍗昤;
+    //     businessFocus[2].value = `${
+    //       pickFirstNumber(byName, ["寰呯敓浜ц鍗曟暟", "鏈畬鎴愯鍗曟暟"]) || 0
+    //     } 鍗昤;
+    //     businessFocus[3].value = `${
+    //       pickFirstNumber(byName, ["閮ㄥ垎瀹屾垚璁㈠崟鏁�"]) || 0
+    //     } 鍗昤;
+    //   }
+    //   if (progressRes.status === "fulfilled") {
+    //     const p = progressRes.value?.data || {};
+    //     const detail = Array.isArray(p.completedOrderDetails)
+    //       ? p.completedOrderDetails
+    //       : [];
+    //     const rows = detail.slice(0, 6).map((item, index) => {
+    //       const qty = pickFirstNumber(item, ["quantity", "planQuantity"]);
+    //       const done = pickFirstNumber(item, [
+    //         "completeQuantity",
+    //         "completedQuantity",
+    //       ]);
+    //       return {
+    //         planNo: item.npsNo || item.productionPlanNo || `NO-${index + 1}`,
+    //         product: item.productCategory || item.productName || "-",
+    //         qty,
+    //         issued: done,
+    //         status:
+    //           qty > 0 && done >= qty ? "宸插畬鎴�" : done > 0 ? "鎵ц涓�" : "寰呬笅鍙�",
+    //       };
+    //     });
+    //     updateArray(planTable, rows);
+    //     setTrendCard(
+    //       "planIssued",
+    //       detail
+    //         .slice(-7)
+    //         .map(i =>
+    //           pickFirstNumber(i, [
+    //             "completeQuantity",
+    //             "completedQuantity",
+    //             "issueNum",
+    //           ])
+    //         )
+    //     );
+    //   }
+    // } catch (error) {
+    //   console.error("orderCount/getProgressStatistics鎺ュ彛鑾峰彇澶辫触:", error);
+    // }
   };
 
   const inferTodoPath = todo => {
@@ -827,112 +879,112 @@
   };
 
   const loadPlanTrend = async () => {
-    try {
-      const res = await processDataProductionStatistics({
-        type: chartRangePlan.value,
-      });
-      const list = Array.isArray(res?.data) ? res.data : [];
-      planXAxis[0].data = list.map(
-        (i, index) => i.processName || `宸ュ簭${index + 1}`
-      );
-      planSeries[0].data = list.map(i =>
-        pickFirstNumber(i, ["totalInput", "input", "planNum"])
-      );
-      planSeries[1].data = list.map(i =>
-        pickFirstNumber(i, ["totalOutput", "output", "issueNum"])
-      );
-      planSeries[2].data = list.map(i =>
-        pickFirstNumber(i, ["totalScrap", "scrap", "completeNum"])
-      );
-    } catch (error) {
-      console.error("processDataProductionStatistics鎺ュ彛鑾峰彇澶辫触:", error);
-    }
+    // try {
+    //   const res = await processDataProductionStatistics({
+    //     type: chartRangePlan.value,
+    //   });
+    //   const list = Array.isArray(res?.data) ? res.data : [];
+    //   planXAxis[0].data = list.map(
+    //     (i, index) => i.processName || `宸ュ簭${index + 1}`
+    //   );
+    //   planSeries[0].data = list.map(i =>
+    //     pickFirstNumber(i, ["totalInput", "input", "planNum"])
+    //   );
+    //   planSeries[1].data = list.map(i =>
+    //     pickFirstNumber(i, ["totalOutput", "output", "issueNum"])
+    //   );
+    //   planSeries[2].data = list.map(i =>
+    //     pickFirstNumber(i, ["totalScrap", "scrap", "completeNum"])
+    //   );
+    // } catch (error) {
+    //   console.error("processDataProductionStatistics鎺ュ彛鑾峰彇澶辫触:", error);
+    // }
   };
 
   const loadQualityData = async () => {
-    try {
-      const res = await qualityInspectionStatistics({
-        type: chartRangeQuality.value,
-      });
-      const data = res?.data || {};
-      const items = Array.isArray(data.item) ? data.item : [];
-      if (items.length > 0) {
-        qualityXAxis[0].data = items.map(i => i.date || i.name || "-");
-        qualitySeries[0].data = items.map(i =>
-          pickFirstNumber(i, [
-            "supplierNum",
-            "processNum",
-            "factoryNum",
-            "totalNum",
-          ])
-        );
-        setTrendCard(
-          "qualityRaw",
-          items.map(i => pickFirstNumber(i, ["supplierNum"]))
-        );
-        setTrendCard(
-          "qualityProcess",
-          items.map(i => pickFirstNumber(i, ["processNum"]))
-        );
-        setTrendCard(
-          "qualityFactory",
-          items.map(i => pickFirstNumber(i, ["factoryNum"]))
-        );
-      } else {
-        qualityXAxis[0].data = ["鏉ユ枡妫�", "杩囩▼妫�", "鎴愬搧妫�"];
-        qualitySeries[0].data = [
-          pickFirstNumber(data, ["supplierNum"]),
-          pickFirstNumber(data, ["processNum"]),
-          pickFirstNumber(data, ["factoryNum"]),
-        ];
-        setTrendCard("qualityRaw", [pickFirstNumber(data, ["supplierNum"])]);
-        setTrendCard("qualityProcess", [pickFirstNumber(data, ["processNum"])]);
-        setTrendCard("qualityFactory", [pickFirstNumber(data, ["factoryNum"])]);
-      }
-      businessFocus[4].value = `${pickFirstNumber(data, [
-        "supplierNum",
-        "totalNum",
-      ])} 鏉;
-      businessFocus[5].value = `${pickFirstNumber(data, ["processNum"])} 鏉;
-    } catch (error) {
-      console.error("qualityInspectionStatistics鎺ュ彛鑾峰彇澶辫触:", error);
-    }
+    // try {
+    //   const res = await qualityInspectionStatistics({
+    //     type: chartRangeQuality.value,
+    //   });
+    //   const data = res?.data || {};
+    //   const items = Array.isArray(data.item) ? data.item : [];
+    //   if (items.length > 0) {
+    //     qualityXAxis[0].data = items.map(i => i.date || i.name || "-");
+    //     qualitySeries[0].data = items.map(i =>
+    //       pickFirstNumber(i, [
+    //         "supplierNum",
+    //         "processNum",
+    //         "factoryNum",
+    //         "totalNum",
+    //       ])
+    //     );
+    //     setTrendCard(
+    //       "qualityRaw",
+    //       items.map(i => pickFirstNumber(i, ["supplierNum"]))
+    //     );
+    //     setTrendCard(
+    //       "qualityProcess",
+    //       items.map(i => pickFirstNumber(i, ["processNum"]))
+    //     );
+    //     setTrendCard(
+    //       "qualityFactory",
+    //       items.map(i => pickFirstNumber(i, ["factoryNum"]))
+    //     );
+    //   } else {
+    //     qualityXAxis[0].data = ["鏉ユ枡妫�", "杩囩▼妫�", "鎴愬搧妫�"];
+    //     qualitySeries[0].data = [
+    //       pickFirstNumber(data, ["supplierNum"]),
+    //       pickFirstNumber(data, ["processNum"]),
+    //       pickFirstNumber(data, ["factoryNum"]),
+    //     ];
+    //     setTrendCard("qualityRaw", [pickFirstNumber(data, ["supplierNum"])]);
+    //     setTrendCard("qualityProcess", [pickFirstNumber(data, ["processNum"])]);
+    //     setTrendCard("qualityFactory", [pickFirstNumber(data, ["factoryNum"])]);
+    //   }
+    //   businessFocus[4].value = `${pickFirstNumber(data, [
+    //     "supplierNum",
+    //     "totalNum",
+    //   ])} 鏉;
+    //   businessFocus[5].value = `${pickFirstNumber(data, ["processNum"])} 鏉;
+    // } catch (error) {
+    //   console.error("qualityInspectionStatistics鎺ュ彛鑾峰彇澶辫触:", error);
+    // }
   };
 
   const loadWarningCenter = async () => {
-    try {
-      const res = await nonComplianceWarning();
-      const list = Array.isArray(res?.data) ? res.data : [];
-      const mapped = list.slice(0, 6).map((item, idx) => {
-        const levelNum = toNumber(item.level ?? item.warningLevel ?? 2);
-        const levelType =
-          levelNum >= 3 ? "danger" : levelNum === 2 ? "warning" : "info";
-        const levelText = levelNum >= 3 ? "楂�" : levelNum === 2 ? "涓�" : "浣�";
-        const title =
-          item.name || item.title || item.paramName || `寮傚父棰勮 ${idx + 1}`;
-        const text = `${title}${item.processName || ""}${
-          item.orderNo || ""
-        }`.toLowerCase();
-        const path = text.includes("璐ㄦ")
-          ? routePathMap.processInspection
-          : text.includes("璁㈠崟")
-          ? routePathMap.order
-          : routePathMap.processInspection ||
-            routePathMap.order ||
-            routePathMap.plan;
-        return {
-          id: item.id || `${idx}-${title}`,
-          levelType,
-          levelText,
-          title,
-          path,
-        };
-      });
-      updateArray(warningList, mapped);
-    } catch (error) {
-      console.error("nonComplianceWarning鎺ュ彛鑾峰彇澶辫触:", error);
-      updateArray(warningList, []);
-    }
+    // try {
+    //   const res = await nonComplianceWarning();
+    //   const list = Array.isArray(res?.data) ? res.data : [];
+    //   const mapped = list.slice(0, 6).map((item, idx) => {
+    //     const levelNum = toNumber(item.level ?? item.warningLevel ?? 2);
+    //     const levelType =
+    //       levelNum >= 3 ? "danger" : levelNum === 2 ? "warning" : "info";
+    //     const levelText = levelNum >= 3 ? "楂�" : levelNum === 2 ? "涓�" : "浣�";
+    //     const title =
+    //       item.name || item.title || item.paramName || `寮傚父棰勮 ${idx + 1}`;
+    //     const text = `${title}${item.processName || ""}${
+    //       item.orderNo || ""
+    //     }`.toLowerCase();
+    //     const path = text.includes("璐ㄦ")
+    //       ? routePathMap.processInspection
+    //       : text.includes("璁㈠崟")
+    //       ? routePathMap.order
+    //       : routePathMap.processInspection ||
+    //         routePathMap.order ||
+    //         routePathMap.plan;
+    //     return {
+    //       id: item.id || `${idx}-${title}`,
+    //       levelType,
+    //       levelText,
+    //       title,
+    //       path,
+    //     };
+    //   });
+    //   updateArray(warningList, mapped);
+    // } catch (error) {
+    //   console.error("nonComplianceWarning鎺ュ彛鑾峰彇澶辫触:", error);
+    //   updateArray(warningList, []);
+    // }
   };
 
   const initSectionConfig = () => {
@@ -964,17 +1016,17 @@
   };
 
   const loadCostComposition = async () => {
-    try {
-      const res = await expenseCompositionAnalysis({ type: 1 });
-      const list = Array.isArray(res?.data) ? res.data : [];
-      const mapped = list.map(i => ({
-        name: i.name || "鏈懡鍚�",
-        value: pickFirstNumber(i, ["value", "amount", "cost"]),
-      }));
-      costSeries[0].data = mapped;
-    } catch (error) {
-      console.error("expenseCompositionAnalysis鎺ュ彛鑾峰彇澶辫触:", error);
-    }
+    // try {
+    //   const res = await expenseCompositionAnalysis({ type: 1 });
+    //   const list = Array.isArray(res?.data) ? res.data : [];
+    //   const mapped = list.map(i => ({
+    //     name: i.name || "鏈懡鍚�",
+    //     value: pickFirstNumber(i, ["value", "amount", "cost"]),
+    //   }));
+    //   costSeries[0].data = mapped;
+    // } catch (error) {
+    //   console.error("expenseCompositionAnalysis鎺ュ彛鑾峰彇澶辫触:", error);
+    // }
   };
 
   const refreshDashboardData = () => {
@@ -984,6 +1036,7 @@
     loadQualityData();
     loadCostComposition();
     loadWarningCenter();
+    updateEnergyTypeChart();
     lastUpdatedAt.value = new Date().toLocaleString();
   };
 

--
Gitblit v1.9.3