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 { selectedStationCode, selectedDeviceType, selectedDevice, selectDevice, initFromRoute } = useDeviceSelection();
|
||||||
|
|
||||||
const localLineDevices = ref<LineDevices>({});
|
|
||||||
|
|
||||||
// 页面初始化
|
// 页面初始化
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
initFromRoute(lineDevices.value);
|
initFromRoute(lineDevices.value);
|
||||||
});
|
});
|
||||||
|
|
||||||
watch(lineDevices, (devices) => initFromRoute(devices), { deep: true });
|
|
||||||
|
|
||||||
// 加载条控制
|
// 加载条控制
|
||||||
watch(
|
watch(
|
||||||
lineDevicesFetching,
|
lineDevicesFetching,
|
||||||
@@ -44,8 +40,7 @@ watch(
|
|||||||
} else {
|
} else {
|
||||||
window.$loadingBar.finish();
|
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">
|
<NLayoutSider bordered :width="600" :collapsed-width="0" show-trigger="bar">
|
||||||
<DeviceTree
|
<DeviceTree
|
||||||
:station-list="stationList"
|
:station-list="stationList"
|
||||||
:line-devices="localLineDevices"
|
:line-devices="lineDevices"
|
||||||
:selected-station-code="selectedStationCode"
|
:selected-station-code="selectedStationCode"
|
||||||
:selected-device-type="selectedDeviceType"
|
:selected-device-type="selectedDeviceType"
|
||||||
:selected-device="selectedDevice"
|
:selected-device="selectedDevice"
|
||||||
|
|||||||
Reference in New Issue
Block a user