Merge branch 'master' of git.code.tencent.com:beijing-rtss-test/bj-rtss-client

This commit is contained in:
Yuan 2023-10-31 16:51:05 +08:00
commit b51ef6ca4f
3 changed files with 390 additions and 326 deletions

View File

@ -28,19 +28,12 @@
label="id"
hint=""
/>
<q-input
dense
outlined
readonly
v-model.number="turnoutState.code"
label="名称"
hint=""
/>
<q-input dense outlined readonly v-model="name" label="名称" hint="" />
<div>
<q-checkbox
v-model="turnoutState.normal"
outlined
label="定位"
label="定位(表示)"
:disable="true"
/>
</div>
@ -48,7 +41,23 @@
<q-checkbox
v-model="turnoutState.reverse"
outlined
label="反位"
label="反位(表示)"
:disable="true"
/>
</div>
<div>
<q-checkbox
v-model="turnoutState.dw"
outlined
label="定位(实际)"
:disable="true"
/>
</div>
<div>
<q-checkbox
v-model="turnoutState.fw"
outlined
label="反位(实际)"
:disable="true"
/>
</div>
@ -56,22 +65,19 @@
</q-card>
</template>
<script setup lang="ts">
import { Turnout } from 'src/graphics/turnout/Turnout';
import { ITurnoutState, Turnout } from 'src/graphics/turnout/Turnout';
import { useLineStore } from 'src/stores/line-store';
import { ref, watch, onMounted } from 'vue';
import { SetSwitchParams, setSwitchPosition } from 'src/api/Simulation';
import { useQuasar } from 'quasar';
import { ApiError } from 'src/boot/axios';
import { request } from 'src/protos/request';
import { TurnoutStates } from 'src/drawApp/graphics/TurnoutInteraction';
const $q = useQuasar();
const lineStore = useLineStore();
const turnoutState = ref({
id: '',
code: '',
normal: false,
reverse: false,
});
const turnoutState = ref<TurnoutStates>(new TurnoutStates());
const name = ref('');
watch(
() => lineStore.selectedGraphics,
@ -79,22 +85,14 @@ watch(
if (val?.length == 1 && val[0].type == Turnout.Type) {
setTurnoutState(val[0] as Turnout);
} else {
turnoutState.value = {
id: '',
code: '',
normal: false,
reverse: false,
};
turnoutState.value = new TurnoutStates();
name.value = '';
}
}
);
function setTurnoutState(turnout: Turnout) {
turnoutState.value = {
id: turnout.datas.id,
code: turnout.datas.code,
normal: turnout.states.normal || false,
reverse: turnout.states.reverse || false,
};
turnoutState.value = turnout.states.clone() as TurnoutStates;
name.value = turnout.datas.code;
}
onMounted(() => {
@ -112,6 +110,9 @@ const options = [
{ label: '取消失表故障', value: request.Turnout.Operation.CancelSB },
{ label: '设置挤岔故障', value: request.Turnout.Operation.SetJC },
{ label: '取消挤岔故障', value: request.Turnout.Operation.CancelJC },
{ label: '强制定位', value: request.Turnout.Operation.ForceDw },
{ label: '强制反位', value: request.Turnout.Operation.ForceFw },
{ label: '取消强制', value: request.Turnout.Operation.CancelForce },
];
function toDo(item: { label: string; value: number }) {
if (!lineStore.simulationId) return;
@ -121,16 +122,29 @@ function toDo(item: { label: string; value: number }) {
deviceId: turnoutState.value.id,
operation: item.value,
};
setSwitchPosition(obj)
.then(() => {
$q.notify({ type: 'positive', message: '修改道岔状态成功' });
})
.catch((err) => {
const error = err as ApiError;
$q.notify({
type: 'negative',
message: '修改道岔状态失败' + error.title,
});
setSwitchPosition(obj).catch((err) => {
const error = err as ApiError;
$q.notify({
type: 'negative',
message: '修改道岔状态失败' + error.title,
});
});
}
watch(
() => lineStore.socketStates,
(val) => {
if (val && turnoutState.value.id) {
const find = val.find((item) => {
return (
item.graphicType == Turnout.Type &&
(item as ITurnoutState).id == turnoutState.value.id
);
});
if (find) {
turnoutState.value = find.clone() as TurnoutStates;
}
}
}
);
</script>

View File

@ -196,11 +196,11 @@ export class Turnout extends JlGraphic {
doRepaint(): void {
// console.log(this.states);
const { pointB, pointC } = this.datas;
if (this.states.normal) {
if (this.states.dw) {
this.graphics.fork.paint(pointB[0]);
this.graphics.label.style.stroke = TurnoutConsts.normalLabelColor;
this.graphics.fork.visible = true;
} else if (this.states.reverse) {
} else if (this.states.fw) {
this.graphics.fork.paint(pointC[0]);
this.graphics.label.style.stroke = TurnoutConsts.reverseLabelColor;
this.graphics.fork.visible = true;
@ -209,7 +209,7 @@ export class Turnout extends JlGraphic {
this.graphics.sections.forEach((sectionGraphic) => sectionGraphic.paint());
this.graphics.label.text = this.datas.code;
if (!this.states.normal && !this.states.reverse) {
if (!this.states.dw && !this.states.fw) {
// 失表
this.graphics.fork.visible = false;
}

View File

@ -3,304 +3,354 @@
* compiler version: 4.23.1
* source: request.proto
* git: https://github.com/thesayyn/protoc-gen-ts */
import * as pb_1 from "google-protobuf";
import * as pb_1 from 'google-protobuf';
export namespace request {
export class Turnout extends pb_1.Message {
#one_of_decls: number[][] = [];
constructor(data?: any[] | {}) {
super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
if (!Array.isArray(data) && typeof data == "object") { }
}
static fromObject(data: {}): Turnout {
const message = new Turnout({});
return message;
}
toObject() {
const data: {} = {};
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 (!w)
return writer.getResultBuffer();
}
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): Turnout {
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new Turnout();
while (reader.nextField()) {
if (reader.isEndGroup())
break;
switch (reader.getFieldNumber()) {
default: reader.skipField();
}
}
return message;
}
serializeBinary(): Uint8Array {
return this.serialize();
}
static deserializeBinary(bytes: Uint8Array): Turnout {
return Turnout.deserialize(bytes);
}
export class Turnout extends pb_1.Message {
#one_of_decls: number[][] = [];
constructor(data?: any[] | {}) {
super();
pb_1.Message.initialize(
this,
Array.isArray(data) ? data : [],
0,
-1,
[],
this.#one_of_decls
);
if (!Array.isArray(data) && typeof data == 'object') {
}
}
export namespace Turnout {
export enum Operation {
Undefined = 0,
DC = 1,
CancelDC = 2,
FC = 3,
CancelFC = 4,
SetSB = 5,
CancelSB = 6,
SetJC = 7,
CancelJC = 8,
ForceDw = 9,
ForceFw = 10,
CancelForce = 11
}
static fromObject(data: {}): Turnout {
const message = new Turnout({});
return message;
}
export class TurnoutOperationReq extends pb_1.Message {
#one_of_decls: number[][] = [];
constructor(data?: any[] | {
toObject() {
const data: {} = {};
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 (!w) return writer.getResultBuffer();
}
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): Turnout {
const reader =
bytes instanceof pb_1.BinaryReader
? bytes
: new pb_1.BinaryReader(bytes),
message = new Turnout();
while (reader.nextField()) {
if (reader.isEndGroup()) break;
switch (reader.getFieldNumber()) {
default:
reader.skipField();
}
}
return message;
}
serializeBinary(): Uint8Array {
return this.serialize();
}
static deserializeBinary(bytes: Uint8Array): Turnout {
return Turnout.deserialize(bytes);
}
}
export namespace Turnout {
export enum Operation {
Undefined = 0,
DC = 1,
CancelDC = 2,
FC = 3,
CancelFC = 4,
SetSB = 5,
CancelSB = 6,
SetJC = 7,
CancelJC = 8,
ForceDw = 9,
ForceFw = 10,
CancelForce = 11,
}
}
export class TurnoutOperationReq extends pb_1.Message {
#one_of_decls: number[][] = [];
constructor(
data?:
| any[]
| {
simulationId?: string;
mapId?: number;
deviceId?: string;
operation?: Turnout.Operation;
}) {
super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
if (!Array.isArray(data) && typeof data == "object") {
if ("simulationId" in data && data.simulationId != undefined) {
this.simulationId = data.simulationId;
}
if ("mapId" in data && data.mapId != undefined) {
this.mapId = data.mapId;
}
if ("deviceId" in data && data.deviceId != undefined) {
this.deviceId = data.deviceId;
}
if ("operation" in data && data.operation != undefined) {
this.operation = data.operation;
}
}
}
) {
super();
pb_1.Message.initialize(
this,
Array.isArray(data) ? data : [],
0,
-1,
[],
this.#one_of_decls
);
if (!Array.isArray(data) && typeof data == 'object') {
if ('simulationId' in data && data.simulationId != undefined) {
this.simulationId = data.simulationId;
}
get simulationId() {
return pb_1.Message.getFieldWithDefault(this, 1, "") as string;
if ('mapId' in data && data.mapId != undefined) {
this.mapId = data.mapId;
}
set simulationId(value: string) {
pb_1.Message.setField(this, 1, value);
if ('deviceId' in data && data.deviceId != undefined) {
this.deviceId = data.deviceId;
}
get mapId() {
return pb_1.Message.getFieldWithDefault(this, 2, 0) as number;
}
set mapId(value: number) {
pb_1.Message.setField(this, 2, value);
}
get deviceId() {
return pb_1.Message.getFieldWithDefault(this, 3, "") as string;
}
set deviceId(value: string) {
pb_1.Message.setField(this, 3, value);
}
get operation() {
return pb_1.Message.getFieldWithDefault(this, 4, Turnout.Operation.Undefined) as Turnout.Operation;
}
set operation(value: Turnout.Operation) {
pb_1.Message.setField(this, 4, value);
}
static fromObject(data: {
simulationId?: string;
mapId?: number;
deviceId?: string;
operation?: Turnout.Operation;
}): TurnoutOperationReq {
const message = new TurnoutOperationReq({});
if (data.simulationId != null) {
message.simulationId = data.simulationId;
}
if (data.mapId != null) {
message.mapId = data.mapId;
}
if (data.deviceId != null) {
message.deviceId = data.deviceId;
}
if (data.operation != null) {
message.operation = data.operation;
}
return message;
}
toObject() {
const data: {
simulationId?: string;
mapId?: number;
deviceId?: string;
operation?: Turnout.Operation;
} = {};
if (this.simulationId != null) {
data.simulationId = this.simulationId;
}
if (this.mapId != null) {
data.mapId = this.mapId;
}
if (this.deviceId != null) {
data.deviceId = this.deviceId;
}
if (this.operation != null) {
data.operation = this.operation;
}
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.simulationId.length)
writer.writeString(1, this.simulationId);
if (this.mapId != 0)
writer.writeInt32(2, this.mapId);
if (this.deviceId.length)
writer.writeString(3, this.deviceId);
if (this.operation != Turnout.Operation.Undefined)
writer.writeEnum(4, this.operation);
if (!w)
return writer.getResultBuffer();
}
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): TurnoutOperationReq {
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new TurnoutOperationReq();
while (reader.nextField()) {
if (reader.isEndGroup())
break;
switch (reader.getFieldNumber()) {
case 1:
message.simulationId = reader.readString();
break;
case 2:
message.mapId = reader.readInt32();
break;
case 3:
message.deviceId = reader.readString();
break;
case 4:
message.operation = reader.readEnum();
break;
default: reader.skipField();
}
}
return message;
}
serializeBinary(): Uint8Array {
return this.serialize();
}
static deserializeBinary(bytes: Uint8Array): TurnoutOperationReq {
return TurnoutOperationReq.deserialize(bytes);
if ('operation' in data && data.operation != undefined) {
this.operation = data.operation;
}
}
}
export class Signal extends pb_1.Message {
#one_of_decls: number[][] = [];
constructor(data?: any[] | {}) {
super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
if (!Array.isArray(data) && typeof data == "object") { }
}
static fromObject(data: {}): Signal {
const message = new Signal({});
return message;
}
toObject() {
const data: {} = {};
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 (!w)
return writer.getResultBuffer();
}
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): Signal {
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new Signal();
while (reader.nextField()) {
if (reader.isEndGroup())
break;
switch (reader.getFieldNumber()) {
default: reader.skipField();
}
}
return message;
}
serializeBinary(): Uint8Array {
return this.serialize();
}
static deserializeBinary(bytes: Uint8Array): Signal {
return Signal.deserialize(bytes);
}
get simulationId() {
return pb_1.Message.getFieldWithDefault(this, 1, '') as string;
}
export namespace Signal {
export enum Operation {
Undefined = 0,
Display = 1,
LightHFaultDs = 2,
LightUFaultDs = 3,
LightLFaultDs = 4,
LightAFaultDs = 5,
LightBFaultDs = 6,
LightHCancelDs = 7,
LightUCancelDs = 8,
LightLCancelDs = 9,
LightACancelDs = 10,
LightBCancelDs = 11
}
set simulationId(value: string) {
pb_1.Message.setField(this, 1, value);
}
export class Section extends pb_1.Message {
#one_of_decls: number[][] = [];
constructor(data?: any[] | {}) {
super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
if (!Array.isArray(data) && typeof data == "object") { }
}
static fromObject(data: {}): Section {
const message = new Section({});
return message;
}
toObject() {
const data: {} = {};
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 (!w)
return writer.getResultBuffer();
}
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): Section {
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new Section();
while (reader.nextField()) {
if (reader.isEndGroup())
break;
switch (reader.getFieldNumber()) {
default: reader.skipField();
}
}
return message;
}
serializeBinary(): Uint8Array {
return this.serialize();
}
static deserializeBinary(bytes: Uint8Array): Section {
return Section.deserialize(bytes);
}
get mapId() {
return pb_1.Message.getFieldWithDefault(this, 2, 0) as number;
}
export namespace Section {
export enum Operation {
SetDrst = 0,
CancelDrst = 1,
SetPdrst = 2,
CancelPdrst = 3,
SetFaultOcc = 4,
CancelFaultOcc = 5
}
set mapId(value: number) {
pb_1.Message.setField(this, 2, value);
}
get deviceId() {
return pb_1.Message.getFieldWithDefault(this, 3, '') as string;
}
set deviceId(value: string) {
pb_1.Message.setField(this, 3, value);
}
get operation() {
return pb_1.Message.getFieldWithDefault(
this,
4,
Turnout.Operation.Undefined
) as Turnout.Operation;
}
set operation(value: Turnout.Operation) {
pb_1.Message.setField(this, 4, value);
}
static fromObject(data: {
simulationId?: string;
mapId?: number;
deviceId?: string;
operation?: Turnout.Operation;
}): TurnoutOperationReq {
const message = new TurnoutOperationReq({});
if (data.simulationId != null) {
message.simulationId = data.simulationId;
}
if (data.mapId != null) {
message.mapId = data.mapId;
}
if (data.deviceId != null) {
message.deviceId = data.deviceId;
}
if (data.operation != null) {
message.operation = data.operation;
}
return message;
}
toObject() {
const data: {
simulationId?: string;
mapId?: number;
deviceId?: string;
operation?: Turnout.Operation;
} = {};
if (this.simulationId != null) {
data.simulationId = this.simulationId;
}
if (this.mapId != null) {
data.mapId = this.mapId;
}
if (this.deviceId != null) {
data.deviceId = this.deviceId;
}
if (this.operation != null) {
data.operation = this.operation;
}
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.simulationId.length) writer.writeString(1, this.simulationId);
if (this.mapId != 0) writer.writeInt32(2, this.mapId);
if (this.deviceId.length) writer.writeString(3, this.deviceId);
if (this.operation != Turnout.Operation.Undefined)
writer.writeEnum(4, this.operation);
if (!w) return writer.getResultBuffer();
}
static deserialize(
bytes: Uint8Array | pb_1.BinaryReader
): TurnoutOperationReq {
const reader =
bytes instanceof pb_1.BinaryReader
? bytes
: new pb_1.BinaryReader(bytes),
message = new TurnoutOperationReq();
while (reader.nextField()) {
if (reader.isEndGroup()) break;
switch (reader.getFieldNumber()) {
case 1:
message.simulationId = reader.readString();
break;
case 2:
message.mapId = reader.readInt32();
break;
case 3:
message.deviceId = reader.readString();
break;
case 4:
message.operation = reader.readEnum();
break;
default:
reader.skipField();
}
}
return message;
}
serializeBinary(): Uint8Array {
return this.serialize();
}
static deserializeBinary(bytes: Uint8Array): TurnoutOperationReq {
return TurnoutOperationReq.deserialize(bytes);
}
}
export class Signal extends pb_1.Message {
#one_of_decls: number[][] = [];
constructor(data?: any[] | {}) {
super();
pb_1.Message.initialize(
this,
Array.isArray(data) ? data : [],
0,
-1,
[],
this.#one_of_decls
);
if (!Array.isArray(data) && typeof data == 'object') {
}
}
static fromObject(data: {}): Signal {
const message = new Signal({});
return message;
}
toObject() {
const data: {} = {};
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 (!w) return writer.getResultBuffer();
}
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): Signal {
const reader =
bytes instanceof pb_1.BinaryReader
? bytes
: new pb_1.BinaryReader(bytes),
message = new Signal();
while (reader.nextField()) {
if (reader.isEndGroup()) break;
switch (reader.getFieldNumber()) {
default:
reader.skipField();
}
}
return message;
}
serializeBinary(): Uint8Array {
return this.serialize();
}
static deserializeBinary(bytes: Uint8Array): Signal {
return Signal.deserialize(bytes);
}
}
export namespace Signal {
export enum Operation {
Undefined = 0,
Display = 1,
LightHFaultDs = 2,
LightUFaultDs = 3,
LightLFaultDs = 4,
LightAFaultDs = 5,
LightBFaultDs = 6,
LightHCancelDs = 7,
LightUCancelDs = 8,
LightLCancelDs = 9,
LightACancelDs = 10,
LightBCancelDs = 11,
}
}
export class Section extends pb_1.Message {
#one_of_decls: number[][] = [];
constructor(data?: any[] | {}) {
super();
pb_1.Message.initialize(
this,
Array.isArray(data) ? data : [],
0,
-1,
[],
this.#one_of_decls
);
if (!Array.isArray(data) && typeof data == 'object') {
}
}
static fromObject(data: {}): Section {
const message = new Section({});
return message;
}
toObject() {
const data: {} = {};
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 (!w) return writer.getResultBuffer();
}
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): Section {
const reader =
bytes instanceof pb_1.BinaryReader
? bytes
: new pb_1.BinaryReader(bytes),
message = new Section();
while (reader.nextField()) {
if (reader.isEndGroup()) break;
switch (reader.getFieldNumber()) {
default:
reader.skipField();
}
}
return message;
}
serializeBinary(): Uint8Array {
return this.serialize();
}
static deserializeBinary(bytes: Uint8Array): Section {
return Section.deserialize(bytes);
}
}
export namespace Section {
export enum Operation {
SetDrst = 0,
CancelDrst = 1,
SetPdrst = 2,
CancelPdrst = 3,
SetFaultOcc = 4,
CancelFaultOcc = 5,
}
}
}