设备增加数据

This commit is contained in:
fan 2023-08-01 14:06:50 +08:00
parent 5eab951255
commit 1d4c58de26
11 changed files with 211 additions and 3 deletions

@ -1 +1 @@
Subproject commit c09c46511d43178e55491efeab848445ea35ddbf
Subproject commit a2b81799c6d9a31a38801f3a356ae3a619abbb5c

View File

@ -14,6 +14,13 @@
@blur="onUpdate"
label="名称"
/>
<q-input
outlined
v-model.number="esbButtonModel.refStand"
type="number"
@blur="onUpdate"
label="对应站台索引"
/>
</q-form>
</template>

View File

@ -20,17 +20,37 @@
@blur="onUpdate"
label="名称"
/>
<q-input
outlined
v-model.number="spksSwitchModel.refStand"
type="number"
@blur="onUpdate"
label="对应站台索引"
/>
<q-select
outlined
style="margin-top: 10px"
v-model="spksSwitchModel.refSections"
:options="sectionList"
:multiple="true"
:map-options="true"
:emit-value="true"
@update:model-value="onUpdate"
label="关联物理区段"
></q-select>
</q-form>
</template>
<script setup lang="ts">
import { SpksSwitchData } from 'src/drawApp/graphics/SpksSwitchInteraction';
import { Section } from 'src/graphics/section/Section';
import { SpksSwitch } from 'src/graphics/spksSwitch/SpksSwitch';
import { useDrawStore } from 'src/stores/draw-store';
import { onMounted, reactive, watch } from 'vue';
const drawStore = useDrawStore();
const spksSwitchModel = reactive(new SpksSwitchData());
const sectionList: { label: string; value: string }[] = reactive([]);
drawStore.$subscribe;
watch(
() => drawStore.selectedGraphic,
@ -43,6 +63,12 @@ watch(
onMounted(() => {
const spksSwitch = drawStore.selectedGraphic as SpksSwitch;
const sections = drawStore
.getDrawApp()
.queryStore.queryByType<Section>(Section.Type);
sections.forEach((se) => {
sectionList.push({ value: se.id, label: se.datas.code });
});
if (spksSwitch) {
spksSwitchModel.copyFrom(spksSwitch.saveData());
}

View File

@ -23,6 +23,24 @@
@update:model-value="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-form>
</template>
@ -30,10 +48,18 @@
import { StopPositionData } from 'src/drawApp/graphics/StopPositionInteraction';
import { StopPosition, CoachNum } from 'src/graphics/stopPosition/StopPosition';
import { useDrawStore } from 'src/stores/draw-store';
import { onMounted, reactive, ref, watch } from 'vue';
import { onMounted, reactive, watch } from 'vue';
const drawStore = useDrawStore();
const stopPositionModel = reactive(new StopPositionData());
const kilometerSystem = reactive({ coordinateSystem: '', kilometer: 0 });
const CoordinateSystemOptions = [
{ label: '车辆段', value: 'DEPOT' },
{ label: '停车场', value: 'PARKING_LOT' },
{ label: '正线', value: 'MAIN_LINE' },
{ label: '换线', value: 'TRANSFER' },
];
const optionsCoachNum = [
{
label: 4,
@ -47,6 +73,11 @@ watch(
(val) => {
if (val && val.type == StopPosition.Type) {
stopPositionModel.copyFrom(val.saveData() as StopPositionData);
if (stopPositionModel.kilometerSystem) {
kilometerSystem.coordinateSystem =
stopPositionModel.kilometerSystem.coordinateSystem;
kilometerSystem.kilometer = stopPositionModel.kilometerSystem.kilometer;
}
}
}
);
@ -55,11 +86,20 @@ onMounted(() => {
const stopPosition = drawStore.selectedGraphic as StopPosition;
if (stopPosition) {
stopPositionModel.copyFrom(stopPosition.saveData());
if (stopPositionModel.kilometerSystem) {
kilometerSystem.coordinateSystem =
stopPositionModel.kilometerSystem.coordinateSystem;
kilometerSystem.kilometer = stopPositionModel.kilometerSystem.kilometer;
}
}
});
function onUpdate() {
const stopPosition = drawStore.selectedGraphic as StopPosition;
stopPositionModel.kilometerSystem = {
coordinateSystem: kilometerSystem.coordinateSystem,
kilometer: kilometerSystem.kilometer,
};
if (stopPosition) {
drawStore
.getDrawApp()

View File

@ -46,6 +46,12 @@ export class EsbButtonData extends GraphicDataBase implements IEsbButton {
set index(v: number) {
this.data.index = v;
}
get refStand(): number {
return this.data.refStand;
}
set refStand(v: number) {
this.data.refStand = v;
}
clone(): EsbButtonData {
return new EsbButtonData(this.data.cloneMessage());
}

View File

@ -46,6 +46,18 @@ export class SpksSwitchData extends GraphicDataBase implements ISpksSwitch {
set index(v: number) {
this.data.index = v;
}
get refStand(): number {
return this.data.refStand;
}
set refStand(v: number) {
this.data.refStand = v;
}
get refSections(): string[] {
return this.data.refSections;
}
set refSections(v: string[]) {
this.data.refSections = v;
}
clone(): SpksSwitchData {
return new SpksSwitchData(this.data.cloneMessage());
}

View File

@ -2,6 +2,7 @@ import * as pb_1 from 'google-protobuf';
import { DisplayObject, FederatedMouseEvent } from 'pixi.js';
import {
IStopPosition,
KilometerSystem,
StopPosition,
} from 'src/graphics/stopPosition/StopPosition';
import {
@ -55,6 +56,12 @@ export class StopPositionData extends GraphicDataBase implements IStopPosition {
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(): StopPositionData {
return new StopPositionData(this.data.cloneMessage());
}

View File

@ -13,6 +13,8 @@ export interface IEsbButton extends GraphicData {
set flip(v: boolean);
get index(): number;
set index(v: number);
get refStand(): number;
set refStand(v: number);
clone(): IEsbButton;
copyFrom(data: IEsbButton): void;
eq(other: IEsbButton): boolean;

View File

@ -13,6 +13,10 @@ export interface ISpksSwitch extends GraphicData {
set flip(v: boolean);
get index(): number;
set index(v: number);
get refStand(): number;
set refStand(v: number);
get refSections(): string[];
set refSections(v: string[]);
clone(): ISpksSwitch;
copyFrom(data: ISpksSwitch): void;
eq(other: ISpksSwitch): boolean;

View File

@ -11,6 +11,13 @@ export enum CoachNum {
Six = 1,
}
export interface KilometerSystem {
get coordinateSystem(): string;
set coordinateSystem(v: string);
get kilometer(): number;
set kilometer(v: number);
}
export interface IStopPosition extends GraphicData {
get code(): string;
set code(v: string);
@ -20,6 +27,8 @@ export interface IStopPosition extends GraphicData {
set coachNum(v: CoachNum);
get index(): number;
set index(v: number);
get kilometerSystem(): KilometerSystem;
set kilometerSystem(v: KilometerSystem);
clone(): IStopPosition;
copyFrom(data: IStopPosition): void;
eq(other: IStopPosition): boolean;

View File

@ -3731,6 +3731,7 @@ export namespace graphicData {
flip?: boolean;
coachNum?: StopPosition.CoachNum;
index?: number;
kilometerSystem?: KilometerSystem;
}) {
super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
@ -3750,6 +3751,9 @@ export namespace graphicData {
if ("index" in data && data.index != undefined) {
this.index = data.index;
}
if ("kilometerSystem" in data && data.kilometerSystem != undefined) {
this.kilometerSystem = data.kilometerSystem;
}
}
}
get common() {
@ -3785,12 +3789,22 @@ export namespace graphicData {
set index(value: number) {
pb_1.Message.setField(this, 5, value);
}
get kilometerSystem() {
return pb_1.Message.getWrapperField(this, KilometerSystem, 6) as KilometerSystem;
}
set kilometerSystem(value: KilometerSystem) {
pb_1.Message.setWrapperField(this, 6, value);
}
get has_kilometerSystem() {
return pb_1.Message.getField(this, 6) != null;
}
static fromObject(data: {
common?: ReturnType<typeof CommonInfo.prototype.toObject>;
code?: string;
flip?: boolean;
coachNum?: StopPosition.CoachNum;
index?: number;
kilometerSystem?: ReturnType<typeof KilometerSystem.prototype.toObject>;
}): StopPosition {
const message = new StopPosition({});
if (data.common != null) {
@ -3808,6 +3822,9 @@ export namespace graphicData {
if (data.index != null) {
message.index = data.index;
}
if (data.kilometerSystem != null) {
message.kilometerSystem = KilometerSystem.fromObject(data.kilometerSystem);
}
return message;
}
toObject() {
@ -3817,6 +3834,7 @@ export namespace graphicData {
flip?: boolean;
coachNum?: StopPosition.CoachNum;
index?: number;
kilometerSystem?: ReturnType<typeof KilometerSystem.prototype.toObject>;
} = {};
if (this.common != null) {
data.common = this.common.toObject();
@ -3833,6 +3851,9 @@ export namespace graphicData {
if (this.index != null) {
data.index = this.index;
}
if (this.kilometerSystem != null) {
data.kilometerSystem = this.kilometerSystem.toObject();
}
return data;
}
serialize(): Uint8Array;
@ -3849,6 +3870,8 @@ export namespace graphicData {
writer.writeEnum(4, this.coachNum);
if (this.index != 0)
writer.writeInt32(5, this.index);
if (this.has_kilometerSystem)
writer.writeMessage(6, this.kilometerSystem, () => this.kilometerSystem.serialize(writer));
if (!w)
return writer.getResultBuffer();
}
@ -3873,6 +3896,9 @@ export namespace graphicData {
case 5:
message.index = reader.readInt32();
break;
case 6:
reader.readMessage(message.kilometerSystem, () => message.kilometerSystem = KilometerSystem.deserialize(reader));
break;
default: reader.skipField();
}
}
@ -3898,9 +3924,11 @@ export namespace graphicData {
code?: string;
flip?: boolean;
index?: number;
refStand?: number;
refSections?: string[];
}) {
super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [6], this.#one_of_decls);
if (!Array.isArray(data) && typeof data == "object") {
if ("common" in data && data.common != undefined) {
this.common = data.common;
@ -3914,6 +3942,12 @@ export namespace graphicData {
if ("index" in data && data.index != undefined) {
this.index = data.index;
}
if ("refStand" in data && data.refStand != undefined) {
this.refStand = data.refStand;
}
if ("refSections" in data && data.refSections != undefined) {
this.refSections = data.refSections;
}
}
}
get common() {
@ -3943,11 +3977,25 @@ export namespace graphicData {
set index(value: number) {
pb_1.Message.setField(this, 4, value);
}
get refStand() {
return pb_1.Message.getFieldWithDefault(this, 5, 0) as number;
}
set refStand(value: number) {
pb_1.Message.setField(this, 5, value);
}
get refSections() {
return pb_1.Message.getFieldWithDefault(this, 6, []) as string[];
}
set refSections(value: string[]) {
pb_1.Message.setField(this, 6, value);
}
static fromObject(data: {
common?: ReturnType<typeof CommonInfo.prototype.toObject>;
code?: string;
flip?: boolean;
index?: number;
refStand?: number;
refSections?: string[];
}): SpksSwitch {
const message = new SpksSwitch({});
if (data.common != null) {
@ -3962,6 +4010,12 @@ export namespace graphicData {
if (data.index != null) {
message.index = data.index;
}
if (data.refStand != null) {
message.refStand = data.refStand;
}
if (data.refSections != null) {
message.refSections = data.refSections;
}
return message;
}
toObject() {
@ -3970,6 +4024,8 @@ export namespace graphicData {
code?: string;
flip?: boolean;
index?: number;
refStand?: number;
refSections?: string[];
} = {};
if (this.common != null) {
data.common = this.common.toObject();
@ -3983,6 +4039,12 @@ export namespace graphicData {
if (this.index != null) {
data.index = this.index;
}
if (this.refStand != null) {
data.refStand = this.refStand;
}
if (this.refSections != null) {
data.refSections = this.refSections;
}
return data;
}
serialize(): Uint8Array;
@ -3997,6 +4059,10 @@ export namespace graphicData {
writer.writeBool(3, this.flip);
if (this.index != 0)
writer.writeInt32(4, this.index);
if (this.refStand != 0)
writer.writeInt32(5, this.refStand);
if (this.refSections.length)
writer.writeRepeatedString(6, this.refSections);
if (!w)
return writer.getResultBuffer();
}
@ -4018,6 +4084,12 @@ export namespace graphicData {
case 4:
message.index = reader.readInt32();
break;
case 5:
message.refStand = reader.readInt32();
break;
case 6:
pb_1.Message.addToRepeatedField(message, 6, reader.readString());
break;
default: reader.skipField();
}
}
@ -4037,6 +4109,7 @@ export namespace graphicData {
code?: string;
flip?: boolean;
index?: number;
refStand?: number;
}) {
super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
@ -4053,6 +4126,9 @@ export namespace graphicData {
if ("index" in data && data.index != undefined) {
this.index = data.index;
}
if ("refStand" in data && data.refStand != undefined) {
this.refStand = data.refStand;
}
}
}
get common() {
@ -4082,11 +4158,18 @@ export namespace graphicData {
set index(value: number) {
pb_1.Message.setField(this, 4, value);
}
get refStand() {
return pb_1.Message.getFieldWithDefault(this, 5, 0) as number;
}
set refStand(value: number) {
pb_1.Message.setField(this, 5, value);
}
static fromObject(data: {
common?: ReturnType<typeof CommonInfo.prototype.toObject>;
code?: string;
flip?: boolean;
index?: number;
refStand?: number;
}): EsbButton {
const message = new EsbButton({});
if (data.common != null) {
@ -4101,6 +4184,9 @@ export namespace graphicData {
if (data.index != null) {
message.index = data.index;
}
if (data.refStand != null) {
message.refStand = data.refStand;
}
return message;
}
toObject() {
@ -4109,6 +4195,7 @@ export namespace graphicData {
code?: string;
flip?: boolean;
index?: number;
refStand?: number;
} = {};
if (this.common != null) {
data.common = this.common.toObject();
@ -4122,6 +4209,9 @@ export namespace graphicData {
if (this.index != null) {
data.index = this.index;
}
if (this.refStand != null) {
data.refStand = this.refStand;
}
return data;
}
serialize(): Uint8Array;
@ -4136,6 +4226,8 @@ export namespace graphicData {
writer.writeBool(3, this.flip);
if (this.index != 0)
writer.writeInt32(4, this.index);
if (this.refStand != 0)
writer.writeInt32(5, this.refStand);
if (!w)
return writer.getResultBuffer();
}
@ -4157,6 +4249,9 @@ export namespace graphicData {
case 4:
message.index = reader.readInt32();
break;
case 5:
message.refStand = reader.readInt32();
break;
default: reader.skipField();
}
}