From 3b61abb564d1e99b845e890a48e8f3cf2c7b5713 Mon Sep 17 00:00:00 2001 From: dong <58670809@qq.com> Date: Wed, 2 Aug 2023 16:47:20 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=97=E8=BD=A6=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/line-app/infos/TrainInfo.vue | 8 ++++++-- src/drawApp/graphics/TrainInteraction.ts | 12 ++++++++++++ src/drawApp/lineApp.ts | 13 ++++++++++++- src/graphics/train/Train.ts | 4 ++++ 4 files changed, 34 insertions(+), 3 deletions(-) diff --git a/src/components/line-app/infos/TrainInfo.vue b/src/components/line-app/infos/TrainInfo.vue index 19b8bbe..f5e7dd7 100644 --- a/src/components/line-app/infos/TrainInfo.vue +++ b/src/components/line-app/infos/TrainInfo.vue @@ -57,6 +57,7 @@ const list: keyType[] = [ { label: '尾车速传2速度值', key: 'tailSensorSpeed2', formatFn: speedFormat }, { label: '头车雷达速度值', key: 'headRadarSpeed', formatFn: speedFormat }, { label: '尾车雷达速度值', key: 'tailRadarSpeed', formatFn: speedFormat }, + { label: '列车长度', key: 'trainLength', formatFn: trainLengthFormat }, ]; function upFormat(v: boolean) { return v ? '是' : '否'; @@ -68,10 +69,13 @@ function runningUpFormat(v: boolean) { return v ? '上行' : '下行'; } function resistanceFormat(v: number) { - return `${v}KN`; + return `${v} KN`; } function speedFormat(v: number) { - return `${v}km/h`; + return `${v} km/h`; +} +function trainLengthFormat(v: number) { + return `${v} mm`; } watch( () => lineStore.selectedGraphics, diff --git a/src/drawApp/graphics/TrainInteraction.ts b/src/drawApp/graphics/TrainInteraction.ts index 1ff5d93..53d81e7 100644 --- a/src/drawApp/graphics/TrainInteraction.ts +++ b/src/drawApp/graphics/TrainInteraction.ts @@ -164,6 +164,18 @@ export class TrainState extends GraphicStateBase implements ITrainState { set tailRadarSpeed(v: number) { this.states.tailRadarSpeed = v; } + get trainLength(): number { + return this.states.trainLength; + } + set trainLength(v: number) { + this.states.trainLength = v; + } + get show(): boolean { + return this.states.show; + } + set show(v: boolean) { + this.states.show = v; + } clone(): TrainState { return new TrainState(this.states.cloneMessage()); } diff --git a/src/drawApp/lineApp.ts b/src/drawApp/lineApp.ts index d63d89e..1f7a45d 100644 --- a/src/drawApp/lineApp.ts +++ b/src/drawApp/lineApp.ts @@ -339,7 +339,18 @@ export async function loadLineDatas(app: GraphicApp) { }); storage.allStatus.trainState.forEach((item) => { // 列车 - states.push(new TrainState(item)); + if (!item.show) { + // 移除列车 + const train = app.queryStore.queryByCodeAndType( + item.id, + Train.Type + ); + if (train) { + app.deleteGraphics(train); + } + } else { + states.push(new TrainState(item)); + } }); } else { storage.varStatus.updatedSection.forEach((item) => { diff --git a/src/graphics/train/Train.ts b/src/graphics/train/Train.ts index 0800a4a..4c89c37 100644 --- a/src/graphics/train/Train.ts +++ b/src/graphics/train/Train.ts @@ -64,6 +64,10 @@ export interface ITrainState extends GraphicState { set headRadarSpeed(v: number); get tailRadarSpeed(): number; set tailRadarSpeed(v: number); + get trainLength(): number; + set trainLength(v: number); + get show(): boolean; + set show(v: boolean); } interface bodyWH {