道岔公里标

This commit is contained in:
Yuan 2023-09-21 17:22:30 +08:00
parent 1d608c5177
commit 1b2d4f46ea
9 changed files with 78 additions and 104 deletions

View File

@ -5,3 +5,5 @@
/node_modules /node_modules
.eslintrc.js .eslintrc.js
/src-ssr /src-ssr
/src/protos
/graphic-pixi

View File

@ -98,7 +98,7 @@ import {
} from 'src/graphics/transponder/Transponder'; } from 'src/graphics/transponder/Transponder';
import { Turnout } from 'src/graphics/turnout/Turnout'; import { Turnout } from 'src/graphics/turnout/Turnout';
import { useDrawStore } from 'src/stores/draw-store'; import { useDrawStore } from 'src/stores/draw-store';
import { computed, onMounted, onUnmounted, reactive } from 'vue'; import { computed } from 'vue';
const drawStore = useDrawStore(); const drawStore = useDrawStore();
const { data: transponderModel, onUpdate } = useFormData( const { data: transponderModel, onUpdate } = useFormData(

View File

@ -15,66 +15,62 @@
@blur="onUpdate" @blur="onUpdate"
label="索引" label="索引"
/> />
<template v-if="turnoutModel.kilometerSystem[0]"> <q-select
<q-select outlined
outlined class="q-mt-sm"
style="margin-top: 10px" v-model="turnoutModel.kilometerSystem[0].coordinateSystem"
v-model="turnoutModel.kilometerSystem[0].coordinateSystem" :options="CoordinateSystemOptions"
:options="CoordinateSystemOptions" :map-options="true"
:map-options="true" :emit-value="true"
:emit-value="true" @update:model-value="onUpdate"
@update:model-value="onUpdate" label="坐标系"
label="坐标系" ></q-select>
></q-select> <q-input
<q-input outlined
outlined class="q-mt-sm"
style="margin-top: 10px" v-model.number="turnoutModel.kilometerSystem[0].kilometer"
v-model.number="turnoutModel.kilometerSystem[0].kilometer" type="number"
type="number" @blur="onUpdate"
@blur="onUpdate" label="公里标(mm):"
label="公里标(mm):" />
/> <q-select
<q-select outlined
outlined class="q-mt-sm"
class="q-mt-sm" v-model="turnoutModel.kilometerSystem[0].direction"
v-model="turnoutModel.kilometerSystem[0].direction" :options="directionOptions"
:options="directionOptions" :map-options="true"
:map-options="true" :emit-value="true"
:emit-value="true" @update:model-value="onUpdate"
@update:model-value="onUpdate" label="方向"
label="方向" ></q-select>
></q-select> <q-select
</template> outlined
<template v-if="turnoutModel.kilometerSystem[1]"> class="q-mt-sm"
<q-select v-model="turnoutModel.kilometerSystem[1].coordinateSystem"
outlined :options="CoordinateSystemOptions"
class="q-mt-sm" :map-options="true"
v-model="turnoutModel.kilometerSystem[1].coordinateSystem" :emit-value="true"
:options="CoordinateSystemOptions" @update:model-value="onUpdate"
:map-options="true" label="坐标系"
:emit-value="true" ></q-select>
@update:model-value="onUpdate" <q-input
label="坐标系2" outlined
></q-select> class="q-mt-sm"
<q-input v-model.number="turnoutModel.kilometerSystem[1].kilometer"
outlined type="number"
style="margin-top: 10px" @blur="onUpdate"
v-model.number="turnoutModel.kilometerSystem[1].kilometer" label="公里标2(mm):"
type="number" />
@blur="onUpdate" <q-select
label="公里标(mm):" outlined
/> class="q-mt-sm"
<q-select v-model="turnoutModel.kilometerSystem[1].direction"
outlined :options="directionOptions"
class="q-mt-sm" :map-options="true"
v-model="turnoutModel.kilometerSystem[1].direction" :emit-value="true"
:options="directionOptions" @update:model-value="onUpdate"
:map-options="true" label="方向"
:emit-value="true" ></q-select>
@update:model-value="onUpdate"
label="方向"
></q-select>
</template>
<q-select <q-select
outlined outlined
class="q-mt-sm" class="q-mt-sm"
@ -115,11 +111,10 @@
<script setup lang="ts"> <script setup lang="ts">
import { TurnoutData } from 'src/drawApp/graphics/TurnoutInteraction'; import { TurnoutData } from 'src/drawApp/graphics/TurnoutInteraction';
import { Section } from 'src/graphics/section/Section'; import { Section } from 'src/graphics/section/Section';
import { Direction } from 'src/graphics/signal/Signal';
import { Turnout } from 'src/graphics/turnout/Turnout'; import { Turnout } from 'src/graphics/turnout/Turnout';
import { graphicData } from 'src/protos/stationLayoutGraphics'; import { graphicData } from 'src/protos/stationLayoutGraphics';
import { useDrawStore } from 'src/stores/draw-store'; import { useDrawStore } from 'src/stores/draw-store';
import { computed, reactive, shallowRef, watchEffect } from 'vue'; import { computed } from 'vue';
import { useFormData } from 'src/components/DrawAppFormUtils'; import { useFormData } from 'src/components/DrawAppFormUtils';
const drawStore = useDrawStore(); const drawStore = useDrawStore();
@ -129,18 +124,17 @@ const CoordinateSystemOptions = [
{ label: '正线', value: 'MAIN_LINE' }, { label: '正线', value: 'MAIN_LINE' },
{ label: '换线', value: 'TRANSFER' }, { label: '换线', value: 'TRANSFER' },
]; ];
const { data: turnoutModel, onUpdate } = useFormData( const { data: turnoutModel, onUpdate } = useFormData(
new TurnoutData(), new TurnoutData(),
drawStore.getDrawApp() drawStore.getDrawApp()
); );
// const kilometerSystem = reactive([
// { coordinateSystem: '', kilometer: 0, direction: Direction.LEFT },
// { coordinateSystem: '', kilometer: 0, direction: Direction.LEFT },
// ]);
const directionOptions = [ const directionOptions = [
{ label: '左行', value: 0 }, { label: '左行', value: 0 },
{ label: '右行', value: 1 }, { label: '右行', value: 1 },
]; ];
const switchMachineTypeOptions = [ const switchMachineTypeOptions = [
{ {
label: '请选择', label: '请选择',
@ -187,31 +181,4 @@ const turnoutRelations = computed(() => {
}(${relation.getOtherRelationParam(turnout).param})` }(${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);
// }
// };
</script> </script>

View File

@ -2,7 +2,6 @@ import * as pb_1 from 'google-protobuf';
import { GraphicDataBase } from './GraphicDataBase'; import { GraphicDataBase } from './GraphicDataBase';
import { ILinkData, Link } from 'src/graphics/link/Link'; import { ILinkData, Link } from 'src/graphics/link/Link';
import { graphicData } from 'src/protos/stationLayoutGraphics'; import { graphicData } from 'src/protos/stationLayoutGraphics';
import { IPointData } from 'pixi.js';
export class LinkData extends GraphicDataBase implements ILinkData { export class LinkData extends GraphicDataBase implements ILinkData {
constructor(data?: graphicData.CalculateLink) { constructor(data?: graphicData.CalculateLink) {

View File

@ -228,6 +228,11 @@ export class TurnoutData extends GraphicDataBase implements ITurnoutData {
this.data.pcRef = ref; this.data.pcRef = ref;
} }
get kilometerSystem(): KilometerSystem[] { get kilometerSystem(): KilometerSystem[] {
if (this.data.kilometerSystem.length < 2) {
this.data.kilometerSystem = Array(2).fill(
new graphicData.KilometerSystem()
);
}
return this.data.kilometerSystem; return this.data.kilometerSystem;
} }
set kilometerSystem(value: KilometerSystem[]) { set kilometerSystem(value: KilometerSystem[]) {

View File

@ -2,14 +2,12 @@
* *
*/ */
import { Graphics, IPointData } from 'pixi.js'; import { IPointData } from 'pixi.js';
import { import {
GraphicData, GraphicData,
JlGraphic, JlGraphic,
JlGraphicTemplate, JlGraphicTemplate,
VectorText, VectorText,
splitLineEvenly,
splitPolyline,
} from 'src/jl-graphic'; } from 'src/jl-graphic';
import { SectionConsts } from '../section/Section'; import { SectionConsts } from '../section/Section';
import { TrackLogicSection } from '../trackLogicSection/TrackLogicSection'; import { TrackLogicSection } from '../trackLogicSection/TrackLogicSection';

View File

@ -9,7 +9,7 @@ import {
angleOfIncludedAngle, angleOfIncludedAngle,
distance2, distance2,
} from 'src/jl-graphic'; } 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 { epsilon } from 'src/jl-graphic/math';
import { import {
IRelatedRefData, IRelatedRefData,
@ -207,6 +207,7 @@ export class Turnout extends JlGraphic {
/** 道岔和区段 */ /** 道岔和区段 */
this.queryStore.queryByType<Section>(Section.Type).forEach((section) => { this.queryStore.queryByType<Section>(Section.Type).forEach((section) => {
if (section.datas.sectionType !== SectionType.Physical) return;
this.getPortPoints().forEach((port, i) => { this.getPortPoints().forEach((port, i) => {
if ( if (
distance2( distance2(

View File

@ -153,11 +153,7 @@
</q-card-section> </q-card-section>
<q-card-actions align="right"> <q-card-actions align="right">
<q-btn <q-btn color="primary" label="提交" @click="saveUniqueIdPrefix()" />
color="primary"
label="提交"
@click="saveUniqueIdPrefix(stationName)"
/>
<q-btn label="取消" v-close-popup /> <q-btn label="取消" v-close-popup />
</q-card-actions> </q-card-actions>
</q-card> </q-card>

View File

@ -196,6 +196,12 @@ const columnDefs: QTableColumn[] = [
}, },
align: 'center', align: 'center',
}, },
{
name: 'creator_id',
label: '创建人id',
field: 'creator_id',
align: 'center',
},
{ {
name: 'created_at', name: 'created_at',
label: '创建时间', label: '创建时间',