列车调整

This commit is contained in:
dong 2023-08-02 16:47:20 +08:00
parent f0e090259c
commit 3b61abb564
4 changed files with 34 additions and 3 deletions

View File

@ -57,6 +57,7 @@ const list: keyType[] = [
{ label: '尾车速传2速度值', key: 'tailSensorSpeed2', formatFn: speedFormat }, { label: '尾车速传2速度值', key: 'tailSensorSpeed2', formatFn: speedFormat },
{ label: '头车雷达速度值', key: 'headRadarSpeed', formatFn: speedFormat }, { label: '头车雷达速度值', key: 'headRadarSpeed', formatFn: speedFormat },
{ label: '尾车雷达速度值', key: 'tailRadarSpeed', formatFn: speedFormat }, { label: '尾车雷达速度值', key: 'tailRadarSpeed', formatFn: speedFormat },
{ label: '列车长度', key: 'trainLength', formatFn: trainLengthFormat },
]; ];
function upFormat(v: boolean) { function upFormat(v: boolean) {
return v ? '是' : '否'; return v ? '是' : '否';
@ -68,10 +69,13 @@ function runningUpFormat(v: boolean) {
return v ? '上行' : '下行'; return v ? '上行' : '下行';
} }
function resistanceFormat(v: number) { function resistanceFormat(v: number) {
return `${v}KN`; return `${v} KN`;
} }
function speedFormat(v: number) { function speedFormat(v: number) {
return `${v}km/h`; return `${v} km/h`;
}
function trainLengthFormat(v: number) {
return `${v} mm`;
} }
watch( watch(
() => lineStore.selectedGraphics, () => lineStore.selectedGraphics,

View File

@ -164,6 +164,18 @@ export class TrainState extends GraphicStateBase implements ITrainState {
set tailRadarSpeed(v: number) { set tailRadarSpeed(v: number) {
this.states.tailRadarSpeed = v; 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 { clone(): TrainState {
return new TrainState(this.states.cloneMessage()); return new TrainState(this.states.cloneMessage());
} }

View File

@ -339,7 +339,18 @@ export async function loadLineDatas(app: GraphicApp) {
}); });
storage.allStatus.trainState.forEach((item) => { 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 { } else {
storage.varStatus.updatedSection.forEach((item) => { storage.varStatus.updatedSection.forEach((item) => {

View File

@ -64,6 +64,10 @@ export interface ITrainState extends GraphicState {
set headRadarSpeed(v: number); set headRadarSpeed(v: number);
get tailRadarSpeed(): number; get tailRadarSpeed(): number;
set tailRadarSpeed(v: number); set tailRadarSpeed(v: number);
get trainLength(): number;
set trainLength(v: number);
get show(): boolean;
set show(v: boolean);
} }
interface bodyWH { interface bodyWH {