From 84b479bc9c2cf08ec6835a99b832be823a13b359 Mon Sep 17 00:00:00 2001 From: "MJM_2025_05\\polly" Date: Mon, 25 Aug 2025 09:41:50 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E6=AD=A3=20dashboard=20?= =?UTF-8?q?=E5=B9=B3=E9=9D=A2=E5=9C=96=E9=A0=90=E8=A8=AD=E5=B0=BA=E5=AF=B8?= =?UTF-8?q?=E9=81=8E=E5=A4=A7=E5=95=8F=E9=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/dashboard/Dashboard.vue | 28 ++++++--------- .../components/DashboardEffectScatter.vue | 34 +++++++++++++------ vite.config.js | 2 +- 3 files changed, 34 insertions(+), 30 deletions(-) diff --git a/src/views/dashboard/Dashboard.vue b/src/views/dashboard/Dashboard.vue index 0cc75c5..15d8010 100644 --- a/src/views/dashboard/Dashboard.vue +++ b/src/views/dashboard/Dashboard.vue @@ -137,25 +137,17 @@ onUnmounted(() => { class="order-3 lg:order-1 w-full lg:w-1/4 min-h-screen flex flex-col justify-start z-10 border-dashboard gap-5" > -
- -
-
- -
-
- -
-
- -
+ + + +
{ geo: { map, roam: true, // 允許縮放和平移 - layoutSize: window.innerWidth <= 768 ? "110%" : "80%", - layoutCenter: ["50%", "50%"], + layoutSize: window.innerWidth <= 768 ? "80%" : "55%", + layoutCenter: ["50%", "40%"], scaleLimit: { min: 1, max: 2 }, }, series: [ @@ -92,12 +92,19 @@ const handleItemClick = (params) => { watch( [searchParams, () => asset_floor_chart.value, () => props.data], ([newValue, newChart, newData], [oldValue]) => { - if (newValue.floor_id && newChart && Object.keys(newData || {}).length > 0) { + if ( + newValue.floor_id && + newChart && + Object.keys(newData || {}).length > 0 + ) { const isFloorChanged = currentFloorId.value !== newValue.floor_id; - + if (isFloorChanged) { // 樓層切換時才重新載入 SVG - console.log("Floor changed, updating chart with new SVG", newValue.floor_id); + console.log( + "Floor changed, updating chart with new SVG", + newValue.floor_id + ); currentFloorId.value = newValue.floor_id; newChart.updateSvg( { @@ -106,20 +113,25 @@ watch( }, defaultOption(newValue.floor_id, currentIconData.value) ); - + // 添加點擊事件監聽 setTimeout(() => { if (newChart.chart) { - newChart.chart.off('click'); // 移除舊的監聽器 - newChart.chart.on('click', handleItemClick); + newChart.chart.off("click"); // 移除舊的監聽器 + newChart.chart.on("click", handleItemClick); } }, 100); } else if (currentFloorId.value === newValue.floor_id && newChart.chart) { // 只是資料更新時,只更新圖表資料,不重新載入 SVG console.log("Data updated, refreshing chart data only"); - newChart.chart.setOption({ - series: defaultOption(newValue.floor_id, currentIconData.value).series - }, false, true); + newChart.chart.setOption( + { + series: defaultOption(newValue.floor_id, currentIconData.value) + .series, + }, + false, + true + ); } } }, diff --git a/vite.config.js b/vite.config.js index 7c685b9..9f03cdd 100644 --- a/vite.config.js +++ b/vite.config.js @@ -16,7 +16,7 @@ export default defineConfig({ server: { proxy: { "/upload": { - target: "https://ibms-empower.production.mjmtech.com.tw", + target: "https://ibms-empower2.production.mjmtech.com.tw", changeOrigin: true, secure: false, },