From 678a50c24c4c978bbb078be4717d175ad92247ad Mon Sep 17 00:00:00 2001 From: dong <58670809@qq.com> Date: Wed, 25 Oct 2023 10:49:04 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8C=BA=E6=AE=B5=E7=A0=81=E4=BD=8D=E5=88=97?= =?UTF-8?q?=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../draw-app/dialogs/SectionCodePointList.vue | 150 ++++++++++ .../properties/KilometerConvertConfig.vue | 4 +- .../properties/SectionCodePointConfig.vue | 261 ++++++++++++++++++ src/drawApp/commonApp.ts | 27 ++ src/layouts/DrawLayout.vue | 22 ++ src/protos/request.ts | 48 ++++ src/protos/stationLayoutGraphics.ts | 115 +++++++- src/stores/draw-store.ts | 7 + 8 files changed, 631 insertions(+), 3 deletions(-) create mode 100644 src/components/draw-app/dialogs/SectionCodePointList.vue create mode 100644 src/components/draw-app/properties/SectionCodePointConfig.vue diff --git a/src/components/draw-app/dialogs/SectionCodePointList.vue b/src/components/draw-app/dialogs/SectionCodePointList.vue new file mode 100644 index 0000000..369e589 --- /dev/null +++ b/src/components/draw-app/dialogs/SectionCodePointList.vue @@ -0,0 +1,150 @@ + + + + + diff --git a/src/components/draw-app/properties/KilometerConvertConfig.vue b/src/components/draw-app/properties/KilometerConvertConfig.vue index 0f4d7cd..dce0f5f 100644 --- a/src/components/draw-app/properties/KilometerConvertConfig.vue +++ b/src/components/draw-app/properties/KilometerConvertConfig.vue @@ -116,7 +116,7 @@ onMounted(() => { watch( () => drawStore.editKilometerConvertIndex, (val) => { - if (val) { + if (val > -1) { getData(); } } @@ -161,7 +161,7 @@ async function onSubmit() { } function onReset() { - handleState.value = '新建'; + // handleState.value = '新建'; data.kmA.coordinateSystem = 'MAIN_LINE'; data.kmA.kilometer = 0; data.kmA.direction = 0; diff --git a/src/components/draw-app/properties/SectionCodePointConfig.vue b/src/components/draw-app/properties/SectionCodePointConfig.vue new file mode 100644 index 0000000..2516c20 --- /dev/null +++ b/src/components/draw-app/properties/SectionCodePointConfig.vue @@ -0,0 +1,261 @@ + + + diff --git a/src/drawApp/commonApp.ts b/src/drawApp/commonApp.ts index 36f7e76..8fdac52 100644 --- a/src/drawApp/commonApp.ts +++ b/src/drawApp/commonApp.ts @@ -237,6 +237,7 @@ export function initCommonDrawApp(app: IDrawApp) { app.on('destroy', async () => { UniqueIdPrefix = new graphicData.UniqueIdOfStationLayout(); kilometerConvertList = []; + sectionCodePointList = []; }); } @@ -246,6 +247,7 @@ export function loadCommonDrawDatas( const datas: GraphicData[] = []; UniqueIdPrefix = storage.UniqueIdPrefix; kilometerConvertList = storage.kilometerConvertList; + sectionCodePointList = storage.sectionCodePointList; storage.Platforms.forEach((platform) => { datas.push(new PlatformData(platform)); }); @@ -380,6 +382,7 @@ export function saveCommonDrawDatas( } storage.UniqueIdPrefix = UniqueIdPrefix; storage.kilometerConvertList = kilometerConvertList; + storage.sectionCodePointList = sectionCodePointList; return storage; } @@ -465,3 +468,27 @@ export const directionOptions = [ { label: '左行', value: 0 }, { label: '右行', value: 1 }, ]; + +//区段码位列表增删改查 +let sectionCodePointList: graphicData.SectionCodePoint[] = []; +export function loadSectionCodePointList() { + return sectionCodePointList; +} +export function creatSectionCodePoint(row: graphicData.SectionCodePoint) { + sectionCodePointList.push(row); +} +export function editSectionCodePoint(row: graphicData.SectionCodePoint) { + const drawStore = useDrawStore(); + const sIndex = drawStore.editSectionCodePointIndex; + const find = sectionCodePointList.find( + (item, index) => + index != sIndex && item.centralizedStation == row.centralizedStation + ); + if (!find && sIndex > -1) { + sectionCodePointList.splice(sIndex, 1, row); + } +} + +export function deleteSectionCodePoint(index: number) { + sectionCodePointList.splice(index, 1); +} diff --git a/src/layouts/DrawLayout.vue b/src/layouts/DrawLayout.vue index 69c7db1..598cf3a 100644 --- a/src/layouts/DrawLayout.vue +++ b/src/layouts/DrawLayout.vue @@ -75,6 +75,11 @@ 公里标转换 + + + 区段码位列表 + + @@ -89,6 +94,9 @@ + @@ -288,6 +296,8 @@ import { CategoryType } from 'src/components/CategoryType'; import { graphicData } from 'src/protos/stationLayoutGraphics'; import KilometerConvertList from 'src/components/draw-app/dialogs/KilometerConvertList.vue'; import KilometerConvertConfig from 'src/components/draw-app/properties/KilometerConvertConfig.vue'; +import SectionCodePointList from 'src/components/draw-app/dialogs/SectionCodePointList.vue'; +import SectionCodePointConfig from 'src/components/draw-app/properties/SectionCodePointConfig.vue'; import StationRelateDeviceConfig from 'src/components/draw-app/properties/StationRelateDeviceConfig.vue'; import StationRelateDeviceList from 'src/components/draw-app/dialogs/StationRelateDeviceList.vue'; import { PictureType } from 'src/protos/picture'; @@ -749,6 +759,18 @@ function openkilometerConvertList() { }); } +const sectionCodePointDialog = ref(); +function openSectionCodePointList() { + if (sectionCodePointDialog.value) return; + sectionCodePointDialog.value = $q + .dialog({ + component: SectionCodePointList, + }) + .onCancel(() => { + sectionCodePointDialog.value = null; + }); +} + let relateDeviceDialogInstance: DialogChainObject | null = null; const relateDeviceConfigEdit = ref>(); diff --git a/src/protos/request.ts b/src/protos/request.ts index fd21add..87c51db 100644 --- a/src/protos/request.ts +++ b/src/protos/request.ts @@ -250,4 +250,52 @@ export namespace request { LightBCancelDs = 11 } } + export class Section extends pb_1.Message { + #one_of_decls: number[][] = []; + constructor(data?: any[] | {}) { + super(); + pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls); + if (!Array.isArray(data) && typeof data == "object") { } + } + static fromObject(data: {}): Section { + const message = new Section({}); + return message; + } + toObject() { + const data: {} = {}; + return data; + } + serialize(): Uint8Array; + serialize(w: pb_1.BinaryWriter): void; + serialize(w?: pb_1.BinaryWriter): Uint8Array | void { + const writer = w || new pb_1.BinaryWriter(); + if (!w) + return writer.getResultBuffer(); + } + static deserialize(bytes: Uint8Array | pb_1.BinaryReader): Section { + const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new Section(); + while (reader.nextField()) { + if (reader.isEndGroup()) + break; + switch (reader.getFieldNumber()) { + default: reader.skipField(); + } + } + return message; + } + serializeBinary(): Uint8Array { + return this.serialize(); + } + static deserializeBinary(bytes: Uint8Array): Section { + return Section.deserialize(bytes); + } + } + export namespace Section { + export enum AxleOperation { + Drst = 0, + Pdrst = 1, + TrainIn = 2, + TrainOut = 3 + } + } } diff --git a/src/protos/stationLayoutGraphics.ts b/src/protos/stationLayoutGraphics.ts index 5c081bf..455c69a 100644 --- a/src/protos/stationLayoutGraphics.ts +++ b/src/protos/stationLayoutGraphics.ts @@ -40,9 +40,10 @@ export namespace graphicData { kilometerConvertList?: KilometerConvert[]; screenDoors?: ScreenDoor[]; stationRelateDeviceList?: StationRelateDevice[]; + sectionCodePointList?: SectionCodePoint[]; }) { super(); - pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [4, 5, 8, 9, 10, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 32, 33, 34], this.#one_of_decls); + pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [4, 5, 8, 9, 10, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 32, 33, 34, 35], this.#one_of_decls); if (!Array.isArray(data) && typeof data == "object") { if ("canvas" in data && data.canvas != undefined) { this.canvas = data.canvas; @@ -128,6 +129,9 @@ export namespace graphicData { if ("stationRelateDeviceList" in data && data.stationRelateDeviceList != undefined) { this.stationRelateDeviceList = data.stationRelateDeviceList; } + if ("sectionCodePointList" in data && data.sectionCodePointList != undefined) { + this.sectionCodePointList = data.sectionCodePointList; + } } } get canvas() { @@ -304,6 +308,12 @@ export namespace graphicData { set stationRelateDeviceList(value: StationRelateDevice[]) { pb_1.Message.setRepeatedWrapperField(this, 34, value); } + get sectionCodePointList() { + return pb_1.Message.getRepeatedWrapperField(this, SectionCodePoint, 35) as SectionCodePoint[]; + } + set sectionCodePointList(value: SectionCodePoint[]) { + pb_1.Message.setRepeatedWrapperField(this, 35, value); + } static fromObject(data: { canvas?: ReturnType; Platforms?: ReturnType[]; @@ -333,6 +343,7 @@ export namespace graphicData { kilometerConvertList?: ReturnType[]; screenDoors?: ReturnType[]; stationRelateDeviceList?: ReturnType[]; + sectionCodePointList?: ReturnType[]; }): RtssGraphicStorage { const message = new RtssGraphicStorage({}); if (data.canvas != null) { @@ -419,6 +430,9 @@ export namespace graphicData { if (data.stationRelateDeviceList != null) { message.stationRelateDeviceList = data.stationRelateDeviceList.map(item => StationRelateDevice.fromObject(item)); } + if (data.sectionCodePointList != null) { + message.sectionCodePointList = data.sectionCodePointList.map(item => SectionCodePoint.fromObject(item)); + } return message; } toObject() { @@ -451,6 +465,7 @@ export namespace graphicData { kilometerConvertList?: ReturnType[]; screenDoors?: ReturnType[]; stationRelateDeviceList?: ReturnType[]; + sectionCodePointList?: ReturnType[]; } = {}; if (this.canvas != null) { data.canvas = this.canvas.toObject(); @@ -536,6 +551,9 @@ export namespace graphicData { if (this.stationRelateDeviceList != null) { data.stationRelateDeviceList = this.stationRelateDeviceList.map((item: StationRelateDevice) => item.toObject()); } + if (this.sectionCodePointList != null) { + data.sectionCodePointList = this.sectionCodePointList.map((item: SectionCodePoint) => item.toObject()); + } return data; } serialize(): Uint8Array; @@ -598,6 +616,8 @@ export namespace graphicData { writer.writeRepeatedMessage(33, this.screenDoors, (item: ScreenDoor) => item.serialize(writer)); if (this.stationRelateDeviceList.length) writer.writeRepeatedMessage(34, this.stationRelateDeviceList, (item: StationRelateDevice) => item.serialize(writer)); + if (this.sectionCodePointList.length) + writer.writeRepeatedMessage(35, this.sectionCodePointList, (item: SectionCodePoint) => item.serialize(writer)); if (!w) return writer.getResultBuffer(); } @@ -691,6 +711,9 @@ export namespace graphicData { case 34: reader.readMessage(message.stationRelateDeviceList, () => pb_1.Message.addToRepeatedWrapperField(message, 34, StationRelateDevice.deserialize(reader), StationRelateDevice)); break; + case 35: + reader.readMessage(message.sectionCodePointList, () => pb_1.Message.addToRepeatedWrapperField(message, 35, SectionCodePoint.deserialize(reader), SectionCodePoint)); + break; default: reader.skipField(); } } @@ -7131,4 +7154,94 @@ export namespace graphicData { return DeviceCombinationtype.deserialize(bytes); } } + export class SectionCodePoint extends pb_1.Message { + #one_of_decls: number[][] = []; + constructor(data?: any[] | { + centralizedStation?: string; + sectionIds?: string[]; + }) { + super(); + pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [2], this.#one_of_decls); + if (!Array.isArray(data) && typeof data == "object") { + if ("centralizedStation" in data && data.centralizedStation != undefined) { + this.centralizedStation = data.centralizedStation; + } + if ("sectionIds" in data && data.sectionIds != undefined) { + this.sectionIds = data.sectionIds; + } + } + } + get centralizedStation() { + return pb_1.Message.getFieldWithDefault(this, 1, "") as string; + } + set centralizedStation(value: string) { + pb_1.Message.setField(this, 1, value); + } + get sectionIds() { + return pb_1.Message.getFieldWithDefault(this, 2, []) as string[]; + } + set sectionIds(value: string[]) { + pb_1.Message.setField(this, 2, value); + } + static fromObject(data: { + centralizedStation?: string; + sectionIds?: string[]; + }): SectionCodePoint { + const message = new SectionCodePoint({}); + if (data.centralizedStation != null) { + message.centralizedStation = data.centralizedStation; + } + if (data.sectionIds != null) { + message.sectionIds = data.sectionIds; + } + return message; + } + toObject() { + const data: { + centralizedStation?: string; + sectionIds?: string[]; + } = {}; + if (this.centralizedStation != null) { + data.centralizedStation = this.centralizedStation; + } + if (this.sectionIds != null) { + data.sectionIds = this.sectionIds; + } + return data; + } + serialize(): Uint8Array; + serialize(w: pb_1.BinaryWriter): void; + serialize(w?: pb_1.BinaryWriter): Uint8Array | void { + const writer = w || new pb_1.BinaryWriter(); + if (this.centralizedStation.length) + writer.writeString(1, this.centralizedStation); + if (this.sectionIds.length) + writer.writeRepeatedString(2, this.sectionIds); + if (!w) + return writer.getResultBuffer(); + } + static deserialize(bytes: Uint8Array | pb_1.BinaryReader): SectionCodePoint { + const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new SectionCodePoint(); + while (reader.nextField()) { + if (reader.isEndGroup()) + break; + switch (reader.getFieldNumber()) { + case 1: + message.centralizedStation = reader.readString(); + break; + case 2: + pb_1.Message.addToRepeatedField(message, 2, reader.readString()); + break; + default: reader.skipField(); + } + } + return message; + } + serializeBinary(): Uint8Array { + return this.serialize(); + } + static deserializeBinary(bytes: Uint8Array): SectionCodePoint { + return SectionCodePoint.deserialize(bytes); + } + } } diff --git a/src/stores/draw-store.ts b/src/stores/draw-store.ts index 57c9792..7c3b22d 100644 --- a/src/stores/draw-store.ts +++ b/src/stores/draw-store.ts @@ -28,6 +28,7 @@ export const useDrawStore = defineStore('draw', { categoryType: null as CategoryType | null, oneClickType: '', editKilometerConvertIndex: -1, + editSectionCodePointIndex: -1, table: undefined as QTable | undefined, showRelateDeviceConfig: false, }), @@ -81,6 +82,9 @@ export const useDrawStore = defineStore('draw', { showEditKilometerConvert: (state) => { return state.editKilometerConvertIndex >= 0; }, + showEditSectionCodePoint: (state) => { + return state.editSectionCodePointIndex >= 0; + }, }, actions: { getDrawApp(): IDrawApp { @@ -151,5 +155,8 @@ export const useDrawStore = defineStore('draw', { setEditKilometerConvertIndex(index: number) { this.editKilometerConvertIndex = index; }, + setEditSectionCodePointIndex(index: number) { + this.editSectionCodePointIndex = index; + }, }, });