Merge remote-tracking branch 'origin/develop' into local-test
All checks were successful
CI / Docker-Build (push) Successful in 2m29s

# Conflicts:
#	src/drawApp/relayCabinetGraphics/RelayInteraction.ts
#	src/graphics/relay/Relay.ts
#	src/layouts/RelayCabinetLayout/GeneraterDevice.ts
#	src/protos/relayCabinetLayoutGraphics.ts
This commit is contained in:
joylink_fanyuhong 2024-06-27 14:49:48 +08:00
commit d17144cd7e
6 changed files with 66 additions and 72 deletions

View File

@ -28,6 +28,15 @@
@update:model-value="onUpdate" @update:model-value="onUpdate"
label="型号" label="型号"
/> />
<q-select
outlined
v-model="relayModel.defaultInitialPosition"
:options="defaultInitialPositionModel"
:map-options="true"
:emit-value="true"
@update:model-value="onUpdate"
label="默认初始位置"
/>
</q-form> </q-form>
</template> </template>
@ -80,4 +89,19 @@ const newOptionsModel = [
value: relayCabinetGraphicData.Relay.ModelType.JZXC_H18, 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,
},
];
</script> </script>

View File

@ -52,6 +52,12 @@ export class RelayData extends GraphicDataBase implements IRelayData {
set showCode(v: string) { set showCode(v: string) {
this.data.showCode = v; 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 { clone(): RelayData {
return new RelayData(this.data.cloneMessage()); return new RelayData(this.data.cloneMessage());
} }

View File

@ -14,6 +14,8 @@ export interface IRelayData extends GraphicData {
set newModel(v: relayCabinetGraphicData.Relay.ModelType); set newModel(v: relayCabinetGraphicData.Relay.ModelType);
get showCode(): string; // 展示的编号 get showCode(): string; // 展示的编号
set showCode(v: string); set showCode(v: string);
get defaultInitialPosition(): relayCabinetGraphicData.CjDataItem.PostionType; // 默认初始位置
set defaultInitialPosition(v: relayCabinetGraphicData.CjDataItem.PostionType);
clone(): IRelayData; clone(): IRelayData;
copyFrom(data: IRelayData): void; copyFrom(data: IRelayData): void;
eq(other: IRelayData): boolean; eq(other: IRelayData): boolean;

View File

@ -9,6 +9,7 @@ import {
} from 'jl-graphic'; } from 'jl-graphic';
import { IRelayData, Relay, RelayTemplate } from './Relay'; import { IRelayData, Relay, RelayTemplate } from './Relay';
import { relayCabinetGraphicData } from 'src/protos/relayCabinetLayoutGraphics';
export interface IRelayDrawOptions { export interface IRelayDrawOptions {
newData: () => IRelayData; newData: () => IRelayData;
@ -39,6 +40,8 @@ export class RelayDraw extends GraphicDrawAssistant<RelayTemplate, IRelayData> {
} }
prepareData(data: IRelayData): boolean { prepareData(data: IRelayData): boolean {
data.transform = this.container.saveTransform(); data.transform = this.container.saveTransform();
data.defaultInitialPosition =
relayCabinetGraphicData.CjDataItem.PostionType.NONE;
return true; return true;
} }
} }

View File

@ -83,6 +83,8 @@ export function generateRelays(
if (relaysInfo.showCode) { if (relaysInfo.showCode) {
generateDevice.datas.showCode = relaysInfo.showCode; generateDevice.datas.showCode = relaysInfo.showCode;
} }
generateDevice.datas.defaultInitialPosition =
relayCabinetGraphicData.CjDataItem.PostionType.NONE;
relaysInfos.shift(); relaysInfos.shift();
} }
} else { } else {
@ -129,6 +131,8 @@ function generateRelaysFormat(
if (relaysInfo.showCode) { if (relaysInfo.showCode) {
generateDevice.datas.showCode = relaysInfo.showCode; generateDevice.datas.showCode = relaysInfo.showCode;
} }
generateDevice.datas.defaultInitialPosition =
relayCabinetGraphicData.CjDataItem.PostionType.NONE;
} }
generateDevice.position.set( generateDevice.position.set(
relayCabinet.x - relayCabinet.x -

View File

@ -369,6 +369,7 @@ export namespace relayCabinetGraphicData {
code?: string; code?: string;
newModel?: Relay.ModelType; newModel?: Relay.ModelType;
showCode?: string; showCode?: string;
defaultInitialPosition?: CjDataItem.PostionType;
}) { }) {
super(); super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls); 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) { if ("showCode" in data && data.showCode != undefined) {
this.showCode = data.showCode; this.showCode = data.showCode;
} }
if ("defaultInitialPosition" in data && data.defaultInitialPosition != undefined) {
this.defaultInitialPosition = data.defaultInitialPosition;
}
} }
} }
get common() { get common() {
@ -414,11 +418,18 @@ export namespace relayCabinetGraphicData {
set showCode(value: string) { set showCode(value: string) {
pb_1.Message.setField(this, 5, value); 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: { static fromObject(data: {
common?: ReturnType<typeof dependency_1.graphicData.CommonInfo.prototype.toObject>; common?: ReturnType<typeof dependency_1.graphicData.CommonInfo.prototype.toObject>;
code?: string; code?: string;
newModel?: Relay.ModelType; newModel?: Relay.ModelType;
showCode?: string; showCode?: string;
defaultInitialPosition?: CjDataItem.PostionType;
}): Relay { }): Relay {
const message = new Relay({}); const message = new Relay({});
if (data.common != null) { if (data.common != null) {
@ -433,6 +444,9 @@ export namespace relayCabinetGraphicData {
if (data.showCode != null) { if (data.showCode != null) {
message.showCode = data.showCode; message.showCode = data.showCode;
} }
if (data.defaultInitialPosition != null) {
message.defaultInitialPosition = data.defaultInitialPosition;
}
return message; return message;
} }
toObject() { toObject() {
@ -441,6 +455,7 @@ export namespace relayCabinetGraphicData {
code?: string; code?: string;
newModel?: Relay.ModelType; newModel?: Relay.ModelType;
showCode?: string; showCode?: string;
defaultInitialPosition?: CjDataItem.PostionType;
} = {}; } = {};
if (this.common != null) { if (this.common != null) {
data.common = this.common.toObject(); data.common = this.common.toObject();
@ -454,6 +469,9 @@ export namespace relayCabinetGraphicData {
if (this.showCode != null) { if (this.showCode != null) {
data.showCode = this.showCode; data.showCode = this.showCode;
} }
if (this.defaultInitialPosition != null) {
data.defaultInitialPosition = this.defaultInitialPosition;
}
return data; return data;
} }
serialize(): Uint8Array; serialize(): Uint8Array;
@ -468,6 +486,8 @@ export namespace relayCabinetGraphicData {
writer.writeEnum(4, this.newModel); writer.writeEnum(4, this.newModel);
if (this.showCode.length) if (this.showCode.length)
writer.writeString(5, this.showCode); writer.writeString(5, this.showCode);
if (this.defaultInitialPosition != CjDataItem.PostionType.Q)
writer.writeEnum(6, this.defaultInitialPosition);
if (!w) if (!w)
return writer.getResultBuffer(); return writer.getResultBuffer();
} }
@ -489,6 +509,9 @@ export namespace relayCabinetGraphicData {
case 5: case 5:
message.showCode = reader.readString(); message.showCode = reader.readString();
break; break;
case 6:
message.defaultInitialPosition = reader.readEnum();
break;
default: reader.skipField(); default: reader.skipField();
} }
} }
@ -817,18 +840,14 @@ export namespace relayCabinetGraphicData {
#one_of_decls: number[][] = []; #one_of_decls: number[][] = [];
constructor(data?: any[] | { constructor(data?: any[] | {
code?: string; code?: string;
oldrefRelays?: string[];
refRelays?: number[]; refRelays?: number[];
}) { }) {
super(); 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 (!Array.isArray(data) && typeof data == "object") {
if ("code" in data && data.code != undefined) { if ("code" in data && data.code != undefined) {
this.code = data.code; this.code = data.code;
} }
if ("oldrefRelays" in data && data.oldrefRelays != undefined) {
this.oldrefRelays = data.oldrefRelays;
}
if ("refRelays" in data && data.refRelays != undefined) { if ("refRelays" in data && data.refRelays != undefined) {
this.refRelays = data.refRelays; this.refRelays = data.refRelays;
} }
@ -840,12 +859,6 @@ export namespace relayCabinetGraphicData {
set code(value: string) { set code(value: string) {
pb_1.Message.setField(this, 1, value); 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() { get refRelays() {
return pb_1.Message.getFieldWithDefault(this, 3, []) as number[]; return pb_1.Message.getFieldWithDefault(this, 3, []) as number[];
} }
@ -854,16 +867,12 @@ export namespace relayCabinetGraphicData {
} }
static fromObject(data: { static fromObject(data: {
code?: string; code?: string;
oldrefRelays?: string[];
refRelays?: number[]; refRelays?: number[];
}): Combinationtype { }): Combinationtype {
const message = new Combinationtype({}); const message = new Combinationtype({});
if (data.code != null) { if (data.code != null) {
message.code = data.code; message.code = data.code;
} }
if (data.oldrefRelays != null) {
message.oldrefRelays = data.oldrefRelays;
}
if (data.refRelays != null) { if (data.refRelays != null) {
message.refRelays = data.refRelays; message.refRelays = data.refRelays;
} }
@ -872,15 +881,11 @@ export namespace relayCabinetGraphicData {
toObject() { toObject() {
const data: { const data: {
code?: string; code?: string;
oldrefRelays?: string[];
refRelays?: number[]; refRelays?: number[];
} = {}; } = {};
if (this.code != null) { if (this.code != null) {
data.code = this.code; data.code = this.code;
} }
if (this.oldrefRelays != null) {
data.oldrefRelays = this.oldrefRelays;
}
if (this.refRelays != null) { if (this.refRelays != null) {
data.refRelays = this.refRelays; data.refRelays = this.refRelays;
} }
@ -892,8 +897,6 @@ export namespace relayCabinetGraphicData {
const writer = w || new pb_1.BinaryWriter(); const writer = w || new pb_1.BinaryWriter();
if (this.code.length) if (this.code.length)
writer.writeString(1, this.code); writer.writeString(1, this.code);
if (this.oldrefRelays.length)
writer.writeRepeatedString(2, this.oldrefRelays);
if (this.refRelays.length) if (this.refRelays.length)
writer.writePackedUint32(3, this.refRelays); writer.writePackedUint32(3, this.refRelays);
if (!w) if (!w)
@ -908,9 +911,6 @@ export namespace relayCabinetGraphicData {
case 1: case 1:
message.code = reader.readString(); message.code = reader.readString();
break; break;
case 2:
pb_1.Message.addToRepeatedField(message, 2, reader.readString());
break;
case 3: case 3:
message.refRelays = reader.readPackedUint32(); message.refRelays = reader.readPackedUint32();
break; break;
@ -1289,16 +1289,12 @@ export namespace relayCabinetGraphicData {
export class CjDataItem extends pb_1.Message { export class CjDataItem extends pb_1.Message {
#one_of_decls: number[][] = []; #one_of_decls: number[][] = [];
constructor(data?: any[] | { constructor(data?: any[] | {
oldrelayId?: string;
position?: CjDataItem.PostionType; position?: CjDataItem.PostionType;
relayId?: number; relayId?: number;
}) { }) {
super(); super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls); pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
if (!Array.isArray(data) && typeof data == "object") { 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) { if ("position" in data && data.position != undefined) {
this.position = data.position; 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() { get position() {
return pb_1.Message.getFieldWithDefault(this, 2, CjDataItem.PostionType.Q) as CjDataItem.PostionType; 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); pb_1.Message.setField(this, 3, value);
} }
static fromObject(data: { static fromObject(data: {
oldrelayId?: string;
position?: CjDataItem.PostionType; position?: CjDataItem.PostionType;
relayId?: number; relayId?: number;
}): CjDataItem { }): CjDataItem {
const message = new CjDataItem({}); const message = new CjDataItem({});
if (data.oldrelayId != null) {
message.oldrelayId = data.oldrelayId;
}
if (data.position != null) { if (data.position != null) {
message.position = data.position; message.position = data.position;
} }
@ -1344,13 +1330,9 @@ export namespace relayCabinetGraphicData {
} }
toObject() { toObject() {
const data: { const data: {
oldrelayId?: string;
position?: CjDataItem.PostionType; position?: CjDataItem.PostionType;
relayId?: number; relayId?: number;
} = {}; } = {};
if (this.oldrelayId != null) {
data.oldrelayId = this.oldrelayId;
}
if (this.position != null) { if (this.position != null) {
data.position = this.position; data.position = this.position;
} }
@ -1363,8 +1345,6 @@ export namespace relayCabinetGraphicData {
serialize(w: pb_1.BinaryWriter): void; serialize(w: pb_1.BinaryWriter): void;
serialize(w?: pb_1.BinaryWriter): Uint8Array | void { serialize(w?: pb_1.BinaryWriter): Uint8Array | void {
const writer = w || new pb_1.BinaryWriter(); const writer = w || new pb_1.BinaryWriter();
if (this.oldrelayId.length)
writer.writeString(1, this.oldrelayId);
if (this.position != CjDataItem.PostionType.Q) if (this.position != CjDataItem.PostionType.Q)
writer.writeEnum(2, this.position); writer.writeEnum(2, this.position);
if (this.relayId != 0) if (this.relayId != 0)
@ -1378,9 +1358,6 @@ export namespace relayCabinetGraphicData {
if (reader.isEndGroup()) if (reader.isEndGroup())
break; break;
switch (reader.getFieldNumber()) { switch (reader.getFieldNumber()) {
case 1:
message.oldrelayId = reader.readString();
break;
case 2: case 2:
message.position = reader.readEnum(); message.position = reader.readEnum();
break; break;
@ -1402,7 +1379,8 @@ export namespace relayCabinetGraphicData {
export namespace CjDataItem { export namespace CjDataItem {
export enum PostionType { export enum PostionType {
Q = 0, Q = 0,
H = 1 H = 1,
NONE = 2
} }
} }
export class CiQd extends pb_1.Message { export class CiQd extends pb_1.Message {
@ -1588,26 +1566,16 @@ export namespace relayCabinetGraphicData {
export class QdData extends pb_1.Message { export class QdData extends pb_1.Message {
#one_of_decls: number[][] = []; #one_of_decls: number[][] = [];
constructor(data?: any[] | { constructor(data?: any[] | {
oldrefRelays?: string[];
refRelays?: number[]; refRelays?: number[];
}) { }) {
super(); 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 (!Array.isArray(data) && typeof data == "object") {
if ("oldrefRelays" in data && data.oldrefRelays != undefined) {
this.oldrefRelays = data.oldrefRelays;
}
if ("refRelays" in data && data.refRelays != undefined) { if ("refRelays" in data && data.refRelays != undefined) {
this.refRelays = data.refRelays; 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() { get refRelays() {
return pb_1.Message.getFieldWithDefault(this, 2, []) as number[]; return pb_1.Message.getFieldWithDefault(this, 2, []) as number[];
} }
@ -1615,13 +1583,9 @@ export namespace relayCabinetGraphicData {
pb_1.Message.setField(this, 2, value); pb_1.Message.setField(this, 2, value);
} }
static fromObject(data: { static fromObject(data: {
oldrefRelays?: string[];
refRelays?: number[]; refRelays?: number[];
}): QdData { }): QdData {
const message = new QdData({}); const message = new QdData({});
if (data.oldrefRelays != null) {
message.oldrefRelays = data.oldrefRelays;
}
if (data.refRelays != null) { if (data.refRelays != null) {
message.refRelays = data.refRelays; message.refRelays = data.refRelays;
} }
@ -1629,12 +1593,8 @@ export namespace relayCabinetGraphicData {
} }
toObject() { toObject() {
const data: { const data: {
oldrefRelays?: string[];
refRelays?: number[]; refRelays?: number[];
} = {}; } = {};
if (this.oldrefRelays != null) {
data.oldrefRelays = this.oldrefRelays;
}
if (this.refRelays != null) { if (this.refRelays != null) {
data.refRelays = this.refRelays; data.refRelays = this.refRelays;
} }
@ -1644,8 +1604,6 @@ export namespace relayCabinetGraphicData {
serialize(w: pb_1.BinaryWriter): void; serialize(w: pb_1.BinaryWriter): void;
serialize(w?: pb_1.BinaryWriter): Uint8Array | void { serialize(w?: pb_1.BinaryWriter): Uint8Array | void {
const writer = w || new pb_1.BinaryWriter(); const writer = w || new pb_1.BinaryWriter();
if (this.oldrefRelays.length)
writer.writeRepeatedString(1, this.oldrefRelays);
if (this.refRelays.length) if (this.refRelays.length)
writer.writePackedUint32(2, this.refRelays); writer.writePackedUint32(2, this.refRelays);
if (!w) if (!w)
@ -1657,9 +1615,6 @@ export namespace relayCabinetGraphicData {
if (reader.isEndGroup()) if (reader.isEndGroup())
break; break;
switch (reader.getFieldNumber()) { switch (reader.getFieldNumber()) {
case 1:
pb_1.Message.addToRepeatedField(message, 1, reader.readString());
break;
case 2: case 2:
message.refRelays = reader.readPackedUint32(); message.refRelays = reader.readPackedUint32();
break; break;