From e2a92db057ef2153f3e645e074f1e771987b2051 Mon Sep 17 00:00:00 2001
From: Gary Gu <garygu@Garydebijibendiannao.local>
Date: Fri, 30 May 2025 10:35:53 +0800
Subject: [PATCH] feat: 优化数据

---
 src/views/EquipmentView.vue |   59 ++++++++++++++++++++++++++++++++++++++++++++++++-----------
 1 files changed, 48 insertions(+), 11 deletions(-)

diff --git a/src/views/EquipmentView.vue b/src/views/EquipmentView.vue
index 54e3d41..d36e47c 100644
--- a/src/views/EquipmentView.vue
+++ b/src/views/EquipmentView.vue
@@ -18,21 +18,21 @@
               <img class="w-[24px] h-[24px]" src="../assets/images/backgrounds/shishirenshu.png" alt="" />
               <span class="satalabel ml-[8px]">实时人数</span>
             </div>
-            <div class="value text-[#00FFFF] text-[28px] font-bold">62</div>
+            <div class="value text-[#00FFFF] text-[28px] font-bold">{{ userData.RealtimeUserNumber }}</div>
           </div>
           <div class="stat-item mb-[10px]">
             <div class="stat-info">
               <img class="w-[24px] h-[24px]" src="../assets/images/backgrounds/people.png" alt="" />
               <span class="satalabel ml-[8px]">今日累计/人次</span>
             </div>
-            <div class="value text-[#FFD500] text-[28px] font-bold">62</div>
+            <div class="value text-[#FFD500] text-[28px] font-bold">{{ userData.TodayUserNumber }}</div>
           </div>
           <div class="stat-item">
             <div class="stat-info">
               <img class="w-[24px] h-[24px]" src="../assets/images/backgrounds/zaigang.png" alt="" />
               <span class="satalabel ml-[8px]">在岗总数</span>
             </div>
-            <div class="value text-[#FFD500] text-[28px] font-bold">62</div>
+            <div class="value text-[#FFD500] text-[28px] font-bold">{{ userData.DutyUserTotle }}</div>
           </div>
         </div>
       </div>
@@ -185,7 +185,19 @@
     },
     data() {
       return {
-        evnData: {},
+        evnData: {
+          Tmp: "0",
+          Rh: "0",
+          Pm25: "0",
+          Pm10: "0",
+          Ws: "0",
+          Wd: "无",
+        },
+        userData: {
+          RealtimeUserNumber: 0,
+          TodayUserNumber: 0,
+          DutyUserTotle: 0,
+        },
         deviceSelected: "",
         options: [],
         backgroundImage: new URL("@/assets/images/backgrounds/cover_bg.png", import.meta.url).href,
@@ -268,14 +280,14 @@
                   },
                   data: [
                     {
-                      value: 81.5,
+                      value: 0,
                       name: "",
                       itemStyle: {
                         color: "#00FFFF",
                       },
                     },
                     {
-                      value: 18.5,
+                      value: 100,
                       name: "",
                       itemStyle: {
                         color: "transparent",
@@ -356,14 +368,14 @@
                   },
                   data: [
                     {
-                      value: 33,
+                      value: 0,
                       name: "",
                       itemStyle: {
                         color: "#00FFFF",
                       },
                     },
                     {
-                      value: 77,
+                      value: 100,
                       name: "",
                       itemStyle: {
                         color: "transparent",
@@ -444,14 +456,14 @@
                   },
                   data: [
                     {
-                      value: 20,
+                      value: 0,
                       name: "",
                       itemStyle: {
                         color: "#00FFFF",
                       },
                     },
                     {
-                      value: 80,
+                      value: 100,
                       name: "",
                       itemStyle: {
                         color: "transparent",
@@ -490,6 +502,7 @@
           // 处理数据变化的逻辑
           this.getDeviceTypes(newVal);
           this.getEnvData(newVal);
+          this.getUserData(newVal);
         },
         deep: true, // 深度监听对象内部变化
         immediate: true, // 立即执行一次
@@ -503,7 +516,31 @@
        */
       handleSelectChange(val) {
         this.getDeviceState(val);
-        this.getEnvData(val);
+        // this.getEnvData(val);
+        // this.getUserData(val);
+      },
+      /**
+       * 获取人员数据
+       * @param bindId
+       */
+      getUserData(bindId) {
+        const params = {
+          bindId,
+        };
+        HomeAPI.GetJSCUserManage(params).then((res) => {
+          if (res.Ret === 1) {
+            const result = res.Data;
+            if (result) {
+              this.userData = result;
+            } else {
+              this.userData = {
+                RealtimeUserNumber: 0,
+                TodayUserNumber: 0,
+                DutyUserTotle: 0,
+              };
+            }
+          }
+        });
       },
       /**
        * 获取环境数据

--
Gitblit v1.9.3