diff --git a/bj-rtss-message b/bj-rtss-message index 8994456..0a6fdf7 160000 --- a/bj-rtss-message +++ b/bj-rtss-message @@ -1 +1 @@ -Subproject commit 89944562247f061937fde4c8a67285f64c55aefa +Subproject commit 0a6fdf768814f03bc563aa79aeb4a2664cc5d9e5 diff --git a/src/components/draw-app/properties/SectionDirectionConfig.vue b/src/components/draw-app/properties/SectionDirectionConfig.vue index 4fdf806..aa196eb 100644 --- a/src/components/draw-app/properties/SectionDirectionConfig.vue +++ b/src/components/draw-app/properties/SectionDirectionConfig.vue @@ -18,11 +18,22 @@ const sectionCode = computed(() => { return ''; }); const formRef = ref | null>(null); -const direction = ref(0); -const directionOptions = [ +const runningDirection = ref(0); +const runningDirectionOptions = [ { label: 'A到B', value: graphicData.Section.RunningDirection.AtoB }, { label: 'B到A', value: graphicData.Section.RunningDirection.BtoA }, ]; +const direction = ref(0); +const directionOptions = [ + { + label: '上行', + value: graphicData.Direction.UP, + }, + { + label: '下行', + value: graphicData.Direction.DOWN, + }, +]; async function onSubmit() { const res = await formRef.value?.validate(); @@ -33,8 +44,8 @@ async function onSubmit() { const queue: { node: Section | Turnout; - direction: graphicData.Section.RunningDirection; - }[] = [{ node: section, direction: direction.value }]; + runningDirection: graphicData.Section.RunningDirection; + }[] = [{ node: section, runningDirection: runningDirection.value }]; const reverseDirection = (d: graphicData.Section.RunningDirection) => d === graphicData.Section.RunningDirection.AtoB @@ -43,7 +54,7 @@ async function onSubmit() { const traverse = ( current: Section | Turnout, - direction: graphicData.Section.RunningDirection + runningDirection: graphicData.Section.RunningDirection ) => { if (visited.includes(current.datas.id)) return; visited.push(current.datas.id); @@ -53,12 +64,12 @@ async function onSubmit() { [current.datas.pbRef?.id, 'B'], ] .filter((item): item is [string, 'A' | 'B'] => !!item[0]) - .forEach(([id, port], idx) => { + .forEach(([id, port]) => { const target = current.queryStore.queryById
(id); if (target instanceof Turnout) { queue.push({ node: target, - direction, + runningDirection, }); } else { const isPortDiffrent = @@ -66,46 +77,32 @@ async function onSubmit() { (port === 'A' && target.datas.pbRef?.id === current.datas.id); queue.push({ node: target, - direction: isPortDiffrent - ? direction - : reverseDirection(direction), + runningDirection: isPortDiffrent + ? runningDirection + : reverseDirection(runningDirection), }); } }); const data = current.datas.clone(); - data.normalRunningDirection = direction; + data.normalRunningDirection = runningDirection; + data.direction = direction.value; current.updateData(data); } else { - [ - current.datas.paRef?.id, - current.datas.pbRef?.id, - current.datas.pcRef?.id, - ] + [current.datas.paRef?.id, current.datas.pbRef?.id] .filter((id): id is string => !!id) - .forEach((id, idx) => { + .forEach((id) => { const target = current.queryStore.queryById
(id); - if ( - target instanceof Turnout && - target.datas.pcRef?.id === current.datas.id && - idx === 2 - ) { - queue.push({ - node: target, - direction: reverseDirection(direction), - }); - } else { - queue.push({ - node: target, - direction, - }); - } + queue.push({ + node: target, + runningDirection, + }); }); } }; do { - const { node, direction } = queue.shift()!; - traverse(node, direction); + const { node, runningDirection } = queue.shift()!; + traverse(node, runningDirection); } while (queue.length > 0); } @@ -134,6 +131,15 @@ async function onSubmit() { outlined label="运行方向" hint="请选择区段的常规运行方向" + v-model="runningDirection" + :options="runningDirectionOptions" + emit-value + map-options + /> + + ; code?: string; @@ -4001,6 +4017,7 @@ export namespace graphicData { centralizedStations?: string[]; normalRunningDirection?: Section.RunningDirection; isTurnBackZone?: boolean; + direction?: Direction; }): Section { const message = new Section({}); if (data.common != null) { @@ -4042,6 +4059,9 @@ export namespace graphicData { if (data.isTurnBackZone != null) { message.isTurnBackZone = data.isTurnBackZone; } + if (data.direction != null) { + message.direction = data.direction; + } return message; } toObject() { @@ -4059,6 +4079,7 @@ export namespace graphicData { centralizedStations?: string[]; normalRunningDirection?: Section.RunningDirection; isTurnBackZone?: boolean; + direction?: Direction; } = {}; if (this.common != null) { data.common = this.common.toObject(); @@ -4099,6 +4120,9 @@ export namespace graphicData { if (this.isTurnBackZone != null) { data.isTurnBackZone = this.isTurnBackZone; } + if (this.direction != null) { + data.direction = this.direction; + } return data; } serialize(): Uint8Array; @@ -4131,6 +4155,8 @@ export namespace graphicData { writer.writeEnum(14, this.normalRunningDirection); if (this.isTurnBackZone != false) writer.writeBool(15, this.isTurnBackZone); + if (this.direction != Direction.UP) + writer.writeEnum(16, this.direction); if (!w) return writer.getResultBuffer(); } @@ -4179,6 +4205,9 @@ export namespace graphicData { case 15: message.isTurnBackZone = reader.readBool(); break; + case 16: + message.direction = reader.readEnum(); + break; default: reader.skipField(); } } @@ -4198,7 +4227,8 @@ export namespace graphicData { } export enum RunningDirection { AtoB = 0, - BtoA = 1 + BtoA = 1, + BOTH = 2 } } export class RelatedRef extends pb_1.Message {