ibp关联组合

This commit is contained in:
Yuan 2023-10-13 16:08:14 +08:00
parent bc56ed8276
commit 726131a38f
9 changed files with 153 additions and 252 deletions

@ -1 +1 @@
Subproject commit cc23df90763bd27ec8813fa9dce24d06deeb2829
Subproject commit 4901aa6c0d5aa323b848fd469ff90ff018d9b303

View File

@ -21,17 +21,7 @@ const pagination = ref({
rowsPerPage: 10,
rowsNumber: 10,
});
const deviceTypeMap = {
6: '车站',
};
const columns: QTable['columns'] = [
{
name: 'deviceType',
label: '设备类型',
field: (row) => deviceTypeMap[row.deviceType as keyof typeof deviceTypeMap],
align: 'center',
},
{ name: 'code', label: '设备编号', field: 'code', align: 'center' },
{
name: 'combinationtypes',
label: '关联的组合类型',
@ -73,18 +63,21 @@ function createData() {
ibpDrawStore.showRelateDeviceConfig = true;
}
function deleteData(row: RelateDevicelistItem) {
$q.dialog({ message: `确定删除 "${row.code}" 吗?`, cancel: true }).onOk(
async () => {
try {
deleteIbpRelateDevice(row);
successNotify('删除数据成功!');
} catch (err) {
errorNotify('删除失败:', err);
} finally {
tableRef.value?.requestServerInteraction();
}
$q.dialog({
message: `确定删除 "${row.combinationtypes
.map((type) => type.code)
.join('\\')}" ?`,
cancel: true,
}).onOk(async () => {
try {
deleteIbpRelateDevice(row);
successNotify('删除数据成功!');
} catch (err) {
errorNotify('删除失败:', err);
} finally {
tableRef.value?.requestServerInteraction();
}
);
});
}
</script>
@ -92,7 +85,7 @@ function deleteData(row: RelateDevicelistItem) {
<DraggableDialog
seamless
@show="onDialogShow"
title="IBP关联的车站"
title="关联的组合类型"
:width="600"
:height="0"
>

View File

@ -1,4 +1,5 @@
<script setup lang="ts">
import { QForm } from 'quasar';
import { useFormData } from 'src/components/DrawAppFormUtils';
import { IbpLightData } from 'src/drawApp/graphics/IbpLightInteraction';
import { ibpGraphicData } from 'src/protos/ibpGraphics';
@ -19,7 +20,7 @@ const colorOptions = [
</script>
<template>
<Qform>
<QForm>
<QInput
outlined
readonly
@ -44,7 +45,7 @@ const colorOptions = [
:options="colorOptions"
@popupHide="onUpdate"
/>
</Qform>
</QForm>
</template>
<style scoped></style>

View File

@ -20,8 +20,6 @@ const ibpDrawStore = useIBPDrawStore();
const $q = useQuasar();
const showRangeConfig = ref(true);
const relateDeviceConfig = ref<{
deviceType: graphicData.RelatedRef.DeviceType | undefined;
code: string;
combinationtypes: {
code: string;
refDevices: string[];
@ -29,13 +27,11 @@ const relateDeviceConfig = ref<{
expanded: boolean;
}[];
}>({
deviceType: undefined,
code: '',
combinationtypes: [
{ code: '组合类型', refDevices: [], refDevicesCode: [], expanded: false },
],
});
const handleState = ref('新建门控箱关联设备');
const handleState = ref('新建IBP关联设备');
const optionsType = [
{ label: '车站', value: graphicData.RelatedRef.DeviceType.station },
@ -89,11 +85,9 @@ async function onSubmit() {
);
});
const ibpRelateDevice = new ibpGraphicData.IbpRelatedDevice({
deviceType: relateDeviceConfig.value.deviceType,
code: relateDeviceConfig.value.code,
combinationtypes: combinationtypes,
});
if (handleState.value == '新建门控箱关联设备') {
if (handleState.value == '新建IBP关联设备') {
handle.value = '创建成功';
handleError.value = '创建失败';
createIbpRelateDevice(ibpRelateDevice);
@ -125,12 +119,10 @@ async function onSubmit() {
async function editRelateDevices(row: RelateDevicelistItem) {
try {
const drawApp = ibpDrawStore.getDrawApp();
handleState.value = '编辑门控箱关联设备';
handleState.value = '编辑IBP关联设备';
selectGraphic = [];
drawApp.updateSelected();
editRow = row;
relateDeviceConfig.value.deviceType = row.deviceType;
relateDeviceConfig.value.code = row.code;
row.combinationtypes.forEach((combinationtype) => {
const refCode: string[] = [];
combinationtype.refDevices.forEach((id) => {
@ -216,10 +208,8 @@ function deleteCombinationtype(index: number) {
function onReset() {
clickIndex = null;
handleState.value = '新建门控箱关联设备';
handleState.value = '新建IBP关联设备';
relateDeviceConfig.value = {
deviceType: undefined,
code: '',
combinationtypes: [
{ code: '组合类型', refDevices: [], refDevicesCode: [], expanded: false },
],
@ -241,21 +231,6 @@ function goBack() {
</QCardSection>
<QSeparator inset></QSeparator>
<QForm ref="myForm" @submit="onSubmit" @reset="onReset">
<QSelect
outlined
v-model="relateDeviceConfig.deviceType"
:options="optionsType"
label="设备类型"
:map-options="true"
:emit-value="true"
:rules="[(val) => val != '' || '设备类型不能为空']"
/>
<QInput
outlined
label="设备编号"
v-model="relateDeviceConfig.code"
:rules="[(val) => val.trim() != '' || '名称不能为空']"
/>
<QList bordered separator class="rounded-borders">
<QExpansionItem
expand-separator

View File

@ -150,6 +150,7 @@ export function saveIBPDrawDatas(app: IDrawApp) {
storage.ibpLights.push(g.saveData<IbpLightData>().data);
}
});
storage.ibpRelatedDevices = ibpRelatedDeviceList;
const base64 = fromUint8Array(storage.serialize());
return base64;
}
@ -184,6 +185,7 @@ async function IBPDrawDataLoader() {
storage.ibpLights.forEach((ibpLight) => {
datas.push(new IbpLightData(ibpLight));
});
ibpRelatedDeviceList = storage.ibpRelatedDevices;
return {
canvasProperty: storage.canvas,
datas: datas,
@ -196,8 +198,6 @@ async function IBPDrawDataLoader() {
}
export interface RelateDevicelistItem {
deviceType: graphicData.RelatedRef.DeviceType | undefined;
code: string;
combinationtypes: {
code: string;
refDevices: string[];
@ -206,13 +206,13 @@ export interface RelateDevicelistItem {
}[];
}
const refDevicesList: ibpGraphicData.IbpRelatedDevice[] = [];
let ibpRelatedDeviceList: ibpGraphicData.IbpRelatedDevice[] = [];
export function loadIbpRelateDeviceList() {
return refDevicesList;
return ibpRelatedDeviceList;
}
export function createIbpRelateDevice(row: ibpGraphicData.IbpRelatedDevice) {
refDevicesList.push(row);
ibpRelatedDeviceList.push(row);
drawApp?.emit('postdataloaded');
}
@ -220,12 +220,12 @@ export function editIbpRelateDevice(
editRow: RelateDevicelistItem,
newData: ibpGraphicData.IbpRelatedDevice
) {
for (let i = 0; i < refDevicesList.length; i++) {
for (let i = 0; i < ibpRelatedDeviceList.length; i++) {
if (
refDevicesList[i].deviceType == editRow.deviceType &&
refDevicesList[i].code == editRow.code
ibpRelatedDeviceList[i].combinationtypes.map((c) => c.code) ==
editRow.combinationtypes.map((c) => c.code)
) {
refDevicesList[i] = newData;
ibpRelatedDeviceList[i] = newData;
break;
}
}
@ -233,12 +233,12 @@ export function editIbpRelateDevice(
}
export function deleteIbpRelateDevice(row: RelateDevicelistItem) {
for (let i = 0; i < refDevicesList.length; i++) {
for (let i = 0; i < ibpRelatedDeviceList.length; i++) {
if (
refDevicesList[i].deviceType == row.deviceType &&
refDevicesList[i].code == row.code
ibpRelatedDeviceList[i].combinationtypes.map((c) => c.code) ==
row.combinationtypes.map((c) => c.code)
) {
refDevicesList.splice(i, 1);
ibpRelatedDeviceList.splice(i, 1);
break;
}
}

View File

@ -144,6 +144,7 @@ function openDeviceRelateList() {
component: IBpRelatedDeviceList,
componentProps: {
onEditClick: (row: RelateDevicelistItem) => {
console.log(row);
relateDeviceConfigEdit.value?.editRelateDevices(row);
},
},

View File

@ -377,16 +377,16 @@ export namespace state {
#one_of_decls: number[][] = [];
constructor(data?: any[] | {
id?: string;
aspect?: Signal.Aspect;
light?: Signal.Light[];
}) {
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, [2], this.#one_of_decls);
if (!Array.isArray(data) && typeof data == "object") {
if ("id" in data && data.id != undefined) {
this.id = data.id;
}
if ("aspect" in data && data.aspect != undefined) {
this.aspect = data.aspect;
if ("light" in data && data.light != undefined) {
this.light = data.light;
}
}
}
@ -396,35 +396,35 @@ export namespace state {
set id(value: string) {
pb_1.Message.setField(this, 1, value);
}
get aspect() {
return pb_1.Message.getFieldWithDefault(this, 2, Signal.Aspect.OFF) as Signal.Aspect;
get light() {
return pb_1.Message.getRepeatedWrapperField(this, Signal.Light, 2) as Signal.Light[];
}
set aspect(value: Signal.Aspect) {
pb_1.Message.setField(this, 2, value);
set light(value: Signal.Light[]) {
pb_1.Message.setRepeatedWrapperField(this, 2, value);
}
static fromObject(data: {
id?: string;
aspect?: Signal.Aspect;
light?: ReturnType<typeof Signal.Light.prototype.toObject>[];
}): SignalState {
const message = new SignalState({});
if (data.id != null) {
message.id = data.id;
}
if (data.aspect != null) {
message.aspect = data.aspect;
if (data.light != null) {
message.light = data.light.map(item => Signal.Light.fromObject(item));
}
return message;
}
toObject() {
const data: {
id?: string;
aspect?: Signal.Aspect;
light?: ReturnType<typeof Signal.Light.prototype.toObject>[];
} = {};
if (this.id != null) {
data.id = this.id;
}
if (this.aspect != null) {
data.aspect = this.aspect;
if (this.light != null) {
data.light = this.light.map((item: Signal.Light) => item.toObject());
}
return data;
}
@ -434,8 +434,8 @@ export namespace state {
const writer = w || new pb_1.BinaryWriter();
if (this.id.length)
writer.writeString(1, this.id);
if (this.aspect != Signal.Aspect.OFF)
writer.writeEnum(2, this.aspect);
if (this.light.length)
writer.writeRepeatedMessage(2, this.light, (item: Signal.Light) => item.serialize(writer));
if (!w)
return writer.getResultBuffer();
}
@ -449,7 +449,7 @@ export namespace state {
message.id = reader.readString();
break;
case 2:
message.aspect = reader.readEnum();
reader.readMessage(message.light, () => pb_1.Message.addToRepeatedWrapperField(message, 2, Signal.Light.deserialize(reader), Signal.Light));
break;
default: reader.skipField();
}
@ -514,6 +514,96 @@ export namespace state {
B = 6,
A = 7
}
export class Light extends pb_1.Message {
#one_of_decls: number[][] = [];
constructor(data?: any[] | {
color?: Signal.Aspect;
display?: boolean;
}) {
super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
if (!Array.isArray(data) && typeof data == "object") {
if ("color" in data && data.color != undefined) {
this.color = data.color;
}
if ("display" in data && data.display != undefined) {
this.display = data.display;
}
}
}
get color() {
return pb_1.Message.getFieldWithDefault(this, 1, Signal.Aspect.OFF) as Signal.Aspect;
}
set color(value: Signal.Aspect) {
pb_1.Message.setField(this, 1, value);
}
get display() {
return pb_1.Message.getFieldWithDefault(this, 2, false) as boolean;
}
set display(value: boolean) {
pb_1.Message.setField(this, 2, value);
}
static fromObject(data: {
color?: Signal.Aspect;
display?: boolean;
}): Light {
const message = new Light({});
if (data.color != null) {
message.color = data.color;
}
if (data.display != null) {
message.display = data.display;
}
return message;
}
toObject() {
const data: {
color?: Signal.Aspect;
display?: boolean;
} = {};
if (this.color != null) {
data.color = this.color;
}
if (this.display != null) {
data.display = this.display;
}
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.color != Signal.Aspect.OFF)
writer.writeEnum(1, this.color);
if (this.display != false)
writer.writeBool(2, this.display);
if (!w)
return writer.getResultBuffer();
}
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): Light {
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new Light();
while (reader.nextField()) {
if (reader.isEndGroup())
break;
switch (reader.getFieldNumber()) {
case 1:
message.color = reader.readEnum();
break;
case 2:
message.display = reader.readBool();
break;
default: reader.skipField();
}
}
return message;
}
serializeBinary(): Uint8Array {
return this.serialize();
}
static deserializeBinary(bytes: Uint8Array): Light {
return Light.deserialize(bytes);
}
}
}
export class PlatformState extends pb_1.Message {
#one_of_decls: number[][] = [];

View File

@ -976,86 +976,46 @@ export namespace ibpGraphicData {
export class IbpRelatedDevice extends pb_1.Message {
#one_of_decls: number[][] = [];
constructor(data?: any[] | {
code?: string;
combinationtypes?: Combinationtype[];
deviceType?: dependency_1.graphicData.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, dependency_1.graphicData.RelatedRef.DeviceType.Section) as dependency_1.graphicData.RelatedRef.DeviceType;
}
set deviceType(value: dependency_1.graphicData.RelatedRef.DeviceType) {
pb_1.Message.setField(this, 3, value);
}
static fromObject(data: {
code?: string;
combinationtypes?: ReturnType<typeof Combinationtype.prototype.toObject>[];
deviceType?: dependency_1.graphicData.RelatedRef.DeviceType;
}): IbpRelatedDevice {
const message = new IbpRelatedDevice({});
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<typeof Combinationtype.prototype.toObject>[];
deviceType?: dependency_1.graphicData.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 != dependency_1.graphicData.RelatedRef.DeviceType.Section)
writer.writeEnum(3, this.deviceType);
if (!w)
return writer.getResultBuffer();
}
@ -1065,15 +1025,9 @@ export namespace ibpGraphicData {
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();
}
}

View File

@ -19,7 +19,7 @@ export namespace pslGraphicData {
pslButtons?: PslButton[];
pslKeys?: PslKey[];
pslTexts?: PslText[];
gatedRelateDeviceList?: GatedRelateDevice[];
gatedRelateDeviceList?: dependency_1.graphicData.DeviceCombinationtype[];
}) {
super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [2, 3, 4, 5, 6], this.#one_of_decls);
@ -78,9 +78,9 @@ export namespace pslGraphicData {
pb_1.Message.setRepeatedWrapperField(this, 5, value);
}
get gatedRelateDeviceList() {
return pb_1.Message.getRepeatedWrapperField(this, GatedRelateDevice, 6) as GatedRelateDevice[];
return pb_1.Message.getRepeatedWrapperField(this, dependency_1.graphicData.DeviceCombinationtype, 6) as dependency_1.graphicData.DeviceCombinationtype[];
}
set gatedRelateDeviceList(value: GatedRelateDevice[]) {
set gatedRelateDeviceList(value: dependency_1.graphicData.DeviceCombinationtype[]) {
pb_1.Message.setRepeatedWrapperField(this, 6, value);
}
static fromObject(data: {
@ -89,7 +89,7 @@ export namespace pslGraphicData {
pslButtons?: ReturnType<typeof PslButton.prototype.toObject>[];
pslKeys?: ReturnType<typeof PslKey.prototype.toObject>[];
pslTexts?: ReturnType<typeof PslText.prototype.toObject>[];
gatedRelateDeviceList?: ReturnType<typeof GatedRelateDevice.prototype.toObject>[];
gatedRelateDeviceList?: ReturnType<typeof dependency_1.graphicData.DeviceCombinationtype.prototype.toObject>[];
}): PslGraphicStorage {
const message = new PslGraphicStorage({});
if (data.canvas != null) {
@ -108,7 +108,7 @@ export namespace pslGraphicData {
message.pslTexts = data.pslTexts.map(item => PslText.fromObject(item));
}
if (data.gatedRelateDeviceList != null) {
message.gatedRelateDeviceList = data.gatedRelateDeviceList.map(item => GatedRelateDevice.fromObject(item));
message.gatedRelateDeviceList = data.gatedRelateDeviceList.map(item => dependency_1.graphicData.DeviceCombinationtype.fromObject(item));
}
return message;
}
@ -119,7 +119,7 @@ export namespace pslGraphicData {
pslButtons?: ReturnType<typeof PslButton.prototype.toObject>[];
pslKeys?: ReturnType<typeof PslKey.prototype.toObject>[];
pslTexts?: ReturnType<typeof PslText.prototype.toObject>[];
gatedRelateDeviceList?: ReturnType<typeof GatedRelateDevice.prototype.toObject>[];
gatedRelateDeviceList?: ReturnType<typeof dependency_1.graphicData.DeviceCombinationtype.prototype.toObject>[];
} = {};
if (this.canvas != null) {
data.canvas = this.canvas.toObject();
@ -137,7 +137,7 @@ export namespace pslGraphicData {
data.pslTexts = this.pslTexts.map((item: PslText) => item.toObject());
}
if (this.gatedRelateDeviceList != null) {
data.gatedRelateDeviceList = this.gatedRelateDeviceList.map((item: GatedRelateDevice) => item.toObject());
data.gatedRelateDeviceList = this.gatedRelateDeviceList.map((item: dependency_1.graphicData.DeviceCombinationtype) => item.toObject());
}
return data;
}
@ -156,7 +156,7 @@ export namespace pslGraphicData {
if (this.pslTexts.length)
writer.writeRepeatedMessage(5, this.pslTexts, (item: PslText) => item.serialize(writer));
if (this.gatedRelateDeviceList.length)
writer.writeRepeatedMessage(6, this.gatedRelateDeviceList, (item: GatedRelateDevice) => item.serialize(writer));
writer.writeRepeatedMessage(6, this.gatedRelateDeviceList, (item: dependency_1.graphicData.DeviceCombinationtype) => item.serialize(writer));
if (!w)
return writer.getResultBuffer();
}
@ -182,7 +182,7 @@ export namespace pslGraphicData {
reader.readMessage(message.pslTexts, () => pb_1.Message.addToRepeatedWrapperField(message, 5, PslText.deserialize(reader), PslText));
break;
case 6:
reader.readMessage(message.gatedRelateDeviceList, () => pb_1.Message.addToRepeatedWrapperField(message, 6, GatedRelateDevice.deserialize(reader), GatedRelateDevice));
reader.readMessage(message.gatedRelateDeviceList, () => pb_1.Message.addToRepeatedWrapperField(message, 6, dependency_1.graphicData.DeviceCombinationtype.deserialize(reader), dependency_1.graphicData.DeviceCombinationtype));
break;
default: reader.skipField();
}
@ -683,117 +683,4 @@ export namespace pslGraphicData {
return PslText.deserialize(bytes);
}
}
export class GatedRelateDevice extends pb_1.Message {
#one_of_decls: number[][] = [];
constructor(data?: any[] | {
code?: string;
combinationtypes?: dependency_1.graphicData.DeviceCombinationtype[];
deviceType?: dependency_1.graphicData.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, dependency_1.graphicData.DeviceCombinationtype, 2) as dependency_1.graphicData.DeviceCombinationtype[];
}
set combinationtypes(value: dependency_1.graphicData.DeviceCombinationtype[]) {
pb_1.Message.setRepeatedWrapperField(this, 2, value);
}
get deviceType() {
return pb_1.Message.getFieldWithDefault(this, 3, dependency_1.graphicData.RelatedRef.DeviceType.Section) as dependency_1.graphicData.RelatedRef.DeviceType;
}
set deviceType(value: dependency_1.graphicData.RelatedRef.DeviceType) {
pb_1.Message.setField(this, 3, value);
}
static fromObject(data: {
code?: string;
combinationtypes?: ReturnType<typeof dependency_1.graphicData.DeviceCombinationtype.prototype.toObject>[];
deviceType?: dependency_1.graphicData.RelatedRef.DeviceType;
}): GatedRelateDevice {
const message = new GatedRelateDevice({});
if (data.code != null) {
message.code = data.code;
}
if (data.combinationtypes != null) {
message.combinationtypes = data.combinationtypes.map(item => dependency_1.graphicData.DeviceCombinationtype.fromObject(item));
}
if (data.deviceType != null) {
message.deviceType = data.deviceType;
}
return message;
}
toObject() {
const data: {
code?: string;
combinationtypes?: ReturnType<typeof dependency_1.graphicData.DeviceCombinationtype.prototype.toObject>[];
deviceType?: dependency_1.graphicData.RelatedRef.DeviceType;
} = {};
if (this.code != null) {
data.code = this.code;
}
if (this.combinationtypes != null) {
data.combinationtypes = this.combinationtypes.map((item: dependency_1.graphicData.DeviceCombinationtype) => 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: dependency_1.graphicData.DeviceCombinationtype) => item.serialize(writer));
if (this.deviceType != dependency_1.graphicData.RelatedRef.DeviceType.Section)
writer.writeEnum(3, this.deviceType);
if (!w)
return writer.getResultBuffer();
}
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): GatedRelateDevice {
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new GatedRelateDevice();
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, dependency_1.graphicData.DeviceCombinationtype.deserialize(reader), dependency_1.graphicData.DeviceCombinationtype));
break;
case 3:
message.deviceType = reader.readEnum();
break;
default: reader.skipField();
}
}
return message;
}
serializeBinary(): Uint8Array {
return this.serialize();
}
static deserializeBinary(bytes: Uint8Array): GatedRelateDevice {
return GatedRelateDevice.deserialize(bytes);
}
}
}