From efd57e13bd5f908ca7a29a4f571d9116b45ea99d Mon Sep 17 00:00:00 2001 From: joylink_zhaoerwei Date: Tue, 22 Aug 2023 14:28:59 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BE=AE=E8=B0=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/rangeConfig.vue | 45 +++++++++++++++++----------------- 1 file changed, 23 insertions(+), 22 deletions(-) diff --git a/src/components/rangeConfig.vue b/src/components/rangeConfig.vue index fb24a65..2d7540c 100644 --- a/src/components/rangeConfig.vue +++ b/src/components/rangeConfig.vue @@ -64,6 +64,7 @@ import { StationData } from 'src/drawApp/graphics/StationInteraction'; import { PlatformData } from 'src/drawApp/graphics/PlatformInteraction'; import { TurnoutData } from 'src/drawApp/graphics/TurnoutInteraction'; import { graphicData } from 'src/protos/stationLayoutGraphics'; +import { JlGraphic } from 'src/jl-graphic'; const route = useRoute(); const lineStore = useLineStore(); @@ -93,30 +94,30 @@ watch( () => lineStore.selectedGraphics, (val) => { if (val && val.length > 0) { - device.value = lineStore.selectedGraphics - ?.filter((g) => g.type == rangeConfig.deviceType) - .map((g) => g.code) as string[]; + const deviceFilter = lineStore.selectedGraphics?.filter( + (g) => g.type == rangeConfig.deviceType + ) as JlGraphic[]; + lineStore.getLineApp().updateSelected(...deviceFilter); + device.value = deviceFilter?.map((g) => g.code) as string[]; const storage = new graphicData.RtssGraphicStorage(); - lineStore.selectedGraphics - ?.filter((g) => g.type == rangeConfig.deviceType) - .forEach((g) => { - if (LogicSection.Type === g.type) { - const logicSectionData = (g as LogicSection).saveData(); - storage.logicSections.push( - (logicSectionData as LogicSectionData).data - ); - } else if (Station.Type === g.type) { - const stationData = (g as Station).saveData(); - storage.stations.push((stationData as StationData).data); - } else if (Platform.Type === g.type) { - const platformData = (g as Platform).saveData(); - storage.Platforms.push((platformData as PlatformData).data); - } else if (Turnout.Type === g.type) { - const turnoutData = (g as Turnout).saveData(); - storage.turnouts.push((turnoutData as TurnoutData).data); - } - }); + deviceFilter?.forEach((g) => { + if (LogicSection.Type === g.type) { + const logicSectionData = (g as LogicSection).saveData(); + storage.logicSections.push( + (logicSectionData as LogicSectionData).data + ); + } else if (Station.Type === g.type) { + const stationData = (g as Station).saveData(); + storage.stations.push((stationData as StationData).data); + } else if (Platform.Type === g.type) { + const platformData = (g as Platform).saveData(); + storage.Platforms.push((platformData as PlatformData).data); + } else if (Turnout.Type === g.type) { + const turnoutData = (g as Turnout).saveData(); + storage.turnouts.push((turnoutData as TurnoutData).data); + } + }); rangeConfig.device = fromUint8Array(storage.serialize()); } }