计轴增加虚拟计轴字段

This commit is contained in:
joylink_zhaoerwei 2023-08-03 09:56:35 +08:00
parent e584681ada
commit dd471e3a5e
4 changed files with 53 additions and 1 deletions

View File

@ -43,6 +43,13 @@
@blur="onUpdate" @blur="onUpdate"
label="公里标(mm):" label="公里标(mm):"
/> />
<q-select
outlined
@blur="onUpdate"
v-model="invent"
:options="optionsInvent"
label="是否虚拟计轴"
/>
<q-list bordered separator class="rounded-borders"> <q-list bordered separator class="rounded-borders">
<q-item> <q-item>
<q-item-section no-wrap class="q-gutter-y-sm column"> <q-item-section no-wrap class="q-gutter-y-sm column">
@ -86,7 +93,7 @@ import { AxleCounting } from 'src/graphics/axleCounting/AxleCounting';
import { Section } from 'src/graphics/section/Section'; import { Section } from 'src/graphics/section/Section';
import { Turnout } from 'src/graphics/turnout/Turnout'; import { Turnout } from 'src/graphics/turnout/Turnout';
import { useDrawStore } from 'src/stores/draw-store'; import { useDrawStore } from 'src/stores/draw-store';
import { computed, onMounted, reactive, watch } from 'vue'; import { computed, onMounted, reactive, ref, watch } from 'vue';
const drawStore = useDrawStore(); const drawStore = useDrawStore();
const axleCountingModel = reactive(new AxleCountingData()); const axleCountingModel = reactive(new AxleCountingData());
@ -99,12 +106,24 @@ const CoordinateSystemOptions = [
{ label: '换线', value: 'TRANSFER' }, { label: '换线', value: 'TRANSFER' },
]; ];
const invent = ref('');
const optionsInvent = ['是', '否'];
enum showSelect {
= 'true',
= 'false',
}
enum showSelectData {
true = '是',
false = '否',
}
drawStore.$subscribe; drawStore.$subscribe;
watch( watch(
() => drawStore.selectedGraphic, () => drawStore.selectedGraphic,
(val) => { (val) => {
if (val && val.type == AxleCounting.Type) { if (val && val.type == AxleCounting.Type) {
axleCountingModel.copyFrom(val.saveData() as AxleCountingData); axleCountingModel.copyFrom(val.saveData() as AxleCountingData);
invent.value = (showSelectData as never)[axleCountingModel.invent + ''];
if (axleCountingModel.kilometerSystem) { if (axleCountingModel.kilometerSystem) {
kilometerSystem.coordinateSystem = kilometerSystem.coordinateSystem =
axleCountingModel.kilometerSystem.coordinateSystem; axleCountingModel.kilometerSystem.coordinateSystem;
@ -118,6 +137,7 @@ onMounted(() => {
const axleCounting = drawStore.selectedGraphic as AxleCounting; const axleCounting = drawStore.selectedGraphic as AxleCounting;
if (axleCounting) { if (axleCounting) {
axleCountingModel.copyFrom(axleCounting.saveData()); axleCountingModel.copyFrom(axleCounting.saveData());
invent.value = (showSelectData as never)[axleCountingModel.invent + ''];
if (axleCountingModel.kilometerSystem) { if (axleCountingModel.kilometerSystem) {
kilometerSystem.coordinateSystem = kilometerSystem.coordinateSystem =
axleCountingModel.kilometerSystem.coordinateSystem; axleCountingModel.kilometerSystem.coordinateSystem;
@ -128,6 +148,7 @@ onMounted(() => {
function onUpdate() { function onUpdate() {
const axleCounting = drawStore.selectedGraphic as AxleCounting; const axleCounting = drawStore.selectedGraphic as AxleCounting;
axleCountingModel.invent = JSON.parse((showSelect as never)[invent.value]);
axleCountingModel.kilometerSystem = { axleCountingModel.kilometerSystem = {
coordinateSystem: kilometerSystem.coordinateSystem, coordinateSystem: kilometerSystem.coordinateSystem,
kilometer: kilometerSystem.kilometer, kilometer: kilometerSystem.kilometer,

View File

@ -50,6 +50,12 @@ export class AxleCountingData
set index(v: number) { set index(v: number) {
this.data.index = v; this.data.index = v;
} }
get invent(): boolean {
return this.data.invent;
}
set invent(v: boolean) {
this.data.invent = v;
}
clone(): AxleCountingData { clone(): AxleCountingData {
return new AxleCountingData(this.data.cloneMessage()); return new AxleCountingData(this.data.cloneMessage());
} }

View File

@ -18,6 +18,8 @@ export interface IAxleCountingData extends GraphicData {
set axleCountingRef(ref: IRelatedRefData[]); set axleCountingRef(ref: IRelatedRefData[]);
get index(): number; // 索引编号 get index(): number; // 索引编号
set index(v: number); set index(v: number);
get invent(): boolean; // 是否虚拟计轴
set invent(v: boolean);
clone(): IAxleCountingData; clone(): IAxleCountingData;
copyFrom(data: IAxleCountingData): void; copyFrom(data: IAxleCountingData): void;
eq(other: IAxleCountingData): boolean; eq(other: IAxleCountingData): boolean;

View File

@ -1523,6 +1523,7 @@ export namespace graphicData {
kilometerSystem?: KilometerSystem; kilometerSystem?: KilometerSystem;
axleCountingRef?: RelatedRef[]; axleCountingRef?: RelatedRef[];
index?: number; index?: number;
invent?: boolean;
}) { }) {
super(); super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [4], this.#one_of_decls); pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [4], this.#one_of_decls);
@ -1542,6 +1543,9 @@ export namespace graphicData {
if ("index" in data && data.index != undefined) { if ("index" in data && data.index != undefined) {
this.index = data.index; this.index = data.index;
} }
if ("invent" in data && data.invent != undefined) {
this.invent = data.invent;
}
} }
} }
get common() { get common() {
@ -1580,12 +1584,19 @@ export namespace graphicData {
set index(value: number) { set index(value: number) {
pb_1.Message.setField(this, 5, value); pb_1.Message.setField(this, 5, value);
} }
get invent() {
return pb_1.Message.getFieldWithDefault(this, 6, false) as boolean;
}
set invent(value: boolean) {
pb_1.Message.setField(this, 6, value);
}
static fromObject(data: { static fromObject(data: {
common?: ReturnType<typeof CommonInfo.prototype.toObject>; common?: ReturnType<typeof CommonInfo.prototype.toObject>;
code?: string; code?: string;
kilometerSystem?: ReturnType<typeof KilometerSystem.prototype.toObject>; kilometerSystem?: ReturnType<typeof KilometerSystem.prototype.toObject>;
axleCountingRef?: ReturnType<typeof RelatedRef.prototype.toObject>[]; axleCountingRef?: ReturnType<typeof RelatedRef.prototype.toObject>[];
index?: number; index?: number;
invent?: boolean;
}): AxleCounting { }): AxleCounting {
const message = new AxleCounting({}); const message = new AxleCounting({});
if (data.common != null) { if (data.common != null) {
@ -1603,6 +1614,9 @@ export namespace graphicData {
if (data.index != null) { if (data.index != null) {
message.index = data.index; message.index = data.index;
} }
if (data.invent != null) {
message.invent = data.invent;
}
return message; return message;
} }
toObject() { toObject() {
@ -1612,6 +1626,7 @@ export namespace graphicData {
kilometerSystem?: ReturnType<typeof KilometerSystem.prototype.toObject>; kilometerSystem?: ReturnType<typeof KilometerSystem.prototype.toObject>;
axleCountingRef?: ReturnType<typeof RelatedRef.prototype.toObject>[]; axleCountingRef?: ReturnType<typeof RelatedRef.prototype.toObject>[];
index?: number; index?: number;
invent?: boolean;
} = {}; } = {};
if (this.common != null) { if (this.common != null) {
data.common = this.common.toObject(); data.common = this.common.toObject();
@ -1628,6 +1643,9 @@ export namespace graphicData {
if (this.index != null) { if (this.index != null) {
data.index = this.index; data.index = this.index;
} }
if (this.invent != null) {
data.invent = this.invent;
}
return data; return data;
} }
serialize(): Uint8Array; serialize(): Uint8Array;
@ -1644,6 +1662,8 @@ export namespace graphicData {
writer.writeRepeatedMessage(4, this.axleCountingRef, (item: RelatedRef) => item.serialize(writer)); writer.writeRepeatedMessage(4, this.axleCountingRef, (item: RelatedRef) => item.serialize(writer));
if (this.index != 0) if (this.index != 0)
writer.writeInt32(5, this.index); writer.writeInt32(5, this.index);
if (this.invent != false)
writer.writeBool(6, this.invent);
if (!w) if (!w)
return writer.getResultBuffer(); return writer.getResultBuffer();
} }
@ -1668,6 +1688,9 @@ export namespace graphicData {
case 5: case 5:
message.index = reader.readInt32(); message.index = reader.readInt32();
break; break;
case 6:
message.invent = reader.readBool();
break;
default: reader.skipField(); default: reader.skipField();
} }
} }