联锁编号映射暂提

This commit is contained in:
joylink_fanyuhong 2024-05-25 10:06:05 +08:00
parent 1035f1751a
commit b504c7482b
2 changed files with 160 additions and 31 deletions

View File

@ -4,6 +4,7 @@
seamless seamless
title="联锁编号映射数据" title="联锁编号映射数据"
v-model="showLianSuoBianHao" v-model="showLianSuoBianHao"
@hide="dialogHide"
:width="600" :width="600"
:height="500" :height="500"
> >
@ -38,7 +39,7 @@
> >
<q-tab-panel name="station"> <q-tab-panel name="station">
<div class="row" style="justify-content: space-around"> <div class="row" style="justify-content: space-around">
<template :key="item.id" v-for="item in deviceOptions"> <template :key="item.id" v-for="item in stationOptions">
<q-input <q-input
outlined outlined
class="q-mt-sm" class="q-mt-sm"
@ -52,7 +53,7 @@
<q-tab-panel name="turnout"> <q-tab-panel name="turnout">
<div class="row" style="justify-content: space-around"> <div class="row" style="justify-content: space-around">
<template :key="item.id" v-for="item in deviceOptions"> <template :key="item.id" v-for="item in turnoutOptions">
<q-input <q-input
outlined outlined
class="q-mt-sm" class="q-mt-sm"
@ -66,7 +67,7 @@
<q-tab-panel name="screenDoor"> <q-tab-panel name="screenDoor">
<div class="row" style="justify-content: space-around"> <div class="row" style="justify-content: space-around">
<template :key="item.id" v-for="item in deviceOptions"> <template :key="item.id" v-for="item in screenDoorOptions">
<q-input <q-input
outlined outlined
class="q-mt-sm" class="q-mt-sm"
@ -79,7 +80,7 @@
</q-tab-panel> </q-tab-panel>
<q-tab-panel name="signal"> <q-tab-panel name="signal">
<div class="row" style="justify-content: space-around"> <div class="row" style="justify-content: space-around">
<template :key="item.id" v-for="item in deviceOptions"> <template :key="item.id" v-for="item in signalOptions">
<q-input <q-input
outlined outlined
class="q-mt-sm" class="q-mt-sm"
@ -93,7 +94,7 @@
<q-tab-panel name="section"> <q-tab-panel name="section">
<div class="row" style="justify-content: space-around"> <div class="row" style="justify-content: space-around">
<template :key="item.id" v-for="item in deviceOptions"> <template :key="item.id" v-for="item in sectionOptions">
<q-input <q-input
outlined outlined
class="q-mt-sm" class="q-mt-sm"
@ -107,7 +108,7 @@
<q-tab-panel name="floodGate"> <q-tab-panel name="floodGate">
<div class="row" style="justify-content: space-around"> <div class="row" style="justify-content: space-around">
<template :key="item.id" v-for="item in deviceOptions"> <template :key="item.id" v-for="item in floodGateOptions">
<q-input <q-input
outlined outlined
class="q-mt-sm" class="q-mt-sm"
@ -121,7 +122,7 @@
<q-tab-panel name="spksSwitch"> <q-tab-panel name="spksSwitch">
<div class="row" style="justify-content: space-around"> <div class="row" style="justify-content: space-around">
<template :key="item.id" v-for="item in deviceOptions"> <template :key="item.id" v-for="item in spksSwitchOptions">
<q-input <q-input
outlined outlined
class="q-mt-sm" class="q-mt-sm"
@ -135,7 +136,7 @@
<q-tab-panel name="garageDoor"> <q-tab-panel name="garageDoor">
<div class="row" style="justify-content: space-around"> <div class="row" style="justify-content: space-around">
<template :key="item.id" v-for="item in deviceOptions"> <template :key="item.id" v-for="item in garageDoorOptions">
<q-input <q-input
outlined outlined
class="q-mt-sm" class="q-mt-sm"
@ -149,7 +150,7 @@
<q-tab-panel name="carWashing"> <q-tab-panel name="carWashing">
<div class="row" style="justify-content: space-around"> <div class="row" style="justify-content: space-around">
<template :key="item.id" v-for="item in deviceOptions"> <template :key="item.id" v-for="item in carWashingOptions">
<q-input <q-input
outlined outlined
class="q-mt-sm" class="q-mt-sm"
@ -167,7 +168,7 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ref } from 'vue'; import { ref, onMounted } from 'vue';
import DraggableDialog from 'src/components/common/DraggableDialog.vue'; import DraggableDialog from 'src/components/common/DraggableDialog.vue';
import { Station } from 'src/graphics/station/Station'; import { Station } from 'src/graphics/station/Station';
import { useDrawStore } from 'src/stores/draw-store'; import { useDrawStore } from 'src/stores/draw-store';
@ -180,22 +181,79 @@ import { FloodGate } from 'src/graphics/floodGate/FloodGate';
import { SpksSwitch } from 'src/graphics/spksSwitch/SpksSwitch'; import { SpksSwitch } from 'src/graphics/spksSwitch/SpksSwitch';
import { GarageDoor } from 'src/graphics/garageDoor/GarageDoor'; import { GarageDoor } from 'src/graphics/garageDoor/GarageDoor';
import { CarWashing } from 'src/graphics/carWashing/CarWashing'; import { CarWashing } from 'src/graphics/carWashing/CarWashing';
import { loadLianSuoData, setLianSuoData } from 'src/drawApp/commonApp';
import { graphicData } from 'src/protos/stationLayoutGraphics';
const drawStore = useDrawStore(); const drawStore = useDrawStore();
const deviceOptions = ref<{ id: number; name: string; index: number }[]>([]); const stationOptions = ref<{ id: number; name: string; index: number }[]>([]);
const tab = ref<string>(''); const turnoutOptions = ref<{ id: number; name: string; index: number }[]>([]);
const screenDoorOptions = ref<{ id: number; name: string; index: number }[]>(
[]
);
const signalOptions = ref<{ id: number; name: string; index: number }[]>([]);
const sectionOptions = ref<{ id: number; name: string; index: number }[]>([]);
const floodGateOptions = ref<{ id: number; name: string; index: number }[]>([]);
const spksSwitchOptions = ref<{ id: number; name: string; index: number }[]>(
[]
);
const garageDoorOptions = ref<{ id: number; name: string; index: number }[]>(
[]
);
const carWashingOptions = ref<{ id: number; name: string; index: number }[]>(
[]
);
const tab = ref<string>('station');
const splitterModel = ref<number>(20); const splitterModel = ref<number>(20);
const showLianSuoBianHao = ref(true); const showLianSuoBianHao = ref(true);
const drawApp = drawStore.getDrawApp(); const drawApp = drawStore.getDrawApp();
let lianSuoMapData = new Map();
onMounted(() => {
lianSuoMapData = new Map();
const lianSuoData = loadLianSuoData();
lianSuoData.stations.forEach((s) => {
lianSuoMapData.set(s.id, s.index);
});
lianSuoData.switchs.forEach((t) => {
lianSuoMapData.set(t.id, t.index);
});
lianSuoData.screenDoors.forEach((t) => {
lianSuoMapData.set(t.id, t.index);
});
lianSuoData.signals.forEach((t) => {
lianSuoMapData.set(t.id, t.index);
});
lianSuoData.sections.forEach((t) => {
lianSuoMapData.set(t.id, t.index);
});
lianSuoData.garageDoors.forEach((t) => {
lianSuoMapData.set(t.id, t.index);
});
lianSuoData.spksSwitchs.forEach((t) => {
lianSuoMapData.set(t.id, t.index);
});
lianSuoData.floodGates.forEach((t) => {
lianSuoMapData.set(t.id, t.index);
});
lianSuoData.carWashing.forEach((t) => {
lianSuoMapData.set(t.id, t.index);
});
});
function stationUpdateData() { function stationUpdateData() {
const list: { id: number; name: string; index: number }[] = []; const list: { id: number; name: string; index: number }[] = [];
const stations = drawApp.queryStore.queryByType<Station>(Station.Type); const stations = drawApp.queryStore.queryByType<Station>(Station.Type);
deviceOptions.value = [];
stations.forEach((sta) => { stations.forEach((sta) => {
list.push({ id: sta.datas.id, name: sta.datas.stationName, index: 0 }); if (sta.datas.concentrationStations) {
deviceOptions.value = list; const index = lianSuoMapData.get(sta.datas.id) || 0;
list.push({
id: sta.datas.id,
name: sta.datas.stationName,
index: index,
});
stationOptions.value = list;
}
}); });
} }
@ -210,8 +268,9 @@ function turnoutUpdateData() {
name = name + '-' + station.datas.stationName; name = name + '-' + station.datas.stationName;
}); });
} }
list.push({ id: turnout.datas.id, name: name, index: 0 }); const index = lianSuoMapData.get(turnout.datas.id) || 0;
deviceOptions.value = list; list.push({ id: turnout.datas.id, name: name, index: index });
turnoutOptions.value = list;
}); });
} }
@ -234,12 +293,13 @@ function screenDoorUpdateData() {
name = name + '-' + station.datas.stationName; name = name + '-' + station.datas.stationName;
} }
} }
const index = lianSuoMapData.get(screenDoor.datas.id) || 0;
list.push({ list.push({
id: screenDoor.datas.id, id: screenDoor.datas.id,
name: name, name: name,
index: 0, index: index,
}); });
deviceOptions.value = list; screenDoorOptions.value = list;
}); });
} }
@ -254,12 +314,13 @@ function signalUpdateData() {
name = name + '-' + station.datas.stationName; name = name + '-' + station.datas.stationName;
}); });
} }
const index = lianSuoMapData.get(signal.datas.id) || 0;
list.push({ list.push({
id: signal.datas.id, id: signal.datas.id,
name: name, name: name,
index: 0, index: index,
}); });
deviceOptions.value = list; signalOptions.value = list;
}); });
} }
@ -274,12 +335,13 @@ function sectionUpdateData() {
name = name + '-' + station.datas.stationName; name = name + '-' + station.datas.stationName;
}); });
} }
const index = lianSuoMapData.get(section.datas.id) || 0;
list.push({ list.push({
id: section.datas.id, id: section.datas.id,
name: name, name: name,
index: 0, index: index,
}); });
deviceOptions.value = list; sectionOptions.value = list;
}); });
} }
@ -294,12 +356,13 @@ function floodGateUpdateData() {
name = name + '-' + station.datas.stationName; name = name + '-' + station.datas.stationName;
}); });
} }
const index = lianSuoMapData.get(floodGate.datas.id) || 0;
list.push({ list.push({
id: floodGate.datas.id, id: floodGate.datas.id,
name: name, name: name,
index: 0, index: index,
}); });
deviceOptions.value = list; floodGateOptions.value = list;
}); });
} }
@ -322,12 +385,13 @@ function spksSwitchUpdateData() {
name = name + '-' + station.datas.stationName; name = name + '-' + station.datas.stationName;
} }
} }
const index = lianSuoMapData.get(spksSwitch.datas.id) || 0;
list.push({ list.push({
id: spksSwitch.datas.id, id: spksSwitch.datas.id,
name: name, name: name,
index: 0, index: index,
}); });
deviceOptions.value = list; spksSwitchOptions.value = list;
}); });
} }
@ -344,12 +408,13 @@ function garageDoorUpdateData() {
name = name + '-' + station.datas.stationName; name = name + '-' + station.datas.stationName;
}); });
} }
const index = lianSuoMapData.get(garageDoor.datas.id) || 0;
list.push({ list.push({
id: garageDoor.datas.id, id: garageDoor.datas.id,
name: name, name: name,
index: 0, index: index,
}); });
deviceOptions.value = list; garageDoorOptions.value = list;
}); });
} }
@ -366,12 +431,13 @@ function carWashingUpdateData() {
name = name + '-' + station.datas.stationName; name = name + '-' + station.datas.stationName;
}); });
} }
const index = lianSuoMapData.get(carWashing.datas.id) || 0;
list.push({ list.push({
id: carWashing.datas.id, id: carWashing.datas.id,
name: name, name: name,
index: 0, index: index,
}); });
deviceOptions.value = list; carWashingOptions.value = list;
}); });
} }
@ -406,5 +472,54 @@ function tabUpdate() {
break; break;
} }
} }
function dialogHide() {
const newLianSuoData = new graphicData.LianSuoData();
stationOptions.value.forEach((st) => {
newLianSuoData.stations.push(
new graphicData.LianSuoIndexData({ id: st.id, index: st.index })
);
});
turnoutOptions.value.forEach((tu) => {
newLianSuoData.switchs.push(
new graphicData.LianSuoIndexData({ id: tu.id, index: tu.index })
);
});
screenDoorOptions.value.forEach((sd) => {
newLianSuoData.screenDoors.push(
new graphicData.LianSuoIndexData({ id: sd.id, index: sd.index })
);
});
sectionOptions.value.forEach((se) => {
newLianSuoData.sections.push(
new graphicData.LianSuoIndexData({ id: se.id, index: se.index })
);
});
signalOptions.value.forEach((si) => {
newLianSuoData.signals.push(
new graphicData.LianSuoIndexData({ id: si.id, index: si.index })
);
});
spksSwitchOptions.value.forEach((ss) => {
newLianSuoData.spksSwitchs.push(
new graphicData.LianSuoIndexData({ id: ss.id, index: ss.index })
);
});
floodGateOptions.value.forEach((fg) => {
newLianSuoData.floodGates.push(
new graphicData.LianSuoIndexData({ id: fg.id, index: fg.index })
);
});
garageDoorOptions.value.forEach((gd) => {
newLianSuoData.garageDoors.push(
new graphicData.LianSuoIndexData({ id: gd.id, index: gd.index })
);
});
carWashingOptions.value.forEach((cw) => {
newLianSuoData.carWashing.push(
new graphicData.LianSuoIndexData({ id: cw.id, index: cw.index })
);
});
setLianSuoData(newLianSuoData);
}
</script> </script>
<style scoped></style> <style scoped></style>

View File

@ -293,6 +293,7 @@ export function initCommonDrawApp(app: IDrawApp) {
UniqueIdPrefix = new graphicData.UniqueIdOfStationLayout(); UniqueIdPrefix = new graphicData.UniqueIdOfStationLayout();
screenDoorConfig = new graphicData.ScreenDoorConfig(); screenDoorConfig = new graphicData.ScreenDoorConfig();
generateAxleCountingConfig = new graphicData.GenerateAxleCountingConfig(); generateAxleCountingConfig = new graphicData.GenerateAxleCountingConfig();
lianSuoData = new graphicData.LianSuoData();
kilometerConvertList = []; kilometerConvertList = [];
sectionCodePointList = []; sectionCodePointList = [];
otherLineList = []; otherLineList = [];
@ -400,6 +401,9 @@ export function loadCommonDrawDatas(
UniqueIdPrefix = storage.UniqueIdPrefix; UniqueIdPrefix = storage.UniqueIdPrefix;
screenDoorConfig = storage.screenDoorConfig; screenDoorConfig = storage.screenDoorConfig;
generateAxleCountingConfig = storage.generateAxleCountingConfig; generateAxleCountingConfig = storage.generateAxleCountingConfig;
if (storage.lianSuoData) {
lianSuoData = storage.lianSuoData;
}
kilometerConvertList = storage.kilometerConvertList; kilometerConvertList = storage.kilometerConvertList;
sectionCodePointList = storage.sectionCodePointList; sectionCodePointList = storage.sectionCodePointList;
otherLineList = storage.otherLineList; otherLineList = storage.otherLineList;
@ -692,6 +696,7 @@ export function saveCommonDrawDatas(app: IDrawApp) {
storage.sectionCodePointList = sectionCodePointList; storage.sectionCodePointList = sectionCodePointList;
storage.otherLineList = otherLineList; storage.otherLineList = otherLineList;
storage.stationRelateDeviceList = refDevicesList; storage.stationRelateDeviceList = refDevicesList;
storage.lianSuoData = lianSuoData;
// if (storage.generateAxleCountingConfig?.bbConnect) { // if (storage.generateAxleCountingConfig?.bbConnect) {
// storage.generateAxleCountingConfig.newbbConnect = // storage.generateAxleCountingConfig.newbbConnect =
// storage.generateAxleCountingConfig.bbConnect.map((item) => +item); // storage.generateAxleCountingConfig.bbConnect.map((item) => +item);
@ -845,6 +850,15 @@ export function setGenerateAxleCountingConfig(
generateAxleCountingConfig = newScreenDoorConfig; generateAxleCountingConfig = newScreenDoorConfig;
} }
let lianSuoData = new graphicData.LianSuoData();
export function loadLianSuoData() {
return lianSuoData;
}
export function setLianSuoData(newLianSuoData: graphicData.LianSuoData) {
lianSuoData = newLianSuoData;
}
// 其他线路数据 // 其他线路数据
let otherLineList: graphicData.OtherLine[] = []; let otherLineList: graphicData.OtherLine[] = [];
export function loadOtherLineList() { export function loadOtherLineList() {