道岔状态面板和继电器状态面板

This commit is contained in:
joylink_zhaoerwei 2024-01-18 15:30:31 +08:00
parent 94fe367687
commit 71612e4613
6 changed files with 158 additions and 225 deletions

View File

@ -21,6 +21,7 @@
<q-input outlined readonly v-model="relayState.id" label="id" />
<q-input outlined readonly v-model="relayState.code" label="名称" />
<q-checkbox disable v-model="relayState.xh" label="是否吸合" />
<q-checkbox disable v-model="relayState.force" label="是否强制" />
</q-card-section>
</q-card>
</template>
@ -40,6 +41,7 @@ const relayState = ref({
id: 0,
code: '',
xh: false,
force: false,
});
let operateOptions: {
label: string;
@ -77,6 +79,7 @@ function setNewRelayState(relay: Relay) {
id: relay.datas.id,
code: relay.datas.code,
xh: relay.states.xh || false,
force: relay.states.force || false,
};
subscribeState(relay);
}

View File

@ -76,17 +76,6 @@
</q-item>
</q-list>
<q-list dense bordered padding class="rounded-borders q-my-sm">
<q-item>
<q-item-section>
<q-checkbox
dense
v-model="turnoutState.force"
outlined
label="是否强制(屏蔽联锁驱动)"
:disable="true"
/>
</q-item-section>
</q-item>
<q-item>
<q-item-section>
<q-checkbox
@ -126,7 +115,7 @@
dense
v-model="turnoutState.dc"
outlined
label="是否定操"
label="是否定操采集"
:disable="true"
/>
</q-item-section>
@ -137,7 +126,7 @@
dense
v-model="turnoutState.fc"
outlined
label="是否反操"
label="是否反操采集"
:disable="true"
/>
</q-item-section>
@ -148,58 +137,21 @@
dense
v-model="turnoutState.yc"
outlined
label="是否允许操作"
:disable="true"
/>
</q-item-section>
</q-item>
</q-list>
<q-list dense bordered padding class="rounded-borders q-my-sm">
<q-item>
<q-item-section>
<q-checkbox
dense
v-model="turnoutState.sb"
outlined
label="是否有失表故障"
:disable="true"
/>
</q-item-section>
</q-item>
<!-- <q-item>
<q-item-section>
<q-checkbox
dense
v-model="turnoutState.dwsb"
outlined
label="是否有定位失表故障"
:disable="true"
/>
</q-item-section>
</q-item> -->
<!-- <q-item>
<q-item-section>
<q-checkbox
dense
v-model="turnoutState.fwsb"
outlined
label="是否有反位失表故障"
:disable="true"
/>
</q-item-section>
</q-item> -->
<q-item>
<q-item-section>
<q-checkbox
dense
v-model="turnoutState.jc"
outlined
label="是否有挤岔故障"
label="是否允许操作采集"
:disable="true"
/>
</q-item-section>
</q-item>
</q-list>
<q-select
outlined
v-model="forcePosition"
:options="turnoutForceOption"
:map-options="true"
:emit-value="true"
label="道岔设置参数"
:disable="true"
/>
</q-card-section>
</q-card>
</template>
@ -213,11 +165,31 @@ import { TurnoutStates } from 'src/drawApp/graphics/TurnoutInteraction';
import TurnoutOperation from 'src/components/draw-app/dialogs/TurnoutOperation.vue';
import { JlGraphic } from 'jl-graphic';
import { errorNotify } from 'src/utils/CommonNotify';
import { request } from 'src/protos/request';
const lineStore = useLineStore();
const turnoutState = ref<TurnoutStates>(new TurnoutStates());
const name = ref('');
const forcePosition = ref<request.Points.Force>(0);
const graphic = ref();
const turnoutForceOption = [
{
label: '无强制',
value: request.Points.Force.FP_NONE,
},
{
label: '定位',
value: request.Points.Force.FP_DW,
},
{
label: '反位',
value: request.Points.Force.FP_FW,
},
{
label: '失表',
value: request.Points.Force.FP_SB,
},
];
watch(
() => lineStore.selectedGraphics,
@ -238,6 +210,7 @@ watch(
function setTurnoutState(turnout: Turnout) {
graphic.value = turnout;
turnoutState.value = turnout.states.clone() as TurnoutStates;
forcePosition.value = turnoutState.value.param.forcePosition;
name.value = turnout.datas.code;
subscribeState(turnout as JlGraphic);
}
@ -293,5 +266,6 @@ function unSubscribeState(g: JlGraphic) {
}
function updateState(newVal: TurnoutStates) {
turnoutState.value = newVal.clone() as TurnoutStates;
forcePosition.value = turnoutState.value.param.forcePosition;
}
</script>

View File

@ -32,6 +32,7 @@ import TurnoutOperation from 'src/components/draw-app/dialogs/TurnoutOperation.v
import { ApiError } from 'src/boot/axios';
import { getKmDistance } from '../lineScene';
import { TrainConfigData } from 'src/api/TrainModelApi';
import { request } from 'src/protos/request';
function getDefaultEndPoint() {
return {
@ -189,15 +190,15 @@ export class TurnoutOperationPlugin extends GraphicInteractionPlugin<Turnout> {
radarCheckTime: 0,
radarEnable: true,
speedSensorEnableA: true,
speedSensorEnableB: true
speedSensorEnableB: true,
},
trainEndsB: {
radarCheckSpeed: 0,
radarCheckTime: 0,
radarEnable: true,
speedSensorEnableA: true,
speedSensorEnableB: true
}
speedSensorEnableB: true,
},
};
if (data.trainLength) {
Object.assign(params, { trainLength: +data.trainLength });
@ -373,35 +374,11 @@ export class TurnoutStates extends GraphicStateBase implements ITurnoutState {
set fw(v: boolean) {
this.states.fw = v;
}
get force(): boolean {
return this.states.force;
get param(): request.PointsParam {
return this.states.param;
}
set force(v: boolean) {
this.states.force = v;
}
get sb(): boolean {
return this.states.sb;
}
set sb(v: boolean) {
this.states.sb = v;
}
get dwsb(): boolean {
return this.states.dwsb;
}
set dwsb(v: boolean) {
this.states.dwsb = v;
}
get fwsb(): boolean {
return this.states.fwsb;
}
set fwsb(v: boolean) {
this.states.fwsb = v;
}
get jc(): boolean {
return this.states.jc;
}
set jc(v: boolean) {
this.states.jc = v;
set param(param: request.PointsParam) {
this.states.param = param;
}
get qdc(): boolean {
return this.states.qdc;

View File

@ -79,6 +79,12 @@ export class RelayState extends GraphicStateBase implements IRelayState {
set xh(xh: boolean) {
this.states.xh = xh;
}
get force(): boolean {
return this.states.force;
}
set force(force: boolean) {
this.states.force = force;
}
get states(): state.ReplyState {
return this.getState<state.ReplyState>();
}

View File

@ -21,6 +21,8 @@ export interface IRelayState extends GraphicState {
get id(): number; //继电器id
get xh(): boolean; //继电器吸合
set xh(v: boolean);
get force(): boolean; //是否强制
set force(v: boolean);
}
export const relayConsts = {

View File

@ -5,6 +5,7 @@
* git: https://github.com/thesayyn/protoc-gen-ts */
import * as dependency_1 from "./stationLayoutGraphics";
import * as dependency_2 from "./common_data";
import * as dependency_3 from "./request";
import * as pb_1 from "google-protobuf";
export namespace state {
export enum SectionType {
@ -224,11 +225,7 @@ export namespace state {
reverse?: boolean;
dw?: boolean;
fw?: boolean;
force?: boolean;
sb?: boolean;
dwsb?: boolean;
fwsb?: boolean;
jc?: boolean;
param?: dependency_3.request.PointsParam;
qdc?: boolean;
qfc?: boolean;
qyc?: boolean;
@ -255,20 +252,8 @@ export namespace state {
if ("fw" in data && data.fw != undefined) {
this.fw = data.fw;
}
if ("force" in data && data.force != undefined) {
this.force = data.force;
}
if ("sb" in data && data.sb != undefined) {
this.sb = data.sb;
}
if ("dwsb" in data && data.dwsb != undefined) {
this.dwsb = data.dwsb;
}
if ("fwsb" in data && data.fwsb != undefined) {
this.fwsb = data.fwsb;
}
if ("jc" in data && data.jc != undefined) {
this.jc = data.jc;
if ("param" in data && data.param != undefined) {
this.param = data.param;
}
if ("qdc" in data && data.qdc != undefined) {
this.qdc = data.qdc;
@ -323,77 +308,56 @@ export namespace state {
set fw(value: boolean) {
pb_1.Message.setField(this, 5, value);
}
get force() {
return pb_1.Message.getFieldWithDefault(this, 6, false) as boolean;
get param() {
return pb_1.Message.getWrapperField(this, dependency_3.request.PointsParam, 6) as dependency_3.request.PointsParam;
}
set force(value: boolean) {
pb_1.Message.setField(this, 6, value);
set param(value: dependency_3.request.PointsParam) {
pb_1.Message.setWrapperField(this, 6, value);
}
get sb() {
return pb_1.Message.getFieldWithDefault(this, 7, false) as boolean;
}
set sb(value: boolean) {
pb_1.Message.setField(this, 7, value);
}
get dwsb() {
return pb_1.Message.getFieldWithDefault(this, 8, false) as boolean;
}
set dwsb(value: boolean) {
pb_1.Message.setField(this, 8, value);
}
get fwsb() {
return pb_1.Message.getFieldWithDefault(this, 9, false) as boolean;
}
set fwsb(value: boolean) {
pb_1.Message.setField(this, 9, value);
}
get jc() {
return pb_1.Message.getFieldWithDefault(this, 10, false) as boolean;
}
set jc(value: boolean) {
pb_1.Message.setField(this, 10, value);
get has_param() {
return pb_1.Message.getField(this, 6) != null;
}
get qdc() {
return pb_1.Message.getFieldWithDefault(this, 11, false) as boolean;
return pb_1.Message.getFieldWithDefault(this, 7, false) as boolean;
}
set qdc(value: boolean) {
pb_1.Message.setField(this, 11, value);
pb_1.Message.setField(this, 7, value);
}
get qfc() {
return pb_1.Message.getFieldWithDefault(this, 12, false) as boolean;
return pb_1.Message.getFieldWithDefault(this, 8, false) as boolean;
}
set qfc(value: boolean) {
pb_1.Message.setField(this, 12, value);
pb_1.Message.setField(this, 8, value);
}
get qyc() {
return pb_1.Message.getFieldWithDefault(this, 13, false) as boolean;
return pb_1.Message.getFieldWithDefault(this, 9, false) as boolean;
}
set qyc(value: boolean) {
pb_1.Message.setField(this, 13, value);
pb_1.Message.setField(this, 9, value);
}
get dc() {
return pb_1.Message.getFieldWithDefault(this, 14, false) as boolean;
return pb_1.Message.getFieldWithDefault(this, 10, false) as boolean;
}
set dc(value: boolean) {
pb_1.Message.setField(this, 14, value);
pb_1.Message.setField(this, 10, value);
}
get fc() {
return pb_1.Message.getFieldWithDefault(this, 15, false) as boolean;
return pb_1.Message.getFieldWithDefault(this, 11, false) as boolean;
}
set fc(value: boolean) {
pb_1.Message.setField(this, 15, value);
pb_1.Message.setField(this, 11, value);
}
get yc() {
return pb_1.Message.getFieldWithDefault(this, 16, false) as boolean;
return pb_1.Message.getFieldWithDefault(this, 12, false) as boolean;
}
set yc(value: boolean) {
pb_1.Message.setField(this, 16, value);
pb_1.Message.setField(this, 12, value);
}
get occupied() {
return pb_1.Message.getFieldWithDefault(this, 17, false) as boolean;
return pb_1.Message.getFieldWithDefault(this, 13, false) as boolean;
}
set occupied(value: boolean) {
pb_1.Message.setField(this, 17, value);
pb_1.Message.setField(this, 13, value);
}
static fromObject(data: {
id?: number;
@ -401,11 +365,7 @@ export namespace state {
reverse?: boolean;
dw?: boolean;
fw?: boolean;
force?: boolean;
sb?: boolean;
dwsb?: boolean;
fwsb?: boolean;
jc?: boolean;
param?: ReturnType<typeof dependency_3.request.PointsParam.prototype.toObject>;
qdc?: boolean;
qfc?: boolean;
qyc?: boolean;
@ -430,20 +390,8 @@ export namespace state {
if (data.fw != null) {
message.fw = data.fw;
}
if (data.force != null) {
message.force = data.force;
}
if (data.sb != null) {
message.sb = data.sb;
}
if (data.dwsb != null) {
message.dwsb = data.dwsb;
}
if (data.fwsb != null) {
message.fwsb = data.fwsb;
}
if (data.jc != null) {
message.jc = data.jc;
if (data.param != null) {
message.param = dependency_3.request.PointsParam.fromObject(data.param);
}
if (data.qdc != null) {
message.qdc = data.qdc;
@ -475,11 +423,7 @@ export namespace state {
reverse?: boolean;
dw?: boolean;
fw?: boolean;
force?: boolean;
sb?: boolean;
dwsb?: boolean;
fwsb?: boolean;
jc?: boolean;
param?: ReturnType<typeof dependency_3.request.PointsParam.prototype.toObject>;
qdc?: boolean;
qfc?: boolean;
qyc?: boolean;
@ -503,20 +447,8 @@ export namespace state {
if (this.fw != null) {
data.fw = this.fw;
}
if (this.force != null) {
data.force = this.force;
}
if (this.sb != null) {
data.sb = this.sb;
}
if (this.dwsb != null) {
data.dwsb = this.dwsb;
}
if (this.fwsb != null) {
data.fwsb = this.fwsb;
}
if (this.jc != null) {
data.jc = this.jc;
if (this.param != null) {
data.param = this.param.toObject();
}
if (this.qdc != null) {
data.qdc = this.qdc;
@ -555,30 +487,22 @@ export namespace state {
writer.writeBool(4, this.dw);
if (this.fw != false)
writer.writeBool(5, this.fw);
if (this.force != false)
writer.writeBool(6, this.force);
if (this.sb != false)
writer.writeBool(7, this.sb);
if (this.dwsb != false)
writer.writeBool(8, this.dwsb);
if (this.fwsb != false)
writer.writeBool(9, this.fwsb);
if (this.jc != false)
writer.writeBool(10, this.jc);
if (this.has_param)
writer.writeMessage(6, this.param, () => this.param.serialize(writer));
if (this.qdc != false)
writer.writeBool(11, this.qdc);
writer.writeBool(7, this.qdc);
if (this.qfc != false)
writer.writeBool(12, this.qfc);
writer.writeBool(8, this.qfc);
if (this.qyc != false)
writer.writeBool(13, this.qyc);
writer.writeBool(9, this.qyc);
if (this.dc != false)
writer.writeBool(14, this.dc);
writer.writeBool(10, this.dc);
if (this.fc != false)
writer.writeBool(15, this.fc);
writer.writeBool(11, this.fc);
if (this.yc != false)
writer.writeBool(16, this.yc);
writer.writeBool(12, this.yc);
if (this.occupied != false)
writer.writeBool(17, this.occupied);
writer.writeBool(13, this.occupied);
if (!w)
return writer.getResultBuffer();
}
@ -604,39 +528,27 @@ export namespace state {
message.fw = reader.readBool();
break;
case 6:
message.force = reader.readBool();
reader.readMessage(message.param, () => message.param = dependency_3.request.PointsParam.deserialize(reader));
break;
case 7:
message.sb = reader.readBool();
break;
case 8:
message.dwsb = reader.readBool();
break;
case 9:
message.fwsb = reader.readBool();
break;
case 10:
message.jc = reader.readBool();
break;
case 11:
message.qdc = reader.readBool();
break;
case 12:
case 8:
message.qfc = reader.readBool();
break;
case 13:
case 9:
message.qyc = reader.readBool();
break;
case 14:
case 10:
message.dc = reader.readBool();
break;
case 15:
case 11:
message.fc = reader.readBool();
break;
case 16:
case 12:
message.yc = reader.readBool();
break;
case 17:
case 13:
message.occupied = reader.readBool();
break;
default: reader.skipField();
@ -656,6 +568,8 @@ export namespace state {
constructor(data?: any[] | {
id?: number;
aspect?: Signal.Aspect;
param?: dependency_3.request.SignalParam;
relayStateMap?: Map<string, boolean>;
}) {
super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
@ -666,7 +580,15 @@ export namespace state {
if ("aspect" in data && data.aspect != undefined) {
this.aspect = data.aspect;
}
if ("param" in data && data.param != undefined) {
this.param = data.param;
}
if ("relayStateMap" in data && data.relayStateMap != undefined) {
this.relayStateMap = data.relayStateMap;
}
}
if (!this.relayStateMap)
this.relayStateMap = new Map();
}
get id() {
return pb_1.Message.getFieldWithDefault(this, 1, 0) as number;
@ -680,9 +602,28 @@ export namespace state {
set aspect(value: Signal.Aspect) {
pb_1.Message.setField(this, 2, value);
}
get param() {
return pb_1.Message.getWrapperField(this, dependency_3.request.SignalParam, 3) as dependency_3.request.SignalParam;
}
set param(value: dependency_3.request.SignalParam) {
pb_1.Message.setWrapperField(this, 3, value);
}
get has_param() {
return pb_1.Message.getField(this, 3) != null;
}
get relayStateMap() {
return pb_1.Message.getField(this, 4) as any as Map<string, boolean>;
}
set relayStateMap(value: Map<string, boolean>) {
pb_1.Message.setField(this, 4, value as any);
}
static fromObject(data: {
id?: number;
aspect?: Signal.Aspect;
param?: ReturnType<typeof dependency_3.request.SignalParam.prototype.toObject>;
relayStateMap?: {
[key: string]: boolean;
};
}): SignalState {
const message = new SignalState({});
if (data.id != null) {
@ -691,12 +632,22 @@ export namespace state {
if (data.aspect != null) {
message.aspect = data.aspect;
}
if (data.param != null) {
message.param = dependency_3.request.SignalParam.fromObject(data.param);
}
if (typeof data.relayStateMap == "object") {
message.relayStateMap = new Map(Object.entries(data.relayStateMap));
}
return message;
}
toObject() {
const data: {
id?: number;
aspect?: Signal.Aspect;
param?: ReturnType<typeof dependency_3.request.SignalParam.prototype.toObject>;
relayStateMap?: {
[key: string]: boolean;
};
} = {};
if (this.id != null) {
data.id = this.id;
@ -704,6 +655,12 @@ export namespace state {
if (this.aspect != null) {
data.aspect = this.aspect;
}
if (this.param != null) {
data.param = this.param.toObject();
}
if (this.relayStateMap != null) {
data.relayStateMap = (Object.fromEntries)(this.relayStateMap);
}
return data;
}
serialize(): Uint8Array;
@ -714,6 +671,14 @@ export namespace state {
writer.writeUint32(1, this.id);
if (this.aspect != Signal.Aspect.Non)
writer.writeEnum(2, this.aspect);
if (this.has_param)
writer.writeMessage(3, this.param, () => this.param.serialize(writer));
for (const [key, value] of this.relayStateMap) {
writer.writeMessage(4, this.relayStateMap, () => {
writer.writeString(1, key);
writer.writeBool(2, value);
});
}
if (!w)
return writer.getResultBuffer();
}
@ -729,6 +694,12 @@ export namespace state {
case 2:
message.aspect = reader.readEnum();
break;
case 3:
reader.readMessage(message.param, () => message.param = dependency_3.request.SignalParam.deserialize(reader));
break;
case 4:
reader.readMessage(message, () => pb_1.Map.deserializeBinary(message.relayStateMap as any, reader, reader.readString, reader.readBool));
break;
default: reader.skipField();
}
}