From 1b2d4f46eafa20e54db0914560ee2bbf7b2b6b35 Mon Sep 17 00:00:00 2001 From: Yuan Date: Thu, 21 Sep 2023 17:22:30 +0800 Subject: [PATCH] =?UTF-8?q?=E9=81=93=E5=B2=94=E5=85=AC=E9=87=8C=E6=A0=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .eslintignore | 2 + .../properties/TransponderProperty.vue | 2 +- .../draw-app/properties/TurnoutProperty.vue | 153 +++++++----------- src/drawApp/graphics/LinkInteraction.ts | 1 - src/drawApp/graphics/TurnoutInteraction.ts | 5 + src/graphics/trackSection/TrackSection.ts | 4 +- src/graphics/turnout/Turnout.ts | 3 +- src/layouts/RelayCabinetLayout.vue | 6 +- src/pages/DraftManage.vue | 6 + 9 files changed, 78 insertions(+), 104 deletions(-) diff --git a/.eslintignore b/.eslintignore index 7b59e09..7acfd4b 100644 --- a/.eslintignore +++ b/.eslintignore @@ -5,3 +5,5 @@ /node_modules .eslintrc.js /src-ssr +/src/protos +/graphic-pixi diff --git a/src/components/draw-app/properties/TransponderProperty.vue b/src/components/draw-app/properties/TransponderProperty.vue index c61ce2b..c753a96 100644 --- a/src/components/draw-app/properties/TransponderProperty.vue +++ b/src/components/draw-app/properties/TransponderProperty.vue @@ -98,7 +98,7 @@ import { } from 'src/graphics/transponder/Transponder'; import { Turnout } from 'src/graphics/turnout/Turnout'; import { useDrawStore } from 'src/stores/draw-store'; -import { computed, onMounted, onUnmounted, reactive } from 'vue'; +import { computed } from 'vue'; const drawStore = useDrawStore(); const { data: transponderModel, onUpdate } = useFormData( diff --git a/src/components/draw-app/properties/TurnoutProperty.vue b/src/components/draw-app/properties/TurnoutProperty.vue index 6b00c3c..f2a21f2 100644 --- a/src/components/draw-app/properties/TurnoutProperty.vue +++ b/src/components/draw-app/properties/TurnoutProperty.vue @@ -15,66 +15,62 @@ @blur="onUpdate" label="索引" /> - - + + + + + + import { TurnoutData } from 'src/drawApp/graphics/TurnoutInteraction'; import { Section } from 'src/graphics/section/Section'; -import { Direction } from 'src/graphics/signal/Signal'; import { Turnout } from 'src/graphics/turnout/Turnout'; import { graphicData } from 'src/protos/stationLayoutGraphics'; import { useDrawStore } from 'src/stores/draw-store'; -import { computed, reactive, shallowRef, watchEffect } from 'vue'; +import { computed } from 'vue'; import { useFormData } from 'src/components/DrawAppFormUtils'; const drawStore = useDrawStore(); @@ -129,18 +124,17 @@ const CoordinateSystemOptions = [ { label: '正线', value: 'MAIN_LINE' }, { label: '换线', value: 'TRANSFER' }, ]; + const { data: turnoutModel, onUpdate } = useFormData( new TurnoutData(), drawStore.getDrawApp() ); -// const kilometerSystem = reactive([ -// { coordinateSystem: '', kilometer: 0, direction: Direction.LEFT }, -// { coordinateSystem: '', kilometer: 0, direction: Direction.LEFT }, -// ]); + const directionOptions = [ { label: '左行', value: 0 }, { label: '右行', value: 1 }, ]; + const switchMachineTypeOptions = [ { label: '请选择', @@ -187,31 +181,4 @@ const turnoutRelations = computed(() => { }(${relation.getOtherRelationParam(turnout).param})` ); }); - -// watchEffect(() => { -// const turnout = drawStore.selectedGraphic; -// if (turnout && turnout instanceof Turnout) { -// turnoutModel.value = turnout.saveData(); -// if (turnoutModel.value.kilometerSystem.length > 0) { -// kilometerSystem.forEach((ks, i) => { -// ks.coordinateSystem = -// turnoutModel.value.kilometerSystem[i].coordinateSystem; -// ks.kilometer = turnoutModel.value.kilometerSystem[i].kilometer; -// ks.direction = turnoutModel.value.kilometerSystem[i].direction; -// }); -// } -// } -// }); - -// const onUpdate = () => { -// const turnout = drawStore.selectedGraphic as Turnout; -// turnoutModel.value.kilometerSystem = kilometerSystem.map((ks) => ({ -// coordinateSystem: ks.coordinateSystem, -// kilometer: ks.kilometer, -// direction: ks.direction, -// })); -// if (turnout) { -// drawStore.getDrawApp().updateGraphicAndRecord(turnout, turnoutModel.value); -// } -// }; diff --git a/src/drawApp/graphics/LinkInteraction.ts b/src/drawApp/graphics/LinkInteraction.ts index e9de1f5..f4433d5 100644 --- a/src/drawApp/graphics/LinkInteraction.ts +++ b/src/drawApp/graphics/LinkInteraction.ts @@ -2,7 +2,6 @@ import * as pb_1 from 'google-protobuf'; import { GraphicDataBase } from './GraphicDataBase'; import { ILinkData, Link } from 'src/graphics/link/Link'; import { graphicData } from 'src/protos/stationLayoutGraphics'; -import { IPointData } from 'pixi.js'; export class LinkData extends GraphicDataBase implements ILinkData { constructor(data?: graphicData.CalculateLink) { diff --git a/src/drawApp/graphics/TurnoutInteraction.ts b/src/drawApp/graphics/TurnoutInteraction.ts index 5b4d148..ef6917b 100644 --- a/src/drawApp/graphics/TurnoutInteraction.ts +++ b/src/drawApp/graphics/TurnoutInteraction.ts @@ -228,6 +228,11 @@ export class TurnoutData extends GraphicDataBase implements ITurnoutData { this.data.pcRef = ref; } get kilometerSystem(): KilometerSystem[] { + if (this.data.kilometerSystem.length < 2) { + this.data.kilometerSystem = Array(2).fill( + new graphicData.KilometerSystem() + ); + } return this.data.kilometerSystem; } set kilometerSystem(value: KilometerSystem[]) { diff --git a/src/graphics/trackSection/TrackSection.ts b/src/graphics/trackSection/TrackSection.ts index 434b8ee..f418005 100644 --- a/src/graphics/trackSection/TrackSection.ts +++ b/src/graphics/trackSection/TrackSection.ts @@ -2,14 +2,12 @@ * 轨道区段 */ -import { Graphics, IPointData } from 'pixi.js'; +import { IPointData } from 'pixi.js'; import { GraphicData, JlGraphic, JlGraphicTemplate, VectorText, - splitLineEvenly, - splitPolyline, } from 'src/jl-graphic'; import { SectionConsts } from '../section/Section'; import { TrackLogicSection } from '../trackLogicSection/TrackLogicSection'; diff --git a/src/graphics/turnout/Turnout.ts b/src/graphics/turnout/Turnout.ts index 6e82370..6666ff0 100644 --- a/src/graphics/turnout/Turnout.ts +++ b/src/graphics/turnout/Turnout.ts @@ -9,7 +9,7 @@ import { angleOfIncludedAngle, distance2, } from 'src/jl-graphic'; -import { Section, SectionPort } from '../section/Section'; +import { Section, SectionPort, SectionType } from '../section/Section'; import { epsilon } from 'src/jl-graphic/math'; import { IRelatedRefData, @@ -207,6 +207,7 @@ export class Turnout extends JlGraphic { /** 道岔和区段 */ this.queryStore.queryByType
(Section.Type).forEach((section) => { + if (section.datas.sectionType !== SectionType.Physical) return; this.getPortPoints().forEach((port, i) => { if ( distance2( diff --git a/src/layouts/RelayCabinetLayout.vue b/src/layouts/RelayCabinetLayout.vue index 333f414..1d63b83 100644 --- a/src/layouts/RelayCabinetLayout.vue +++ b/src/layouts/RelayCabinetLayout.vue @@ -153,11 +153,7 @@ - + diff --git a/src/pages/DraftManage.vue b/src/pages/DraftManage.vue index 0a2519e..0304250 100644 --- a/src/pages/DraftManage.vue +++ b/src/pages/DraftManage.vue @@ -196,6 +196,12 @@ const columnDefs: QTableColumn[] = [ }, align: 'center', }, + { + name: 'creator_id', + label: '创建人id', + field: 'creator_id', + align: 'center', + }, { name: 'created_at', label: '创建时间',