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"
|
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">
|
<DashboardProduct
|
||||||
<DashboardRefrig />
|
@visible-change="(v) => (productVisible = v)"
|
||||||
</div>
|
v-show="productVisible"
|
||||||
|
/>
|
||||||
|
<DashboardProductComplete
|
||||||
|
@visible-change="(v) => (productCompleteVisible = v)"
|
||||||
|
v-show="productVisible"
|
||||||
|
/>
|
||||||
|
<DashboardIndoor />
|
||||||
|
<DashboardRefrig class="mb-10" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div
|
<div
|
||||||
|
@ -28,8 +28,8 @@ const defaultOption = (map, data = []) => {
|
|||||||
geo: {
|
geo: {
|
||||||
map,
|
map,
|
||||||
roam: true, // 允許縮放和平移
|
roam: true, // 允許縮放和平移
|
||||||
layoutSize: window.innerWidth <= 768 ? "110%" : "80%",
|
layoutSize: window.innerWidth <= 768 ? "80%" : "55%",
|
||||||
layoutCenter: ["50%", "50%"],
|
layoutCenter: ["50%", "40%"],
|
||||||
scaleLimit: { min: 1, max: 2 },
|
scaleLimit: { min: 1, max: 2 },
|
||||||
},
|
},
|
||||||
series: [
|
series: [
|
||||||
@ -92,12 +92,19 @@ const handleItemClick = (params) => {
|
|||||||
watch(
|
watch(
|
||||||
[searchParams, () => asset_floor_chart.value, () => props.data],
|
[searchParams, () => asset_floor_chart.value, () => props.data],
|
||||||
([newValue, newChart, newData], [oldValue]) => {
|
([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;
|
const isFloorChanged = currentFloorId.value !== newValue.floor_id;
|
||||||
|
|
||||||
if (isFloorChanged) {
|
if (isFloorChanged) {
|
||||||
// 樓層切換時才重新載入 SVG
|
// 樓層切換時才重新載入 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;
|
currentFloorId.value = newValue.floor_id;
|
||||||
newChart.updateSvg(
|
newChart.updateSvg(
|
||||||
{
|
{
|
||||||
@ -106,20 +113,25 @@ watch(
|
|||||||
},
|
},
|
||||||
defaultOption(newValue.floor_id, currentIconData.value)
|
defaultOption(newValue.floor_id, currentIconData.value)
|
||||||
);
|
);
|
||||||
|
|
||||||
// 添加點擊事件監聽
|
// 添加點擊事件監聽
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
if (newChart.chart) {
|
if (newChart.chart) {
|
||||||
newChart.chart.off('click'); // 移除舊的監聽器
|
newChart.chart.off("click"); // 移除舊的監聽器
|
||||||
newChart.chart.on('click', handleItemClick);
|
newChart.chart.on("click", handleItemClick);
|
||||||
}
|
}
|
||||||
}, 100);
|
}, 100);
|
||||||
} else if (currentFloorId.value === newValue.floor_id && newChart.chart) {
|
} else if (currentFloorId.value === newValue.floor_id && newChart.chart) {
|
||||||
// 只是資料更新時,只更新圖表資料,不重新載入 SVG
|
// 只是資料更新時,只更新圖表資料,不重新載入 SVG
|
||||||
console.log("Data updated, refreshing chart data only");
|
console.log("Data updated, refreshing chart data only");
|
||||||
newChart.chart.setOption({
|
newChart.chart.setOption(
|
||||||
series: defaultOption(newValue.floor_id, currentIconData.value).series
|
{
|
||||||
}, false, true);
|
series: defaultOption(newValue.floor_id, currentIconData.value)
|
||||||
|
.series,
|
||||||
|
},
|
||||||
|
false,
|
||||||
|
true
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -16,7 +16,7 @@ export default defineConfig({
|
|||||||
server: {
|
server: {
|
||||||
proxy: {
|
proxy: {
|
||||||
"/upload": {
|
"/upload": {
|
||||||
target: "https://ibms-empower.production.mjmtech.com.tw",
|
target: "https://ibms-empower2.production.mjmtech.com.tw",
|
||||||
changeOrigin: true,
|
changeOrigin: true,
|
||||||
secure: false,
|
secure: false,
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user