From bb7f2e3ecbd47edfde477d742990bcbad3d601e1 Mon Sep 17 00:00:00 2001
From: yangfeng <wanwan926_4@163.com>
Date: 星期一, 04 十二月 2023 11:43:41 +0800
Subject: [PATCH] 接口联调及人员饼图模块样式优化

---
 src/views/cockpitPage/index.vue |  112 +++++++++++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 107 insertions(+), 5 deletions(-)

diff --git a/src/views/cockpitPage/index.vue b/src/views/cockpitPage/index.vue
index b9dc0ea..c090ee5 100644
--- a/src/views/cockpitPage/index.vue
+++ b/src/views/cockpitPage/index.vue
@@ -1,26 +1,128 @@
 <template>
   <BackgroundBoardLayout>
+    <template #leftBlock1>
+      <StatisticalBox :all-list="allList"></StatisticalBox>
+    </template>
+    <template #leftBlock2>
+      <MachineStartupRate></MachineStartupRate>
+    </template>
+    <template #leftBlock3>
+      <CountView :total-object="totalObject"></CountView>
+    </template>
+    <template #leftBlock4>
+      <OrderCompleteRadio></OrderCompleteRadio>
+    </template>
+    <template #leftBlock5>
+      <WorkOrderProgress></WorkOrderProgress>
+    </template>
+    <template #leftBlock6>
+      <PerSonnelProductivity></PerSonnelProductivity>
+    </template>
+    <template #rightBlock1>
+      <DeviceChart></DeviceChart>
+    </template>
+    <template #rightBlock2>
+      <MaterialChart></MaterialChart>
+    </template>
     <template #rightBlock3>
-      <BarChart @should-reload="reloadAllData"></BarChart>
+      <BarChart></BarChart>
     </template>
   </BackgroundBoardLayout>
 </template>
 
 <script>
+import StatisticalBox from "@/views/cockpitPage/components/StatisticalBox";
+import MachineStartupRate from "@/views/cockpitPage/components/MachineStartupRate";
+import CountView from "@/views/cockpitPage/components/CountView";
 import BackgroundBoardLayout from "@/components/cockpitPage/BackgroundBoardLayout.vue";
-import BarChart from "@/components/cockpitPage/BarChart.vue";
+import PerSonnelProductivity from "@/views/cockpitPage/components/PerSonnelProductivity.vue";
+import DeviceChart from "@/views/cockpitPage/components/DeviceChart.vue";
+import MaterialChart from "@/views/cockpitPage/components/MaterialChart.vue";
+import BarChart from "@/views/cockpitPage/components/BarChart.vue";
+import OrderCompleteRadio from "@/views/cockpitPage/components/OrderCompleteRadio";
+import WorkOrderProgress from "@/views/cockpitPage/components/WorkOrderProgress";
+import { getDashboard } from "@/api/cockpitPage/index";
 export default {
   components: {
+    StatisticalBox,
     BackgroundBoardLayout,
+    PerSonnelProductivity,
+    DeviceChart,
+    MaterialChart,
     BarChart,
+    MachineStartupRate,
+    CountView,
+    OrderCompleteRadio,
+    WorkOrderProgress,
   },
   props: {},
   data() {
-    return {};
+    return {
+      allList: [
+        { value: 0, label: "寮�鏈哄彴鏁�" },
+        { value: 0, label: "鎬讳骇閲�" },
+        { value: 0, label: "鐢熶骇宸ュ崟鏁�" },
+        { value: 0, label: "寤舵湡浜や粯" },
+        { value: 0, label: "鐗╂枡涓嶈冻" },
+        { value: 0, label: "璁″垝杈炬垚鐜�" },
+      ],
+      totalObject: {},
+    };
   },
-  mounted() {},
+  mounted() {
+    this.getDashboard();
+    setInterval(() => {
+      this.getDashboard();
+    }, 300000);
+  },
   watch: {},
-  methods: {},
+  methods: {
+    async getDashboard() {
+      await getDashboard().then((res) => {
+        console.log(res);
+        // 宸︿笂鏁板�肩粺璁℃暟鎹�
+        this.setLeftBlock1(res.data);
+        //  宸︿腑鏁版嵁缁熻鍊�
+        this.setLeftBlock3(res.data);
+      });
+    },
+    // 澶勭悊宸︿笂鏁版嵁
+    setLeftBlock1(data) {
+      this.allList.map((item) => {
+        if (item.label === "寮�鏈哄彴鏁�") {
+          item.value = data?.DeviceRunningAmount ?? 0;
+        } else if (item.label === "鎬讳骇閲�") {
+          item.value = data?.TotalProductionAmount ?? 0;
+        } else if (item.label === "鐢熶骇宸ュ崟鏁�") {
+          item.value = data?.WorkOrderAmount ?? 0;
+        } else if (item.label === "寤舵湡浜や粯") {
+          item.value = data?.DelayWorkOrderAmount ?? 0;
+        } else if (item.label === "鐗╂枡涓嶈冻") {
+          item.value = data?.MaterialMissWorkOrderAmount ?? 0;
+        } else if (item.label === "璁″垝杈炬垚鐜�") {
+          item.value =
+            typeof data?.PlanOrderFinishRate === "string"
+              ? parseFloat(
+                  data?.PlanOrderFinishRate.length > 0
+                    ? data?.PlanOrderFinishRate
+                    : "0"
+                )
+              : data?.PlanOrderFinishRate ?? 0;
+        }
+      });
+    },
+    // 宸︿腑鏁版嵁缁熻鍊�
+    setLeftBlock3(data) {
+      this.totalObject = {
+        InternalDeviceRunningAmount: data?.InternalDeviceRunningAmount ?? 0,
+        ExternalDeviceRunningAmount: data?.ExternalDeviceRunningAmount ?? 0,
+        OutPlanProductionAmount: data?.OutPlanProductionAmount ?? 0,
+        PlanProductionAmount: data?.PlanProductionAmount ?? 0,
+        RealExternalProductionAmount: data?.RealExternalProductionAmount ?? 0,
+        RealProductionAmount: data?.RealProductionAmount ?? 0,
+      };
+    },
+  },
 };
 </script>
 

--
Gitblit v1.8.0