diff --git a/src/components/draw-app/properties/RelayProperty.vue b/src/components/draw-app/properties/RelayProperty.vue index bbf23c4..4493688 100644 --- a/src/components/draw-app/properties/RelayProperty.vue +++ b/src/components/draw-app/properties/RelayProperty.vue @@ -28,6 +28,15 @@ @update:model-value="onUpdate" label="型号" /> + @@ -80,4 +89,19 @@ const newOptionsModel = [ value: relayCabinetGraphicData.Relay.ModelType.JZXC_H18, }, ]; + +const defaultInitialPositionModel = [ + { + label: 'Q', + value: relayCabinetGraphicData.CjDataItem.PostionType.Q, + }, + { + label: 'H', + value: relayCabinetGraphicData.CjDataItem.PostionType.H, + }, + { + label: 'NONE', + value: relayCabinetGraphicData.CjDataItem.PostionType.NONE, + }, +]; diff --git a/src/drawApp/relayCabinetGraphics/RelayInteraction.ts b/src/drawApp/relayCabinetGraphics/RelayInteraction.ts index 4aee0ae..54a6ad7 100644 --- a/src/drawApp/relayCabinetGraphics/RelayInteraction.ts +++ b/src/drawApp/relayCabinetGraphics/RelayInteraction.ts @@ -52,6 +52,12 @@ export class RelayData extends GraphicDataBase implements IRelayData { set showCode(v: string) { this.data.showCode = v; } + get defaultInitialPosition(): relayCabinetGraphicData.CjDataItem.PostionType { + return this.data.defaultInitialPosition; + } + set defaultInitialPosition(v: relayCabinetGraphicData.CjDataItem.PostionType) { + this.data.defaultInitialPosition = v; + } clone(): RelayData { return new RelayData(this.data.cloneMessage()); } diff --git a/src/graphics/relay/Relay.ts b/src/graphics/relay/Relay.ts index 0fbafe6..b0e1807 100644 --- a/src/graphics/relay/Relay.ts +++ b/src/graphics/relay/Relay.ts @@ -14,6 +14,8 @@ export interface IRelayData extends GraphicData { set newModel(v: relayCabinetGraphicData.Relay.ModelType); get showCode(): string; // 展示的编号 set showCode(v: string); + get defaultInitialPosition(): relayCabinetGraphicData.CjDataItem.PostionType; // 默认初始位置 + set defaultInitialPosition(v: relayCabinetGraphicData.CjDataItem.PostionType); clone(): IRelayData; copyFrom(data: IRelayData): void; eq(other: IRelayData): boolean; diff --git a/src/graphics/relay/RelayDrawAssistant.ts b/src/graphics/relay/RelayDrawAssistant.ts index fa75250..d526c30 100644 --- a/src/graphics/relay/RelayDrawAssistant.ts +++ b/src/graphics/relay/RelayDrawAssistant.ts @@ -9,6 +9,7 @@ import { } from 'jl-graphic'; import { IRelayData, Relay, RelayTemplate } from './Relay'; +import { relayCabinetGraphicData } from 'src/protos/relayCabinetLayoutGraphics'; export interface IRelayDrawOptions { newData: () => IRelayData; @@ -39,6 +40,8 @@ export class RelayDraw extends GraphicDrawAssistant { } prepareData(data: IRelayData): boolean { data.transform = this.container.saveTransform(); + data.defaultInitialPosition = + relayCabinetGraphicData.CjDataItem.PostionType.NONE; return true; } } diff --git a/src/layouts/RelayCabinetLayout/GeneraterDevice.ts b/src/layouts/RelayCabinetLayout/GeneraterDevice.ts index 8377588..0917033 100644 --- a/src/layouts/RelayCabinetLayout/GeneraterDevice.ts +++ b/src/layouts/RelayCabinetLayout/GeneraterDevice.ts @@ -83,6 +83,8 @@ export function generateRelays( if (relaysInfo.showCode) { generateDevice.datas.showCode = relaysInfo.showCode; } + generateDevice.datas.defaultInitialPosition = + relayCabinetGraphicData.CjDataItem.PostionType.NONE; relaysInfos.shift(); } } else { @@ -129,6 +131,8 @@ function generateRelaysFormat( if (relaysInfo.showCode) { generateDevice.datas.showCode = relaysInfo.showCode; } + generateDevice.datas.defaultInitialPosition = + relayCabinetGraphicData.CjDataItem.PostionType.NONE; } generateDevice.position.set( relayCabinet.x - diff --git a/src/protos/relayCabinetLayoutGraphics.ts b/src/protos/relayCabinetLayoutGraphics.ts index 6a04569..ff8744d 100644 --- a/src/protos/relayCabinetLayoutGraphics.ts +++ b/src/protos/relayCabinetLayoutGraphics.ts @@ -369,6 +369,7 @@ export namespace relayCabinetGraphicData { code?: string; newModel?: Relay.ModelType; showCode?: string; + defaultInitialPosition?: CjDataItem.PostionType; }) { super(); pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls); @@ -385,6 +386,9 @@ export namespace relayCabinetGraphicData { if ("showCode" in data && data.showCode != undefined) { this.showCode = data.showCode; } + if ("defaultInitialPosition" in data && data.defaultInitialPosition != undefined) { + this.defaultInitialPosition = data.defaultInitialPosition; + } } } get common() { @@ -414,11 +418,18 @@ export namespace relayCabinetGraphicData { set showCode(value: string) { pb_1.Message.setField(this, 5, value); } + get defaultInitialPosition() { + return pb_1.Message.getFieldWithDefault(this, 6, CjDataItem.PostionType.Q) as CjDataItem.PostionType; + } + set defaultInitialPosition(value: CjDataItem.PostionType) { + pb_1.Message.setField(this, 6, value); + } static fromObject(data: { common?: ReturnType; code?: string; newModel?: Relay.ModelType; showCode?: string; + defaultInitialPosition?: CjDataItem.PostionType; }): Relay { const message = new Relay({}); if (data.common != null) { @@ -433,6 +444,9 @@ export namespace relayCabinetGraphicData { if (data.showCode != null) { message.showCode = data.showCode; } + if (data.defaultInitialPosition != null) { + message.defaultInitialPosition = data.defaultInitialPosition; + } return message; } toObject() { @@ -441,6 +455,7 @@ export namespace relayCabinetGraphicData { code?: string; newModel?: Relay.ModelType; showCode?: string; + defaultInitialPosition?: CjDataItem.PostionType; } = {}; if (this.common != null) { data.common = this.common.toObject(); @@ -454,6 +469,9 @@ export namespace relayCabinetGraphicData { if (this.showCode != null) { data.showCode = this.showCode; } + if (this.defaultInitialPosition != null) { + data.defaultInitialPosition = this.defaultInitialPosition; + } return data; } serialize(): Uint8Array; @@ -468,6 +486,8 @@ export namespace relayCabinetGraphicData { writer.writeEnum(4, this.newModel); if (this.showCode.length) writer.writeString(5, this.showCode); + if (this.defaultInitialPosition != CjDataItem.PostionType.Q) + writer.writeEnum(6, this.defaultInitialPosition); if (!w) return writer.getResultBuffer(); } @@ -489,6 +509,9 @@ export namespace relayCabinetGraphicData { case 5: message.showCode = reader.readString(); break; + case 6: + message.defaultInitialPosition = reader.readEnum(); + break; default: reader.skipField(); } } @@ -817,18 +840,14 @@ export namespace relayCabinetGraphicData { #one_of_decls: number[][] = []; constructor(data?: any[] | { code?: string; - oldrefRelays?: string[]; refRelays?: number[]; }) { super(); - pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [2, 3], this.#one_of_decls); + pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [3], this.#one_of_decls); if (!Array.isArray(data) && typeof data == "object") { if ("code" in data && data.code != undefined) { this.code = data.code; } - if ("oldrefRelays" in data && data.oldrefRelays != undefined) { - this.oldrefRelays = data.oldrefRelays; - } if ("refRelays" in data && data.refRelays != undefined) { this.refRelays = data.refRelays; } @@ -840,12 +859,6 @@ export namespace relayCabinetGraphicData { set code(value: string) { pb_1.Message.setField(this, 1, value); } - get oldrefRelays() { - return pb_1.Message.getFieldWithDefault(this, 2, []) as string[]; - } - set oldrefRelays(value: string[]) { - pb_1.Message.setField(this, 2, value); - } get refRelays() { return pb_1.Message.getFieldWithDefault(this, 3, []) as number[]; } @@ -854,16 +867,12 @@ export namespace relayCabinetGraphicData { } static fromObject(data: { code?: string; - oldrefRelays?: string[]; refRelays?: number[]; }): Combinationtype { const message = new Combinationtype({}); if (data.code != null) { message.code = data.code; } - if (data.oldrefRelays != null) { - message.oldrefRelays = data.oldrefRelays; - } if (data.refRelays != null) { message.refRelays = data.refRelays; } @@ -872,15 +881,11 @@ export namespace relayCabinetGraphicData { toObject() { const data: { code?: string; - oldrefRelays?: string[]; refRelays?: number[]; } = {}; if (this.code != null) { data.code = this.code; } - if (this.oldrefRelays != null) { - data.oldrefRelays = this.oldrefRelays; - } if (this.refRelays != null) { data.refRelays = this.refRelays; } @@ -892,8 +897,6 @@ export namespace relayCabinetGraphicData { const writer = w || new pb_1.BinaryWriter(); if (this.code.length) writer.writeString(1, this.code); - if (this.oldrefRelays.length) - writer.writeRepeatedString(2, this.oldrefRelays); if (this.refRelays.length) writer.writePackedUint32(3, this.refRelays); if (!w) @@ -908,9 +911,6 @@ export namespace relayCabinetGraphicData { case 1: message.code = reader.readString(); break; - case 2: - pb_1.Message.addToRepeatedField(message, 2, reader.readString()); - break; case 3: message.refRelays = reader.readPackedUint32(); break; @@ -1289,16 +1289,12 @@ export namespace relayCabinetGraphicData { export class CjDataItem extends pb_1.Message { #one_of_decls: number[][] = []; constructor(data?: any[] | { - oldrelayId?: string; position?: CjDataItem.PostionType; relayId?: number; }) { super(); pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls); if (!Array.isArray(data) && typeof data == "object") { - if ("oldrelayId" in data && data.oldrelayId != undefined) { - this.oldrelayId = data.oldrelayId; - } if ("position" in data && data.position != undefined) { this.position = data.position; } @@ -1307,12 +1303,6 @@ export namespace relayCabinetGraphicData { } } } - get oldrelayId() { - return pb_1.Message.getFieldWithDefault(this, 1, "") as string; - } - set oldrelayId(value: string) { - pb_1.Message.setField(this, 1, value); - } get position() { return pb_1.Message.getFieldWithDefault(this, 2, CjDataItem.PostionType.Q) as CjDataItem.PostionType; } @@ -1326,14 +1316,10 @@ export namespace relayCabinetGraphicData { pb_1.Message.setField(this, 3, value); } static fromObject(data: { - oldrelayId?: string; position?: CjDataItem.PostionType; relayId?: number; }): CjDataItem { const message = new CjDataItem({}); - if (data.oldrelayId != null) { - message.oldrelayId = data.oldrelayId; - } if (data.position != null) { message.position = data.position; } @@ -1344,13 +1330,9 @@ export namespace relayCabinetGraphicData { } toObject() { const data: { - oldrelayId?: string; position?: CjDataItem.PostionType; relayId?: number; } = {}; - if (this.oldrelayId != null) { - data.oldrelayId = this.oldrelayId; - } if (this.position != null) { data.position = this.position; } @@ -1363,8 +1345,6 @@ export namespace relayCabinetGraphicData { serialize(w: pb_1.BinaryWriter): void; serialize(w?: pb_1.BinaryWriter): Uint8Array | void { const writer = w || new pb_1.BinaryWriter(); - if (this.oldrelayId.length) - writer.writeString(1, this.oldrelayId); if (this.position != CjDataItem.PostionType.Q) writer.writeEnum(2, this.position); if (this.relayId != 0) @@ -1378,9 +1358,6 @@ export namespace relayCabinetGraphicData { if (reader.isEndGroup()) break; switch (reader.getFieldNumber()) { - case 1: - message.oldrelayId = reader.readString(); - break; case 2: message.position = reader.readEnum(); break; @@ -1402,7 +1379,8 @@ export namespace relayCabinetGraphicData { export namespace CjDataItem { export enum PostionType { Q = 0, - H = 1 + H = 1, + NONE = 2 } } export class CiQd extends pb_1.Message { @@ -1588,26 +1566,16 @@ export namespace relayCabinetGraphicData { export class QdData extends pb_1.Message { #one_of_decls: number[][] = []; constructor(data?: any[] | { - oldrefRelays?: string[]; refRelays?: number[]; }) { super(); - pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [1, 2], this.#one_of_decls); + pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [2], this.#one_of_decls); if (!Array.isArray(data) && typeof data == "object") { - if ("oldrefRelays" in data && data.oldrefRelays != undefined) { - this.oldrefRelays = data.oldrefRelays; - } if ("refRelays" in data && data.refRelays != undefined) { this.refRelays = data.refRelays; } } } - get oldrefRelays() { - return pb_1.Message.getFieldWithDefault(this, 1, []) as string[]; - } - set oldrefRelays(value: string[]) { - pb_1.Message.setField(this, 1, value); - } get refRelays() { return pb_1.Message.getFieldWithDefault(this, 2, []) as number[]; } @@ -1615,13 +1583,9 @@ export namespace relayCabinetGraphicData { pb_1.Message.setField(this, 2, value); } static fromObject(data: { - oldrefRelays?: string[]; refRelays?: number[]; }): QdData { const message = new QdData({}); - if (data.oldrefRelays != null) { - message.oldrefRelays = data.oldrefRelays; - } if (data.refRelays != null) { message.refRelays = data.refRelays; } @@ -1629,12 +1593,8 @@ export namespace relayCabinetGraphicData { } toObject() { const data: { - oldrefRelays?: string[]; refRelays?: number[]; } = {}; - if (this.oldrefRelays != null) { - data.oldrefRelays = this.oldrefRelays; - } if (this.refRelays != null) { data.refRelays = this.refRelays; } @@ -1644,8 +1604,6 @@ export namespace relayCabinetGraphicData { serialize(w: pb_1.BinaryWriter): void; serialize(w?: pb_1.BinaryWriter): Uint8Array | void { const writer = w || new pb_1.BinaryWriter(); - if (this.oldrefRelays.length) - writer.writeRepeatedString(1, this.oldrefRelays); if (this.refRelays.length) writer.writePackedUint32(2, this.refRelays); if (!w) @@ -1657,9 +1615,6 @@ export namespace relayCabinetGraphicData { if (reader.isEndGroup()) break; switch (reader.getFieldNumber()) { - case 1: - pb_1.Message.addToRepeatedField(message, 1, reader.readString()); - break; case 2: message.refRelays = reader.readPackedUint32(); break;