From 348bbe09cbde94a4d2d03c90c1bf5d9194208e33 Mon Sep 17 00:00:00 2001 From: ko1234 Date: Thu, 25 Sep 2025 15:21:39 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AA=BF=E6=95=B4=E9=A6=96=E9=A0=81=E7=94=A8?= =?UTF-8?q?=E9=9B=BB=E5=B0=8F=E5=8D=A1=E7=9A=84=E9=A0=90=E8=A8=AD=E9=A1=AF?= =?UTF-8?q?=E7=A4=BA=20|=20=E5=84=AA=E5=8C=96=E6=AD=B7=E5=8F=B2=E6=95=B8?= =?UTF-8?q?=E6=93=9A=E9=BB=9E=E4=BD=8D=E7=8D=B2=E5=8F=96=E8=88=87=E9=A1=AF?= =?UTF-8?q?=E7=A4=BA=E9=82=8F=E8=BC=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/dashboard/Dashboard.vue | 10 ++++++++-- src/views/history/components/HistorySearch.vue | 7 ++++--- 2 files changed, 12 insertions(+), 5 deletions(-) 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: "累積數據",