調整首頁用電小卡的預設顯示 | 優化歷史數據點位獲取與顯示邏輯

This commit is contained in:
koko 2025-09-25 15:21:39 +08:00
parent eeac7a10a8
commit 348bbe09cb
2 changed files with 12 additions and 5 deletions

View File

@ -33,7 +33,7 @@ const floors = ref([]);
//
const companyOptions = ref([]);
const { searchParams } = useSearchParams();
const { changeParams, searchParams } = useSearchParams();
let intervalId = null;
const init = async () => {
@ -63,7 +63,8 @@ const getDevice = async (option = 1) => {
);
return {
...meter,
device_coordinate_3d: JSON.parse(dbidItem?.device_coordinate_3d) || null,
device_coordinate_3d:
JSON.parse(dbidItem?.device_coordinate_3d) || null,
};
});
meterList.value = meters;
@ -73,6 +74,11 @@ const getDevice = async (option = 1) => {
meterList.value[0]?.main_id !== undefined
) {
selectedMeter.value = meterList.value[0].main_id;
changeParams({
option: 5,
camera_position: meterList.value[0].camera_position,
target_position: meterList.value[0].target_position,
});
}
} else if (res.data?.refrigerationData) {
heatmapDevices.value = res.data.refrigerationData;

View File

@ -109,8 +109,9 @@ const {
const getPoint = async (Device_list, Cumulant) => {
const res = await getHistoryPoints({ Device_list, Cumulant });
const data = Array.isArray(res.data) ? res.data : [];
setPoints(
res.data.map((d, index) => ({
data.map((d, index) => ({
...d,
title: d.item_name,
key: d.points,