From db5f15dfde6f8f520c911cec78765c573fab1500 Mon Sep 17 00:00:00 2001 From: ko1234 Date: Mon, 4 Aug 2025 15:13:18 +0800 Subject: [PATCH] =?UTF-8?q?=E7=B8=BD=E9=83=A8=E9=A6=96=E9=A0=81=20api=20?= =?UTF-8?q?=E4=B8=B2=E6=8E=A5=20|=20=20navbar=E8=AA=9E=E8=A8=80=E5=8C=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/apis/building/index.js | 6 +- src/apis/headquarters/api.js | 6 + src/apis/headquarters/index.js | 44 +++++ src/components/navbar/NavbarBuilding.vue | 18 ++- src/components/navbar/NavbarItem.vue | 30 ++-- src/config/cn.json | 12 ++ src/config/tw.json | 20 ++- src/config/us.json | 12 ++ src/constant/authPage.js | 20 --- src/router/index.js | 4 +- src/stores/useUserInfoStore.js | 1 - .../headquarters/HeadquartersManagement.vue | 10 +- .../headquarters/components/ElecCompare.vue | 152 +++++++----------- .../headquarters/components/ElecRank.vue | 79 ++++++--- .../headquarters/components/ElecTrends.vue | 128 ++++++--------- .../headquarters/components/SysProgress.vue | 97 ++++++----- .../components/SysProgressModal.vue | 132 +++++++++++++++ src/views/login/Login.vue | 2 +- 18 files changed, 475 insertions(+), 298 deletions(-) create mode 100644 src/apis/headquarters/api.js create mode 100644 src/apis/headquarters/index.js create mode 100644 src/views/headquarters/components/SysProgressModal.vue diff --git a/src/apis/building/index.js b/src/apis/building/index.js index 0c3579e..88a039e 100644 --- a/src/apis/building/index.js +++ b/src/apis/building/index.js @@ -39,9 +39,9 @@ export const deleteBuildings = async (building_guid) => { }); }; -export const getAuth = async (lang) => { +export const getAuth = async (build) => { const res = await instance.post(GET_AUTHPAGE_API, { - lang, + build, }); return apihandler(res.code, res.data, { msg: res.msg, @@ -50,7 +50,7 @@ export const getAuth = async (lang) => { }; export const getAllSysSidebar = async (building_guid) => { - const res = await instance.post(GET_SUBAUTHPAGE_API, {building_guid}); + const res = await instance.post(GET_SUBAUTHPAGE_API, { building_guid }); return apihandler(res.code, res.data, { msg: res.msg, code: res.code, diff --git a/src/apis/headquarters/api.js b/src/apis/headquarters/api.js new file mode 100644 index 0000000..517ce4f --- /dev/null +++ b/src/apis/headquarters/api.js @@ -0,0 +1,6 @@ +export const GET_SITES_SYSTEM_STATUS_API = `/api/monitoring/sites-system-status`; +export const GET_SITES_SYSTEM_ENERGY_COST_RANK_API = `/api/energy-manager/all-site/energy-cost-rank`; +export const GET_SITES_SYSTEM_ENERGY_COST_TREND_API = `/api/energy-manager/all-site/energy-cost-trend`; +export const GET_SITES_SYSTEM_ENERGY_COST_GROWTH_API = `/api/energy-manager/all-site/energy-cost-growth-rate`; + + diff --git a/src/apis/headquarters/index.js b/src/apis/headquarters/index.js new file mode 100644 index 0000000..8cd7485 --- /dev/null +++ b/src/apis/headquarters/index.js @@ -0,0 +1,44 @@ +import { + GET_SITES_SYSTEM_STATUS_API, + GET_SITES_SYSTEM_ENERGY_COST_RANK_API, + GET_SITES_SYSTEM_ENERGY_COST_TREND_API, + GET_SITES_SYSTEM_ENERGY_COST_GROWTH_API, +} from "./api"; +import instance from "@/util/request"; +import apihandler from "@/util/apihandler"; + +export const getSystemStatus = async (building_ids) => { + const res = await instance.post(GET_SITES_SYSTEM_STATUS_API, building_ids); + + return apihandler(res.code, res.data, { + msg: res.msg, + code: res.code, + }); +}; + +export const getSystemEnergyCostRank = async (building_ids) => { + const res = await instance.post(GET_SITES_SYSTEM_ENERGY_COST_RANK_API, building_ids); + + return apihandler(res.code, res.data, { + msg: res.msg, + code: res.code, + }); +}; + +export const getSystemEnergyCostTrend = async (building_ids) => { + const res = await instance.post(GET_SITES_SYSTEM_ENERGY_COST_TREND_API, building_ids); + + return apihandler(res.code, res.data, { + msg: res.msg, + code: res.code, + }); +} + +export const getSystemEnergyCostGrowth = async (building_ids) => { + const res = await instance.get(GET_SITES_SYSTEM_ENERGY_COST_GROWTH_API, building_ids); + + return apihandler(res.code, res.data, { + msg: res.msg, + code: res.code, + }); +} \ No newline at end of file diff --git a/src/components/navbar/NavbarBuilding.vue b/src/components/navbar/NavbarBuilding.vue index d36fb9d..aa1c472 100644 --- a/src/components/navbar/NavbarBuilding.vue +++ b/src/components/navbar/NavbarBuilding.vue @@ -1,9 +1,10 @@