Merge branch 'master' of https://git.code.tencent.com/beijing-rtss-test/bj-rtss-client
This commit is contained in:
commit
0d7a80f399
@ -85,6 +85,9 @@ export enum typeStr {
|
||||
string = 'string',
|
||||
int = 'int',
|
||||
bool = 'bool',
|
||||
uint8 = 'uint8',
|
||||
uint16 = 'uint16',
|
||||
uint32 = 'uint32',
|
||||
}
|
||||
|
||||
export interface Description {
|
||||
|
@ -7,12 +7,24 @@
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="menu.type != typeStr.array">
|
||||
<ConfigData
|
||||
v-for="(item, index) in menu.itemTypeFields"
|
||||
:key="index"
|
||||
:cgData="item"
|
||||
@val="setVal"
|
||||
></ConfigData>
|
||||
<q-card
|
||||
flat
|
||||
:bordered="level != 1"
|
||||
:class="level != 1 ? 'q-ma-sm' : ''"
|
||||
>
|
||||
<q-card-section class="q-pa-sm" v-if="level != 1">
|
||||
<div>{{ menu.description }}</div>
|
||||
</q-card-section>
|
||||
<q-card-section :class="level != 1 ? 'q-pt-none' : 'q-pa-none'">
|
||||
<ConfigData
|
||||
v-for="(item, index) in menu.itemTypeFields"
|
||||
:key="index"
|
||||
:cgData="item"
|
||||
:level="level + 1"
|
||||
@val="setVal"
|
||||
></ConfigData>
|
||||
</q-card-section>
|
||||
</q-card>
|
||||
</div>
|
||||
<div
|
||||
v-else-if="menu.type == typeStr.array && menu.val"
|
||||
@ -29,6 +41,7 @@
|
||||
v-for="(item, index) in fs"
|
||||
:key="index"
|
||||
:cgData="item"
|
||||
:level="level + 1"
|
||||
@val="setVal"
|
||||
></ConfigData>
|
||||
</q-card-section>
|
||||
@ -50,7 +63,14 @@
|
||||
dense
|
||||
type="number"
|
||||
v-model.number="menu.val"
|
||||
v-else-if="menu.type == typeStr.int"
|
||||
v-else-if="
|
||||
[
|
||||
typeStr.int,
|
||||
typeStr.uint8,
|
||||
typeStr.uint16,
|
||||
typeStr.uint32,
|
||||
].includes(menu.type)
|
||||
"
|
||||
/>
|
||||
<q-checkbox
|
||||
v-model="menu.val"
|
||||
@ -67,6 +87,7 @@ import { Description, typeStr } from 'src/api/RunconfigApi';
|
||||
import { onMounted, reactive, watch } from 'vue';
|
||||
const props = defineProps<{
|
||||
cgData: Description;
|
||||
level: number;
|
||||
}>();
|
||||
const menu = reactive<Description>({
|
||||
fieldName: '',
|
||||
|
219
src/components/draw-app/properties/AxleCountingConfig.vue
Normal file
219
src/components/draw-app/properties/AxleCountingConfig.vue
Normal file
@ -0,0 +1,219 @@
|
||||
<template>
|
||||
<q-card class="q-gutter-sm q-pa-sm">
|
||||
<q-card-section>
|
||||
<div class="text-h6">一键生成计轴配置</div>
|
||||
</q-card-section>
|
||||
<q-form ref="myForm" @submit="onSubmit">
|
||||
<q-list bordered separator class="rounded-borders">
|
||||
<q-expansion-item
|
||||
expand-separator
|
||||
v-for="(combinationtype, index) in axleCountingConfig.generate"
|
||||
:key="combinationtype"
|
||||
v-model="combinationtype.expanded"
|
||||
:label="combinationtype.code"
|
||||
@click="toggleItem(index)"
|
||||
>
|
||||
<q-card>
|
||||
<q-item>
|
||||
<q-item-section no-wrap class="q-gutter-y-sm column">
|
||||
<div class="q-gutter-sm row">
|
||||
<q-chip
|
||||
v-for="(
|
||||
item, selectIndex
|
||||
) in combinationtype.refTurnoutCode"
|
||||
:key="item"
|
||||
square
|
||||
color="primary"
|
||||
text-color="white"
|
||||
removable
|
||||
@remove="removeSelect(selectIndex)"
|
||||
clickable
|
||||
@click="clickSelectCenter(selectIndex)"
|
||||
>
|
||||
{{ item }}
|
||||
</q-chip>
|
||||
</div>
|
||||
<div>
|
||||
<q-btn
|
||||
v-show="combinationtype.refTurnoutCode.length > 0"
|
||||
style="width: 130px"
|
||||
label="清空选择的道岔"
|
||||
color="red"
|
||||
class="q-mr-md"
|
||||
@click="clearAllSelect(index)"
|
||||
/>
|
||||
</div>
|
||||
</q-item-section>
|
||||
</q-item>
|
||||
</q-card>
|
||||
</q-expansion-item>
|
||||
</q-list>
|
||||
<div class="q-mt-md">
|
||||
<q-btn
|
||||
label="确认修改"
|
||||
color="primary"
|
||||
@click="onSubmit"
|
||||
class="q-mr-md"
|
||||
/>
|
||||
<q-btn label="返回" color="primary" @click="goBack" />
|
||||
</div>
|
||||
</q-form>
|
||||
</q-card>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { onMounted, ref, watch } from 'vue';
|
||||
import { QForm, useQuasar } from 'quasar';
|
||||
import { JlGraphic } from 'src/jl-graphic';
|
||||
import { useDrawStore } from 'src/stores/draw-store';
|
||||
import { graphicData } from 'src/protos/stationLayoutGraphics';
|
||||
import { Turnout } from 'src/graphics/turnout/Turnout';
|
||||
import {
|
||||
loadGenerateAxleCountingConfig,
|
||||
setGenerateAxleCountingConfig,
|
||||
} from 'src/drawApp/commonApp';
|
||||
|
||||
const emit = defineEmits(['close']);
|
||||
|
||||
const drawStore = useDrawStore();
|
||||
const $q = useQuasar();
|
||||
const axleCountingConfig = ref<{
|
||||
generate: {
|
||||
code: string;
|
||||
refTurnout: string[];
|
||||
refTurnoutCode: string[];
|
||||
expanded: boolean;
|
||||
}[];
|
||||
}>({
|
||||
generate: [
|
||||
{
|
||||
code: 'bb连接的道岔',
|
||||
refTurnout: [],
|
||||
refTurnoutCode: [],
|
||||
expanded: false,
|
||||
},
|
||||
{
|
||||
code: '不生成计轴的道岔组',
|
||||
refTurnout: [],
|
||||
refTurnoutCode: [],
|
||||
expanded: false,
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
let selectGraphic: JlGraphic[] = [];
|
||||
watch(
|
||||
() => drawStore.selectedGraphics,
|
||||
(val) => {
|
||||
if (val && val.length > 0 && clickIndex !== null) {
|
||||
const selectFilter = drawStore.selectedGraphics?.filter(
|
||||
(g) => g.type == Turnout.Type
|
||||
) as JlGraphic[];
|
||||
selectGraphic.push(...selectFilter);
|
||||
selectGraphic = Array.from(new Set(selectGraphic));
|
||||
drawStore.getDrawApp().updateSelected(...selectGraphic);
|
||||
axleCountingConfig.value.generate[clickIndex].refTurnoutCode =
|
||||
selectGraphic.map((g) =>
|
||||
(g as Turnout).datas.code == '' ? g.id : (g as Turnout).datas.code
|
||||
);
|
||||
axleCountingConfig.value.generate[clickIndex].refTurnout =
|
||||
selectGraphic.map((g) => g.id) as string[];
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
onMounted(() => {
|
||||
const generateAxleCountingConfig = loadGenerateAxleCountingConfig();
|
||||
if (generateAxleCountingConfig !== undefined) {
|
||||
axleCountingConfig.value.generate.forEach((generate) => {
|
||||
if (generate.code == 'bb连接的道岔') {
|
||||
generate.refTurnout = generateAxleCountingConfig.bbConnect;
|
||||
generateAxleCountingConfig.bbConnect.forEach((id) => {
|
||||
const g = drawStore.getDrawApp().queryStore.queryById(id);
|
||||
generate.refTurnoutCode.push(g.code);
|
||||
});
|
||||
} else if (generate.code == '不生成计轴的道岔组') {
|
||||
generate.refTurnout = generateAxleCountingConfig.noGenerateGroup;
|
||||
generateAxleCountingConfig.noGenerateGroup.forEach((id) => {
|
||||
const g = drawStore.getDrawApp().queryStore.queryById(id);
|
||||
generate.refTurnoutCode.push(g.code);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
const myForm = ref<QForm | null>(null);
|
||||
async function onSubmit() {
|
||||
myForm.value?.validate().then(async (res) => {
|
||||
if (res) {
|
||||
try {
|
||||
const generateAxleCountingConfig =
|
||||
new graphicData.GenerateAxleCountingConfig();
|
||||
axleCountingConfig.value.generate.forEach((generate) => {
|
||||
if (generate.code == 'bb连接的道岔') {
|
||||
generateAxleCountingConfig.bbConnect = generate.refTurnout;
|
||||
} else if (generate.code == '不生成计轴的道岔组') {
|
||||
generateAxleCountingConfig.noGenerateGroup = generate.refTurnout;
|
||||
}
|
||||
});
|
||||
setGenerateAxleCountingConfig(generateAxleCountingConfig);
|
||||
$q.notify({
|
||||
type: 'positive',
|
||||
message: '更新成功',
|
||||
});
|
||||
} catch (err) {
|
||||
$q.notify({
|
||||
type: 'negative',
|
||||
message: '更新失败',
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
let clickIndex: null | number = null;
|
||||
function toggleItem(index: number) {
|
||||
const drawApp = drawStore.getDrawApp();
|
||||
selectGraphic = [];
|
||||
drawApp.updateSelected();
|
||||
const generate = axleCountingConfig.value.generate;
|
||||
if (generate[index].expanded == true) {
|
||||
clickIndex = index;
|
||||
const select: JlGraphic[] = [];
|
||||
generate[index].refTurnout.forEach((id: string) => {
|
||||
const g = drawApp.queryStore.queryById(id);
|
||||
select.push(g);
|
||||
});
|
||||
drawApp.updateSelected(...select);
|
||||
} else {
|
||||
clickIndex = null;
|
||||
}
|
||||
}
|
||||
|
||||
function removeSelect(removeIndex: number) {
|
||||
const clickTarget = axleCountingConfig.value.generate[clickIndex as number];
|
||||
selectGraphic.splice(removeIndex, 1);
|
||||
clickTarget.refTurnoutCode.splice(removeIndex, 1);
|
||||
clickTarget.refTurnout.splice(removeIndex, 1);
|
||||
drawStore.getDrawApp().updateSelected(...selectGraphic);
|
||||
}
|
||||
|
||||
function clickSelectCenter(index: number) {
|
||||
const drawApp = drawStore.getDrawApp();
|
||||
const clickTarget = axleCountingConfig.value.generate[clickIndex as number];
|
||||
const turnout = drawApp.queryStore.queryById(clickTarget.refTurnout[index]);
|
||||
drawApp.makeGraphicCenterShow(turnout);
|
||||
}
|
||||
|
||||
function clearAllSelect(index: number) {
|
||||
axleCountingConfig.value.generate[index].refTurnout = [];
|
||||
axleCountingConfig.value.generate[index].refTurnoutCode = [];
|
||||
selectGraphic = [];
|
||||
drawStore.getDrawApp().updateSelected();
|
||||
}
|
||||
|
||||
function goBack() {
|
||||
emit('close');
|
||||
}
|
||||
</script>
|
@ -204,34 +204,43 @@
|
||||
</q-card>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { ITurnoutState, Turnout } from 'src/graphics/turnout/Turnout';
|
||||
import { Turnout } from 'src/graphics/turnout/Turnout';
|
||||
import { useLineStore } from 'src/stores/line-store';
|
||||
import { ref, watch, onMounted } from 'vue';
|
||||
import { ref, watch, onMounted, onUnmounted } from 'vue';
|
||||
import { SetSwitchParams, setSwitchPosition } from 'src/api/Simulation';
|
||||
import { useQuasar } from 'quasar';
|
||||
import { ApiError } from 'src/boot/axios';
|
||||
import { request } from 'src/protos/request';
|
||||
import { TurnoutStates } from 'src/drawApp/graphics/TurnoutInteraction';
|
||||
import { JlGraphic } from 'src/jl-graphic';
|
||||
|
||||
const $q = useQuasar();
|
||||
const lineStore = useLineStore();
|
||||
const turnoutState = ref<TurnoutStates>(new TurnoutStates());
|
||||
const name = ref('');
|
||||
const graphic = ref();
|
||||
|
||||
watch(
|
||||
() => lineStore.selectedGraphics,
|
||||
(val) => {
|
||||
(val, oldVal) => {
|
||||
if (oldVal?.length == 1 && oldVal[0].type == Turnout.Type) {
|
||||
unSubscribeState(oldVal[0] as JlGraphic);
|
||||
}
|
||||
if (val?.length == 1 && val[0].type == Turnout.Type) {
|
||||
graphic.value = val[0];
|
||||
setTurnoutState(val[0] as Turnout);
|
||||
} else {
|
||||
turnoutState.value = new TurnoutStates();
|
||||
name.value = '';
|
||||
graphic.value = null;
|
||||
}
|
||||
}
|
||||
);
|
||||
function setTurnoutState(turnout: Turnout) {
|
||||
graphic.value = turnout;
|
||||
turnoutState.value = turnout.states.clone() as TurnoutStates;
|
||||
name.value = turnout.datas.code;
|
||||
subscribeState(turnout as JlGraphic);
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
@ -239,6 +248,11 @@ onMounted(() => {
|
||||
setTurnoutState(lineStore.selectedGraphics[0] as Turnout);
|
||||
}
|
||||
});
|
||||
onUnmounted(() => {
|
||||
if (graphic.value) {
|
||||
unSubscribeState(graphic.value as JlGraphic);
|
||||
}
|
||||
});
|
||||
|
||||
const options = [
|
||||
{ label: '定操', value: request.Turnout.Operation.DC },
|
||||
@ -270,20 +284,17 @@ function toDo(item: { label: string; value: number }) {
|
||||
});
|
||||
}
|
||||
|
||||
watch(
|
||||
() => lineStore.socketStates,
|
||||
(val) => {
|
||||
if (val && turnoutState.value.id) {
|
||||
const find = val.find((item) => {
|
||||
return (
|
||||
item.graphicType == Turnout.Type &&
|
||||
(item as ITurnoutState).id == turnoutState.value.id
|
||||
);
|
||||
});
|
||||
if (find) {
|
||||
turnoutState.value = find.clone() as TurnoutStates;
|
||||
}
|
||||
}
|
||||
function subscribeState(g: JlGraphic) {
|
||||
if (g) {
|
||||
g.on('stateupdate', updateState);
|
||||
}
|
||||
);
|
||||
}
|
||||
function unSubscribeState(g: JlGraphic) {
|
||||
if (g) {
|
||||
g.off('stateupdate', updateState);
|
||||
}
|
||||
}
|
||||
function updateState(newVal: TurnoutStates) {
|
||||
turnoutState.value = newVal.clone() as TurnoutStates;
|
||||
}
|
||||
</script>
|
||||
|
@ -221,6 +221,7 @@ export function initCommonDrawApp(app: IDrawApp) {
|
||||
app.on('destroy', async () => {
|
||||
UniqueIdPrefix = new graphicData.UniqueIdOfStationLayout();
|
||||
screenDoorConfig = new graphicData.ScreenDoorConfig();
|
||||
generateAxleCountingConfig = new graphicData.GenerateAxleCountingConfig();
|
||||
kilometerConvertList = [];
|
||||
sectionCodePointList = [];
|
||||
});
|
||||
@ -232,6 +233,7 @@ export function loadCommonDrawDatas(
|
||||
const datas: GraphicData[] = [];
|
||||
UniqueIdPrefix = storage.UniqueIdPrefix;
|
||||
screenDoorConfig = storage.screenDoorConfig;
|
||||
generateAxleCountingConfig = storage.generateAxleCountingConfig;
|
||||
kilometerConvertList = storage.kilometerConvertList;
|
||||
sectionCodePointList = storage.sectionCodePointList;
|
||||
storage.Platforms.forEach((platform) => {
|
||||
@ -368,6 +370,7 @@ export function saveCommonDrawDatas(
|
||||
}
|
||||
storage.UniqueIdPrefix = UniqueIdPrefix;
|
||||
storage.screenDoorConfig = screenDoorConfig;
|
||||
storage.generateAxleCountingConfig = generateAxleCountingConfig;
|
||||
storage.kilometerConvertList = kilometerConvertList;
|
||||
storage.sectionCodePointList = sectionCodePointList;
|
||||
return storage;
|
||||
@ -491,3 +494,15 @@ export function setScreenDoorConfig(
|
||||
) {
|
||||
screenDoorConfig = newScreenDoorConfig;
|
||||
}
|
||||
|
||||
//一键生成计轴配置
|
||||
let generateAxleCountingConfig = new graphicData.GenerateAxleCountingConfig();
|
||||
export function loadGenerateAxleCountingConfig() {
|
||||
return generateAxleCountingConfig;
|
||||
}
|
||||
|
||||
export function setGenerateAxleCountingConfig(
|
||||
newScreenDoorConfig: graphicData.GenerateAxleCountingConfig
|
||||
) {
|
||||
generateAxleCountingConfig = newScreenDoorConfig;
|
||||
}
|
||||
|
@ -19,6 +19,7 @@ import { Section, SectionPort, SectionType } from '../section/Section';
|
||||
import { Turnout, TurnoutPort } from '../turnout/Turnout';
|
||||
import { IRelatedRefData, createRelatedRefProto } from '../CommonGraphics';
|
||||
import { Signal } from '../signal/Signal';
|
||||
import { loadGenerateAxleCountingConfig } from 'src/drawApp/commonApp';
|
||||
|
||||
export interface IAxleCountingDrawOptions {
|
||||
newData: () => IAxleCountingData;
|
||||
@ -79,12 +80,39 @@ export class AxleCountingDraw extends GraphicDrawAssistant<
|
||||
refGraphic: Section | Turnout,
|
||||
refPort: TurnoutPort | SectionPort
|
||||
) {
|
||||
const generateAxleCountingConfig = loadGenerateAxleCountingConfig();
|
||||
if (generateAxleCountingConfig?.noGenerateGroup !== undefined) {
|
||||
const noGenerateGroup = generateAxleCountingConfig.noGenerateGroup;
|
||||
for (let i = 0; i < noGenerateGroup.length; i++) {
|
||||
if (
|
||||
noGenerateGroup[i] == graphic.id &&
|
||||
((i % 2 == 0 && refGraphic.id == noGenerateGroup[i + 1]) ||
|
||||
(i % 2 == 1 && refGraphic.id == noGenerateGroup[i - 1]))
|
||||
) {
|
||||
map.set(`${graphic.id}-${port}`, 1);
|
||||
map.set(`${refGraphic.id}-${refPort}`, 1);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (
|
||||
graphic.type == 'Turnout' &&
|
||||
reftype == 'Turnout' &&
|
||||
port == TurnoutPort.B &&
|
||||
refPort == TurnoutPort.B
|
||||
) {
|
||||
//查看生成计轴bb配置
|
||||
let hasBB = false;
|
||||
if (generateAxleCountingConfig !== undefined) {
|
||||
const bbConnect = generateAxleCountingConfig.bbConnect;
|
||||
if (
|
||||
bbConnect.includes(graphic.id) ||
|
||||
bbConnect.includes(refGraphic.id)
|
||||
) {
|
||||
hasBB = true;
|
||||
}
|
||||
}
|
||||
//bb连接处有信号机需要生成
|
||||
const points = (graphic as Turnout).getPortPoints();
|
||||
const portPs = graphic.localToCanvasPoints(points[1][0])[0];
|
||||
let hasSingle = false;
|
||||
@ -94,7 +122,7 @@ export class AxleCountingDraw extends GraphicDrawAssistant<
|
||||
hasSingle = true;
|
||||
}
|
||||
});
|
||||
if (!hasSingle) {
|
||||
if (!hasSingle && !hasBB) {
|
||||
map.set(`${graphic.id}-${port}`, 1);
|
||||
map.set(`${refGraphic.id}-${refPort}`, 1);
|
||||
return;
|
||||
|
@ -59,7 +59,6 @@
|
||||
</q-popup-edit>
|
||||
</q-btn>
|
||||
<q-btn-dropdown
|
||||
v-if="drawStore.categoryType === CategoryType.TH"
|
||||
color="orange"
|
||||
label="数据管理"
|
||||
style="margin-right: 10px"
|
||||
@ -95,6 +94,10 @@
|
||||
v-else-if="showScreenDoorConfig"
|
||||
@close="closeScreenDoorConfig"
|
||||
/>
|
||||
<axleCounting-config
|
||||
v-else-if="showGenerateAxleCountingConfig"
|
||||
@close="closeGenerateAxleCountingConfig"
|
||||
/>
|
||||
<draw-properties
|
||||
v-else-if="!drawStore.showRelateDeviceConfig"
|
||||
></draw-properties>
|
||||
@ -300,6 +303,7 @@ import SectionCodePointConfig from 'src/components/draw-app/properties/SectionCo
|
||||
import StationRelateDeviceConfig from 'src/components/draw-app/properties/StationRelateDeviceConfig.vue';
|
||||
import StationRelateDeviceList from 'src/components/draw-app/dialogs/StationRelateDeviceList.vue';
|
||||
import ScreenDoorConfig from 'src/components/draw-app/properties/ScreenDoorConfig.vue';
|
||||
import AxleCountingConfig from 'src/components/draw-app/properties/AxleCountingConfig.vue';
|
||||
import { PictureType } from 'src/protos/picture';
|
||||
import { Beacon } from 'src/graphics/beacon/Beacon';
|
||||
|
||||
@ -394,11 +398,19 @@ const showScreenDoorConfig = ref(false);
|
||||
const closeScreenDoorConfig = () => {
|
||||
showScreenDoorConfig.value = false;
|
||||
};
|
||||
const showGenerateAxleCountingConfig = ref(false);
|
||||
const closeGenerateAxleCountingConfig = () => {
|
||||
showGenerateAxleCountingConfig.value = false;
|
||||
};
|
||||
const dataManageConfig = [
|
||||
{ label: '关联设备列表', click: openDeviceRelateList },
|
||||
{ label: '公里标转换', click: openkilometerConvertList },
|
||||
{ label: '区段码位列表', click: openSectionCodePointList },
|
||||
{ label: '屏蔽门配置', click: () => (showScreenDoorConfig.value = true) },
|
||||
{
|
||||
label: '一键生成计轴配置',
|
||||
click: () => (showGenerateAxleCountingConfig.value = true),
|
||||
},
|
||||
];
|
||||
|
||||
onMounted(() => {
|
||||
@ -428,20 +440,7 @@ onMounted(() => {
|
||||
EsbButton.Type,
|
||||
SlopeKiloMarker.Type,
|
||||
CurvatureKiloMarker.Type,
|
||||
Beacon.Type,
|
||||
];
|
||||
drawAssistantsTypes.forEach((type) => {
|
||||
const drawAssistant = drawStore.getDrawApp().getDrawAssistant(type);
|
||||
if (drawAssistant) {
|
||||
utilsOption.push(
|
||||
new ControlItem(
|
||||
drawAssistant.name,
|
||||
drawAssistant.icon,
|
||||
drawAssistant.description || drawAssistant.name
|
||||
)
|
||||
);
|
||||
}
|
||||
});
|
||||
switch (drawStore.categoryType) {
|
||||
case CategoryType.TH:
|
||||
leftMenuConfig.push(
|
||||
@ -460,7 +459,22 @@ onMounted(() => {
|
||||
{ label: '一键生成逻辑区段', click: oneClickLogicSection }
|
||||
);
|
||||
break;
|
||||
case CategoryType.ZDWX:
|
||||
drawAssistantsTypes.push(Beacon.Type);
|
||||
break;
|
||||
}
|
||||
drawAssistantsTypes.forEach((type) => {
|
||||
const drawAssistant = drawStore.getDrawApp().getDrawAssistant(type);
|
||||
if (drawAssistant) {
|
||||
utilsOption.push(
|
||||
new ControlItem(
|
||||
drawAssistant.name,
|
||||
drawAssistant.icon,
|
||||
drawAssistant.description || drawAssistant.name
|
||||
)
|
||||
);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
const canvasWidth = ref(0);
|
||||
|
@ -74,6 +74,7 @@
|
||||
indicator-color="primary"
|
||||
align="justify"
|
||||
narrow-indicator
|
||||
outside-arrows
|
||||
>
|
||||
<q-tab
|
||||
v-for="(item, index) in list"
|
||||
@ -90,7 +91,11 @@
|
||||
:name="item.fieldName"
|
||||
>
|
||||
<div style="height: 350px; overflow-y: auto; padding: 5px">
|
||||
<ConfigData :cgData="item" @val="setVal"></ConfigData>
|
||||
<ConfigData
|
||||
:cgData="item"
|
||||
:level="1"
|
||||
@val="setVal"
|
||||
></ConfigData>
|
||||
</div>
|
||||
</q-tab-panel>
|
||||
</q-tab-panels>
|
||||
@ -356,6 +361,9 @@ const valObj = {
|
||||
string: '',
|
||||
int: 0,
|
||||
bool: false,
|
||||
uint8: 0,
|
||||
uint16: 0,
|
||||
uint32: 0,
|
||||
};
|
||||
function getObjData(fieldInfo: Description, obj: obj) {
|
||||
const key = fieldInfo.fieldName;
|
||||
@ -379,8 +387,15 @@ function getObjData(fieldInfo: Description, obj: obj) {
|
||||
obj[key] = fieldInfo.val;
|
||||
}
|
||||
}
|
||||
const basicsType = [
|
||||
typeStr.string,
|
||||
typeStr.int,
|
||||
typeStr.bool,
|
||||
typeStr.uint8,
|
||||
typeStr.uint16,
|
||||
typeStr.uint32,
|
||||
];
|
||||
function setDefaultVal(fieldInfo: Description) {
|
||||
const arr = ['string', 'int', 'bool'];
|
||||
if (fieldInfo.itemTypeFields) {
|
||||
if (fieldInfo.type == typeStr.array) {
|
||||
delete fieldInfo.val;
|
||||
@ -389,7 +404,7 @@ function setDefaultVal(fieldInfo: Description) {
|
||||
setDefaultVal(ii);
|
||||
});
|
||||
} else {
|
||||
if (arr.includes(fieldInfo.type)) {
|
||||
if (basicsType.includes(fieldInfo.type)) {
|
||||
fieldInfo.val = valObj[fieldInfo.type as keyof typeof valObj];
|
||||
}
|
||||
}
|
||||
@ -397,18 +412,22 @@ function setDefaultVal(fieldInfo: Description) {
|
||||
|
||||
function setEditVal(eData: obj, item: Description) {
|
||||
if (item.type == typeStr.map) {
|
||||
item.itemTypeFields?.forEach((ii) => {
|
||||
setEditVal(eData[item.fieldName], ii);
|
||||
});
|
||||
eData[item.fieldName] &&
|
||||
item.itemTypeFields?.forEach((ii) => {
|
||||
setEditVal(eData[item.fieldName], ii);
|
||||
});
|
||||
} else if (item.type == typeStr.array) {
|
||||
item.val = [];
|
||||
eData[item.fieldName].forEach((ii: obj) => {
|
||||
const fs: Description[] = JSON.parse(JSON.stringify(item.itemTypeFields));
|
||||
fs.forEach((it: Description) => {
|
||||
setEditVal(ii, it);
|
||||
eData[item.fieldName] &&
|
||||
eData[item.fieldName].forEach((ii: obj) => {
|
||||
const fs: Description[] = JSON.parse(
|
||||
JSON.stringify(item.itemTypeFields)
|
||||
);
|
||||
fs.forEach((it: Description) => {
|
||||
setEditVal(ii, it);
|
||||
});
|
||||
item.val.push(fs);
|
||||
});
|
||||
item.val.push(fs);
|
||||
});
|
||||
} else {
|
||||
let v = valObj[item.type as keyof typeof valObj];
|
||||
item.val = eData[item.fieldName] || v;
|
||||
|
@ -43,6 +43,7 @@ export namespace graphicData {
|
||||
sectionCodePointList?: SectionCodePoint[];
|
||||
screenDoorConfig?: ScreenDoorConfig;
|
||||
beacons?: Beacon[];
|
||||
generateAxleCountingConfig?: GenerateAxleCountingConfig;
|
||||
}) {
|
||||
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, 32, 33, 34, 35, 37], this.#one_of_decls);
|
||||
@ -140,6 +141,9 @@ export namespace graphicData {
|
||||
if ("beacons" in data && data.beacons != undefined) {
|
||||
this.beacons = data.beacons;
|
||||
}
|
||||
if ("generateAxleCountingConfig" in data && data.generateAxleCountingConfig != undefined) {
|
||||
this.generateAxleCountingConfig = data.generateAxleCountingConfig;
|
||||
}
|
||||
}
|
||||
}
|
||||
get canvas() {
|
||||
@ -337,6 +341,15 @@ export namespace graphicData {
|
||||
set beacons(value: Beacon[]) {
|
||||
pb_1.Message.setRepeatedWrapperField(this, 37, value);
|
||||
}
|
||||
get generateAxleCountingConfig() {
|
||||
return pb_1.Message.getWrapperField(this, GenerateAxleCountingConfig, 38) as GenerateAxleCountingConfig;
|
||||
}
|
||||
set generateAxleCountingConfig(value: GenerateAxleCountingConfig) {
|
||||
pb_1.Message.setWrapperField(this, 38, value);
|
||||
}
|
||||
get has_generateAxleCountingConfig() {
|
||||
return pb_1.Message.getField(this, 38) != null;
|
||||
}
|
||||
static fromObject(data: {
|
||||
canvas?: ReturnType<typeof Canvas.prototype.toObject>;
|
||||
Platforms?: ReturnType<typeof Platform.prototype.toObject>[];
|
||||
@ -369,6 +382,7 @@ export namespace graphicData {
|
||||
sectionCodePointList?: ReturnType<typeof SectionCodePoint.prototype.toObject>[];
|
||||
screenDoorConfig?: ReturnType<typeof ScreenDoorConfig.prototype.toObject>;
|
||||
beacons?: ReturnType<typeof Beacon.prototype.toObject>[];
|
||||
generateAxleCountingConfig?: ReturnType<typeof GenerateAxleCountingConfig.prototype.toObject>;
|
||||
}): RtssGraphicStorage {
|
||||
const message = new RtssGraphicStorage({});
|
||||
if (data.canvas != null) {
|
||||
@ -464,6 +478,9 @@ export namespace graphicData {
|
||||
if (data.beacons != null) {
|
||||
message.beacons = data.beacons.map(item => Beacon.fromObject(item));
|
||||
}
|
||||
if (data.generateAxleCountingConfig != null) {
|
||||
message.generateAxleCountingConfig = GenerateAxleCountingConfig.fromObject(data.generateAxleCountingConfig);
|
||||
}
|
||||
return message;
|
||||
}
|
||||
toObject() {
|
||||
@ -499,6 +516,7 @@ export namespace graphicData {
|
||||
sectionCodePointList?: ReturnType<typeof SectionCodePoint.prototype.toObject>[];
|
||||
screenDoorConfig?: ReturnType<typeof ScreenDoorConfig.prototype.toObject>;
|
||||
beacons?: ReturnType<typeof Beacon.prototype.toObject>[];
|
||||
generateAxleCountingConfig?: ReturnType<typeof GenerateAxleCountingConfig.prototype.toObject>;
|
||||
} = {};
|
||||
if (this.canvas != null) {
|
||||
data.canvas = this.canvas.toObject();
|
||||
@ -593,6 +611,9 @@ export namespace graphicData {
|
||||
if (this.beacons != null) {
|
||||
data.beacons = this.beacons.map((item: Beacon) => item.toObject());
|
||||
}
|
||||
if (this.generateAxleCountingConfig != null) {
|
||||
data.generateAxleCountingConfig = this.generateAxleCountingConfig.toObject();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
serialize(): Uint8Array;
|
||||
@ -661,6 +682,8 @@ export namespace graphicData {
|
||||
writer.writeMessage(36, this.screenDoorConfig, () => this.screenDoorConfig.serialize(writer));
|
||||
if (this.beacons.length)
|
||||
writer.writeRepeatedMessage(37, this.beacons, (item: Beacon) => item.serialize(writer));
|
||||
if (this.has_generateAxleCountingConfig)
|
||||
writer.writeMessage(38, this.generateAxleCountingConfig, () => this.generateAxleCountingConfig.serialize(writer));
|
||||
if (!w)
|
||||
return writer.getResultBuffer();
|
||||
}
|
||||
@ -763,6 +786,9 @@ export namespace graphicData {
|
||||
case 37:
|
||||
reader.readMessage(message.beacons, () => pb_1.Message.addToRepeatedWrapperField(message, 37, Beacon.deserialize(reader), Beacon));
|
||||
break;
|
||||
case 38:
|
||||
reader.readMessage(message.generateAxleCountingConfig, () => message.generateAxleCountingConfig = GenerateAxleCountingConfig.deserialize(reader));
|
||||
break;
|
||||
default: reader.skipField();
|
||||
}
|
||||
}
|
||||
@ -2406,6 +2432,96 @@ export namespace graphicData {
|
||||
SectionBoundary = 1
|
||||
}
|
||||
}
|
||||
export class GenerateAxleCountingConfig extends pb_1.Message {
|
||||
#one_of_decls: number[][] = [];
|
||||
constructor(data?: any[] | {
|
||||
bbConnect?: string[];
|
||||
noGenerateGroup?: string[];
|
||||
}) {
|
||||
super();
|
||||
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [1, 2], this.#one_of_decls);
|
||||
if (!Array.isArray(data) && typeof data == "object") {
|
||||
if ("bbConnect" in data && data.bbConnect != undefined) {
|
||||
this.bbConnect = data.bbConnect;
|
||||
}
|
||||
if ("noGenerateGroup" in data && data.noGenerateGroup != undefined) {
|
||||
this.noGenerateGroup = data.noGenerateGroup;
|
||||
}
|
||||
}
|
||||
}
|
||||
get bbConnect() {
|
||||
return pb_1.Message.getFieldWithDefault(this, 1, []) as string[];
|
||||
}
|
||||
set bbConnect(value: string[]) {
|
||||
pb_1.Message.setField(this, 1, value);
|
||||
}
|
||||
get noGenerateGroup() {
|
||||
return pb_1.Message.getFieldWithDefault(this, 2, []) as string[];
|
||||
}
|
||||
set noGenerateGroup(value: string[]) {
|
||||
pb_1.Message.setField(this, 2, value);
|
||||
}
|
||||
static fromObject(data: {
|
||||
bbConnect?: string[];
|
||||
noGenerateGroup?: string[];
|
||||
}): GenerateAxleCountingConfig {
|
||||
const message = new GenerateAxleCountingConfig({});
|
||||
if (data.bbConnect != null) {
|
||||
message.bbConnect = data.bbConnect;
|
||||
}
|
||||
if (data.noGenerateGroup != null) {
|
||||
message.noGenerateGroup = data.noGenerateGroup;
|
||||
}
|
||||
return message;
|
||||
}
|
||||
toObject() {
|
||||
const data: {
|
||||
bbConnect?: string[];
|
||||
noGenerateGroup?: string[];
|
||||
} = {};
|
||||
if (this.bbConnect != null) {
|
||||
data.bbConnect = this.bbConnect;
|
||||
}
|
||||
if (this.noGenerateGroup != null) {
|
||||
data.noGenerateGroup = this.noGenerateGroup;
|
||||
}
|
||||
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.bbConnect.length)
|
||||
writer.writeRepeatedString(1, this.bbConnect);
|
||||
if (this.noGenerateGroup.length)
|
||||
writer.writeRepeatedString(2, this.noGenerateGroup);
|
||||
if (!w)
|
||||
return writer.getResultBuffer();
|
||||
}
|
||||
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): GenerateAxleCountingConfig {
|
||||
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new GenerateAxleCountingConfig();
|
||||
while (reader.nextField()) {
|
||||
if (reader.isEndGroup())
|
||||
break;
|
||||
switch (reader.getFieldNumber()) {
|
||||
case 1:
|
||||
pb_1.Message.addToRepeatedField(message, 1, reader.readString());
|
||||
break;
|
||||
case 2:
|
||||
pb_1.Message.addToRepeatedField(message, 2, reader.readString());
|
||||
break;
|
||||
default: reader.skipField();
|
||||
}
|
||||
}
|
||||
return message;
|
||||
}
|
||||
serializeBinary(): Uint8Array {
|
||||
return this.serialize();
|
||||
}
|
||||
static deserializeBinary(bytes: Uint8Array): GenerateAxleCountingConfig {
|
||||
return GenerateAxleCountingConfig.deserialize(bytes);
|
||||
}
|
||||
}
|
||||
export class Turnout extends pb_1.Message {
|
||||
#one_of_decls: number[][] = [];
|
||||
constructor(data?: any[] | {
|
||||
|
Loading…
Reference in New Issue
Block a user