diff --git a/bj-rtss-message b/bj-rtss-message index 85290a8..6a2a393 160000 --- a/bj-rtss-message +++ b/bj-rtss-message @@ -1 +1 @@ -Subproject commit 85290a8ba96ee41ab47a61f44e913f308c8599d7 +Subproject commit 6a2a393bf035066167d68d8538a8160aa866da4e diff --git a/src/components/draw-app/dialogs/StationRelateDeviceList.vue b/src/components/draw-app/dialogs/StationRelateDeviceList.vue new file mode 100644 index 0000000..9aec704 --- /dev/null +++ b/src/components/draw-app/dialogs/StationRelateDeviceList.vue @@ -0,0 +1,151 @@ + + + + + diff --git a/src/components/draw-app/properties/StationRelateDeviceConfig.vue b/src/components/draw-app/properties/StationRelateDeviceConfig.vue new file mode 100644 index 0000000..6d8ae2d --- /dev/null +++ b/src/components/draw-app/properties/StationRelateDeviceConfig.vue @@ -0,0 +1,327 @@ + + + diff --git a/src/drawApp/thApp.ts b/src/drawApp/thApp.ts index dc859e1..3a0d0e0 100644 --- a/src/drawApp/thApp.ts +++ b/src/drawApp/thApp.ts @@ -143,3 +143,53 @@ export function saveThDrawDatas(app: IDrawApp) { const base64 = fromUint8Array(storage.serialize()); return base64; } + +//关联设备列表的增删改查 +export interface RelateDevicelistItem { + deviceType: graphicData.RelatedRef.DeviceType | undefined; + code: string; + combinationtypes: { + code: string; + refDevices: string[]; + refDevicesCode?: string[]; + expanded?: boolean; + }[]; +} + +const refDevicesList: graphicData.StationRelateDevice[] = []; +export function loadStationRelateDeviceList() { + return refDevicesList; +} + +export function creatStationRelateDevice(row: graphicData.StationRelateDevice) { + refDevicesList.push(row); + thDrawApp?.emit('postdataloaded'); +} + +export function editStationRelateDevice( + editRow: RelateDevicelistItem, + newData: graphicData.StationRelateDevice +) { + for (let i = 0; i < refDevicesList.length; i++) { + if ( + refDevicesList[i].deviceType == editRow.deviceType && + refDevicesList[i].code == editRow.code + ) { + refDevicesList[i] = newData; + break; + } + } + thDrawApp?.emit('postdataloaded'); +} + +export function deleteStationRelateDevice(row: RelateDevicelistItem) { + for (let i = 0; i < refDevicesList.length; i++) { + if ( + refDevicesList[i].deviceType == row.deviceType && + refDevicesList[i].code == row.code + ) { + refDevicesList.splice(i, 1); + break; + } + } +} diff --git a/src/protos/stationLayoutGraphics.ts b/src/protos/stationLayoutGraphics.ts index 649006b..36a09ab 100644 --- a/src/protos/stationLayoutGraphics.ts +++ b/src/protos/stationLayoutGraphics.ts @@ -39,9 +39,10 @@ export namespace graphicData { UniqueIdPrefix?: UniqueIdOfStationLayout; kilometerConvertList?: KilometerConvert[]; screenDoors?: ScreenDoor[]; + stationRelateDeviceList?: StationRelateDevice[]; }) { 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], 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], this.#one_of_decls); if (!Array.isArray(data) && typeof data == "object") { if ("canvas" in data && data.canvas != undefined) { this.canvas = data.canvas; @@ -124,6 +125,9 @@ export namespace graphicData { if ("screenDoors" in data && data.screenDoors != undefined) { this.screenDoors = data.screenDoors; } + if ("stationRelateDeviceList" in data && data.stationRelateDeviceList != undefined) { + this.stationRelateDeviceList = data.stationRelateDeviceList; + } } } get canvas() { @@ -294,6 +298,12 @@ export namespace graphicData { set screenDoors(value: ScreenDoor[]) { pb_1.Message.setRepeatedWrapperField(this, 33, value); } + get stationRelateDeviceList() { + return pb_1.Message.getRepeatedWrapperField(this, StationRelateDevice, 34) as StationRelateDevice[]; + } + set stationRelateDeviceList(value: StationRelateDevice[]) { + pb_1.Message.setRepeatedWrapperField(this, 34, value); + } static fromObject(data: { canvas?: ReturnType; Platforms?: ReturnType[]; @@ -322,6 +332,7 @@ export namespace graphicData { UniqueIdPrefix?: ReturnType; kilometerConvertList?: ReturnType[]; screenDoors?: ReturnType[]; + stationRelateDeviceList?: ReturnType[]; }): RtssGraphicStorage { const message = new RtssGraphicStorage({}); if (data.canvas != null) { @@ -405,6 +416,9 @@ export namespace graphicData { if (data.screenDoors != null) { message.screenDoors = data.screenDoors.map(item => ScreenDoor.fromObject(item)); } + if (data.stationRelateDeviceList != null) { + message.stationRelateDeviceList = data.stationRelateDeviceList.map(item => StationRelateDevice.fromObject(item)); + } return message; } toObject() { @@ -436,6 +450,7 @@ export namespace graphicData { UniqueIdPrefix?: ReturnType; kilometerConvertList?: ReturnType[]; screenDoors?: ReturnType[]; + stationRelateDeviceList?: ReturnType[]; } = {}; if (this.canvas != null) { data.canvas = this.canvas.toObject(); @@ -518,6 +533,9 @@ export namespace graphicData { if (this.screenDoors != null) { data.screenDoors = this.screenDoors.map((item: ScreenDoor) => item.toObject()); } + if (this.stationRelateDeviceList != null) { + data.stationRelateDeviceList = this.stationRelateDeviceList.map((item: StationRelateDevice) => item.toObject()); + } return data; } serialize(): Uint8Array; @@ -578,6 +596,8 @@ export namespace graphicData { writer.writeRepeatedMessage(32, this.kilometerConvertList, (item: KilometerConvert) => item.serialize(writer)); if (this.screenDoors.length) 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 (!w) return writer.getResultBuffer(); } @@ -668,6 +688,9 @@ export namespace graphicData { case 33: reader.readMessage(message.screenDoors, () => pb_1.Message.addToRepeatedWrapperField(message, 33, ScreenDoor.deserialize(reader), ScreenDoor)); break; + case 34: + reader.readMessage(message.stationRelateDeviceList, () => pb_1.Message.addToRepeatedWrapperField(message, 34, StationRelateDevice.deserialize(reader), StationRelateDevice)); + break; default: reader.skipField(); } } @@ -6595,4 +6618,207 @@ export namespace graphicData { return KilometerConvert.deserialize(bytes); } } + export class StationRelateDevice extends pb_1.Message { + #one_of_decls: number[][] = []; + constructor(data?: any[] | { + code?: string; + combinationtypes?: Combinationtype[]; + deviceType?: RelatedRef.DeviceType; + }) { + 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 ("code" in data && data.code != undefined) { + this.code = data.code; + } + if ("combinationtypes" in data && data.combinationtypes != undefined) { + this.combinationtypes = data.combinationtypes; + } + if ("deviceType" in data && data.deviceType != undefined) { + this.deviceType = data.deviceType; + } + } + } + get code() { + return pb_1.Message.getFieldWithDefault(this, 1, "") as string; + } + set code(value: string) { + pb_1.Message.setField(this, 1, value); + } + get combinationtypes() { + return pb_1.Message.getRepeatedWrapperField(this, Combinationtype, 2) as Combinationtype[]; + } + set combinationtypes(value: Combinationtype[]) { + pb_1.Message.setRepeatedWrapperField(this, 2, value); + } + get deviceType() { + return pb_1.Message.getFieldWithDefault(this, 3, RelatedRef.DeviceType.Section) as RelatedRef.DeviceType; + } + set deviceType(value: RelatedRef.DeviceType) { + pb_1.Message.setField(this, 3, value); + } + static fromObject(data: { + code?: string; + combinationtypes?: ReturnType[]; + deviceType?: RelatedRef.DeviceType; + }): StationRelateDevice { + const message = new StationRelateDevice({}); + if (data.code != null) { + message.code = data.code; + } + if (data.combinationtypes != null) { + message.combinationtypes = data.combinationtypes.map(item => Combinationtype.fromObject(item)); + } + if (data.deviceType != null) { + message.deviceType = data.deviceType; + } + return message; + } + toObject() { + const data: { + code?: string; + combinationtypes?: ReturnType[]; + deviceType?: RelatedRef.DeviceType; + } = {}; + if (this.code != null) { + data.code = this.code; + } + if (this.combinationtypes != null) { + data.combinationtypes = this.combinationtypes.map((item: Combinationtype) => item.toObject()); + } + if (this.deviceType != null) { + data.deviceType = this.deviceType; + } + 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.code.length) + writer.writeString(1, this.code); + if (this.combinationtypes.length) + writer.writeRepeatedMessage(2, this.combinationtypes, (item: Combinationtype) => item.serialize(writer)); + if (this.deviceType != RelatedRef.DeviceType.Section) + writer.writeEnum(3, this.deviceType); + if (!w) + return writer.getResultBuffer(); + } + static deserialize(bytes: Uint8Array | pb_1.BinaryReader): StationRelateDevice { + const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new StationRelateDevice(); + while (reader.nextField()) { + if (reader.isEndGroup()) + break; + switch (reader.getFieldNumber()) { + case 1: + message.code = reader.readString(); + break; + case 2: + reader.readMessage(message.combinationtypes, () => pb_1.Message.addToRepeatedWrapperField(message, 2, Combinationtype.deserialize(reader), Combinationtype)); + break; + case 3: + message.deviceType = reader.readEnum(); + break; + default: reader.skipField(); + } + } + return message; + } + serializeBinary(): Uint8Array { + return this.serialize(); + } + static deserializeBinary(bytes: Uint8Array): StationRelateDevice { + return StationRelateDevice.deserialize(bytes); + } + } + export class Combinationtype extends pb_1.Message { + #one_of_decls: number[][] = []; + constructor(data?: any[] | { + code?: string; + refDevices?: 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 ("code" in data && data.code != undefined) { + this.code = data.code; + } + if ("refDevices" in data && data.refDevices != undefined) { + this.refDevices = data.refDevices; + } + } + } + get code() { + return pb_1.Message.getFieldWithDefault(this, 1, "") as string; + } + set code(value: string) { + pb_1.Message.setField(this, 1, value); + } + get refDevices() { + return pb_1.Message.getFieldWithDefault(this, 2, []) as string[]; + } + set refDevices(value: string[]) { + pb_1.Message.setField(this, 2, value); + } + static fromObject(data: { + code?: string; + refDevices?: string[]; + }): Combinationtype { + const message = new Combinationtype({}); + if (data.code != null) { + message.code = data.code; + } + if (data.refDevices != null) { + message.refDevices = data.refDevices; + } + return message; + } + toObject() { + const data: { + code?: string; + refDevices?: string[]; + } = {}; + if (this.code != null) { + data.code = this.code; + } + if (this.refDevices != null) { + data.refDevices = this.refDevices; + } + 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.code.length) + writer.writeString(1, this.code); + if (this.refDevices.length) + writer.writeRepeatedString(2, this.refDevices); + if (!w) + return writer.getResultBuffer(); + } + static deserialize(bytes: Uint8Array | pb_1.BinaryReader): Combinationtype { + const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new Combinationtype(); + while (reader.nextField()) { + if (reader.isEndGroup()) + break; + switch (reader.getFieldNumber()) { + case 1: + message.code = 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): Combinationtype { + return Combinationtype.deserialize(bytes); + } + } } diff --git a/src/stores/draw-store.ts b/src/stores/draw-store.ts index 376487d..57c9792 100644 --- a/src/stores/draw-store.ts +++ b/src/stores/draw-store.ts @@ -1,5 +1,6 @@ import { defineStore } from 'pinia'; import { CategoryType } from 'src/components/CategoryType'; +import { QTable } from 'quasar'; import { destroyThDrawApp, getThDrawApp, @@ -27,6 +28,8 @@ export const useDrawStore = defineStore('draw', { categoryType: null as CategoryType | null, oneClickType: '', editKilometerConvertIndex: -1, + table: undefined as QTable | undefined, + showRelateDeviceConfig: false, }), getters: { drawMode: (state) => state.drawAssistant != null, diff --git a/src/stores/psl-draw-store.ts b/src/stores/psl-draw-store.ts index 2df7187..4673d54 100644 --- a/src/stores/psl-draw-store.ts +++ b/src/stores/psl-draw-store.ts @@ -16,7 +16,6 @@ export const usePslDrawStore = defineStore('pslDraw', { oneClickType: '', table: undefined as QTable | undefined, showRelateDeviceConfig: false, - tableOfCombinationType: undefined as QTable | undefined, }), getters: { drawMode: (state) => state.drawAssistant != null,