diff --git a/src/apis/energy/api.js b/src/apis/energy/api.js
index 5931055..d9a94ba 100644
--- a/src/apis/energy/api.js
+++ b/src/apis/energy/api.js
@@ -5,3 +5,5 @@ export const GET_TAI_POWER_API = `/api/Energe/GetTaipower`;
export const GET_SIDEBAR_API = `/api/Energe/GetEnergySideBar`;
export const GET_SEARCH_API = `/api/Energe/GetFilter`;
+export const GET_REPORT_API = `/api/Energe/GetReport`;
+
diff --git a/src/apis/energy/index.js b/src/apis/energy/index.js
index 927e72b..a615b03 100644
--- a/src/apis/energy/index.js
+++ b/src/apis/energy/index.js
@@ -4,6 +4,7 @@ import {
GET_TAI_POWER_API,
GET_SIDEBAR_API,
GET_SEARCH_API,
+ GET_REPORT_API,
} from "./api";
import instance from "@/util/request";
import apihandler from "@/util/apihandler";
@@ -52,3 +53,26 @@ export const getEnergySearch = async (type) => {
code: res.code,
});
};
+
+export const getReport = async ({
+ department,
+ elecType,
+ floor,
+ start_time,
+ end_time,
+ type,
+}) => {
+ const res = await instance.post(GET_REPORT_API, {
+ department,
+ elecType,
+ floor,
+ start_time,
+ end_time,
+ type,
+ });
+
+ return apihandler(res.code, res.data, {
+ msg: res.msg,
+ code: res.code,
+ });
+};
diff --git a/src/views/energyManagement/components/EnergyReport/EnergyReportSearch.vue b/src/views/energyManagement/components/EnergyReport/EnergyReportSearch.vue
index aa5a7aa..55096a9 100644
--- a/src/views/energyManagement/components/EnergyReport/EnergyReportSearch.vue
+++ b/src/views/energyManagement/components/EnergyReport/EnergyReportSearch.vue
@@ -8,7 +8,7 @@ import {
getAssetFloorList,
getElecTypeList,
} from "@/apis/asset";
-import { getAccountUserList } from "@/apis/account";
+import { getReport } from "@/apis/energy";
import { useI18n } from "vue-i18n";
const { t } = useI18n();
const route = useRoute();
@@ -78,7 +78,7 @@ const getFloor = async () => {
const onSearch = async () => {
loading.value = true;
- const res = await getAccountUserList(formState.value);
+ const res = await getReport(formState.value);
tableData.value = res.data;
loading.value = false;
};
@@ -114,7 +114,7 @@ watch(
watch(
() => route.params.type,
(newVal) => {
- formState.value.type = newVal;
+ formState.value.type = Number(newVal);
},
{ immediate: true }
);
diff --git a/src/views/energyManagement/components/EnergyReport/EnergyReportTable.vue b/src/views/energyManagement/components/EnergyReport/EnergyReportTable.vue
index 8f2e893..75076c8 100644
--- a/src/views/energyManagement/components/EnergyReport/EnergyReportTable.vue
+++ b/src/views/energyManagement/components/EnergyReport/EnergyReportTable.vue
@@ -1,33 +1,91 @@
-
+
-
+
\ No newline at end of file
diff --git a/src/views/system/System.vue b/src/views/system/System.vue
index abea7f9..dca1f24 100644
--- a/src/views/system/System.vue
+++ b/src/views/system/System.vue
@@ -157,12 +157,17 @@ const updateCurrentFloor = (floor) => {
const realtimeData = ref([])
const timeId = ref(null)
-const getAllDeviceRealtime = () => {
- timeId.value = setInterval(async () => {
- const res = await getSystemRealTime(subscribeData.value.map(d => d.device_number))
- console.log(res.data)
- realtimeData.value = res.data
- }, 10000)
+const getAllDeviceRealtime = async () => {
+ // 立即執行一次
+ const fetchData = async () => {
+ const res = await getSystemRealTime(subscribeData.value.map(d => d.device_number));
+ console.log(res.data);
+ realtimeData.value = res.data;
+ };
+ await fetchData(); // 立即執行一次
+
+ // 然後設定每 10 秒更新一次
+ timeId.value = setInterval(fetchData, 10000);
}
watch(subscribeData, (newValue) => {
@@ -206,9 +211,7 @@ const getCurrentInfoModalData = async (e, position, value) => {
: "",
};
}
-
- const immediateRes = await getSystemRealTime([value.device_number]);
- realtimeData.value = immediateRes.data;
+
}
const mobile = isMobile(e);
selectedDevice.value = {
diff --git a/src/views/system/SystemFloor.vue b/src/views/system/SystemFloor.vue
index a7153b8..e3eb0c0 100644
--- a/src/views/system/SystemFloor.vue
+++ b/src/views/system/SystemFloor.vue
@@ -1,14 +1,16 @@
-
+
-
+
diff --git a/src/views/system/components/SystemCard.vue b/src/views/system/components/SystemCard.vue
index dae5cfa..75d15c7 100644
--- a/src/views/system/components/SystemCard.vue
+++ b/src/views/system/components/SystemCard.vue
@@ -10,10 +10,6 @@ const FILE_BASEURL = import.meta.env.VITE_FILE_API_BASEURL;
const fitToView = (forge_dbid, spriteDbId) => {
selected_dbid.value = [forge_dbid, spriteDbId];
- console.log(subscribeData.value)
- let allData = [...subscribeData.value].map(d => ({ ...d, is2DActive: d.forge_dbid === forge_dbid }))
- subscribeData.value = allData;
-
};