This commit is contained in:
joylink_zhaoerwei 2023-08-22 14:28:59 +08:00
parent b678b64db8
commit efd57e13bd

View File

@ -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());
}
}