diff --git a/public/CviLux_globalmap.png b/public/CviLux_globalmap.png new file mode 100644 index 0000000..eeb3b99 Binary files /dev/null and b/public/CviLux_globalmap.png differ diff --git a/src/apis/building/api.js b/src/apis/building/api.js index b71612b..7692b1a 100644 --- a/src/apis/building/api.js +++ b/src/apis/building/api.js @@ -4,3 +4,4 @@ export const DELETE_BUILDING_API = `/AssetManage/DeleteBuilding`; export const GET_AUTHPAGE_API = `/api/GetUsrFroList`; export const GET_SUBAUTHPAGE_API = `/api/Device/GetMainSub`; export const GET_ALL_DEVICE_API = `/api/Device/GetAllDevice`; +export const GET_FUNCTION_LIST_API = `/api/function/get-function-list`; diff --git a/src/apis/building/index.js b/src/apis/building/index.js index 88a039e..f232ff2 100644 --- a/src/apis/building/index.js +++ b/src/apis/building/index.js @@ -5,6 +5,7 @@ import { GET_AUTHPAGE_API, GET_SUBAUTHPAGE_API, GET_ALL_DEVICE_API, + GET_FUNCTION_LIST_API, } from "./api"; import instance from "@/util/request"; import apihandler from "@/util/apihandler"; @@ -39,9 +40,9 @@ export const deleteBuildings = async (building_guid) => { }); }; -export const getAuth = async (build) => { - const res = await instance.post(GET_AUTHPAGE_API, { - build, +export const getAuth = async (building_id) => { + const res = await instance.get(GET_FUNCTION_LIST_API, { + params: { building_id }, }); return apihandler(res.code, res.data, { msg: res.msg, diff --git a/src/apis/energy/api.js b/src/apis/energy/api.js index 9f427a0..ae7c5bb 100644 --- a/src/apis/energy/api.js +++ b/src/apis/energy/api.js @@ -1,6 +1,6 @@ export const GET_REALTIME_DIST_API = `/api/Energe/GetRealTimeDistribution`; export const GET_ELECUSE_DAY_API = `/api/Energe/GetElecUseDay`; -export const GET_TAI_POWER_API = `/api/Energe/GetTaipower`; +export const GET_TAI_POWER_API = `/api/energy-manager/power-usage`; export const GET_SIDEBAR_API = `/api/GetSideBar`; export const GET_SEARCH_API = `/api/Energe/GetFilter`; diff --git a/src/components/navbar/NavbarBuilding.vue b/src/components/navbar/NavbarBuilding.vue index aa1c472..bac9e2f 100644 --- a/src/components/navbar/NavbarBuilding.vue +++ b/src/components/navbar/NavbarBuilding.vue @@ -7,24 +7,17 @@ const store = useBuildingStore(); const router = useRouter(); const selectBuilding = (bui) => { store.selectedBuilding = bui; // 改變 selectedBuilding,watch 會自動更新資料 + + if (bui.is_headquarter == true) { + router.replace({ path: "/headquarters" }); + } else { + router.replace({ path: "/dashboard" }); + } }; onMounted(() => { store.initialize(); // 初始化資料 }); - -watch( - () => store.selectedBuilding, - (newValue) => { - console.log('Selected building changed:', newValue); - - if (newValue.is_headquarter == true) { - router.replace({ path: "/headquarters" }); - } else { - router.replace({ path: "/dashboard" }); - } - } -);