fix: 修正 dashboard 平面圖預設尺寸過大問題
This commit is contained in:
parent
d88dfe3c85
commit
84b479bc9c
@ -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"
|
||||
>
|
||||
<!-- 無資料時:完整隱藏區塊,不留空白 -->
|
||||
<div class="mb-6">
|
||||
<DashboardProduct
|
||||
@visible-change="(v) => (productVisible = v)"
|
||||
v-show="productVisible"
|
||||
/>
|
||||
</div>
|
||||
<div class="mb-6">
|
||||
<DashboardProductComplete
|
||||
@visible-change="(v) => (productCompleteVisible = v)"
|
||||
v-show="productVisible"
|
||||
/>
|
||||
</div>
|
||||
<div class="mb-6">
|
||||
<DashboardIndoor />
|
||||
</div>
|
||||
|
||||
<div class="mb-10">
|
||||
<DashboardRefrig />
|
||||
</div>
|
||||
<DashboardProduct
|
||||
@visible-change="(v) => (productVisible = v)"
|
||||
v-show="productVisible"
|
||||
/>
|
||||
<DashboardProductComplete
|
||||
@visible-change="(v) => (productCompleteVisible = v)"
|
||||
v-show="productVisible"
|
||||
/>
|
||||
<DashboardIndoor />
|
||||
<DashboardRefrig class="mb-10" />
|
||||
</div>
|
||||
|
||||
<div
|
||||
|
@ -28,8 +28,8 @@ const defaultOption = (map, data = []) => {
|
||||
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
|
||||
);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -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,
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user