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, },