应答器添加公里标

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"
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
outlined
style="margin-top: 10px"
@ -51,12 +69,28 @@ const typeOptions = [
{ 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;
watch(
() => drawStore.selectedGraphic,
(val) => {
if (val && val.type == Transponder.Type) {
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;
if (Transponder) {
transponderModel.copyFrom(Transponder.saveData());
if (transponderModel.kilometerSystem) {
kilometerSystem.coordinateSystem =
transponderModel.kilometerSystem.coordinateSystem;
kilometerSystem.kilometer = transponderModel.kilometerSystem.kilometer;
}
}
});
function onUpdate() {
const Transponder = drawStore.selectedGraphic as Transponder;
transponderModel.kilometerSystem = {
coordinateSystem: kilometerSystem.coordinateSystem,
kilometer: kilometerSystem.kilometer,
};
if (Transponder) {
drawStore
.getDrawApp()

View File

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

View File

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