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 {