应答器添加公里标

This commit is contained in:
dong 2023-08-01 10:23:10 +08:00
parent ad15260265
commit f0a891510c
3 changed files with 53 additions and 0 deletions

View File

@ -21,6 +21,24 @@
@blur="onUpdate" @blur="onUpdate"
label="索引" label="索引"
/> />
<q-select
outlined
style="margin-top: 10px"
v-model="kilometerSystem.coordinateSystem"
:options="CoordinateSystemOptions"
:map-options="true"
:emit-value="true"
@update:model-value="onUpdate"
label="坐标系"
></q-select>
<q-input
outlined
style="margin-top: 10px"
v-model.number="kilometerSystem.kilometer"
type="number"
@blur="onUpdate"
label="公里标(mm):"
/>
<q-select <q-select
outlined outlined
style="margin-top: 10px" style="margin-top: 10px"
@ -51,12 +69,28 @@ const typeOptions = [
{ label: '休眠唤醒应答器', value: transponderTypeEnum.DB }, { label: '休眠唤醒应答器', value: transponderTypeEnum.DB },
]; ];
const kilometerSystem = reactive({ coordinateSystem: '', kilometer: 0 });
const CoordinateSystemOptions = [
{ label: '车辆段', value: 'DEPOT' },
{ label: '停车场', value: 'PARKING_LOT' },
{ label: '正线', value: 'MAIN_LINE' },
{ label: '换线', value: 'TRANSFER' },
];
drawStore.$subscribe; drawStore.$subscribe;
watch( watch(
() => drawStore.selectedGraphic, () => drawStore.selectedGraphic,
(val) => { (val) => {
if (val && val.type == Transponder.Type) { if (val && val.type == Transponder.Type) {
transponderModel.copyFrom(val.saveData() as TransponderData); transponderModel.copyFrom(val.saveData() as TransponderData);
if (transponderModel.kilometerSystem) {
kilometerSystem.coordinateSystem =
transponderModel.kilometerSystem.coordinateSystem;
kilometerSystem.kilometer = transponderModel.kilometerSystem.kilometer;
} else {
kilometerSystem.coordinateSystem = '';
kilometerSystem.kilometer = 0;
}
} }
} }
); );
@ -65,11 +99,20 @@ onMounted(() => {
const Transponder = drawStore.selectedGraphic as Transponder; const Transponder = drawStore.selectedGraphic as Transponder;
if (Transponder) { if (Transponder) {
transponderModel.copyFrom(Transponder.saveData()); transponderModel.copyFrom(Transponder.saveData());
if (transponderModel.kilometerSystem) {
kilometerSystem.coordinateSystem =
transponderModel.kilometerSystem.coordinateSystem;
kilometerSystem.kilometer = transponderModel.kilometerSystem.kilometer;
}
} }
}); });
function onUpdate() { function onUpdate() {
const Transponder = drawStore.selectedGraphic as Transponder; const Transponder = drawStore.selectedGraphic as Transponder;
transponderModel.kilometerSystem = {
coordinateSystem: kilometerSystem.coordinateSystem,
kilometer: kilometerSystem.kilometer,
};
if (Transponder) { if (Transponder) {
drawStore drawStore
.getDrawApp() .getDrawApp()

View File

@ -5,6 +5,7 @@ import {
} from 'src/graphics/transponder/Transponder'; } from 'src/graphics/transponder/Transponder';
import { graphicData } from 'src/protos/stationLayoutGraphics'; import { graphicData } from 'src/protos/stationLayoutGraphics';
import { GraphicDataBase } from './GraphicDataBase'; import { GraphicDataBase } from './GraphicDataBase';
import { KilometerSystem } from 'src/graphics/signal/Signal';
export class TransponderData export class TransponderData
extends GraphicDataBase extends GraphicDataBase
@ -43,6 +44,12 @@ export class TransponderData
set index(v: number) { set index(v: number) {
this.data.index = v; this.data.index = v;
} }
get kilometerSystem(): KilometerSystem {
return this.data.kilometerSystem;
}
set kilometerSystem(v: KilometerSystem) {
this.data.kilometerSystem = new graphicData.KilometerSystem(v);
}
clone(): TransponderData { clone(): TransponderData {
return new TransponderData(this.data.cloneMessage()); return new TransponderData(this.data.cloneMessage());
} }

View File

@ -5,6 +5,7 @@ import {
JlGraphicTemplate, JlGraphicTemplate,
VectorText, VectorText,
} from 'src/jl-graphic'; } from 'src/jl-graphic';
import { KilometerSystem } from '../signal/Signal';
export interface ITransponderData extends GraphicData { export interface ITransponderData extends GraphicData {
get code(): string; // 编号 get code(): string; // 编号
@ -13,6 +14,8 @@ export interface ITransponderData extends GraphicData {
set transponderType(v: number); set transponderType(v: number);
get index(): number; // 索引 get index(): number; // 索引
set index(v: number); set index(v: number);
get kilometerSystem(): KilometerSystem;
set kilometerSystem(v: KilometerSystem);
clone(): ITransponderData; clone(): ITransponderData;
copyFrom(data: ITransponderData): void; copyFrom(data: ITransponderData): void;
eq(other: ITransponderData): boolean; eq(other: ITransponderData): boolean;