fix: 修正 dashboard 平面圖預設尺寸過大問題

This commit is contained in:
MJM_2025_05\polly 2025-08-25 09:41:50 +08:00
parent d88dfe3c85
commit 84b479bc9c
3 changed files with 34 additions and 30 deletions

View File

@ -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

View File

@ -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
);
} }
} }
}, },

View File

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