diff --git a/src/views/dashboard/Dashboard.vue b/src/views/dashboard/Dashboard.vue index d6b8e32..24d16e9 100644 --- a/src/views/dashboard/Dashboard.vue +++ b/src/views/dashboard/Dashboard.vue @@ -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; diff --git a/src/views/history/components/HistorySearch.vue b/src/views/history/components/HistorySearch.vue index 92965bd..ea54708 100644 --- a/src/views/history/components/HistorySearch.vue +++ b/src/views/history/components/HistorySearch.vue @@ -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, @@ -146,12 +147,12 @@ watch(searchParams, (newVal, oldValue) => { : newVal.Device_list, newVal.Cumulant ); - + setSearchTypeItems([ { title: "IOT數據", key: 1, - active: parseInt(newVal?.Cumulant) === 1, + active: parseInt(newVal?.Cumulant) === 1, }, { title: "累積數據",