uniqueId信号布置图

This commit is contained in:
joylink_zhaoerwei 2023-09-21 09:09:29 +08:00
parent 235de94f46
commit 5f999bd8f8
5 changed files with 198 additions and 11 deletions

View File

@ -223,12 +223,16 @@ export function initCommonDrawApp(app: IDrawApp) {
};
DefaultCanvasMenu.open(e.global);
});
app.on('destroy', async () => {
UniqueIdPrefix = new graphicData.UniqueIdType();
});
}
export function loadCommonDrawDatas(
storage: graphicData.RtssGraphicStorage
): GraphicData[] {
const datas: GraphicData[] = [];
UniqueIdPrefix = storage.UniqueIdPrefix;
storage.Platforms.forEach((platform) => {
datas.push(new PlatformData(platform));
});
@ -349,6 +353,7 @@ export function saveCommonDrawDatas(app: IDrawApp) {
storage.curvatures.push((curvatureData as CurvatureData).data);
}
});
storage.UniqueIdPrefix = UniqueIdPrefix;
return storage;
}
@ -392,3 +397,13 @@ export function saveDrawToServer(base64: string) {
errorNotify(err.message, err);
});
}
//UniqueId
let UniqueIdPrefix = new graphicData.UniqueIdType();
export function loadUniqueIdPrefix() {
return UniqueIdPrefix;
}
export function setUniqueIdPrefix(newUniqueIdPrefix: graphicData.UniqueIdType) {
UniqueIdPrefix = newUniqueIdPrefix;
}

View File

@ -278,11 +278,11 @@ export function deleteDeviceRelateRelay(row: RelateRelaylistItem) {
//所属集中站
let UniqueIdPrefix = new relayCabinetGraphicData.UniqueIdType();
export function loadBelongsStation() {
export function loadUniqueIdPrefix() {
return UniqueIdPrefix;
}
export function setBelongsStation(
export function setUniqueIdPrefix(
newUniqueIdPrefix: relayCabinetGraphicData.UniqueIdType
) {
UniqueIdPrefix = newUniqueIdPrefix;

View File

@ -100,13 +100,53 @@
</q-card-actions>
</q-card>
</q-dialog>
<q-dialog
v-model="uniqueIdPrefixDialog"
persistent
transition-show="scale"
transition-hide="scale"
>
<q-card style="width: 300px">
<q-card-section>
<div class="text-h6">UniqueId配置</div>
</q-card-section>
<q-card-section>
<q-input
outlined
label="所属城市"
v-model="UniqueIdPrefix.city"
:rules="[(val) => val.trim() != '' || '集中站名称不能为空']"
/>
<q-input
outlined
label="线路号"
v-model="UniqueIdPrefix.lineId"
:rules="[(val) => val.trim() != '' || '集中站名称不能为空']"
/>
</q-card-section>
<q-card-actions align="right">
<q-btn
color="primary"
label="提交"
@click="saveUniqueIdPrefix(stationName)"
/>
<q-btn label="取消" v-close-popup />
</q-card-actions>
</q-card>
</q-dialog>
<q-resize-observer @resize="onResize" />
</q-layout>
</template>
<script setup lang="ts">
import DrawProperties from 'src/components/draw-app/DrawProperties.vue';
import { saveDrawToServer, checkDataToServer } from 'src/drawApp/commonApp';
import {
saveDrawToServer,
checkDataToServer,
loadUniqueIdPrefix,
setUniqueIdPrefix,
} from 'src/drawApp/commonApp';
import { saveJkDrawDatas, loadLinkDatas } from 'src/drawApp/jkApp';
import { saveThDrawDatas } from 'src/drawApp/thApp';
import { useDrawStore } from 'src/stores/draw-store';
@ -149,6 +189,7 @@ import { EsbButton } from 'src/graphics/esbButton/EsbButton';
import { SlopeKiloMarker } from 'src/graphics/slopeKiloMarker/SlopeKiloMarker';
import { CurvatureKiloMarker } from 'src/graphics/curvatureKiloMarker/CurvatureKiloMarker';
import { CategoryType } from 'src/components/CategoryType';
import { graphicData } from 'src/protos/stationLayoutGraphics';
const $q = useQuasar();
const route = useRoute();
@ -220,6 +261,7 @@ const leftMenuConfig = [
{ label: '保存', click: saveAllDrawDatas },
{ label: '另存为', click: () => (saveAsDialog.value = true) },
{ label: '数据校验', click: handleCheckData },
{ label: 'UniqueId配置', click: openUniqueIdPrefixDialog },
{ label: '一键关联', click: buildRelations },
{ label: '一键生成车次窗', click: oneClickGeneration },
{ label: '一键生成分隔符', click: oneClickSeparator },
@ -318,6 +360,20 @@ function onResize() {
}
}
const uniqueIdPrefixDialog = ref(false);
const UniqueIdPrefix = ref();
function openUniqueIdPrefixDialog() {
uniqueIdPrefixDialog.value = true;
UniqueIdPrefix.value = loadUniqueIdPrefix() ?? new graphicData.UniqueIdType();
}
function saveUniqueIdPrefix() {
setUniqueIdPrefix(UniqueIdPrefix.value);
uniqueIdPrefixDialog.value = false;
saveAllDrawDatas();
}
function saveAllDrawDatas() {
const drawApp = drawStore.getDrawApp();
let base64 = '';

View File

@ -18,7 +18,7 @@
<q-item
clickable
v-close-popup
@click="openBelongsToStationDialog"
@click="openUniqueIdPrefixDialog"
>
<q-item-section>UniqueId配置</q-item-section>
</q-item>
@ -156,7 +156,7 @@
<q-btn
color="primary"
label="提交"
@click="belongsToStation(stationName)"
@click="saveUniqueIdPrefix(stationName)"
/>
<q-btn label="取消" v-close-popup />
</q-card-actions>
@ -176,8 +176,8 @@ import {
checkDataToServer,
RelateRelaylistItem,
saveDrawToServer,
loadBelongsStation,
setBelongsStation,
loadUniqueIdPrefix,
setUniqueIdPrefix,
} from 'src/drawApp/relayCabinetLayoutApp';
import { IDrawApp } from 'src/jl-graphic';
import { useRelayCabinetStore } from 'src/stores/relayCabinet-store';
@ -336,14 +336,14 @@ async function saveAs(name: string) {
const belongsToStationDialog = ref(false);
const UniqueIdPrefix = ref();
function openBelongsToStationDialog() {
function openUniqueIdPrefixDialog() {
belongsToStationDialog.value = true;
UniqueIdPrefix.value =
loadBelongsStation() ?? new relayCabinetGraphicData.UniqueIdType();
loadUniqueIdPrefix() ?? new relayCabinetGraphicData.UniqueIdType();
}
function belongsToStation() {
setBelongsStation(UniqueIdPrefix.value);
function saveUniqueIdPrefix() {
setUniqueIdPrefix(UniqueIdPrefix.value);
belongsToStationDialog.value = false;
saveAllDrawDatas();
}

View File

@ -36,6 +36,7 @@ export namespace graphicData {
curvatures?: Curvature[];
trackSections?: TrackSection[];
trackLogicSections?: TrackLogicSection[];
UniqueIdPrefix?: UniqueIdType;
}) {
super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [4, 5, 8, 9, 10, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29], this.#one_of_decls);
@ -112,6 +113,9 @@ export namespace graphicData {
if ("trackLogicSections" in data && data.trackLogicSections != undefined) {
this.trackLogicSections = data.trackLogicSections;
}
if ("UniqueIdPrefix" in data && data.UniqueIdPrefix != undefined) {
this.UniqueIdPrefix = data.UniqueIdPrefix;
}
}
}
get canvas() {
@ -261,6 +265,15 @@ export namespace graphicData {
set trackLogicSections(value: TrackLogicSection[]) {
pb_1.Message.setRepeatedWrapperField(this, 29, value);
}
get UniqueIdPrefix() {
return pb_1.Message.getWrapperField(this, UniqueIdType, 30) as UniqueIdType;
}
set UniqueIdPrefix(value: UniqueIdType) {
pb_1.Message.setWrapperField(this, 30, value);
}
get has_UniqueIdPrefix() {
return pb_1.Message.getField(this, 30) != null;
}
static fromObject(data: {
canvas?: ReturnType<typeof Canvas.prototype.toObject>;
Platforms?: ReturnType<typeof Platform.prototype.toObject>[];
@ -286,6 +299,7 @@ export namespace graphicData {
curvatures?: ReturnType<typeof Curvature.prototype.toObject>[];
trackSections?: ReturnType<typeof TrackSection.prototype.toObject>[];
trackLogicSections?: ReturnType<typeof TrackLogicSection.prototype.toObject>[];
UniqueIdPrefix?: ReturnType<typeof UniqueIdType.prototype.toObject>;
}): RtssGraphicStorage {
const message = new RtssGraphicStorage({});
if (data.canvas != null) {
@ -360,6 +374,9 @@ export namespace graphicData {
if (data.trackLogicSections != null) {
message.trackLogicSections = data.trackLogicSections.map(item => TrackLogicSection.fromObject(item));
}
if (data.UniqueIdPrefix != null) {
message.UniqueIdPrefix = UniqueIdType.fromObject(data.UniqueIdPrefix);
}
return message;
}
toObject() {
@ -388,6 +405,7 @@ export namespace graphicData {
curvatures?: ReturnType<typeof Curvature.prototype.toObject>[];
trackSections?: ReturnType<typeof TrackSection.prototype.toObject>[];
trackLogicSections?: ReturnType<typeof TrackLogicSection.prototype.toObject>[];
UniqueIdPrefix?: ReturnType<typeof UniqueIdType.prototype.toObject>;
} = {};
if (this.canvas != null) {
data.canvas = this.canvas.toObject();
@ -461,6 +479,9 @@ export namespace graphicData {
if (this.trackLogicSections != null) {
data.trackLogicSections = this.trackLogicSections.map((item: TrackLogicSection) => item.toObject());
}
if (this.UniqueIdPrefix != null) {
data.UniqueIdPrefix = this.UniqueIdPrefix.toObject();
}
return data;
}
serialize(): Uint8Array;
@ -515,6 +536,8 @@ export namespace graphicData {
writer.writeRepeatedMessage(28, this.trackSections, (item: TrackSection) => item.serialize(writer));
if (this.trackLogicSections.length)
writer.writeRepeatedMessage(29, this.trackLogicSections, (item: TrackLogicSection) => item.serialize(writer));
if (this.has_UniqueIdPrefix)
writer.writeMessage(30, this.UniqueIdPrefix, () => this.UniqueIdPrefix.serialize(writer));
if (!w)
return writer.getResultBuffer();
}
@ -596,6 +619,9 @@ export namespace graphicData {
case 29:
reader.readMessage(message.trackLogicSections, () => pb_1.Message.addToRepeatedWrapperField(message, 29, TrackLogicSection.deserialize(reader), TrackLogicSection));
break;
case 30:
reader.readMessage(message.UniqueIdPrefix, () => message.UniqueIdPrefix = UniqueIdType.deserialize(reader));
break;
default: reader.skipField();
}
}
@ -6105,4 +6131,94 @@ export namespace graphicData {
}
}
}
export class UniqueIdType extends pb_1.Message {
#one_of_decls: number[][] = [];
constructor(data?: any[] | {
city?: string;
lineId?: string;
}) {
super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
if (!Array.isArray(data) && typeof data == "object") {
if ("city" in data && data.city != undefined) {
this.city = data.city;
}
if ("lineId" in data && data.lineId != undefined) {
this.lineId = data.lineId;
}
}
}
get city() {
return pb_1.Message.getFieldWithDefault(this, 1, "") as string;
}
set city(value: string) {
pb_1.Message.setField(this, 1, value);
}
get lineId() {
return pb_1.Message.getFieldWithDefault(this, 2, "") as string;
}
set lineId(value: string) {
pb_1.Message.setField(this, 2, value);
}
static fromObject(data: {
city?: string;
lineId?: string;
}): UniqueIdType {
const message = new UniqueIdType({});
if (data.city != null) {
message.city = data.city;
}
if (data.lineId != null) {
message.lineId = data.lineId;
}
return message;
}
toObject() {
const data: {
city?: string;
lineId?: string;
} = {};
if (this.city != null) {
data.city = this.city;
}
if (this.lineId != null) {
data.lineId = this.lineId;
}
return data;
}
serialize(): Uint8Array;
serialize(w: pb_1.BinaryWriter): void;
serialize(w?: pb_1.BinaryWriter): Uint8Array | void {
const writer = w || new pb_1.BinaryWriter();
if (this.city.length)
writer.writeString(1, this.city);
if (this.lineId.length)
writer.writeString(2, this.lineId);
if (!w)
return writer.getResultBuffer();
}
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): UniqueIdType {
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new UniqueIdType();
while (reader.nextField()) {
if (reader.isEndGroup())
break;
switch (reader.getFieldNumber()) {
case 1:
message.city = reader.readString();
break;
case 2:
message.lineId = reader.readString();
break;
default: reader.skipField();
}
}
return message;
}
serializeBinary(): Uint8Array {
return this.serialize();
}
static deserializeBinary(bytes: Uint8Array): UniqueIdType {
return UniqueIdType.deserialize(bytes);
}
}
}