道岔公里标

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
.eslintrc.js
/src-ssr
/src/protos
/graphic-pixi

View File

@ -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(

View File

@ -15,66 +15,62 @@
@blur="onUpdate"
label="索引"
/>
<template v-if="turnoutModel.kilometerSystem[0]">
<q-select
outlined
style="margin-top: 10px"
v-model="turnoutModel.kilometerSystem[0].coordinateSystem"
:options="CoordinateSystemOptions"
:map-options="true"
:emit-value="true"
@update:model-value="onUpdate"
label="坐标系"
></q-select>
<q-input
outlined
style="margin-top: 10px"
v-model.number="turnoutModel.kilometerSystem[0].kilometer"
type="number"
@blur="onUpdate"
label="公里标(mm):"
/>
<q-select
outlined
class="q-mt-sm"
v-model="turnoutModel.kilometerSystem[0].direction"
:options="directionOptions"
:map-options="true"
:emit-value="true"
@update:model-value="onUpdate"
label="方向"
></q-select>
</template>
<template v-if="turnoutModel.kilometerSystem[1]">
<q-select
outlined
class="q-mt-sm"
v-model="turnoutModel.kilometerSystem[1].coordinateSystem"
:options="CoordinateSystemOptions"
:map-options="true"
:emit-value="true"
@update:model-value="onUpdate"
label="坐标系2"
></q-select>
<q-input
outlined
style="margin-top: 10px"
v-model.number="turnoutModel.kilometerSystem[1].kilometer"
type="number"
@blur="onUpdate"
label="公里标(mm):"
/>
<q-select
outlined
class="q-mt-sm"
v-model="turnoutModel.kilometerSystem[1].direction"
:options="directionOptions"
:map-options="true"
:emit-value="true"
@update:model-value="onUpdate"
label="方向"
></q-select>
</template>
<q-select
outlined
class="q-mt-sm"
v-model="turnoutModel.kilometerSystem[0].coordinateSystem"
:options="CoordinateSystemOptions"
:map-options="true"
:emit-value="true"
@update:model-value="onUpdate"
label="坐标系"
></q-select>
<q-input
outlined
class="q-mt-sm"
v-model.number="turnoutModel.kilometerSystem[0].kilometer"
type="number"
@blur="onUpdate"
label="公里标(mm):"
/>
<q-select
outlined
class="q-mt-sm"
v-model="turnoutModel.kilometerSystem[0].direction"
:options="directionOptions"
:map-options="true"
:emit-value="true"
@update:model-value="onUpdate"
label="方向"
></q-select>
<q-select
outlined
class="q-mt-sm"
v-model="turnoutModel.kilometerSystem[1].coordinateSystem"
:options="CoordinateSystemOptions"
:map-options="true"
:emit-value="true"
@update:model-value="onUpdate"
label="坐标系"
></q-select>
<q-input
outlined
class="q-mt-sm"
v-model.number="turnoutModel.kilometerSystem[1].kilometer"
type="number"
@blur="onUpdate"
label="公里标2(mm):"
/>
<q-select
outlined
class="q-mt-sm"
v-model="turnoutModel.kilometerSystem[1].direction"
:options="directionOptions"
:map-options="true"
:emit-value="true"
@update:model-value="onUpdate"
label="方向"
></q-select>
<q-select
outlined
class="q-mt-sm"
@ -115,11 +111,10 @@
<script setup lang="ts">
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);
// }
// };
</script>

View File

@ -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) {

View File

@ -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[]) {

View File

@ -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';

View File

@ -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>(Section.Type).forEach((section) => {
if (section.datas.sectionType !== SectionType.Physical) return;
this.getPortPoints().forEach((port, i) => {
if (
distance2(

View File

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

View File

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