From 0837953f5738cbe555da6d9e1fdc995ac8d126f5 Mon Sep 17 00:00:00 2001 From: Gary Gu <garygu@Garydebijibendiannao.local> Date: Wed, 28 May 2025 10:51:19 +0800 Subject: [PATCH] feat: 获取人员数据对接 --- src/api/home.js | 5 +++++ src/views/EquipmentView.vue | 32 +++++++++++++++++++++++++++++--- 2 files changed, 34 insertions(+), 3 deletions(-) diff --git a/src/api/home.js b/src/api/home.js index 50b0d63..46af30e 100644 --- a/src/api/home.js +++ b/src/api/home.js @@ -68,4 +68,9 @@ params: data, }); }, + GetJSCUserManage: (data) => { + return http.get("/api/jsc/JSCManage/GetJSCUserManage", { + params: data, + }); + }, }; diff --git a/src/views/EquipmentView.vue b/src/views/EquipmentView.vue index 54e3d41..ed32f55 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> @@ -186,6 +186,7 @@ data() { return { evnData: {}, + userData: {}, deviceSelected: "", options: [], backgroundImage: new URL("@/assets/images/backgrounds/cover_bg.png", import.meta.url).href, @@ -490,6 +491,7 @@ // 处理数据变化的逻辑 this.getDeviceTypes(newVal); this.getEnvData(newVal); + this.getUserData(newVal); }, deep: true, // 深度监听对象内部变化 immediate: true, // 立即执行一次 @@ -504,6 +506,30 @@ handleSelectChange(val) { this.getDeviceState(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