This commit is contained in:
fan 2023-06-09 17:45:21 +08:00
commit 6b3bc45677
6 changed files with 830 additions and 2 deletions

View File

@ -210,6 +210,7 @@ class ControlItem {
onMounted(() => {
console.log('绘制应用layout mounted');
const dom = document.getElementById('draw-app-container');
drawStore.setDraftType(route.params.type as string);
if (dom) {
drawStore.setDraftId(+route.params.id as number);
const drawApp = drawStore.initDrawApp(dom);

View File

@ -32,7 +32,7 @@
color="primary"
:disable="operateDisabled"
label="编辑"
:to="`/painting/${props.row.id}`"
:to="`/painting/${props.row.id}/${props.row.type}`"
/>
<q-btn
color="primary"

566
src/protos/Device.ts Normal file
View File

@ -0,0 +1,566 @@
/**
* Generated by the protoc-gen-ts. DO NOT EDIT!
* compiler version: 4.23.1
* source: Device.proto
* git: https://github.com/thesayyn/protoc-gen-ts */
import * as pb_1 from "google-protobuf";
export class Device extends pb_1.Message {
#one_of_decls: number[][] = [];
constructor(data?: any[] | {
lineId?: number;
reportId?: 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 ("lineId" in data && data.lineId != undefined) {
this.lineId = data.lineId;
}
if ("reportId" in data && data.reportId != undefined) {
this.reportId = data.reportId;
}
}
}
get lineId() {
return pb_1.Message.getFieldWithDefault(this, 1, 0) as number;
}
set lineId(value: number) {
pb_1.Message.setField(this, 1, value);
}
get reportId() {
return pb_1.Message.getFieldWithDefault(this, 2, 0) as number;
}
set reportId(value: number) {
pb_1.Message.setField(this, 2, value);
}
static fromObject(data: {
lineId?: number;
reportId?: number;
}): Device {
const message = new Device({});
if (data.lineId != null) {
message.lineId = data.lineId;
}
if (data.reportId != null) {
message.reportId = data.reportId;
}
return message;
}
toObject() {
const data: {
lineId?: number;
reportId?: number;
} = {};
if (this.lineId != null) {
data.lineId = this.lineId;
}
if (this.reportId != null) {
data.reportId = this.reportId;
}
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.lineId != 0)
writer.writeInt32(1, this.lineId);
if (this.reportId != 0)
writer.writeInt32(2, this.reportId);
if (!w)
return writer.getResultBuffer();
}
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): Device {
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new Device();
while (reader.nextField()) {
if (reader.isEndGroup())
break;
switch (reader.getFieldNumber()) {
case 1:
message.lineId = reader.readInt32();
break;
case 2:
message.reportId = reader.readInt32();
break;
default: reader.skipField();
}
}
return message;
}
serializeBinary(): Uint8Array {
return this.serialize();
}
static deserializeBinary(bytes: Uint8Array): Device {
return Device.deserialize(bytes);
}
}
export class DeviceDetail extends pb_1.Message {
#one_of_decls: number[][] = [];
constructor(data?: any[] | {
deviceType?: string;
deviceName?: string;
}) {
super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
if (!Array.isArray(data) && typeof data == "object") {
if ("deviceType" in data && data.deviceType != undefined) {
this.deviceType = data.deviceType;
}
if ("deviceName" in data && data.deviceName != undefined) {
this.deviceName = data.deviceName;
}
}
}
get deviceType() {
return pb_1.Message.getFieldWithDefault(this, 1, "") as string;
}
set deviceType(value: string) {
pb_1.Message.setField(this, 1, value);
}
get deviceName() {
return pb_1.Message.getFieldWithDefault(this, 2, "") as string;
}
set deviceName(value: string) {
pb_1.Message.setField(this, 2, value);
}
static fromObject(data: {
deviceType?: string;
deviceName?: string;
}): DeviceDetail {
const message = new DeviceDetail({});
if (data.deviceType != null) {
message.deviceType = data.deviceType;
}
if (data.deviceName != null) {
message.deviceName = data.deviceName;
}
return message;
}
toObject() {
const data: {
deviceType?: string;
deviceName?: string;
} = {};
if (this.deviceType != null) {
data.deviceType = this.deviceType;
}
if (this.deviceName != null) {
data.deviceName = this.deviceName;
}
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.deviceType.length)
writer.writeString(1, this.deviceType);
if (this.deviceName.length)
writer.writeString(2, this.deviceName);
if (!w)
return writer.getResultBuffer();
}
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): DeviceDetail {
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new DeviceDetail();
while (reader.nextField()) {
if (reader.isEndGroup())
break;
switch (reader.getFieldNumber()) {
case 1:
message.deviceType = reader.readString();
break;
case 2:
message.deviceName = reader.readString();
break;
default: reader.skipField();
}
}
return message;
}
serializeBinary(): Uint8Array {
return this.serialize();
}
static deserializeBinary(bytes: Uint8Array): DeviceDetail {
return DeviceDetail.deserialize(bytes);
}
}
export class Track extends pb_1.Message {
#one_of_decls: number[][] = [];
constructor(data?: any[] | {
device?: Device;
detail?: DeviceDetail;
speedLimit?: number;
limitType?: 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 ("device" in data && data.device != undefined) {
this.device = data.device;
}
if ("detail" in data && data.detail != undefined) {
this.detail = data.detail;
}
if ("speedLimit" in data && data.speedLimit != undefined) {
this.speedLimit = data.speedLimit;
}
if ("limitType" in data && data.limitType != undefined) {
this.limitType = data.limitType;
}
}
}
get device() {
return pb_1.Message.getWrapperField(this, Device, 1) as Device;
}
set device(value: Device) {
pb_1.Message.setWrapperField(this, 1, value);
}
get has_device() {
return pb_1.Message.getField(this, 1) != null;
}
get detail() {
return pb_1.Message.getWrapperField(this, DeviceDetail, 2) as DeviceDetail;
}
set detail(value: DeviceDetail) {
pb_1.Message.setWrapperField(this, 2, value);
}
get has_detail() {
return pb_1.Message.getField(this, 2) != null;
}
get speedLimit() {
return pb_1.Message.getFieldWithDefault(this, 3, 0) as number;
}
set speedLimit(value: number) {
pb_1.Message.setField(this, 3, value);
}
get limitType() {
return pb_1.Message.getFieldWithDefault(this, 4, 0) as number;
}
set limitType(value: number) {
pb_1.Message.setField(this, 4, value);
}
static fromObject(data: {
device?: ReturnType<typeof Device.prototype.toObject>;
detail?: ReturnType<typeof DeviceDetail.prototype.toObject>;
speedLimit?: number;
limitType?: number;
}): Track {
const message = new Track({});
if (data.device != null) {
message.device = Device.fromObject(data.device);
}
if (data.detail != null) {
message.detail = DeviceDetail.fromObject(data.detail);
}
if (data.speedLimit != null) {
message.speedLimit = data.speedLimit;
}
if (data.limitType != null) {
message.limitType = data.limitType;
}
return message;
}
toObject() {
const data: {
device?: ReturnType<typeof Device.prototype.toObject>;
detail?: ReturnType<typeof DeviceDetail.prototype.toObject>;
speedLimit?: number;
limitType?: number;
} = {};
if (this.device != null) {
data.device = this.device.toObject();
}
if (this.detail != null) {
data.detail = this.detail.toObject();
}
if (this.speedLimit != null) {
data.speedLimit = this.speedLimit;
}
if (this.limitType != null) {
data.limitType = this.limitType;
}
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.has_device)
writer.writeMessage(1, this.device, () => this.device.serialize(writer));
if (this.has_detail)
writer.writeMessage(2, this.detail, () => this.detail.serialize(writer));
if (this.speedLimit != 0)
writer.writeFloat(3, this.speedLimit);
if (this.limitType != 0)
writer.writeInt32(4, this.limitType);
if (!w)
return writer.getResultBuffer();
}
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): Track {
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new Track();
while (reader.nextField()) {
if (reader.isEndGroup())
break;
switch (reader.getFieldNumber()) {
case 1:
reader.readMessage(message.device, () => message.device = Device.deserialize(reader));
break;
case 2:
reader.readMessage(message.detail, () => message.detail = DeviceDetail.deserialize(reader));
break;
case 3:
message.speedLimit = reader.readFloat();
break;
case 4:
message.limitType = reader.readInt32();
break;
default: reader.skipField();
}
}
return message;
}
serializeBinary(): Uint8Array {
return this.serialize();
}
static deserializeBinary(bytes: Uint8Array): Track {
return Track.deserialize(bytes);
}
}
export class Platform extends pb_1.Message {
#one_of_decls: number[][] = [];
constructor(data?: any[] | {
device?: Device;
detail?: DeviceDetail;
stopTime?: 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 ("device" in data && data.device != undefined) {
this.device = data.device;
}
if ("detail" in data && data.detail != undefined) {
this.detail = data.detail;
}
if ("stopTime" in data && data.stopTime != undefined) {
this.stopTime = data.stopTime;
}
}
}
get device() {
return pb_1.Message.getWrapperField(this, Device, 1) as Device;
}
set device(value: Device) {
pb_1.Message.setWrapperField(this, 1, value);
}
get has_device() {
return pb_1.Message.getField(this, 1) != null;
}
get detail() {
return pb_1.Message.getWrapperField(this, DeviceDetail, 2) as DeviceDetail;
}
set detail(value: DeviceDetail) {
pb_1.Message.setWrapperField(this, 2, value);
}
get has_detail() {
return pb_1.Message.getField(this, 2) != null;
}
get stopTime() {
return pb_1.Message.getFieldWithDefault(this, 3, 0) as number;
}
set stopTime(value: number) {
pb_1.Message.setField(this, 3, value);
}
static fromObject(data: {
device?: ReturnType<typeof Device.prototype.toObject>;
detail?: ReturnType<typeof DeviceDetail.prototype.toObject>;
stopTime?: number;
}): Platform {
const message = new Platform({});
if (data.device != null) {
message.device = Device.fromObject(data.device);
}
if (data.detail != null) {
message.detail = DeviceDetail.fromObject(data.detail);
}
if (data.stopTime != null) {
message.stopTime = data.stopTime;
}
return message;
}
toObject() {
const data: {
device?: ReturnType<typeof Device.prototype.toObject>;
detail?: ReturnType<typeof DeviceDetail.prototype.toObject>;
stopTime?: number;
} = {};
if (this.device != null) {
data.device = this.device.toObject();
}
if (this.detail != null) {
data.detail = this.detail.toObject();
}
if (this.stopTime != null) {
data.stopTime = this.stopTime;
}
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.has_device)
writer.writeMessage(1, this.device, () => this.device.serialize(writer));
if (this.has_detail)
writer.writeMessage(2, this.detail, () => this.detail.serialize(writer));
if (this.stopTime != 0)
writer.writeInt32(3, this.stopTime);
if (!w)
return writer.getResultBuffer();
}
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): Platform {
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new Platform();
while (reader.nextField()) {
if (reader.isEndGroup())
break;
switch (reader.getFieldNumber()) {
case 1:
reader.readMessage(message.device, () => message.device = Device.deserialize(reader));
break;
case 2:
reader.readMessage(message.detail, () => message.detail = DeviceDetail.deserialize(reader));
break;
case 3:
message.stopTime = reader.readInt32();
break;
default: reader.skipField();
}
}
return message;
}
serializeBinary(): Uint8Array {
return this.serialize();
}
static deserializeBinary(bytes: Uint8Array): Platform {
return Platform.deserialize(bytes);
}
}
export class Switch extends pb_1.Message {
#one_of_decls: number[][] = [];
constructor(data?: any[] | {
device?: Device;
detail?: DeviceDetail;
speedLimit?: 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 ("device" in data && data.device != undefined) {
this.device = data.device;
}
if ("detail" in data && data.detail != undefined) {
this.detail = data.detail;
}
if ("speedLimit" in data && data.speedLimit != undefined) {
this.speedLimit = data.speedLimit;
}
}
}
get device() {
return pb_1.Message.getWrapperField(this, Device, 1) as Device;
}
set device(value: Device) {
pb_1.Message.setWrapperField(this, 1, value);
}
get has_device() {
return pb_1.Message.getField(this, 1) != null;
}
get detail() {
return pb_1.Message.getWrapperField(this, DeviceDetail, 2) as DeviceDetail;
}
set detail(value: DeviceDetail) {
pb_1.Message.setWrapperField(this, 2, value);
}
get has_detail() {
return pb_1.Message.getField(this, 2) != null;
}
get speedLimit() {
return pb_1.Message.getFieldWithDefault(this, 3, 0) as number;
}
set speedLimit(value: number) {
pb_1.Message.setField(this, 3, value);
}
static fromObject(data: {
device?: ReturnType<typeof Device.prototype.toObject>;
detail?: ReturnType<typeof DeviceDetail.prototype.toObject>;
speedLimit?: number;
}): Switch {
const message = new Switch({});
if (data.device != null) {
message.device = Device.fromObject(data.device);
}
if (data.detail != null) {
message.detail = DeviceDetail.fromObject(data.detail);
}
if (data.speedLimit != null) {
message.speedLimit = data.speedLimit;
}
return message;
}
toObject() {
const data: {
device?: ReturnType<typeof Device.prototype.toObject>;
detail?: ReturnType<typeof DeviceDetail.prototype.toObject>;
speedLimit?: number;
} = {};
if (this.device != null) {
data.device = this.device.toObject();
}
if (this.detail != null) {
data.detail = this.detail.toObject();
}
if (this.speedLimit != null) {
data.speedLimit = this.speedLimit;
}
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.has_device)
writer.writeMessage(1, this.device, () => this.device.serialize(writer));
if (this.has_detail)
writer.writeMessage(2, this.detail, () => this.detail.serialize(writer));
if (this.speedLimit != 0)
writer.writeFloat(3, this.speedLimit);
if (!w)
return writer.getResultBuffer();
}
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): Switch {
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new Switch();
while (reader.nextField()) {
if (reader.isEndGroup())
break;
switch (reader.getFieldNumber()) {
case 1:
reader.readMessage(message.device, () => message.device = Device.deserialize(reader));
break;
case 2:
reader.readMessage(message.detail, () => message.detail = DeviceDetail.deserialize(reader));
break;
case 3:
message.speedLimit = reader.readFloat();
break;
default: reader.skipField();
}
}
return message;
}
serializeBinary(): Uint8Array {
return this.serialize();
}
static deserializeBinary(bytes: Uint8Array): Switch {
return Switch.deserialize(bytes);
}
}

View File

@ -0,0 +1,257 @@
/**
* Generated by the protoc-gen-ts. DO NOT EDIT!
* compiler version: 4.23.1
* source: LineNetTrainOffset.proto
* git: https://github.com/thesayyn/protoc-gen-ts */
import * as pb_1 from "google-protobuf";
export class LineNetTrainOffset extends pb_1.Message {
#one_of_decls: number[][] = [];
constructor(data?: any[] | {
lineId?: number;
Group_id?: string;
dir?: number;
initType?: boolean;
offset?: number;
destinationId?: number;
backId?: number;
show?: boolean;
rate?: 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 ("lineId" in data && data.lineId != undefined) {
this.lineId = data.lineId;
}
if ("Group_id" in data && data.Group_id != undefined) {
this.Group_id = data.Group_id;
}
if ("dir" in data && data.dir != undefined) {
this.dir = data.dir;
}
if ("initType" in data && data.initType != undefined) {
this.initType = data.initType;
}
if ("offset" in data && data.offset != undefined) {
this.offset = data.offset;
}
if ("destinationId" in data && data.destinationId != undefined) {
this.destinationId = data.destinationId;
}
if ("backId" in data && data.backId != undefined) {
this.backId = data.backId;
}
if ("show" in data && data.show != undefined) {
this.show = data.show;
}
if ("rate" in data && data.rate != undefined) {
this.rate = data.rate;
}
}
}
get lineId() {
return pb_1.Message.getFieldWithDefault(this, 1, 0) as number;
}
set lineId(value: number) {
pb_1.Message.setField(this, 1, value);
}
get Group_id() {
return pb_1.Message.getFieldWithDefault(this, 2, "") as string;
}
set Group_id(value: string) {
pb_1.Message.setField(this, 2, value);
}
get dir() {
return pb_1.Message.getFieldWithDefault(this, 3, 0) as number;
}
set dir(value: number) {
pb_1.Message.setField(this, 3, value);
}
get initType() {
return pb_1.Message.getFieldWithDefault(this, 4, false) as boolean;
}
set initType(value: boolean) {
pb_1.Message.setField(this, 4, value);
}
get offset() {
return pb_1.Message.getFieldWithDefault(this, 5, 0) as number;
}
set offset(value: number) {
pb_1.Message.setField(this, 5, value);
}
get destinationId() {
return pb_1.Message.getFieldWithDefault(this, 6, 0) as number;
}
set destinationId(value: number) {
pb_1.Message.setField(this, 6, value);
}
get backId() {
return pb_1.Message.getFieldWithDefault(this, 7, 0) as number;
}
set backId(value: number) {
pb_1.Message.setField(this, 7, value);
}
get show() {
return pb_1.Message.getFieldWithDefault(this, 8, false) as boolean;
}
set show(value: boolean) {
pb_1.Message.setField(this, 8, value);
}
get rate() {
return pb_1.Message.getFieldWithDefault(this, 9, 0) as number;
}
set rate(value: number) {
pb_1.Message.setField(this, 9, value);
}
static fromObject(data: {
lineId?: number;
Group_id?: string;
dir?: number;
initType?: boolean;
offset?: number;
destinationId?: number;
backId?: number;
show?: boolean;
rate?: number;
}): LineNetTrainOffset {
const message = new LineNetTrainOffset({});
if (data.lineId != null) {
message.lineId = data.lineId;
}
if (data.Group_id != null) {
message.Group_id = data.Group_id;
}
if (data.dir != null) {
message.dir = data.dir;
}
if (data.initType != null) {
message.initType = data.initType;
}
if (data.offset != null) {
message.offset = data.offset;
}
if (data.destinationId != null) {
message.destinationId = data.destinationId;
}
if (data.backId != null) {
message.backId = data.backId;
}
if (data.show != null) {
message.show = data.show;
}
if (data.rate != null) {
message.rate = data.rate;
}
return message;
}
toObject() {
const data: {
lineId?: number;
Group_id?: string;
dir?: number;
initType?: boolean;
offset?: number;
destinationId?: number;
backId?: number;
show?: boolean;
rate?: number;
} = {};
if (this.lineId != null) {
data.lineId = this.lineId;
}
if (this.Group_id != null) {
data.Group_id = this.Group_id;
}
if (this.dir != null) {
data.dir = this.dir;
}
if (this.initType != null) {
data.initType = this.initType;
}
if (this.offset != null) {
data.offset = this.offset;
}
if (this.destinationId != null) {
data.destinationId = this.destinationId;
}
if (this.backId != null) {
data.backId = this.backId;
}
if (this.show != null) {
data.show = this.show;
}
if (this.rate != null) {
data.rate = this.rate;
}
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.lineId != 0)
writer.writeInt32(1, this.lineId);
if (this.Group_id.length)
writer.writeString(2, this.Group_id);
if (this.dir != 0)
writer.writeInt32(3, this.dir);
if (this.initType != false)
writer.writeBool(4, this.initType);
if (this.offset != 0)
writer.writeInt32(5, this.offset);
if (this.destinationId != 0)
writer.writeInt32(6, this.destinationId);
if (this.backId != 0)
writer.writeInt32(7, this.backId);
if (this.show != false)
writer.writeBool(8, this.show);
if (this.rate != 0)
writer.writeFloat(9, this.rate);
if (!w)
return writer.getResultBuffer();
}
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): LineNetTrainOffset {
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new LineNetTrainOffset();
while (reader.nextField()) {
if (reader.isEndGroup())
break;
switch (reader.getFieldNumber()) {
case 1:
message.lineId = reader.readInt32();
break;
case 2:
message.Group_id = reader.readString();
break;
case 3:
message.dir = reader.readInt32();
break;
case 4:
message.initType = reader.readBool();
break;
case 5:
message.offset = reader.readInt32();
break;
case 6:
message.destinationId = reader.readInt32();
break;
case 7:
message.backId = reader.readInt32();
break;
case 8:
message.show = reader.readBool();
break;
case 9:
message.rate = reader.readFloat();
break;
default: reader.skipField();
}
}
return message;
}
serializeBinary(): Uint8Array {
return this.serialize();
}
static deserializeBinary(bytes: Uint8Array): LineNetTrainOffset {
return LineNetTrainOffset.deserialize(bytes);
}
}

View File

@ -57,7 +57,7 @@ const routes: RouteRecordRaw[] = [
],
},
{
path: '/painting/:id',
path: '/painting/:id/:type',
name: 'painting',
component: () => import('layouts/DrawLayout.vue'),
},

View File

@ -7,6 +7,7 @@ export const useDrawStore = defineStore('draw', {
drawAssistant: null as DrawAssistant | null,
selectedGraphics: null as JlGraphic[] | null,
draftId: null as number | null,
draftType: 'Line',
}),
getters: {
drawMode: (state) => state.drawAssistant != null,
@ -78,5 +79,8 @@ export const useDrawStore = defineStore('draw', {
setDraftId(id: number | null) {
this.draftId = id;
},
setDraftType(type: string) {
this.draftType = type;
},
},
});