perf: optimize query and device tree
This commit is contained in:
@@ -26,15 +26,11 @@ const onClickBack = () => router.push({ path: `${route.query['from']}` });
|
||||
|
||||
const { selectedStationCode, selectedDeviceType, selectedDevice, selectDevice, initFromRoute } = useDeviceSelection();
|
||||
|
||||
const localLineDevices = ref<LineDevices>({});
|
||||
|
||||
// 页面初始化
|
||||
onMounted(() => {
|
||||
initFromRoute(lineDevices.value);
|
||||
});
|
||||
|
||||
watch(lineDevices, (devices) => initFromRoute(devices), { deep: true });
|
||||
|
||||
// 加载条控制
|
||||
watch(
|
||||
lineDevicesFetching,
|
||||
@@ -44,8 +40,7 @@ watch(
|
||||
} else {
|
||||
window.$loadingBar.finish();
|
||||
// 当设备数据更新时,需要重新配置设备树
|
||||
localLineDevices.value = lineDevices.value;
|
||||
// initFromRoute(lineDevices.value);
|
||||
initFromRoute(lineDevices.value);
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -59,7 +54,7 @@ watch(
|
||||
<NLayoutSider bordered :width="600" :collapsed-width="0" show-trigger="bar">
|
||||
<DeviceTree
|
||||
:station-list="stationList"
|
||||
:line-devices="localLineDevices"
|
||||
:line-devices="lineDevices"
|
||||
:selected-station-code="selectedStationCode"
|
||||
:selected-device-type="selectedDeviceType"
|
||||
:selected-device="selectedDevice"
|
||||
|
||||
Reference in New Issue
Block a user