系統監控getData帶入buildingStore.selectedBuilding

This commit is contained in:
koko 2024-11-08 14:36:27 +08:00
parent eee56c4273
commit 3460130e7e

View File

@ -118,21 +118,30 @@ const updateDataByGas = (gas) => {
} }
watch( watch(
[() => buildingStore.selectedBuilding, () => route.params.sub_system_id], () => buildingStore.selectedBuilding,
([newBuilding, newRoute], [oldBuilding, oldRoute]) => { (newBuilding) => {
if (newBuilding && newRoute && newRoute !== oldRoute) { if (Boolean(newBuilding)) {
getData(); getData();
} }
}, },
{ {
immediate: true,
deep: true, deep: true,
} }
); );
watch(
() => route.params.sub_system_id,
(newRoute, oldRoute) => {
if (buildingStore.selectedBuilding && newRoute !== oldRoute) {
getData();
}
}
);
onMounted(() => { onMounted(() => {
getFloors(); getFloors();
getCompany(); getCompany();
getData();
}); });
const currentFloor = ref(null); const currentFloor = ref(null);