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, rowsPerPage: 10,
rowsNumber: 10, rowsNumber: 10,
}); });
const deviceTypeMap = {
6: '车站',
};
const columns: QTable['columns'] = [ 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', name: 'combinationtypes',
label: '关联的组合类型', label: '关联的组合类型',
@ -73,8 +63,12 @@ function createData() {
ibpDrawStore.showRelateDeviceConfig = true; ibpDrawStore.showRelateDeviceConfig = true;
} }
function deleteData(row: RelateDevicelistItem) { function deleteData(row: RelateDevicelistItem) {
$q.dialog({ message: `确定删除 "${row.code}" 吗?`, cancel: true }).onOk( $q.dialog({
async () => { message: `确定删除 "${row.combinationtypes
.map((type) => type.code)
.join('\\')}" ?`,
cancel: true,
}).onOk(async () => {
try { try {
deleteIbpRelateDevice(row); deleteIbpRelateDevice(row);
successNotify('删除数据成功!'); successNotify('删除数据成功!');
@ -83,8 +77,7 @@ function deleteData(row: RelateDevicelistItem) {
} finally { } finally {
tableRef.value?.requestServerInteraction(); tableRef.value?.requestServerInteraction();
} }
} });
);
} }
</script> </script>
@ -92,7 +85,7 @@ function deleteData(row: RelateDevicelistItem) {
<DraggableDialog <DraggableDialog
seamless seamless
@show="onDialogShow" @show="onDialogShow"
title="IBP关联的车站" title="关联的组合类型"
:width="600" :width="600"
:height="0" :height="0"
> >

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -976,86 +976,46 @@ export namespace ibpGraphicData {
export class IbpRelatedDevice extends pb_1.Message { export class IbpRelatedDevice extends pb_1.Message {
#one_of_decls: number[][] = []; #one_of_decls: number[][] = [];
constructor(data?: any[] | { constructor(data?: any[] | {
code?: string;
combinationtypes?: Combinationtype[]; combinationtypes?: Combinationtype[];
deviceType?: dependency_1.graphicData.RelatedRef.DeviceType;
}) { }) {
super(); super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -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 ("code" in data && data.code != undefined) {
this.code = data.code;
}
if ("combinationtypes" in data && data.combinationtypes != undefined) { if ("combinationtypes" in data && data.combinationtypes != undefined) {
this.combinationtypes = data.combinationtypes; 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() { get combinationtypes() {
return pb_1.Message.getRepeatedWrapperField(this, Combinationtype, 2) as Combinationtype[]; return pb_1.Message.getRepeatedWrapperField(this, Combinationtype, 2) as Combinationtype[];
} }
set combinationtypes(value: Combinationtype[]) { set combinationtypes(value: Combinationtype[]) {
pb_1.Message.setRepeatedWrapperField(this, 2, value); 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: { static fromObject(data: {
code?: string;
combinationtypes?: ReturnType<typeof Combinationtype.prototype.toObject>[]; combinationtypes?: ReturnType<typeof Combinationtype.prototype.toObject>[];
deviceType?: dependency_1.graphicData.RelatedRef.DeviceType;
}): IbpRelatedDevice { }): IbpRelatedDevice {
const message = new IbpRelatedDevice({}); const message = new IbpRelatedDevice({});
if (data.code != null) {
message.code = data.code;
}
if (data.combinationtypes != null) { if (data.combinationtypes != null) {
message.combinationtypes = data.combinationtypes.map(item => Combinationtype.fromObject(item)); message.combinationtypes = data.combinationtypes.map(item => Combinationtype.fromObject(item));
} }
if (data.deviceType != null) {
message.deviceType = data.deviceType;
}
return message; return message;
} }
toObject() { toObject() {
const data: { const data: {
code?: string;
combinationtypes?: ReturnType<typeof Combinationtype.prototype.toObject>[]; combinationtypes?: ReturnType<typeof Combinationtype.prototype.toObject>[];
deviceType?: dependency_1.graphicData.RelatedRef.DeviceType;
} = {}; } = {};
if (this.code != null) {
data.code = this.code;
}
if (this.combinationtypes != null) { if (this.combinationtypes != null) {
data.combinationtypes = this.combinationtypes.map((item: Combinationtype) => item.toObject()); data.combinationtypes = this.combinationtypes.map((item: Combinationtype) => item.toObject());
} }
if (this.deviceType != null) {
data.deviceType = this.deviceType;
}
return data; return data;
} }
serialize(): Uint8Array; serialize(): Uint8Array;
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.code.length)
writer.writeString(1, this.code);
if (this.combinationtypes.length) if (this.combinationtypes.length)
writer.writeRepeatedMessage(2, this.combinationtypes, (item: Combinationtype) => item.serialize(writer)); 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) if (!w)
return writer.getResultBuffer(); return writer.getResultBuffer();
} }
@ -1065,15 +1025,9 @@ export namespace ibpGraphicData {
if (reader.isEndGroup()) if (reader.isEndGroup())
break; break;
switch (reader.getFieldNumber()) { switch (reader.getFieldNumber()) {
case 1:
message.code = reader.readString();
break;
case 2: case 2:
reader.readMessage(message.combinationtypes, () => pb_1.Message.addToRepeatedWrapperField(message, 2, Combinationtype.deserialize(reader), Combinationtype)); reader.readMessage(message.combinationtypes, () => pb_1.Message.addToRepeatedWrapperField(message, 2, Combinationtype.deserialize(reader), Combinationtype));
break; break;
case 3:
message.deviceType = reader.readEnum();
break;
default: reader.skipField(); default: reader.skipField();
} }
} }

View File

@ -19,7 +19,7 @@ export namespace pslGraphicData {
pslButtons?: PslButton[]; pslButtons?: PslButton[];
pslKeys?: PslKey[]; pslKeys?: PslKey[];
pslTexts?: PslText[]; pslTexts?: PslText[];
gatedRelateDeviceList?: GatedRelateDevice[]; gatedRelateDeviceList?: dependency_1.graphicData.DeviceCombinationtype[];
}) { }) {
super(); super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [2, 3, 4, 5, 6], this.#one_of_decls); 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); pb_1.Message.setRepeatedWrapperField(this, 5, value);
} }
get gatedRelateDeviceList() { 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); pb_1.Message.setRepeatedWrapperField(this, 6, value);
} }
static fromObject(data: { static fromObject(data: {
@ -89,7 +89,7 @@ export namespace pslGraphicData {
pslButtons?: ReturnType<typeof PslButton.prototype.toObject>[]; pslButtons?: ReturnType<typeof PslButton.prototype.toObject>[];
pslKeys?: ReturnType<typeof PslKey.prototype.toObject>[]; pslKeys?: ReturnType<typeof PslKey.prototype.toObject>[];
pslTexts?: ReturnType<typeof PslText.prototype.toObject>[]; pslTexts?: ReturnType<typeof PslText.prototype.toObject>[];
gatedRelateDeviceList?: ReturnType<typeof GatedRelateDevice.prototype.toObject>[]; gatedRelateDeviceList?: ReturnType<typeof dependency_1.graphicData.DeviceCombinationtype.prototype.toObject>[];
}): PslGraphicStorage { }): PslGraphicStorage {
const message = new PslGraphicStorage({}); const message = new PslGraphicStorage({});
if (data.canvas != null) { if (data.canvas != null) {
@ -108,7 +108,7 @@ export namespace pslGraphicData {
message.pslTexts = data.pslTexts.map(item => PslText.fromObject(item)); message.pslTexts = data.pslTexts.map(item => PslText.fromObject(item));
} }
if (data.gatedRelateDeviceList != null) { 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; return message;
} }
@ -119,7 +119,7 @@ export namespace pslGraphicData {
pslButtons?: ReturnType<typeof PslButton.prototype.toObject>[]; pslButtons?: ReturnType<typeof PslButton.prototype.toObject>[];
pslKeys?: ReturnType<typeof PslKey.prototype.toObject>[]; pslKeys?: ReturnType<typeof PslKey.prototype.toObject>[];
pslTexts?: ReturnType<typeof PslText.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) { if (this.canvas != null) {
data.canvas = this.canvas.toObject(); data.canvas = this.canvas.toObject();
@ -137,7 +137,7 @@ export namespace pslGraphicData {
data.pslTexts = this.pslTexts.map((item: PslText) => item.toObject()); data.pslTexts = this.pslTexts.map((item: PslText) => item.toObject());
} }
if (this.gatedRelateDeviceList != null) { 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; return data;
} }
@ -156,7 +156,7 @@ export namespace pslGraphicData {
if (this.pslTexts.length) if (this.pslTexts.length)
writer.writeRepeatedMessage(5, this.pslTexts, (item: PslText) => item.serialize(writer)); writer.writeRepeatedMessage(5, this.pslTexts, (item: PslText) => item.serialize(writer));
if (this.gatedRelateDeviceList.length) 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) if (!w)
return writer.getResultBuffer(); return writer.getResultBuffer();
} }
@ -182,7 +182,7 @@ export namespace pslGraphicData {
reader.readMessage(message.pslTexts, () => pb_1.Message.addToRepeatedWrapperField(message, 5, PslText.deserialize(reader), PslText)); reader.readMessage(message.pslTexts, () => pb_1.Message.addToRepeatedWrapperField(message, 5, PslText.deserialize(reader), PslText));
break; break;
case 6: 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; break;
default: reader.skipField(); default: reader.skipField();
} }
@ -683,117 +683,4 @@ export namespace pslGraphicData {
return PslText.deserialize(bytes); 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);
}
}
} }