车站名字--站台上下行和关联车站
This commit is contained in:
parent
25b4f6d3ea
commit
2dc864920d
@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<q-form>
|
||||
<q-form class="q-gutter-sm">
|
||||
<q-input outlined readonly v-model="platformModel.id" label="id" hint="" />
|
||||
<q-input
|
||||
outlined
|
||||
@ -24,12 +24,32 @@
|
||||
:options="optionsDirection"
|
||||
label="方向"
|
||||
/>
|
||||
<q-select
|
||||
outlined
|
||||
@blur="onUpdate"
|
||||
v-model="upAndDown"
|
||||
:options="optionsUpAndDown"
|
||||
label="上下行"
|
||||
/>
|
||||
<q-list bordered separator class="rounded-borders">
|
||||
<q-item>
|
||||
<q-item-section no-wrap class="q-gutter-y-sm column">
|
||||
<q-item-label> 关联的车站 </q-item-label>
|
||||
<div class="q-gutter-sm row">
|
||||
<q-chip square color="primary" text-color="white">
|
||||
{{ stationName }}
|
||||
</q-chip>
|
||||
</div>
|
||||
</q-item-section>
|
||||
</q-item>
|
||||
</q-list>
|
||||
</q-form>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { PlatformData } from 'src/drawApp/graphics/PlatformInteraction';
|
||||
import { Platform } from 'src/graphics/platform/Platform';
|
||||
import { Station } from 'src/graphics/station/Station';
|
||||
import { useDrawStore } from 'src/stores/draw-store';
|
||||
import { onMounted, reactive, ref, watch } from 'vue';
|
||||
|
||||
@ -38,18 +58,25 @@ const platformModel = reactive(new PlatformData());
|
||||
const hasDoor = ref('是');
|
||||
const optionsDoor = ['是', '否'];
|
||||
const direction = ref('向上');
|
||||
const upAndDown = ref('');
|
||||
const optionsDirection = ['向上', '向下'];
|
||||
const optionsUpAndDown = ['上行', '下行'];
|
||||
const stationName = ref('');
|
||||
enum showSelect {
|
||||
是 = 'true',
|
||||
否 = 'false',
|
||||
向上 = 'up',
|
||||
向下 = 'down',
|
||||
上行 = 'upLink',
|
||||
下行 = 'downLink',
|
||||
}
|
||||
enum showSelectData {
|
||||
true = '是',
|
||||
false = '否',
|
||||
up = '向上',
|
||||
down = '向下',
|
||||
upLink = '上行',
|
||||
downLink = '下行',
|
||||
}
|
||||
|
||||
drawStore.$subscribe;
|
||||
@ -60,6 +87,13 @@ watch(
|
||||
platformModel.copyFrom(val.saveData() as PlatformData);
|
||||
hasDoor.value = (showSelectData as never)[platformModel.hasdoor + ''];
|
||||
direction.value = (showSelectData as never)[platformModel.direction];
|
||||
upAndDown.value = (showSelectData as never)[platformModel.upAndDown];
|
||||
if (platformModel.refStation) {
|
||||
const refStation = val.queryStore.queryById<Station>(
|
||||
platformModel.refStation
|
||||
) as Station;
|
||||
stationName.value = refStation.datas.name;
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
@ -70,12 +104,20 @@ onMounted(() => {
|
||||
platformModel.copyFrom(platform.saveData());
|
||||
hasDoor.value = (showSelectData as never)[platformModel.hasdoor + ''];
|
||||
direction.value = (showSelectData as never)[platformModel.direction];
|
||||
upAndDown.value = (showSelectData as never)[platformModel.upAndDown];
|
||||
if (platformModel.refStation) {
|
||||
const refStation = platform.queryStore.queryById<Station>(
|
||||
platformModel.refStation
|
||||
) as Station;
|
||||
stationName.value = refStation.datas.name;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
function onUpdate() {
|
||||
platformModel.hasdoor = JSON.parse((showSelect as never)[hasDoor.value]);
|
||||
platformModel.direction = (showSelect as never)[direction.value];
|
||||
platformModel.upAndDown = (showSelect as never)[upAndDown.value];
|
||||
const platform = drawStore.selectedGraphic as Platform;
|
||||
if (platform) {
|
||||
drawStore.getDrawApp().updateGraphicAndRecord(platform, platformModel);
|
||||
|
@ -3,13 +3,22 @@
|
||||
<q-input outlined readonly v-model="stationModel.id" label="id" hint="" />
|
||||
<q-input
|
||||
outlined
|
||||
label="车站名称"
|
||||
label="车站索引"
|
||||
type="textarea"
|
||||
@blur="onUpdate"
|
||||
v-model="stationModel.code"
|
||||
lazy-rules
|
||||
autogrow
|
||||
/>
|
||||
<q-input
|
||||
outlined
|
||||
label="车站名称"
|
||||
type="textarea"
|
||||
@blur="onUpdate"
|
||||
v-model="stationModel.name"
|
||||
lazy-rules
|
||||
autogrow
|
||||
/>
|
||||
<q-select
|
||||
outlined
|
||||
style="margin-top: 10px"
|
||||
|
@ -53,6 +53,18 @@ export class PlatformData extends GraphicDataBase implements IPlatformData {
|
||||
set direction(v: string) {
|
||||
this.data.direction = v;
|
||||
}
|
||||
get upAndDown(): string {
|
||||
return this.data.upAndDown;
|
||||
}
|
||||
set upAndDown(v: string) {
|
||||
this.data.upAndDown = v;
|
||||
}
|
||||
get refStation(): string {
|
||||
return this.data.refStation;
|
||||
}
|
||||
set refStation(v: string) {
|
||||
this.data.refStation = v;
|
||||
}
|
||||
|
||||
clone(): PlatformData {
|
||||
return new PlatformData(this.data.cloneMessage());
|
||||
|
@ -59,6 +59,12 @@ export class StationData extends GraphicDataBase implements IStationData {
|
||||
set concentrationStations(v: boolean) {
|
||||
this.data.concentrationStations = v;
|
||||
}
|
||||
get name(): string {
|
||||
return this.data.name;
|
||||
}
|
||||
set name(v: string) {
|
||||
this.data.name = v;
|
||||
}
|
||||
clone(): StationData {
|
||||
return new StationData(this.data.cloneMessage());
|
||||
}
|
||||
|
@ -8,6 +8,7 @@ import {
|
||||
calculateMirrorPoint,
|
||||
getRectangleCenter,
|
||||
} from 'src/jl-graphic';
|
||||
import { Station } from '../station/Station';
|
||||
|
||||
export interface IPlatformData extends GraphicData {
|
||||
get code(): string; // 编号
|
||||
@ -16,6 +17,10 @@ export interface IPlatformData extends GraphicData {
|
||||
set hasdoor(v: boolean);
|
||||
get direction(): string; // 屏蔽门上下
|
||||
set direction(v: string);
|
||||
get upAndDown(): string; // 站台上下行
|
||||
set upAndDown(v: string);
|
||||
get refStation(): string; // 关联的车站
|
||||
set refStation(v: string);
|
||||
clone(): IPlatformData;
|
||||
copyFrom(data: IPlatformData): void;
|
||||
eq(other: IPlatformData): boolean;
|
||||
@ -405,6 +410,16 @@ export class Platform extends JlGraphic {
|
||||
this.besideGraphic.changeState(this.states);
|
||||
this.codeGraph.changeState(this.states);
|
||||
}
|
||||
buildRelation() {
|
||||
const stationas = this.queryStore.queryByType<Station>(Station.Type);
|
||||
for (let i = 0; i < stationas.length; i++) {
|
||||
const sP = stationas[i].localBoundsToCanvasPoints();
|
||||
if (this.x > sP[0].x && this.x < sP[1].x) {
|
||||
this.datas.refStation = stationas[i].id;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export class PlatformTemplate extends JlGraphicTemplate<Platform> {
|
||||
|
@ -9,14 +9,16 @@ import {
|
||||
import { KilometerSystem } from '../signal/Signal';
|
||||
|
||||
export interface IStationData extends GraphicData {
|
||||
get code(): string; // 编号
|
||||
get code(): string; // 车站索引
|
||||
set code(v: string);
|
||||
get kilometerSystem(): KilometerSystem;
|
||||
set kilometerSystem(v: KilometerSystem);
|
||||
get hasControl(): boolean; /// 是否有控制
|
||||
get hasControl(): boolean; //是否有控制
|
||||
set hasControl(v: boolean);
|
||||
get concentrationStations(): boolean; ////是否集中站
|
||||
get concentrationStations(): boolean; //是否集中站
|
||||
set concentrationStations(v: boolean);
|
||||
get name(): string; //车站名称
|
||||
set name(v: string);
|
||||
clone(): IStationData;
|
||||
copyFrom(data: IStationData): void;
|
||||
eq(other: IStationData): boolean;
|
||||
@ -171,7 +173,8 @@ export class Station extends JlGraphic {
|
||||
const kilometerGraph = this.kilometerGraph;
|
||||
const controlGraphic = this.controlGraphic;
|
||||
controlGraphic.clear();
|
||||
codeGraph.text = this.datas?.code || '车站Station';
|
||||
codeGraph.text =
|
||||
`${this.datas?.name}(${this.datas?.code})` || '车站Station';
|
||||
codeGraph.style.fill = stationConsts.codeColor;
|
||||
codeGraph.setVectorFontSize(stationConsts.codeFontSize);
|
||||
codeGraph.anchor.set(0.5);
|
||||
|
@ -1706,6 +1706,8 @@ export namespace graphicData {
|
||||
code?: string;
|
||||
hasdoor?: boolean;
|
||||
direction?: string;
|
||||
upAndDown?: string;
|
||||
refStation?: string;
|
||||
}) {
|
||||
super();
|
||||
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
|
||||
@ -1722,6 +1724,12 @@ export namespace graphicData {
|
||||
if ("direction" in data && data.direction != undefined) {
|
||||
this.direction = data.direction;
|
||||
}
|
||||
if ("upAndDown" in data && data.upAndDown != undefined) {
|
||||
this.upAndDown = data.upAndDown;
|
||||
}
|
||||
if ("refStation" in data && data.refStation != undefined) {
|
||||
this.refStation = data.refStation;
|
||||
}
|
||||
}
|
||||
}
|
||||
get common() {
|
||||
@ -1751,11 +1759,25 @@ export namespace graphicData {
|
||||
set direction(value: string) {
|
||||
pb_1.Message.setField(this, 4, value);
|
||||
}
|
||||
get upAndDown() {
|
||||
return pb_1.Message.getFieldWithDefault(this, 5, "") as string;
|
||||
}
|
||||
set upAndDown(value: string) {
|
||||
pb_1.Message.setField(this, 5, value);
|
||||
}
|
||||
get refStation() {
|
||||
return pb_1.Message.getFieldWithDefault(this, 6, "") as string;
|
||||
}
|
||||
set refStation(value: string) {
|
||||
pb_1.Message.setField(this, 6, value);
|
||||
}
|
||||
static fromObject(data: {
|
||||
common?: ReturnType<typeof CommonInfo.prototype.toObject>;
|
||||
code?: string;
|
||||
hasdoor?: boolean;
|
||||
direction?: string;
|
||||
upAndDown?: string;
|
||||
refStation?: string;
|
||||
}): Platform {
|
||||
const message = new Platform({});
|
||||
if (data.common != null) {
|
||||
@ -1770,6 +1792,12 @@ export namespace graphicData {
|
||||
if (data.direction != null) {
|
||||
message.direction = data.direction;
|
||||
}
|
||||
if (data.upAndDown != null) {
|
||||
message.upAndDown = data.upAndDown;
|
||||
}
|
||||
if (data.refStation != null) {
|
||||
message.refStation = data.refStation;
|
||||
}
|
||||
return message;
|
||||
}
|
||||
toObject() {
|
||||
@ -1778,6 +1806,8 @@ export namespace graphicData {
|
||||
code?: string;
|
||||
hasdoor?: boolean;
|
||||
direction?: string;
|
||||
upAndDown?: string;
|
||||
refStation?: string;
|
||||
} = {};
|
||||
if (this.common != null) {
|
||||
data.common = this.common.toObject();
|
||||
@ -1791,6 +1821,12 @@ export namespace graphicData {
|
||||
if (this.direction != null) {
|
||||
data.direction = this.direction;
|
||||
}
|
||||
if (this.upAndDown != null) {
|
||||
data.upAndDown = this.upAndDown;
|
||||
}
|
||||
if (this.refStation != null) {
|
||||
data.refStation = this.refStation;
|
||||
}
|
||||
return data;
|
||||
}
|
||||
serialize(): Uint8Array;
|
||||
@ -1805,6 +1841,10 @@ export namespace graphicData {
|
||||
writer.writeBool(3, this.hasdoor);
|
||||
if (this.direction.length)
|
||||
writer.writeString(4, this.direction);
|
||||
if (this.upAndDown.length)
|
||||
writer.writeString(5, this.upAndDown);
|
||||
if (this.refStation.length)
|
||||
writer.writeString(6, this.refStation);
|
||||
if (!w)
|
||||
return writer.getResultBuffer();
|
||||
}
|
||||
@ -1826,6 +1866,12 @@ export namespace graphicData {
|
||||
case 4:
|
||||
message.direction = reader.readString();
|
||||
break;
|
||||
case 5:
|
||||
message.upAndDown = reader.readString();
|
||||
break;
|
||||
case 6:
|
||||
message.refStation = reader.readString();
|
||||
break;
|
||||
default: reader.skipField();
|
||||
}
|
||||
}
|
||||
@ -1846,6 +1892,7 @@ export namespace graphicData {
|
||||
hasControl?: boolean;
|
||||
concentrationStations?: boolean;
|
||||
kilometerSystem?: KilometerSystem;
|
||||
name?: string;
|
||||
}) {
|
||||
super();
|
||||
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
|
||||
@ -1865,6 +1912,9 @@ export namespace graphicData {
|
||||
if ("kilometerSystem" in data && data.kilometerSystem != undefined) {
|
||||
this.kilometerSystem = data.kilometerSystem;
|
||||
}
|
||||
if ("name" in data && data.name != undefined) {
|
||||
this.name = data.name;
|
||||
}
|
||||
}
|
||||
}
|
||||
get common() {
|
||||
@ -1903,12 +1953,19 @@ export namespace graphicData {
|
||||
get has_kilometerSystem() {
|
||||
return pb_1.Message.getField(this, 6) != null;
|
||||
}
|
||||
get name() {
|
||||
return pb_1.Message.getFieldWithDefault(this, 7, "") as string;
|
||||
}
|
||||
set name(value: string) {
|
||||
pb_1.Message.setField(this, 7, value);
|
||||
}
|
||||
static fromObject(data: {
|
||||
common?: ReturnType<typeof CommonInfo.prototype.toObject>;
|
||||
code?: string;
|
||||
hasControl?: boolean;
|
||||
concentrationStations?: boolean;
|
||||
kilometerSystem?: ReturnType<typeof KilometerSystem.prototype.toObject>;
|
||||
name?: string;
|
||||
}): Station {
|
||||
const message = new Station({});
|
||||
if (data.common != null) {
|
||||
@ -1926,6 +1983,9 @@ export namespace graphicData {
|
||||
if (data.kilometerSystem != null) {
|
||||
message.kilometerSystem = KilometerSystem.fromObject(data.kilometerSystem);
|
||||
}
|
||||
if (data.name != null) {
|
||||
message.name = data.name;
|
||||
}
|
||||
return message;
|
||||
}
|
||||
toObject() {
|
||||
@ -1935,6 +1995,7 @@ export namespace graphicData {
|
||||
hasControl?: boolean;
|
||||
concentrationStations?: boolean;
|
||||
kilometerSystem?: ReturnType<typeof KilometerSystem.prototype.toObject>;
|
||||
name?: string;
|
||||
} = {};
|
||||
if (this.common != null) {
|
||||
data.common = this.common.toObject();
|
||||
@ -1951,6 +2012,9 @@ export namespace graphicData {
|
||||
if (this.kilometerSystem != null) {
|
||||
data.kilometerSystem = this.kilometerSystem.toObject();
|
||||
}
|
||||
if (this.name != null) {
|
||||
data.name = this.name;
|
||||
}
|
||||
return data;
|
||||
}
|
||||
serialize(): Uint8Array;
|
||||
@ -1967,6 +2031,8 @@ export namespace graphicData {
|
||||
writer.writeBool(4, this.concentrationStations);
|
||||
if (this.has_kilometerSystem)
|
||||
writer.writeMessage(6, this.kilometerSystem, () => this.kilometerSystem.serialize(writer));
|
||||
if (this.name.length)
|
||||
writer.writeString(7, this.name);
|
||||
if (!w)
|
||||
return writer.getResultBuffer();
|
||||
}
|
||||
@ -1991,6 +2057,9 @@ export namespace graphicData {
|
||||
case 6:
|
||||
reader.readMessage(message.kilometerSystem, () => message.kilometerSystem = KilometerSystem.deserialize(reader));
|
||||
break;
|
||||
case 7:
|
||||
message.name = reader.readString();
|
||||
break;
|
||||
default: reader.skipField();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user