diff --git a/src/components/chart/EffectScatter.vue b/src/components/chart/EffectScatter.vue index cbc0b3a..ff48c2a 100644 --- a/src/components/chart/EffectScatter.vue +++ b/src/components/chart/EffectScatter.vue @@ -27,7 +27,12 @@ async function updateSvg(svg, option) { axios.get(svg.path).then(async ({ data }) => { echarts.registerMap(svg.full_name, { svg: data }); await nextTick(); - chart.value.setOption(option); + // 延遲執行以避免在主進程中調用 setOption + setTimeout(() => { + if (chart.value && !chart.value.isDisposed()) { + chart.value.setOption(option); + } + }, 0); if (props.getCoordinate) { chart.value.getZr().on("click", function (params) { var pixelPoint = [params.offsetX, params.offsetY]; @@ -45,11 +50,15 @@ async function updateSvg(svg, option) { value: dataPoint, // 當前座標值 itemStyle: { color: "#0000FF" }, // 設為藍色 }); - chart.value.setOption({ - series: { - data: updatedData, - }, - }); + setTimeout(() => { + if (chart.value && !chart.value.isDisposed()) { + chart.value.setOption({ + series: { + data: updatedData, + }, + }); + } + }, 0); }); } }); diff --git a/src/views/dashboard/Dashboard.vue b/src/views/dashboard/Dashboard.vue index 600204a..aef0243 100644 --- a/src/views/dashboard/Dashboard.vue +++ b/src/views/dashboard/Dashboard.vue @@ -37,7 +37,9 @@ watch( formState.value.building_guid = newBuilding.building_guid; imgBaseUrl.value = store.previewImageExt ? `${FILE_BASEURL}/upload/setting/previewImage/${newBuilding.building_guid}${store.previewImageExt}` - : ""; + : import.meta.env.MODE === "production" + ? "dist/build_img.jpg" + : "/build_img.jpg"; } }, { immediate: true, deep: true } @@ -111,7 +113,7 @@ onUnmounted(() => { build {
build { + if (asset_floor_chart.value?.chart && !asset_floor_chart.value.chart.isDisposed()) { + asset_floor_chart.value.chart.setOption({ + series: [ + { data: unSelected }, + { + data: selected, + }, + ], + }); + } + }, 0); } }, {