diff --git a/src/apis/energy/api.js b/src/apis/energy/api.js index 1932442..e22b872 100644 --- a/src/apis/energy/api.js +++ b/src/apis/energy/api.js @@ -1,2 +1,3 @@ +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`; \ No newline at end of file diff --git a/src/apis/energy/index.js b/src/apis/energy/index.js index 9c30d97..afb6dc9 100644 --- a/src/apis/energy/index.js +++ b/src/apis/energy/index.js @@ -1,10 +1,20 @@ import { + GET_REALTIME_DIST_API, GET_ELECUSE_DAY_API, GET_TAI_POWER_API, } from "./api"; import instance from "@/util/request"; import apihandler from "@/util/apihandler"; +export const getRealTimeDist = async () => { + const res = await instance.post(GET_REALTIME_DIST_API); + + return apihandler(res.code, res.data, { + msg: res.msg, + code: res.code, + }); +}; + export const getElecUseDay = async () => { const res = await instance.post(GET_ELECUSE_DAY_API); diff --git a/src/config/cn.json b/src/config/cn.json index 26b3711..c8971a2 100644 --- a/src/config/cn.json +++ b/src/config/cn.json @@ -27,6 +27,7 @@ "title": "历史资料", "building_name": "厂区", "device_name": "设备名称", + "system_category": "系统类别", "device_category": "设备类别", "category": "类别", "value": "数值", @@ -243,7 +244,7 @@ "phone": "手机", "created_at": "建立时间", "operation": "功能", - "name_placeholder": "请输入使用者名称", + "name_placeholder": "请输入使用者、帐号名称", "role_placeholder": "请输入角色名称", "change_password": "变更密码", "choose": "选择" diff --git a/src/config/tw.json b/src/config/tw.json index 1414899..a22f98c 100644 --- a/src/config/tw.json +++ b/src/config/tw.json @@ -27,6 +27,7 @@ "title": "歷史資料", "building_name": "廠區", "device_name": "設備名稱", + "system_category": "系統類別", "device_category": "設備類別", "category": "類別", "value": "數值", @@ -243,7 +244,7 @@ "phone": "手機", "created_at": "建立時間", "operation": "功能", - "name_placeholder": "請輸入使用者名稱", + "name_placeholder": "請輸入使用者、帳號名稱", "role_placeholder": "請輸入角色名稱", "change_password": "變更密碼", "choose": "選擇" diff --git a/src/config/us.json b/src/config/us.json index 566bcc6..6452fe9 100644 --- a/src/config/us.json +++ b/src/config/us.json @@ -18,6 +18,7 @@ "title": "Historical Data", "building_name": "Building", "device_name": "Device Name", + "system_category": "System Category", "device_category": "Device Category", "category": "Category", "value": "Value", @@ -155,7 +156,7 @@ "phone": "Phone", "email": "Email", "created_at": "Creation Date", - "maintenance": "Maintenance", + "maintenance": "Upkeep", "repair": "Repair", "company_info": "Company Info", "repair_item": "Repair Item", @@ -243,8 +244,8 @@ "phone": "Phone", "created_at": "Created Time", "operation": "Function", - "name_placeholder": "Please enter user name", - "role_placeholder": "Please enter the role name", + "name_placeholder": "Please enter the user's name / account", + "role_placeholder": "Please enter the role's name", "change_password": "Change Password", "choose": "Choose" }, @@ -261,8 +262,8 @@ "submit": "Submit", "edit": "Edit", "delete": "Delete", - "deselect_all": "Deselect all", - "select_all": "Select all", + "deselect_all": "Deselect All", + "select_all": "Select All", "phone_format": "Please enter the correct phone number format", "email_format": "Please enter correct email address", "password_format": "The password must be at least 8 characters long and must contain English and numbers.", diff --git a/src/views/accountManagement/components/Account.vue b/src/views/accountManagement/components/Account.vue index dff89f2..9988c1a 100644 --- a/src/views/accountManagement/components/Account.vue +++ b/src/views/accountManagement/components/Account.vue @@ -147,7 +147,7 @@ const removeAccount = async (id) => { :placeholder="t('accountManagement.name_placeholder')" name="Full_name" :value="searchData" - class="mr-3" + class="mr-3 w-96" /> import { ref, computed } from "vue"; -// Mock data based on the image, grouped data -const mockData = ref([ - { - title: "Abnormal state", - items: [ - [ - { label: "Abnormal", value: 0 }, - { label: "Return", value: 5168 }, - ], - [ - { label: "Confirmed", value: 182 }, - { label: "Unacknowledged", value: 4986 }, - ], - ], - }, - { - title: "Progress", - items: [ - [ - { label: "Not dispatched", value: 5126 }, - { label: "Dispatched", value: 42 }, - ], - [ - { label: "Completed", value: 28 }, - { label: "Unfinished", value: 14 }, - ], - ], - }, -]); +const equipmentData = ref({ + title: "System Status", + items: [ + { label: "Auxiliary", online: 6, offline: 0, alarm: 0 }, + { label: "Air Detection", online: 31, offline: 0, alarm: 2 }, + { label: "Electricity", online: 12, offline: 0, alarm: 1 }, + { label: "Lighting", online: 20, offline: 3, alarm: 0 }, + { label: "Air Condition", online: 23, offline: 0, alarm: 0 }, + ], +}); -// Compute progress value for each group -const getProgressValue = (group) => { - const total = group.reduce((sum, item) => sum + item.value, 0); - return (group[0].value / total) * 100; -}; +const orderData = ref({ + title: "Work Order", + items: [ + { label: "Unassigned", value: 2 }, + { label: "Assigned", value: 4 }, + { label: "Completed", value: 1 }, + ], +}); diff --git a/src/views/history/components/HistorySearch.vue b/src/views/history/components/HistorySearch.vue index a809da6..03ebd3c 100644 --- a/src/views/history/components/HistorySearch.vue +++ b/src/views/history/components/HistorySearch.vue @@ -25,8 +25,15 @@ import dayjs from "dayjs"; const { searchParams, changeParams } = useSearchParam(); -// 選小類 const store = useBuildingStore(); +// 選大類 +const { + items: sysMainTagItems, + changeActiveBtn: changeMainSysActiveBtn, + setItems: setMainSysItems, + selectedBtn: selectedMainSysItems, +} = useActiveBtn(); +// 選小類 const { items: sysTagItems, changeActiveBtn: changeSysActiveBtn, @@ -34,6 +41,38 @@ const { selectedBtn: selectedSysItems, } = useActiveBtn(); +watch( + () => store.mainSys, + () => { + setMainSysItems( + store.mainSubSys.map(({ full_name, main_system_tag }, index) => ({ + title: full_name, + key: main_system_tag, + active: searchParams.value.main_system_tag + ? searchParams.value.main_system_tag === mian_system_tag + : index === 0, + })) + ); + } +); + +watch( + () => selectedMainSysItems, + (newVal, oldVal) => { + setSysItems( + store.subSys.filter((s) => s.main_system_tag === newVal.value?.key).map(({ full_name, sub_system_tag }, index) => ({ + title: full_name, + key: sub_system_tag, + active: index === 0, + })) + ); + }, + { + deep: true, + immediate: true, + } +); + watch( () => selectedSysItems, (newVal, oldVal) => { @@ -54,21 +93,6 @@ watch( } ); -watch( - () => store.subSys, - () => { - setSysItems( - store.subSys.map(({ full_name, sub_system_tag }, index) => ({ - title: full_name, - key: sub_system_tag, - active: searchParams.value.sub_system_tag - ? searchParams.value.sub_system_tag === sub_system_tag - : index === 0, - })) - ); - } -); - // 設定點位 const { items: points, @@ -82,7 +106,7 @@ const getPoint = async (deviceList) => { setPoints( res.data.map((d, index) => ({ ...d, - title: d.points, + title: d.item_name, key: d.points, active: index === 0, })) @@ -118,10 +142,10 @@ watch(searchParams, (newVal, oldValue) => { }); onMounted(() => { - setSysItems( - store.subSys.map(({ full_name, sub_system_tag }, index) => ({ + setMainSysItems( + store.mainSubSys.map(({ full_name, main_system_tag }, index) => ({ title: full_name, - key: sub_system_tag, + key: main_system_tag, active: index === 0, })) ); @@ -136,7 +160,23 @@ onBeforeMount(() => {
-

{{ $t("history.device_category") }} :

+

+ {{ $t("history.system_category") }} : +

+ +
+
+

+ {{ $t("history.device_category") }} : +

{