diff --git a/src/views/system/System.vue b/src/views/system/System.vue index 9809284..3ecaf2a 100644 --- a/src/views/system/System.vue +++ b/src/views/system/System.vue @@ -118,21 +118,30 @@ const updateDataByGas = (gas) => { } watch( - [() => buildingStore.selectedBuilding, () => route.params.sub_system_id], - ([newBuilding, newRoute], [oldBuilding, oldRoute]) => { - if (newBuilding && newRoute && newRoute !== oldRoute) { + () => buildingStore.selectedBuilding, + (newBuilding) => { + if (Boolean(newBuilding)) { getData(); } }, { + immediate: true, deep: true, } ); +watch( + () => route.params.sub_system_id, + (newRoute, oldRoute) => { + if (buildingStore.selectedBuilding && newRoute !== oldRoute) { + getData(); + } + } +); + onMounted(() => { getFloors(); getCompany(); - getData(); }); const currentFloor = ref(null);