From d829bd45d80ac1910687bc528ec313ed74f5d137 Mon Sep 17 00:00:00 2001 From: joylink_zhaoerwei Date: Wed, 25 Oct 2023 14:38:36 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A9=B1=E5=8A=A8=E7=BB=A7=E7=94=B5=E5=99=A8?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E5=88=9D=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../{CollectionList.vue => CiCjList.vue} | 30 +- src/components/draw-app/dialogs/CiQdList.vue | 117 ++++++++ .../{CollectionConfig.vue => CiCjConfig.vue} | 19 +- .../draw-app/properties/CiQdConfig.vue | 205 +++++++++++++ src/drawApp/relayCabinetLayoutApp.ts | 24 +- src/layouts/RelayCabinetLayout.vue | 81 ++++-- src/protos/relayCabinetLayoutGraphics.ts | 273 ++++++++++++++++++ src/stores/relayCabinet-store.ts | 11 +- 8 files changed, 704 insertions(+), 56 deletions(-) rename src/components/draw-app/dialogs/{CollectionList.vue => CiCjList.vue} (72%) create mode 100644 src/components/draw-app/dialogs/CiQdList.vue rename src/components/draw-app/properties/{CollectionConfig.vue => CiCjConfig.vue} (91%) create mode 100644 src/components/draw-app/properties/CiQdConfig.vue diff --git a/src/components/draw-app/dialogs/CollectionList.vue b/src/components/draw-app/dialogs/CiCjList.vue similarity index 72% rename from src/components/draw-app/dialogs/CollectionList.vue rename to src/components/draw-app/dialogs/CiCjList.vue index 35e446d..e477e61 100644 --- a/src/components/draw-app/dialogs/CollectionList.vue +++ b/src/components/draw-app/dialogs/CiCjList.vue @@ -5,7 +5,7 @@ class="ceil" :class="{ heightLight: - ciCjList.cjList[col - 1].bitList[row - 1].refRelays.length, + ciCjList?.cjList[col - 1].bitList[row - 1].refRelays.length, }" v-for="col in setCellMessage.cols" :key="col" @@ -52,7 +52,8 @@ - + + @@ -60,10 +61,11 @@ diff --git a/src/components/draw-app/dialogs/CiQdList.vue b/src/components/draw-app/dialogs/CiQdList.vue new file mode 100644 index 0000000..2de6dc1 --- /dev/null +++ b/src/components/draw-app/dialogs/CiQdList.vue @@ -0,0 +1,117 @@ + + + + + diff --git a/src/components/draw-app/properties/CollectionConfig.vue b/src/components/draw-app/properties/CiCjConfig.vue similarity index 91% rename from src/components/draw-app/properties/CollectionConfig.vue rename to src/components/draw-app/properties/CiCjConfig.vue index dd88980..754ab50 100644 --- a/src/components/draw-app/properties/CollectionConfig.vue +++ b/src/components/draw-app/properties/CiCjConfig.vue @@ -5,9 +5,9 @@
{{ '编辑采集' + - relayCabinetStore.editCollectionConfigIndex.row + + relayCabinetStore.editCiCjConfigIndex.row + '-' + - relayCabinetStore.editCollectionConfigIndex.col + relayCabinetStore.editCiCjConfigIndex.col }}
@@ -61,7 +61,7 @@ import { onMounted, onUnmounted, ref, watch } from 'vue'; import { QForm, useQuasar } from 'quasar'; import { JlGraphic } from 'src/jl-graphic'; import { - CollectionConfigCeil, + CiCjConfigCeil, useRelayCabinetStore, } from 'src/stores/relayCabinet-store'; import { Relay } from 'src/graphics/relay/Relay'; @@ -106,7 +106,7 @@ watch( //监听编辑 watch( - () => relayCabinetStore.editCollectionConfigIndex, + () => relayCabinetStore.editCiCjConfigIndex, (val) => { if (val) { getEditData(); @@ -125,8 +125,7 @@ function getEditData() { app.updateSelected(); collectionConfig.value.refRelays = []; const ciCjList = loadCiCjList(); - const click = - relayCabinetStore.editCollectionConfigIndex as CollectionConfigCeil; + const click = relayCabinetStore.editCiCjConfigIndex as CiCjConfigCeil; ciCjList.cjList[click.col - 1].bitList[click.row - 1].refRelays.forEach( (relay) => { collectionConfig.value.refRelays.push(relay.relayId); @@ -148,8 +147,7 @@ async function onSubmit() { if (res) { try { const ciCjList = loadCiCjList(); - const click = - relayCabinetStore.editCollectionConfigIndex as CollectionConfigCeil; + const click = relayCabinetStore.editCiCjConfigIndex as CiCjConfigCeil; ciCjList.cjList[click.col - 1].bitList[click.row - 1].refRelays = []; collectionConfig.value.refRelays.forEach((relayId) => { ciCjList.cjList[click.col - 1].bitList[click.row - 1].refRelays.push( @@ -207,11 +205,10 @@ function onReset() { function goBack() { onReset(); - relayCabinetStore.showCollectionConfig = false; + relayCabinetStore.showCiCjConfig = false; } onUnmounted(() => { - relayCabinetStore.showCollectionConfig = false; - relayCabinetStore.editCollectionConfigIndex = null; + relayCabinetStore.showCiCjConfig = false; }); diff --git a/src/components/draw-app/properties/CiQdConfig.vue b/src/components/draw-app/properties/CiQdConfig.vue new file mode 100644 index 0000000..16b1532 --- /dev/null +++ b/src/components/draw-app/properties/CiQdConfig.vue @@ -0,0 +1,205 @@ + + + diff --git a/src/drawApp/relayCabinetLayoutApp.ts b/src/drawApp/relayCabinetLayoutApp.ts index ed389c7..21feafe 100644 --- a/src/drawApp/relayCabinetLayoutApp.ts +++ b/src/drawApp/relayCabinetLayoutApp.ts @@ -226,6 +226,7 @@ export function saveDrawDatas(app: IDrawApp) { storage.combinationtypeList = combinationTypeList; storage.UniqueIdPrefix = UniqueIdPrefix; storage.ciCjList = ciCjList; + storage.ciQdList = ciQdList; const base64 = fromUint8Array(storage.serialize()); console.log('保存数据', storage); return base64; @@ -260,6 +261,7 @@ export async function loadDrawDatas(): Promise { combinationTypeList = storage.combinationtypeList; UniqueIdPrefix = storage.UniqueIdPrefix; ciCjList = storage.ciCjList; + ciQdList = storage.ciQdList; return Promise.resolve({ canvasProperty: storage.canvas, datas: datas, @@ -363,7 +365,7 @@ export function deleteCombinationtype(row: CombinationTypeListItem) { } //所属集中站 -let UniqueIdPrefix = new relayCabinetGraphicData.UniqueIdType(); +let UniqueIdPrefix: relayCabinetGraphicData.UniqueIdType; export function loadUniqueIdPrefix() { return UniqueIdPrefix; } @@ -375,7 +377,7 @@ export function setUniqueIdPrefix( } //采集列表的增删改查 -let ciCjList = new relayCabinetGraphicData.CiCj(); +let ciCjList: relayCabinetGraphicData.CiCj; export function loadCiCjList() { return ciCjList; } @@ -391,3 +393,21 @@ export function creatCiCjList(rows: number, cols: number) { } } } + +//驱动列表的增删改查 +let ciQdList: relayCabinetGraphicData.CiQd; +export function loadCiQdList() { + return ciQdList; +} + +export function creatCiQdList(rows: number, cols: number) { + ciQdList = new relayCabinetGraphicData.CiQd(); + ciQdList.dsCount = rows; + for (let i = 0; i < cols; i++) { + ciQdList.qdList[i] = new relayCabinetGraphicData.QdDataSet(); + ciQdList.qdList[i].name = 'D' + (i + 1); + for (let j = 0; j < rows; j++) { + ciQdList.qdList[i].bitList[j] = new relayCabinetGraphicData.QdData(); + } + } +} diff --git a/src/layouts/RelayCabinetLayout.vue b/src/layouts/RelayCabinetLayout.vue index 3f9699a..c5d4f11 100644 --- a/src/layouts/RelayCabinetLayout.vue +++ b/src/layouts/RelayCabinetLayout.vue @@ -64,20 +64,14 @@ style="margin-right: 10px" > - - - 设备关联继电器列表 - - - - - 组合类型列表 - - - - - 采集列表 - + + {{ item.label }} @@ -93,7 +87,8 @@ v-if=" !relayCabinetStore.showRelateRelayConfig && !relayCabinetStore.showCombinationTypeConfig && - !relayCabinetStore.showCollectionConfig + !relayCabinetStore.showCiCjConfig && + !relayCabinetStore.showCiQdConfig " > - + + @@ -184,8 +180,10 @@ import DeviceRelateRelayList from 'src/components/draw-app/dialogs/DeviceRelateR import RelateRelayConfig from 'src/components/draw-app/properties/RelateRelayConfig.vue'; import CombinationtypeList from 'src/components/draw-app/dialogs/CombinationtypeList.vue'; import CombinationTypeConfig from 'src/components/draw-app/properties/CombinationTypeConfig.vue'; -import CollectionList from 'src/components/draw-app/dialogs/CollectionList.vue'; -import CollectionConfig from 'src/components/draw-app/properties/CollectionConfig.vue'; +import CiCjList from 'src/components/draw-app/dialogs/CiCjList.vue'; +import CiQdList from 'src/components/draw-app/dialogs/CiQdList.vue'; +import CiCjConfig from 'src/components/draw-app/properties/CiCjConfig.vue'; +import CiQdConfig from 'src/components/draw-app/properties/CiQdConfig.vue'; import { getDrawApp, saveDrawDatas, @@ -255,6 +253,14 @@ const leftMenuConfig = [ { label: '批量生成继电器或继电器柜', click: batchBuild }, ]; +//数据管理下拉按钮 +const dataManageConfig = [ + { label: '设备关联继电器列表', click: openDeviceRelateRelayList }, + { label: '组合类型列表', click: openCombinationTypeList }, + { label: '采集列表', click: openCiCjList }, + { label: '驱动列表', click: openCiQdList }, +]; + watch( () => relayCabinetStore.drawMode, (drawMode) => { @@ -438,19 +444,31 @@ function openCombinationTypeList() { }); } -let collectDialogInstance: DialogChainObject | null = null; -function openCjList() { - if (collectDialogInstance) return; - collectDialogInstance = $q +let ciCjListDialogInstance: DialogChainObject | null = null; +function openCiCjList() { + if (ciCjListDialogInstance) return; + ciCjListDialogInstance = $q .dialog({ - component: CollectionList, + component: CiCjList, }) .onCancel(() => { - collectDialogInstance = null; - relayCabinetStore.setEditCollectionConfig(null); - relayCabinetStore.showCollectionConfig = false; - relayCabinetStore.selectedGraphics = []; - relayCabinetStore.getDrawApp().updateSelected(); + ciCjListDialogInstance = null; + relayCabinetStore.setEditCiCjConfig(null); + relayCabinetStore.showCiCjConfig = false; + }); +} + +let ciQdListDialogInstance: DialogChainObject | null = null; +function openCiQdList() { + if (ciQdListDialogInstance) return; + ciQdListDialogInstance = $q + .dialog({ + component: CiQdList, + }) + .onCancel(() => { + ciQdListDialogInstance = null; + relayCabinetStore.setEditCiCjConfig(null); + relayCabinetStore.showCiQdConfig = false; }); } @@ -470,8 +488,11 @@ onUnmounted(() => { if (combinationTypeDialogInstance) { combinationTypeDialogInstance.hide(); } - if (collectDialogInstance) { - collectDialogInstance.hide(); + if (ciCjListDialogInstance) { + ciCjListDialogInstance.hide(); + } + if (ciQdListDialogInstance) { + ciQdListDialogInstance.hide(); } }); diff --git a/src/protos/relayCabinetLayoutGraphics.ts b/src/protos/relayCabinetLayoutGraphics.ts index c5b245b..b2a880a 100644 --- a/src/protos/relayCabinetLayoutGraphics.ts +++ b/src/protos/relayCabinetLayoutGraphics.ts @@ -18,6 +18,7 @@ export namespace relayCabinetGraphicData { combinationtypeList?: Combinationtype[]; signalFaultAlarms?: SignalFaultAlarm[]; ciCjList?: CiCj; + ciQdList?: CiQd; }) { super(); pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [2, 3, 4, 7, 8, 9], this.#one_of_decls); @@ -49,6 +50,9 @@ export namespace relayCabinetGraphicData { if ("ciCjList" in data && data.ciCjList != undefined) { this.ciCjList = data.ciCjList; } + if ("ciQdList" in data && data.ciQdList != undefined) { + this.ciQdList = data.ciQdList; + } } } get canvas() { @@ -114,6 +118,15 @@ export namespace relayCabinetGraphicData { get has_ciCjList() { return pb_1.Message.getField(this, 10) != null; } + get ciQdList() { + return pb_1.Message.getWrapperField(this, CiQd, 11) as CiQd; + } + set ciQdList(value: CiQd) { + pb_1.Message.setWrapperField(this, 11, value); + } + get has_ciQdList() { + return pb_1.Message.getField(this, 11) != null; + } static fromObject(data: { canvas?: ReturnType; relayCabinets?: ReturnType[]; @@ -124,6 +137,7 @@ export namespace relayCabinetGraphicData { combinationtypeList?: ReturnType[]; signalFaultAlarms?: ReturnType[]; ciCjList?: ReturnType; + ciQdList?: ReturnType; }): RelayCabinetGraphicStorage { const message = new RelayCabinetGraphicStorage({}); if (data.canvas != null) { @@ -153,6 +167,9 @@ export namespace relayCabinetGraphicData { if (data.ciCjList != null) { message.ciCjList = CiCj.fromObject(data.ciCjList); } + if (data.ciQdList != null) { + message.ciQdList = CiQd.fromObject(data.ciQdList); + } return message; } toObject() { @@ -166,6 +183,7 @@ export namespace relayCabinetGraphicData { combinationtypeList?: ReturnType[]; signalFaultAlarms?: ReturnType[]; ciCjList?: ReturnType; + ciQdList?: ReturnType; } = {}; if (this.canvas != null) { data.canvas = this.canvas.toObject(); @@ -194,6 +212,9 @@ export namespace relayCabinetGraphicData { if (this.ciCjList != null) { data.ciCjList = this.ciCjList.toObject(); } + if (this.ciQdList != null) { + data.ciQdList = this.ciQdList.toObject(); + } return data; } serialize(): Uint8Array; @@ -218,6 +239,8 @@ export namespace relayCabinetGraphicData { writer.writeRepeatedMessage(9, this.signalFaultAlarms, (item: SignalFaultAlarm) => item.serialize(writer)); if (this.has_ciCjList) writer.writeMessage(10, this.ciCjList, () => this.ciCjList.serialize(writer)); + if (this.has_ciQdList) + writer.writeMessage(11, this.ciQdList, () => this.ciQdList.serialize(writer)); if (!w) return writer.getResultBuffer(); } @@ -254,6 +277,9 @@ export namespace relayCabinetGraphicData { case 10: reader.readMessage(message.ciCjList, () => message.ciCjList = CiCj.deserialize(reader)); break; + case 11: + reader.readMessage(message.ciQdList, () => message.ciQdList = CiQd.deserialize(reader)); + break; default: reader.skipField(); } } @@ -1333,4 +1359,251 @@ export namespace relayCabinetGraphicData { H = 1 } } + export class CiQd extends pb_1.Message { + #one_of_decls: number[][] = []; + constructor(data?: any[] | { + dsCount?: number; + qdList?: QdDataSet[]; + }) { + 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 ("dsCount" in data && data.dsCount != undefined) { + this.dsCount = data.dsCount; + } + if ("qdList" in data && data.qdList != undefined) { + this.qdList = data.qdList; + } + } + } + get dsCount() { + return pb_1.Message.getFieldWithDefault(this, 1, 0) as number; + } + set dsCount(value: number) { + pb_1.Message.setField(this, 1, value); + } + get qdList() { + return pb_1.Message.getRepeatedWrapperField(this, QdDataSet, 2) as QdDataSet[]; + } + set qdList(value: QdDataSet[]) { + pb_1.Message.setRepeatedWrapperField(this, 2, value); + } + static fromObject(data: { + dsCount?: number; + qdList?: ReturnType[]; + }): CiQd { + const message = new CiQd({}); + if (data.dsCount != null) { + message.dsCount = data.dsCount; + } + if (data.qdList != null) { + message.qdList = data.qdList.map(item => QdDataSet.fromObject(item)); + } + return message; + } + toObject() { + const data: { + dsCount?: number; + qdList?: ReturnType[]; + } = {}; + if (this.dsCount != null) { + data.dsCount = this.dsCount; + } + if (this.qdList != null) { + data.qdList = this.qdList.map((item: QdDataSet) => item.toObject()); + } + 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.dsCount != 0) + writer.writeInt32(1, this.dsCount); + if (this.qdList.length) + writer.writeRepeatedMessage(2, this.qdList, (item: QdDataSet) => item.serialize(writer)); + if (!w) + return writer.getResultBuffer(); + } + static deserialize(bytes: Uint8Array | pb_1.BinaryReader): CiQd { + const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new CiQd(); + while (reader.nextField()) { + if (reader.isEndGroup()) + break; + switch (reader.getFieldNumber()) { + case 1: + message.dsCount = reader.readInt32(); + break; + case 2: + reader.readMessage(message.qdList, () => pb_1.Message.addToRepeatedWrapperField(message, 2, QdDataSet.deserialize(reader), QdDataSet)); + break; + default: reader.skipField(); + } + } + return message; + } + serializeBinary(): Uint8Array { + return this.serialize(); + } + static deserializeBinary(bytes: Uint8Array): CiQd { + return CiQd.deserialize(bytes); + } + } + export class QdDataSet extends pb_1.Message { + #one_of_decls: number[][] = []; + constructor(data?: any[] | { + name?: string; + bitList?: QdData[]; + }) { + 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 ("name" in data && data.name != undefined) { + this.name = data.name; + } + if ("bitList" in data && data.bitList != undefined) { + this.bitList = data.bitList; + } + } + } + get name() { + return pb_1.Message.getFieldWithDefault(this, 1, "") as string; + } + set name(value: string) { + pb_1.Message.setField(this, 1, value); + } + get bitList() { + return pb_1.Message.getRepeatedWrapperField(this, QdData, 2) as QdData[]; + } + set bitList(value: QdData[]) { + pb_1.Message.setRepeatedWrapperField(this, 2, value); + } + static fromObject(data: { + name?: string; + bitList?: ReturnType[]; + }): QdDataSet { + const message = new QdDataSet({}); + if (data.name != null) { + message.name = data.name; + } + if (data.bitList != null) { + message.bitList = data.bitList.map(item => QdData.fromObject(item)); + } + return message; + } + toObject() { + const data: { + name?: string; + bitList?: ReturnType[]; + } = {}; + if (this.name != null) { + data.name = this.name; + } + if (this.bitList != null) { + data.bitList = this.bitList.map((item: QdData) => item.toObject()); + } + 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.name.length) + writer.writeString(1, this.name); + if (this.bitList.length) + writer.writeRepeatedMessage(2, this.bitList, (item: QdData) => item.serialize(writer)); + if (!w) + return writer.getResultBuffer(); + } + static deserialize(bytes: Uint8Array | pb_1.BinaryReader): QdDataSet { + const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new QdDataSet(); + while (reader.nextField()) { + if (reader.isEndGroup()) + break; + switch (reader.getFieldNumber()) { + case 1: + message.name = reader.readString(); + break; + case 2: + reader.readMessage(message.bitList, () => pb_1.Message.addToRepeatedWrapperField(message, 2, QdData.deserialize(reader), QdData)); + break; + default: reader.skipField(); + } + } + return message; + } + serializeBinary(): Uint8Array { + return this.serialize(); + } + static deserializeBinary(bytes: Uint8Array): QdDataSet { + return QdDataSet.deserialize(bytes); + } + } + export class QdData extends pb_1.Message { + #one_of_decls: number[][] = []; + constructor(data?: any[] | { + refRelays?: string[]; + }) { + super(); + pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [1], this.#one_of_decls); + if (!Array.isArray(data) && typeof data == "object") { + if ("refRelays" in data && data.refRelays != undefined) { + this.refRelays = data.refRelays; + } + } + } + get refRelays() { + return pb_1.Message.getFieldWithDefault(this, 1, []) as string[]; + } + set refRelays(value: string[]) { + pb_1.Message.setField(this, 1, value); + } + static fromObject(data: { + refRelays?: string[]; + }): QdData { + const message = new QdData({}); + if (data.refRelays != null) { + message.refRelays = data.refRelays; + } + return message; + } + toObject() { + const data: { + refRelays?: string[]; + } = {}; + if (this.refRelays != null) { + data.refRelays = this.refRelays; + } + 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.refRelays.length) + writer.writeRepeatedString(1, this.refRelays); + if (!w) + return writer.getResultBuffer(); + } + static deserialize(bytes: Uint8Array | pb_1.BinaryReader): QdData { + const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new QdData(); + while (reader.nextField()) { + if (reader.isEndGroup()) + break; + switch (reader.getFieldNumber()) { + case 1: + pb_1.Message.addToRepeatedField(message, 1, reader.readString()); + break; + default: reader.skipField(); + } + } + return message; + } + serializeBinary(): Uint8Array { + return this.serialize(); + } + static deserializeBinary(bytes: Uint8Array): QdData { + return QdData.deserialize(bytes); + } + } } diff --git a/src/stores/relayCabinet-store.ts b/src/stores/relayCabinet-store.ts index 8022f09..78abf42 100644 --- a/src/stores/relayCabinet-store.ts +++ b/src/stores/relayCabinet-store.ts @@ -8,7 +8,7 @@ import { import { DrawAssistant, IJlCanvas, IDrawApp, JlGraphic } from 'src/jl-graphic'; import { markRaw } from 'vue'; -export interface CollectionConfigCeil { +export interface CiCjConfigCeil { row: number; col: number; } @@ -22,8 +22,9 @@ export const useRelayCabinetStore = defineStore('relayCabinet', { table: undefined as QTable | undefined, showCombinationTypeConfig: false, tableOfCombinationType: undefined as QTable | undefined, - editCollectionConfigIndex: null as CollectionConfigCeil | null, - showCollectionConfig: false, + editCiCjConfigIndex: null as CiCjConfigCeil | null, + showCiCjConfig: false, + showCiQdConfig: false, }), getters: { drawMode: (state) => state.drawAssistant != null, @@ -98,8 +99,8 @@ export const useRelayCabinetStore = defineStore('relayCabinet', { setDraftId(id: number | null) { this.draftId = id; }, - setEditCollectionConfig(index: CollectionConfigCeil | null) { - this.editCollectionConfigIndex = index; + setEditCiCjConfig(index: CiCjConfigCeil | null) { + this.editCiCjConfigIndex = index; }, }, });