調整首頁用電小卡的預設顯示 | 優化歷史數據點位獲取與顯示邏輯
This commit is contained in:
parent
eeac7a10a8
commit
348bbe09cb
@ -33,7 +33,7 @@ const floors = ref([]);
|
|||||||
// 廠商列表
|
// 廠商列表
|
||||||
const companyOptions = ref([]);
|
const companyOptions = ref([]);
|
||||||
|
|
||||||
const { searchParams } = useSearchParams();
|
const { changeParams, searchParams } = useSearchParams();
|
||||||
let intervalId = null;
|
let intervalId = null;
|
||||||
|
|
||||||
const init = async () => {
|
const init = async () => {
|
||||||
@ -63,7 +63,8 @@ const getDevice = async (option = 1) => {
|
|||||||
);
|
);
|
||||||
return {
|
return {
|
||||||
...meter,
|
...meter,
|
||||||
device_coordinate_3d: JSON.parse(dbidItem?.device_coordinate_3d) || null,
|
device_coordinate_3d:
|
||||||
|
JSON.parse(dbidItem?.device_coordinate_3d) || null,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
meterList.value = meters;
|
meterList.value = meters;
|
||||||
@ -73,6 +74,11 @@ const getDevice = async (option = 1) => {
|
|||||||
meterList.value[0]?.main_id !== undefined
|
meterList.value[0]?.main_id !== undefined
|
||||||
) {
|
) {
|
||||||
selectedMeter.value = meterList.value[0].main_id;
|
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) {
|
} else if (res.data?.refrigerationData) {
|
||||||
heatmapDevices.value = res.data.refrigerationData;
|
heatmapDevices.value = res.data.refrigerationData;
|
||||||
|
@ -109,8 +109,9 @@ const {
|
|||||||
|
|
||||||
const getPoint = async (Device_list, Cumulant) => {
|
const getPoint = async (Device_list, Cumulant) => {
|
||||||
const res = await getHistoryPoints({ Device_list, Cumulant });
|
const res = await getHistoryPoints({ Device_list, Cumulant });
|
||||||
|
const data = Array.isArray(res.data) ? res.data : [];
|
||||||
setPoints(
|
setPoints(
|
||||||
res.data.map((d, index) => ({
|
data.map((d, index) => ({
|
||||||
...d,
|
...d,
|
||||||
title: d.item_name,
|
title: d.item_name,
|
||||||
key: d.points,
|
key: d.points,
|
||||||
@ -146,12 +147,12 @@ watch(searchParams, (newVal, oldValue) => {
|
|||||||
: newVal.Device_list,
|
: newVal.Device_list,
|
||||||
newVal.Cumulant
|
newVal.Cumulant
|
||||||
);
|
);
|
||||||
|
|
||||||
setSearchTypeItems([
|
setSearchTypeItems([
|
||||||
{
|
{
|
||||||
title: "IOT數據",
|
title: "IOT數據",
|
||||||
key: 1,
|
key: 1,
|
||||||
active: parseInt(newVal?.Cumulant) === 1,
|
active: parseInt(newVal?.Cumulant) === 1,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "累積數據",
|
title: "累積數據",
|
||||||
|
Loading…
Reference in New Issue
Block a user