diff --git a/src/api/Simulation.ts b/src/api/Simulation.ts
index 3bcc8d5..ab15288 100644
--- a/src/api/Simulation.ts
+++ b/src/api/Simulation.ts
@@ -430,3 +430,17 @@ export async function updateTrainConn(data: {
}) {
return await api.post(`${UriBase}/train/conn`, data);
}
+
+/** 车库门参数修改 */
+export async function ckmUpdateParams(data: {
+ simulationId: string;
+ mapId: number;
+ deviceId: number;
+ operation: request.Ckm.Operation;
+ param: {
+ force: request.Ckm.Force;
+ fault: request.Ckm.Fault;
+ };
+}) {
+ return await api.put(`${UriBase}/ckm/operation`, data);
+}
diff --git a/src/components/draw-app/dialogs/CkmOperation.vue b/src/components/draw-app/dialogs/CkmOperation.vue
new file mode 100644
index 0000000..07a9df7
--- /dev/null
+++ b/src/components/draw-app/dialogs/CkmOperation.vue
@@ -0,0 +1,151 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/components/line-app/StateProperties.vue b/src/components/line-app/StateProperties.vue
index d599309..3f7915b 100644
--- a/src/components/line-app/StateProperties.vue
+++ b/src/components/line-app/StateProperties.vue
@@ -28,6 +28,7 @@
+
@@ -56,6 +57,8 @@ import SpksSwitchState from './states/SpksSwitchState.vue';
import { SpksSwitch } from 'src/graphics/spksSwitch/SpksSwitch';
import TransponderState from './states/TransponderState.vue';
import { Transponder } from 'src/graphics/transponder/Transponder';
+import { GarageDoor } from "src/graphics/garageDoor/GarageDoor";
+import GarageDoorState from './states/GarageDoorState'
const lineStore = useLineStore();
diff --git a/src/components/line-app/states/GarageDoorState.vue b/src/components/line-app/states/GarageDoorState.vue
new file mode 100644
index 0000000..f44eb4f
--- /dev/null
+++ b/src/components/line-app/states/GarageDoorState.vue
@@ -0,0 +1,184 @@
+
+
+
+ 车库门状态
+
+
+
+
+ {{ item.label }}
+
+
+
+
+
+
+
+
+
+
+ {{ item.label }}
+
+
+ {{
+ item.formatFn
+ ? item.formatFn(garageDoorState[item.key])
+ : garageDoorState[item.key]
+ }}
+
+
+
+
+
+
+
diff --git a/src/drawApp/commonApp.ts b/src/drawApp/commonApp.ts
index 5cc5549..8a7e5c6 100644
--- a/src/drawApp/commonApp.ts
+++ b/src/drawApp/commonApp.ts
@@ -160,7 +160,10 @@ import { CarWashingDraw } from 'src/graphics/carWashing/CarWashingDrawAssistant'
import { FloodGateData } from './graphics/FloodGateInteraction';
import { FloodGate, FloodGateTemplate } from 'src/graphics/floodGate/FloodGate';
import { FloodGateDraw } from 'src/graphics/floodGate/FloodGateDrawAssistant';
-import { GarageDoorData } from './graphics/GarageDoorInteraction';
+import {
+ GarageDoorData,
+ GarageDoorState,
+} from './graphics/GarageDoorInteraction';
import {
GarageDoor,
GarageDoorTemplate,
@@ -258,7 +261,10 @@ export function initCommonDrawApp(app: IDrawApp) {
);
new CarWashingDraw(app, new CarWashingTemplate(new CarWashingData()));
new FloodGateDraw(app, new FloodGateTemplate(new FloodGateData()));
- new GarageDoorDraw(app, new GarageDoorTemplate(new GarageDoorData()));
+ new GarageDoorDraw(
+ app,
+ new GarageDoorTemplate(new GarageDoorData(), new GarageDoorState())
+ );
DrawSignalInteraction.init(app);
DrawStopPositionInteraction.init(app);
DrawSpksSwitchInteraction.init(app);
diff --git a/src/drawApp/graphics/GarageDoorInteraction.ts b/src/drawApp/graphics/GarageDoorInteraction.ts
index 381b1f8..b54d11c 100644
--- a/src/drawApp/graphics/GarageDoorInteraction.ts
+++ b/src/drawApp/graphics/GarageDoorInteraction.ts
@@ -1,13 +1,25 @@
import * as pb_1 from 'google-protobuf';
-import { FederatedMouseEvent } from 'pixi.js';
+import { DisplayObject, FederatedMouseEvent } from 'pixi.js';
import {
GarageDoor,
IGarageDoorData,
+ IGarageDoorState,
} from 'src/graphics/garageDoor/GarageDoor';
-import { GraphicInteractionPlugin, JlGraphic, IGraphicScene } from 'jl-graphic';
+import {
+ GraphicInteractionPlugin,
+ JlGraphic,
+ IGraphicScene,
+ MenuItemOptions,
+ ContextMenu,
+} from 'jl-graphic';
import { graphicData } from 'src/protos/stationLayoutGraphics';
-import { GraphicDataBase } from './GraphicDataBase';
+import { GraphicDataBase, GraphicStateBase } from './GraphicDataBase';
+import { useLineStore } from 'src/stores/line-store';
+import { Dialog } from 'quasar';
+import CkmOperation from 'src/components/draw-app/dialogs/CkmOperation.vue';
+import { state } from 'src/protos/device_state';
+import { request } from 'src/protos/request';
export class GarageDoorData extends GraphicDataBase implements IGarageDoorData {
constructor(data?: graphicData.GarageDoor) {
@@ -54,10 +66,76 @@ export class GarageDoorData extends GraphicDataBase implements IGarageDoorData {
}
}
+export class GarageDoorState
+ extends GraphicStateBase
+ implements IGarageDoorState
+{
+ constructor(proto?: state.CkmState) {
+ let states;
+ if (proto) {
+ states = proto;
+ } else {
+ states = new state.CkmState();
+ }
+ super(states, GarageDoor.Type);
+ }
+ get code(): string {
+ return this.states.id + '';
+ }
+ get id(): number {
+ return this.states.id;
+ }
+ set id(id: number) {
+ this.states.id = id;
+ }
+ get mgj() {
+ return this.states.mgj;
+ }
+ set mgj(v: boolean) {
+ this.states.mgj = v;
+ }
+ get stateLoss(): boolean {
+ //状态丢失
+ return this.states.stateLoss;
+ }
+ set stateLoss(v: boolean) {
+ this.states.stateLoss = v;
+ }
+ get param(): request.CkmParam {
+ return this.states.param;
+ }
+ set param(param: request.CkmParam) {
+ this.states.param = param;
+ }
+ get states(): state.CkmState {
+ return this.getState();
+ }
+ clone(): GarageDoorState {
+ return new GarageDoorState(this.states.cloneMessage());
+ }
+ copyFrom(data: GraphicStateBase): void {
+ pb_1.Message.copyInto(data._state, this._state);
+ }
+ eq(data: GraphicStateBase): boolean {
+ return pb_1.Message.equals(this._state, data._state);
+ }
+}
+
+const setCkmrParam: MenuItemOptions = { name: '设置参数' };
+const ckmOperateMenu: ContextMenu = ContextMenu.init({
+ name: '屏蔽门操作菜单',
+ groups: [
+ {
+ items: [setCkmrParam],
+ },
+ ],
+});
+
export class GarageDoorOperationInteraction extends GraphicInteractionPlugin {
static Name = 'garage_door_operation';
constructor(scene: IGraphicScene) {
super(GarageDoorOperationInteraction.Name, scene);
+ scene.registerMenu(ckmOperateMenu);
}
static init(scene: IGraphicScene) {
return new GarageDoorOperationInteraction(scene);
@@ -85,4 +163,26 @@ export class GarageDoorOperationInteraction extends GraphicInteractionPlugin();
+ if (!garageDoor) return;
+ this.app.updateSelected(garageDoor);
+ const lineStore = useLineStore();
+ setCkmrParam.handler = async () => {
+ if (lineStore.deviceOpreratDialogInstance) return;
+ lineStore.deviceOpreratDialogInstance = Dialog.create({
+ component: CkmOperation,
+ componentProps: {
+ id: garageDoor.id,
+ code: garageDoor.datas.code,
+ garageDoorForceProp: garageDoor.states.param.force,
+ garageDoorFaultProp: garageDoor.states.param.fault,
+ },
+ cancel: true,
+ persistent: true,
+ });
+ };
+ ckmOperateMenu.open(e.global);
+ }
}
diff --git a/src/drawApp/lineScene.ts b/src/drawApp/lineScene.ts
index ced567e..a7ec184 100644
--- a/src/drawApp/lineScene.ts
+++ b/src/drawApp/lineScene.ts
@@ -37,6 +37,7 @@ import {
import {
GarageDoorData,
GarageDoorOperationInteraction,
+ GarageDoorState,
} from './graphics/GarageDoorInteraction';
import {
GarageDoor,
@@ -333,7 +334,7 @@ export function initLineScene(lineApp: IGraphicApp, sceneName: string) {
new AutoReturnBoxState()
),
new CarWashingTemplate(new CarWashingData()),
- new GarageDoorTemplate(new GarageDoorData()),
+ new GarageDoorTemplate(new GarageDoorData(), new GarageDoorState()),
new FloodGateTemplate(new FloodGateData()),
new GarageDoorBoxTemplate(new GarageDoorBoxData()),
];
diff --git a/src/graphics/garageDoor/GarageDoor.ts b/src/graphics/garageDoor/GarageDoor.ts
index 4c0b7c3..933bb7a 100644
--- a/src/graphics/garageDoor/GarageDoor.ts
+++ b/src/graphics/garageDoor/GarageDoor.ts
@@ -1,10 +1,12 @@
import { Graphics } from 'pixi.js';
import {
GraphicData,
+ GraphicState,
JlGraphic,
JlGraphicTemplate,
VectorText,
} from 'jl-graphic';
+import { request } from 'src/protos/request';
export interface IGarageDoorData extends GraphicData {
get code(): string;
@@ -18,6 +20,17 @@ export interface IGarageDoorData extends GraphicData {
eq(other: IGarageDoorData): boolean;
}
+export interface IGarageDoorState extends GraphicState {
+ get id(): number;
+ set id(v: number);
+ get mgj(): boolean; //车库门关闭继电器
+ set mgj(v: boolean);
+ get param(): request.CkmParam;
+ set param(v: request.CkmParam);
+ get stateLoss(): boolean; //状态丢失
+ set stateLoss(v: boolean);
+}
+
const garageConsts = {
codeFontSize: 12,
codeColor: 0xffffff,
@@ -44,6 +57,10 @@ export class GarageDoor extends JlGraphic {
get datas(): IGarageDoorData {
return this.getDatas();
}
+
+ get states(): IGarageDoorState {
+ return this.getStates();
+ }
doRepaint(): void {
const codeGraph = this.codeGraph;
codeGraph.text = this.datas.code;
@@ -88,12 +105,13 @@ export class GarageDoor extends JlGraphic {
}
export class GarageDoorTemplate extends JlGraphicTemplate {
- constructor(dataTemplate: IGarageDoorData) {
- super(GarageDoor.Type, { dataTemplate });
+ constructor(dataTemplate: IGarageDoorData, stateTemplate?: IGarageDoorState) {
+ super(GarageDoor.Type, { dataTemplate, stateTemplate });
}
new(): GarageDoor {
const garageDoor = new GarageDoor();
garageDoor.loadData(this.datas);
+ garageDoor.loadState(this.states);
return garageDoor;
}
}
diff --git a/src/protos/device_state.ts b/src/protos/device_state.ts
index 1228222..86fa582 100644
--- a/src/protos/device_state.ts
+++ b/src/protos/device_state.ts
@@ -6873,6 +6873,145 @@ export namespace state {
}
}
}
+ export class CkmState extends pb_1.Message {
+ #one_of_decls: number[][] = [];
+ constructor(data?: any[] | {
+ id?: number;
+ mgj?: boolean;
+ param?: dependency_3.request.CkmParam;
+ stateLoss?: 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 ("id" in data && data.id != undefined) {
+ this.id = data.id;
+ }
+ if ("mgj" in data && data.mgj != undefined) {
+ this.mgj = data.mgj;
+ }
+ if ("param" in data && data.param != undefined) {
+ this.param = data.param;
+ }
+ if ("stateLoss" in data && data.stateLoss != undefined) {
+ this.stateLoss = data.stateLoss;
+ }
+ }
+ }
+ get id() {
+ return pb_1.Message.getFieldWithDefault(this, 1, 0) as number;
+ }
+ set id(value: number) {
+ pb_1.Message.setField(this, 1, value);
+ }
+ get mgj() {
+ return pb_1.Message.getFieldWithDefault(this, 2, false) as boolean;
+ }
+ set mgj(value: boolean) {
+ pb_1.Message.setField(this, 2, value);
+ }
+ get param() {
+ return pb_1.Message.getWrapperField(this, dependency_3.request.CkmParam, 3) as dependency_3.request.CkmParam;
+ }
+ set param(value: dependency_3.request.CkmParam) {
+ pb_1.Message.setWrapperField(this, 3, value);
+ }
+ get has_param() {
+ return pb_1.Message.getField(this, 3) != null;
+ }
+ get stateLoss() {
+ return pb_1.Message.getFieldWithDefault(this, 4, false) as boolean;
+ }
+ set stateLoss(value: boolean) {
+ pb_1.Message.setField(this, 4, value);
+ }
+ static fromObject(data: {
+ id?: number;
+ mgj?: boolean;
+ param?: ReturnType;
+ stateLoss?: boolean;
+ }): CkmState {
+ const message = new CkmState({});
+ if (data.id != null) {
+ message.id = data.id;
+ }
+ if (data.mgj != null) {
+ message.mgj = data.mgj;
+ }
+ if (data.param != null) {
+ message.param = dependency_3.request.CkmParam.fromObject(data.param);
+ }
+ if (data.stateLoss != null) {
+ message.stateLoss = data.stateLoss;
+ }
+ return message;
+ }
+ toObject() {
+ const data: {
+ id?: number;
+ mgj?: boolean;
+ param?: ReturnType;
+ stateLoss?: boolean;
+ } = {};
+ if (this.id != null) {
+ data.id = this.id;
+ }
+ if (this.mgj != null) {
+ data.mgj = this.mgj;
+ }
+ if (this.param != null) {
+ data.param = this.param.toObject();
+ }
+ if (this.stateLoss != null) {
+ data.stateLoss = this.stateLoss;
+ }
+ 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.id != 0)
+ writer.writeUint32(1, this.id);
+ if (this.mgj != false)
+ writer.writeBool(2, this.mgj);
+ if (this.has_param)
+ writer.writeMessage(3, this.param, () => this.param.serialize(writer));
+ if (this.stateLoss != false)
+ writer.writeBool(4, this.stateLoss);
+ if (!w)
+ return writer.getResultBuffer();
+ }
+ static deserialize(bytes: Uint8Array | pb_1.BinaryReader): CkmState {
+ const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new CkmState();
+ while (reader.nextField()) {
+ if (reader.isEndGroup())
+ break;
+ switch (reader.getFieldNumber()) {
+ case 1:
+ message.id = reader.readUint32();
+ break;
+ case 2:
+ message.mgj = reader.readBool();
+ break;
+ case 3:
+ reader.readMessage(message.param, () => message.param = dependency_3.request.CkmParam.deserialize(reader));
+ break;
+ case 4:
+ message.stateLoss = reader.readBool();
+ break;
+ default: reader.skipField();
+ }
+ }
+ return message;
+ }
+ serializeBinary(): Uint8Array {
+ return this.serialize();
+ }
+ static deserializeBinary(bytes: Uint8Array): CkmState {
+ return CkmState.deserialize(bytes);
+ }
+ }
export class VariationStatus extends pb_1.Message {
#one_of_decls: number[][] = [];
constructor(data?: any[] | {
@@ -7048,9 +7187,10 @@ export namespace state {
platformState?: PlatformState[];
baliseState?: BaliseState[];
stationQc?: StationQc;
+ ckmStates?: CkmState[];
}) {
super();
- pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12], this.#one_of_decls);
+ pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 14], this.#one_of_decls);
if (!Array.isArray(data) && typeof data == "object") {
if ("trainState" in data && data.trainState != undefined) {
this.trainState = data.trainState;
@@ -7091,6 +7231,9 @@ export namespace state {
if ("stationQc" in data && data.stationQc != undefined) {
this.stationQc = data.stationQc;
}
+ if ("ckmStates" in data && data.ckmStates != undefined) {
+ this.ckmStates = data.ckmStates;
+ }
}
}
get trainState() {
@@ -7174,6 +7317,12 @@ export namespace state {
get has_stationQc() {
return pb_1.Message.getField(this, 13) != null;
}
+ get ckmStates() {
+ return pb_1.Message.getRepeatedWrapperField(this, CkmState, 14) as CkmState[];
+ }
+ set ckmStates(value: CkmState[]) {
+ pb_1.Message.setRepeatedWrapperField(this, 14, value);
+ }
static fromObject(data: {
trainState?: ReturnType[];
switchState?: ReturnType[];
@@ -7188,6 +7337,7 @@ export namespace state {
platformState?: ReturnType[];
baliseState?: ReturnType[];
stationQc?: ReturnType;
+ ckmStates?: ReturnType[];
}): AllDevicesStatus {
const message = new AllDevicesStatus({});
if (data.trainState != null) {
@@ -7229,6 +7379,9 @@ export namespace state {
if (data.stationQc != null) {
message.stationQc = StationQc.fromObject(data.stationQc);
}
+ if (data.ckmStates != null) {
+ message.ckmStates = data.ckmStates.map(item => CkmState.fromObject(item));
+ }
return message;
}
toObject() {
@@ -7246,6 +7399,7 @@ export namespace state {
platformState?: ReturnType[];
baliseState?: ReturnType[];
stationQc?: ReturnType;
+ ckmStates?: ReturnType[];
} = {};
if (this.trainState != null) {
data.trainState = this.trainState.map((item: TrainMapState) => item.toObject());
@@ -7286,6 +7440,9 @@ export namespace state {
if (this.stationQc != null) {
data.stationQc = this.stationQc.toObject();
}
+ if (this.ckmStates != null) {
+ data.ckmStates = this.ckmStates.map((item: CkmState) => item.toObject());
+ }
return data;
}
serialize(): Uint8Array;
@@ -7318,6 +7475,8 @@ export namespace state {
writer.writeRepeatedMessage(12, this.baliseState, (item: BaliseState) => item.serialize(writer));
if (this.has_stationQc)
writer.writeMessage(13, this.stationQc, () => this.stationQc.serialize(writer));
+ if (this.ckmStates.length)
+ writer.writeRepeatedMessage(14, this.ckmStates, (item: CkmState) => item.serialize(writer));
if (!w)
return writer.getResultBuffer();
}
@@ -7366,6 +7525,9 @@ export namespace state {
case 13:
reader.readMessage(message.stationQc, () => message.stationQc = StationQc.deserialize(reader));
break;
+ case 14:
+ reader.readMessage(message.ckmStates, () => pb_1.Message.addToRepeatedWrapperField(message, 14, CkmState.deserialize(reader), CkmState));
+ break;
default: reader.skipField();
}
}