表单改动

This commit is contained in:
Yuan 2023-09-19 16:39:01 +08:00
parent 61f6848dc8
commit 5da2d6a6e2
39 changed files with 651 additions and 1403 deletions

@ -1 +1 @@
Subproject commit b6bb68aa99c33ce539a7a858a3682f6269d5a392
Subproject commit be738fbf2d34715099189eba61e425a1b2229c3f

View File

@ -1,13 +1,15 @@
import { type GraphicDataBase } from 'src/drawApp/graphics/GraphicDataBase';
import { JlGraphic } from 'src/jl-graphic';
import { IDrawApp, JlGraphic } from 'src/jl-graphic';
import { useDrawStore } from 'src/stores/draw-store';
import { onMounted, onUnmounted, reactive } from 'vue';
const drawStore = useDrawStore();
export function useFormData<T extends GraphicDataBase>(source: T) {
export function useFormData<T extends GraphicDataBase>(
source: T,
app: IDrawApp
) {
const data = reactive<T>(source);
const app = drawStore.getDrawApp();
onMounted(() => {
app.bindFormData(data);

View File

@ -28,7 +28,7 @@
<q-select
outlined
style="margin-top: 10px"
v-model="kilometerSystem.coordinateSystem"
v-model="axleCountingModel.kilometerSystem.coordinateSystem"
:options="CoordinateSystemOptions"
:map-options="true"
:emit-value="true"
@ -38,14 +38,14 @@
<q-input
outlined
style="margin-top: 10px"
v-model.number="kilometerSystem.kilometer"
v-model.number="axleCountingModel.kilometerSystem.kilometer"
type="number"
@blur="onUpdate"
label="公里标(mm):"
/>
<q-select
outlined
v-model="kilometerSystem.direction"
v-model="axleCountingModel.kilometerSystem.direction"
:options="directionOptions"
:map-options="true"
:emit-value="true"
@ -55,16 +55,18 @@
<q-select
outlined
@blur="onUpdate"
v-model="invent"
v-model="axleCountingModel.invent"
:options="optionsInvent"
label="是否虚拟区段检测点"
map-options
emit-value
/>
<q-select
outlined
v-model="axleCountingModel.type"
:options="optionsDetectType"
:map-options="true"
:emit-value="true"
map-options
emit-value
@update:model-value="onUpdate"
label="区段检测点的类型"
></q-select>
@ -115,22 +117,20 @@
</template>
<script setup lang="ts">
import { useFormData } from 'src/components/DrawAppFormUtils';
import { AxleCountingData } from 'src/drawApp/graphics/AxleCountingInteraction';
import { AxleCounting } from 'src/graphics/axleCounting/AxleCounting';
import { Section } from 'src/graphics/section/Section';
import { Turnout } from 'src/graphics/turnout/Turnout';
import { GraphicIdGenerator } from 'src/jl-graphic';
import { useDrawStore } from 'src/stores/draw-store';
import { computed, onMounted, onUnmounted, reactive, ref } from 'vue';
import { computed } from 'vue';
const drawStore = useDrawStore();
const axleCountingModel = reactive(new AxleCountingData());
const kilometerSystem = reactive({
coordinateSystem: '',
kilometer: 0,
direction: 0,
});
const { data: axleCountingModel, onUpdate } = useFormData(
new AxleCountingData(),
drawStore.getDrawApp()
);
const CoordinateSystemOptions = [
{ label: '车辆段', value: 'DEPOT' },
{ label: '停车场', value: 'PARKING_LOT' },
@ -143,20 +143,14 @@ const directionOptions = [
{ label: '右行', value: 1 },
];
const invent = ref('');
const optionsInvent = ['是', '否'];
const optionsInvent = [
{ label: '是', value: true },
{ label: '否', value: false },
];
const optionsDetectType = [
{ label: '计轴', value: 0 },
{ label: '区段边界', value: 1 },
];
enum showSelect {
= 'true',
= 'false',
}
enum showSelectData {
true = '是',
false = '否',
}
const sectionRelations = computed(() => {
const axleCounting = drawStore.selectedGraphic as AxleCounting;
@ -190,24 +184,6 @@ const turnoutRelations = computed(() => {
return Array.from(new Set(ref));
});
onMounted(() => {
drawStore.bindFormData(axleCountingModel);
const axleCounting = drawStore.selectedGraphic as AxleCounting;
if (axleCounting) {
axleCountingModel.copyFrom(axleCounting.saveData());
invent.value = (showSelectData as never)[axleCountingModel.invent + ''];
if (axleCountingModel.kilometerSystem) {
kilometerSystem.coordinateSystem =
axleCountingModel.kilometerSystem.coordinateSystem;
kilometerSystem.kilometer = axleCountingModel.kilometerSystem.kilometer;
kilometerSystem.direction = axleCountingModel.kilometerSystem.direction;
}
}
});
onUnmounted(() => {
drawStore.unbindFormData(axleCountingModel);
});
function oneClickAxleCounting() {
const select = drawStore.selectedGraphic as AxleCounting;
const axleCountings = select.queryStore.queryByType<AxleCounting>(
@ -241,19 +217,4 @@ function oneClickAxleCounting() {
axleCounting.loadRelations();
}
}
function onUpdate() {
const axleCounting = drawStore.selectedGraphic as AxleCounting;
axleCountingModel.invent = JSON.parse((showSelect as never)[invent.value]);
axleCountingModel.kilometerSystem = {
coordinateSystem: kilometerSystem.coordinateSystem,
kilometer: kilometerSystem.kilometer,
direction: kilometerSystem.direction,
};
if (axleCounting) {
drawStore
.getDrawApp()
.updateGraphicAndRecord(axleCounting, axleCountingModel);
}
}
</script>

View File

@ -69,36 +69,21 @@ import { AxleCounting } from 'src/graphics/axleCounting/AxleCounting';
import { AxleCountingSection } from 'src/graphics/axleCountingSection/AxleCountingSection';
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';
import { useFormData } from 'src/components/DrawAppFormUtils';
const drawStore = useDrawStore();
const axleCountingSectionModel = reactive(new AxleCountingSectionData());
const { data: axleCountingSectionModel, onUpdate } = useFormData(
new AxleCountingSectionData(),
drawStore.getDrawApp()
);
enum turoutPos {
'定位',
'反位',
}
onMounted(() => {
drawStore.bindFormData(axleCountingSectionModel);
const axleCountingSection = drawStore.selectedGraphic as AxleCountingSection;
if (axleCountingSection) {
axleCountingSectionModel.copyFrom(axleCountingSection.saveData());
}
});
onUnmounted(() => {
drawStore.unbindFormData(axleCountingSectionModel);
});
function onUpdate() {
const axleCountingSection = drawStore.selectedGraphic as AxleCountingSection;
if (axleCountingSection) {
drawStore
.getDrawApp()
.updateGraphicAndRecord(axleCountingSection, axleCountingSectionModel);
}
}
const axleCountingRelations = computed(() => {
const axleCountingSection = drawStore.selectedGraphic as AxleCountingSection;
const sectionRelations =

View File

@ -58,7 +58,7 @@ const canvas = reactive({
});
onMounted(() => {
console.log('画布属性表单mounted');
// console.log('mounted');
const jc = drawStore.getJlCanvas();
canvas.width = jc.properties.width;
canvas.height = jc.properties.height;
@ -66,11 +66,11 @@ onMounted(() => {
});
onUnmounted(() => {
console.log('画布属性表单unmounted');
// console.log('unmounted');
});
function onUpdate() {
console.log('画布属性更新');
// console.log('');
const app = drawStore.getDrawApp();
app.updateCanvasAndRecord({
...canvas,

View File

@ -58,7 +58,7 @@ const canvas = reactive({
});
onMounted(() => {
console.log('画布属性表单mounted');
// console.log('mounted');
const jc = pslDrawStore.getJlCanvas();
canvas.width = jc.properties.width;
canvas.height = jc.properties.height;
@ -66,11 +66,11 @@ onMounted(() => {
});
onUnmounted(() => {
console.log('画布属性表单unmounted');
// console.log('unmounted');
});
function onUpdate() {
console.log('画布属性更新');
// console.log('');
const app = pslDrawStore.getDrawApp();
app.updateCanvasAndRecord({
...canvas,

View File

@ -58,7 +58,7 @@ const canvas = reactive({
});
onMounted(() => {
console.log('画布属性表单mounted');
// console.log('mounted');
const jc = relayCabinetStore.getJlCanvas();
canvas.width = jc.properties.width;
canvas.height = jc.properties.height;
@ -66,11 +66,11 @@ onMounted(() => {
});
onUnmounted(() => {
console.log('画布属性表单unmounted');
// console.log('unmounted');
});
function onUpdate() {
console.log('画布属性更新');
// console.log('');
const app = relayCabinetStore.getDrawApp();
app.updateCanvasAndRecord({
...canvas,

View File

@ -1,23 +1,14 @@
<script setup lang="ts">
import { CurvatureKiloMarkerData } from 'src/drawApp/graphics/CurvatureKiloMarkerInteraction';
import { CurvatureKiloMarker } from 'src/graphics/curvatureKiloMarker/CurvatureKiloMarker';
import { useFormData } from 'src/components/DrawAppFormUtils';
import { useDrawStore } from 'src/stores/draw-store';
import { reactive, shallowRef, watchEffect } from 'vue';
const drawStore = useDrawStore();
const kiloMarkerModel = shallowRef(new CurvatureKiloMarkerData());
const kilometerSystem = reactive([
{
coordinateSystem: '',
kilometer: 0,
direction: 0,
},
{
coordinateSystem: '',
kilometer: 0,
direction: 0,
},
]);
const { data: kiloMarkerModel, onUpdate } = useFormData(
new CurvatureKiloMarkerData(),
drawStore.getDrawApp()
);
const CoordinateSystemOptions = [
{ label: '车辆段', value: 'DEPOT' },
@ -29,40 +20,6 @@ const directionOptions = [
{ label: '左行', value: 0 },
{ label: '右行', value: 1 },
];
watchEffect(() => {
const kiloMarker = drawStore.selectedGraphic;
if (kiloMarker && kiloMarker instanceof CurvatureKiloMarker) {
kiloMarkerModel.value = kiloMarker.saveData();
if (kiloMarkerModel.value.kilometerSystem.length > 0) {
kilometerSystem.forEach((ks, i) => {
ks.coordinateSystem =
kiloMarkerModel.value.kilometerSystem[i].coordinateSystem;
ks.kilometer = kiloMarkerModel.value.kilometerSystem[i].kilometer;
ks.direction = kiloMarkerModel.value.kilometerSystem[i].direction;
});
} else {
kilometerSystem.forEach((ks) => {
ks.coordinateSystem = '';
ks.kilometer = 0;
ks.direction = 0;
});
}
}
});
const onUpdate = () => {
const kiloMarker = drawStore.selectedGraphic as CurvatureKiloMarker;
kiloMarkerModel.value.kilometerSystem = kilometerSystem.map((ks) => ({
coordinateSystem: ks.coordinateSystem,
kilometer: ks.kilometer,
direction: ks.direction,
}));
if (kiloMarker) {
drawStore
.getDrawApp()
.updateGraphicAndRecord(kiloMarker, kiloMarkerModel.value);
}
};
</script>
<template>
@ -74,66 +31,61 @@ const onUpdate = () => {
label="id"
hint=""
/>
<!-- <q-input
outlined
label="索引编号"
type="textarea"
@blur="onUpdate"
v-model="logicSectionModel.index"
lazy-rules
autogrow
/> -->
<q-select
outlined
v-model="kilometerSystem[0].coordinateSystem"
:options="CoordinateSystemOptions"
:map-options="true"
:emit-value="true"
@update:model-value="onUpdate"
label="坐标系"
></q-select>
<q-input
outlined
v-model.number="kilometerSystem[0].kilometer"
type="number"
@blur="onUpdate"
label="公里标(mm):"
/>
<q-select
outlined
v-model="kilometerSystem[0].direction"
:options="directionOptions"
:map-options="true"
:emit-value="true"
@update:model-value="onUpdate"
label="方向"
></q-select>
<q-select
outlined
class="q-mt-lg"
v-model="kilometerSystem[1].coordinateSystem"
:options="CoordinateSystemOptions"
:map-options="true"
:emit-value="true"
@update:model-value="onUpdate"
label="坐标系"
></q-select>
<q-input
outlined
v-model.number="kilometerSystem[1].kilometer"
type="number"
@blur="onUpdate"
label="公里标(mm):"
/>
<q-select
outlined
v-model="kilometerSystem[1].direction"
:options="directionOptions"
:map-options="true"
:emit-value="true"
@update:model-value="onUpdate"
label="方向"
></q-select>
<template v-if="kiloMarkerModel.kilometerSystem[0]">
<q-select
outlined
v-model="kiloMarkerModel.kilometerSystem[0].coordinateSystem"
:options="CoordinateSystemOptions"
:map-options="true"
:emit-value="true"
@update:model-value="onUpdate"
label="坐标系"
></q-select>
<q-input
outlined
v-model.number="kiloMarkerModel.kilometerSystem[0].kilometer"
type="number"
@blur="onUpdate"
label="公里标(mm):"
/>
<q-select
outlined
v-model="kiloMarkerModel.kilometerSystem[0].direction"
:options="directionOptions"
:map-options="true"
:emit-value="true"
@update:model-value="onUpdate"
label="方向"
></q-select>
</template>
<template v-if="kiloMarkerModel.kilometerSystem[1]">
<q-select
outlined
class="q-mt-lg"
v-model="kiloMarkerModel.kilometerSystem[1].coordinateSystem"
:options="CoordinateSystemOptions"
:map-options="true"
:emit-value="true"
@update:model-value="onUpdate"
label="坐标系"
></q-select>
<q-input
outlined
v-model.number="kiloMarkerModel.kilometerSystem[1].kilometer"
type="number"
@blur="onUpdate"
label="公里标(mm):"
/>
<q-select
outlined
v-model="kiloMarkerModel.kilometerSystem[1].direction"
:options="directionOptions"
:map-options="true"
:emit-value="true"
@update:model-value="onUpdate"
label="方向"
></q-select>
</template>
</q-form>
</template>

View File

@ -46,32 +46,22 @@ import { CurvatureData } from 'src/drawApp/graphics/CurvatureInteraction';
import { Curvature } from 'src/graphics/curvature/Curvature';
import { CurvatureKiloMarker } from 'src/graphics/curvatureKiloMarker/CurvatureKiloMarker';
import { useDrawStore } from 'src/stores/draw-store';
import { computed, onMounted, onUnmounted, reactive, ref } from 'vue';
import { computed } from 'vue';
import { useFormData } from 'src/components/DrawAppFormUtils';
const drawStore = useDrawStore();
const curvatureModel = reactive(new CurvatureData());
const direction = ref('无曲度');
const { data: curvatureModel, onUpdate } = useFormData(
new CurvatureData(),
drawStore.getDrawApp()
);
onMounted(() => {
drawStore.bindFormData(curvatureModel);
const curvature = drawStore.selectedGraphic as Curvature;
if (curvature) {
curvatureModel.copyFrom(curvature.saveData());
if (curvatureModel.curvatureNumber !== 0) {
direction.value = curvatureModel.curvatureNumber > 0 ? '外侧' : '内侧';
}
}
});
onUnmounted(() => {
drawStore.unbindFormData(curvatureModel);
});
function onUpdate() {
const curvature = drawStore.selectedGraphic as Curvature;
if (curvature) {
drawStore.getDrawApp().updateGraphicAndRecord(curvature, curvatureModel);
}
}
const direction = computed(() =>
curvatureModel.curvatureNumber === 0
? '无曲度'
: curvatureModel.curvatureNumber > 0
? '外侧'
: '内侧'
);
const curvatureKiloMarkerRelations = computed(() => {
const curvature = drawStore.selectedGraphic as Curvature;

View File

@ -10,14 +10,14 @@
/>
<q-input
outlined
style="margin-top: 10px"
class="q-mt-sm"
v-model="esbButtonModel.code"
@blur="onUpdate"
label="名称"
/>
<q-input
outlined
style="margin-top: 10px"
class="q-mt-sm"
v-model.number="esbButtonModel.refStand"
type="number"
@blur="onUpdate"
@ -28,28 +28,13 @@
<script setup lang="ts">
import { EsbButtonData } from 'src/drawApp/graphics/EsbButtonInteraction';
import { EsbButton } from 'src/graphics/esbButton/EsbButton';
import { useFormData } from 'src/components/DrawAppFormUtils';
import { useDrawStore } from 'src/stores/draw-store';
import { onMounted, onUnmounted, reactive } from 'vue';
const drawStore = useDrawStore();
const esbButtonModel = reactive(new EsbButtonData());
onMounted(() => {
drawStore.bindFormData(esbButtonModel);
const esbButton = drawStore.selectedGraphic as EsbButton;
if (esbButton) {
esbButtonModel.copyFrom(esbButton.saveData());
}
});
onUnmounted(() => {
drawStore.unbindFormData(esbButtonModel);
});
function onUpdate() {
const esbButton = drawStore.selectedGraphic as EsbButton;
if (esbButton) {
drawStore.getDrawApp().updateGraphicAndRecord(esbButton, esbButtonModel);
}
}
const { data: esbButtonModel, onUpdate } = useFormData(
new EsbButtonData(),
drawStore.getDrawApp()
);
</script>

View File

@ -10,6 +10,7 @@
/>
<q-input
outlined
class="q-mt-sm"
v-model="gatedBoxModel.code"
@blur="onUpdate"
label="名称"
@ -19,28 +20,11 @@
<script setup lang="ts">
import { GatedBoxData } from 'src/drawApp/graphics/GatedBoxInteraction';
import { GatedBox } from 'src/graphics/gatedBox/GatedBox';
import { useFormData } from 'src/components/DrawAppFormUtils';
import { useDrawStore } from 'src/stores/draw-store';
import { onMounted, onUnmounted, reactive } from 'vue';
const drawStore = useDrawStore();
const gatedBoxModel = reactive(new GatedBoxData());
onMounted(() => {
drawStore.bindFormData(gatedBoxModel);
const gatedBox = drawStore.selectedGraphic as GatedBox;
if (gatedBox) {
gatedBoxModel.copyFrom(gatedBox.saveData());
}
});
onUnmounted(() => {
drawStore.unbindFormData(gatedBoxModel);
});
function onUpdate() {
const gatedBox = drawStore.selectedGraphic as GatedBox;
if (gatedBox) {
drawStore.getDrawApp().updateGraphicAndRecord(gatedBox, gatedBoxModel);
}
}
const { data: gatedBoxModel, onUpdate } = useFormData(
new GatedBoxData(),
useDrawStore().getDrawApp()
);
</script>

View File

@ -11,27 +11,28 @@
/>
<q-input
outlined
class="q-mt-sm"
v-model.number="linkModel.length"
readonly
type="number"
@blur="onUpdate"
label="长度"
/>
<q-field class="q-mt-lg" outlined label="A端关联设备" readonly stack-label>
<q-field class="q-mt-sm" outlined label="A端关联设备" readonly stack-label>
<template #control>
<q-chip color="primary" text-color="white" square>{{
aRelation
}}</q-chip>
</template>
</q-field>
<q-field class="q-mt-lg" outlined label="B端关联设备" readonly stack-label>
<q-field class="q-mt-sm" outlined label="B端关联设备" readonly stack-label>
<template #control>
<q-chip color="primary" text-color="white" square>{{
bRelation
}}</q-chip>
</template>
</q-field>
<q-field class="q-mt-lg" outlined label="关联设备位置" readonly stack-label>
<q-field class="q-mt-sm" outlined label="关联设备位置" readonly stack-label>
<template #control>
<q-chip
color="primary"
@ -53,11 +54,14 @@ import { Section } from 'src/graphics/section/Section';
import { Signal } from 'src/graphics/signal/Signal';
import { Turnout } from 'src/graphics/turnout/Turnout';
import { useDrawStore } from 'src/stores/draw-store';
import { onMounted, reactive, computed, onUnmounted } from 'vue';
import { computed } from 'vue';
import { useFormData } from 'src/components/DrawAppFormUtils';
const drawStore = useDrawStore();
const linkModel = reactive(new LinkData());
const sectionList: { label: string; value: string }[] = reactive([]);
const { data: linkModel, onUpdate } = useFormData(
new LinkData(),
drawStore.getDrawApp()
);
const portList = ['A', 'B', 'C'];
const aRelation = computed(() => {
@ -89,31 +93,4 @@ const deviceRelations = computed(() => {
});
return relations;
});
onMounted(() => {
drawStore.bindFormData(linkModel);
const link = drawStore.selectedGraphic as Link;
const sections = drawStore
.getDrawApp()
.queryStore.queryByType<Section>(Section.Type);
sections.forEach((se) => {
sectionList.push({
value: se.id,
label: `${se.datas.code}[${se.datas.index}]`,
});
});
if (link) {
linkModel.copyFrom(link.saveData());
}
});
onUnmounted(() => {
drawStore.unbindFormData(linkModel);
});
function onUpdate() {
const link = drawStore.selectedGraphic as Link;
if (link) {
drawStore.getDrawApp().updateGraphicAndRecord(link, linkModel);
}
}
</script>

View File

@ -51,30 +51,14 @@ import { LogicSectionData } from 'src/drawApp/graphics/LogicSectionInteraction';
import { AxleCountingSection } from 'src/graphics/axleCountingSection/AxleCountingSection';
import { LogicSection } from 'src/graphics/logicSection/LogicSection';
import { useDrawStore } from 'src/stores/draw-store';
import { computed, onMounted, onUnmounted, reactive } from 'vue';
import { computed } from 'vue';
import { useFormData } from 'src/components/DrawAppFormUtils';
const drawStore = useDrawStore();
const logicSectionModel = reactive(new LogicSectionData());
onMounted(() => {
drawStore.bindFormData(logicSectionModel);
const logicSection = drawStore.selectedGraphic as LogicSection;
if (logicSection) {
logicSectionModel.copyFrom(logicSection.saveData());
}
});
onUnmounted(() => {
drawStore.unbindFormData(logicSectionModel);
});
function onUpdate() {
const logicSection = drawStore.selectedGraphic as LogicSection;
if (logicSection) {
drawStore
.getDrawApp()
.updateGraphicAndRecord(logicSection, logicSectionModel);
}
}
const { data: logicSectionModel, onUpdate } = useFormData(
new LogicSectionData(),
drawStore.getDrawApp()
);
const logicSectionRelations = computed(() => {
const logicSection = drawStore.selectedGraphic as LogicSection;

View File

@ -18,14 +18,18 @@
<q-select
outlined
@blur="onUpdate"
v-model="hasDoor"
v-model="platformModel.hasdoor"
emit-value
map-options
:options="optionsDoor"
label="是否有屏蔽门"
/>
<q-select
outlined
@blur="onUpdate"
v-model="direction"
v-model="platformModel.direction"
emit-value
map-options
:options="optionsDirection"
label="方向"
/>
@ -34,48 +38,20 @@
<script setup lang="ts">
import { PlatformData } from 'src/drawApp/graphics/PlatformInteraction';
import { Platform } from 'src/graphics/platform/Platform';
import { useFormData } from 'src/components/DrawAppFormUtils';
import { useDrawStore } from 'src/stores/draw-store';
import { onMounted, onUnmounted, reactive, ref } from 'vue';
const drawStore = useDrawStore();
const platformModel = reactive(new PlatformData());
const hasDoor = ref('是');
const optionsDoor = ['是', '否'];
const direction = ref('向上');
const optionsDirection = ['向上', '向下'];
enum showSelect {
= 'true',
= 'false',
向上 = 'up',
向下 = 'down',
}
enum showSelectData {
true = '是',
false = '否',
up = '向上',
down = '向下',
}
const { data: platformModel, onUpdate } = useFormData(
new PlatformData(),
useDrawStore().getDrawApp()
);
onMounted(() => {
drawStore.bindFormData(platformModel);
const platform = drawStore.selectedGraphic as Platform;
if (platform) {
platformModel.copyFrom(platform.saveData());
hasDoor.value = (showSelectData as never)[platformModel.hasdoor + ''];
direction.value = (showSelectData as never)[platformModel.direction];
}
});
onUnmounted(() => {
drawStore.unbindFormData(platformModel);
});
function onUpdate() {
platformModel.hasdoor = JSON.parse((showSelect as never)[hasDoor.value]);
platformModel.direction = (showSelect as never)[direction.value];
const platform = drawStore.selectedGraphic as Platform;
if (platform) {
drawStore.getDrawApp().updateGraphicAndRecord(platform, platformModel);
}
}
const optionsDoor = [
{ label: '是', value: true },
{ label: '否', value: false },
];
const optionsDirection = [
{ label: '向上', value: 'up' },
{ label: '向下', value: 'down' },
];
</script>

View File

@ -10,7 +10,7 @@
/>
<q-input
outlined
style="margin-top: 10px"
class="q-mt-sm"
v-model="pslButtonModel.topAnnotation"
@blur="onUpdate"
label="上方注释"
@ -18,7 +18,7 @@
/>
<q-select
outlined
style="margin-top: 10px"
class="q-mt-sm"
v-model="pslButtonModel.buttonColor"
:options="optionsButtonColor"
:map-options="true"
@ -31,40 +31,17 @@
<script setup lang="ts">
import { PslButtonData } from 'src/drawApp/graphics/PslButtonInteraction';
import { PslButton } from 'src/graphics/pslButton/pslButton';
import { pslGraphicData } from 'src/protos/pslGraphics';
import { useFormData } from 'src/components/DrawAppFormUtils';
import { usePslDrawStore } from 'src/stores/psl-draw-store';
import { onMounted, reactive, watch } from 'vue';
const pslDrawStore = usePslDrawStore();
const pslButtonModel = reactive(new PslButtonData());
pslDrawStore.$subscribe;
watch(
() => pslDrawStore.selectedGraphic,
(val) => {
if (val && val.type == PslButton.Type) {
pslButtonModel.copyFrom(val.saveData() as PslButtonData);
}
}
const { data: pslButtonModel, onUpdate } = useFormData(
new PslButtonData(),
usePslDrawStore().getDrawApp()
);
const optionsButtonColor = [
{ label: '红色', value: pslGraphicData.PslElementColor.red },
{ label: '绿色', value: pslGraphicData.PslElementColor.green },
];
onMounted(() => {
const pslButton = pslDrawStore.selectedGraphic as PslButton;
if (pslButton) {
pslButtonModel.copyFrom(pslButton.saveData());
}
});
function onUpdate() {
const pslButton = pslDrawStore.selectedGraphic as PslButton;
if (pslButton) {
pslDrawStore.getDrawApp().updateGraphicAndRecord(pslButton, pslButtonModel);
}
}
</script>

View File

@ -10,7 +10,7 @@
/>
<q-input
outlined
style="margin-top: 10px"
class="q-mt-sm"
v-model="pslKeyModel.topAnnotation"
@blur="onUpdate"
label="上方注释"
@ -18,7 +18,7 @@
/>
<q-input
outlined
style="margin-top: 10px"
class="q-mt-sm"
v-model="pslKeyModel.rightAnnotation"
@blur="onUpdate"
label="右侧注释"
@ -29,34 +29,12 @@
<script setup lang="ts">
import { PslKeyData } from 'src/drawApp/graphics/PslKeyInteraction';
import { PslKey } from 'src/graphics/pslKey/pslKey';
import { usePslDrawStore } from 'src/stores/psl-draw-store';
import { onMounted, reactive, watch } from 'vue';
import { useFormData } from 'src/components/DrawAppFormUtils';
const pslDrawStore = usePslDrawStore();
const pslKeyModel = reactive(new PslKeyData());
pslDrawStore.$subscribe;
watch(
() => pslDrawStore.selectedGraphic,
(val) => {
if (val && val.type == PslKey.Type) {
pslKeyModel.copyFrom(val.saveData() as PslKeyData);
}
}
const { data: pslKeyModel, onUpdate } = useFormData(
new PslKeyData(),
pslDrawStore.getDrawApp()
);
onMounted(() => {
const pslKey = pslDrawStore.selectedGraphic as PslKey;
if (pslKey) {
pslKeyModel.copyFrom(pslKey.saveData());
}
});
function onUpdate() {
const pslKey = pslDrawStore.selectedGraphic as PslKey;
if (pslKey) {
pslDrawStore.getDrawApp().updateGraphicAndRecord(pslKey, pslKeyModel);
}
}
</script>

View File

@ -10,7 +10,7 @@
/>
<q-input
outlined
style="margin-top: 10px"
class="q-mt-sm"
v-model="pslLightModel.topAnnotation"
@blur="onUpdate"
label="上方注释"
@ -18,7 +18,7 @@
/>
<q-select
outlined
style="margin-top: 10px"
class="q-mt-sm"
v-model="pslLightModel.lightColor"
:options="optionsLightColor"
:map-options="true"
@ -31,22 +31,13 @@
<script setup lang="ts">
import { PslLightData } from 'src/drawApp/graphics/PslLightInteraction';
import { PslLight } from 'src/graphics/pslLight/pslLight';
import { pslGraphicData } from 'src/protos/pslGraphics';
import { usePslDrawStore } from 'src/stores/psl-draw-store';
import { onMounted, reactive, watch } from 'vue';
import { useFormData } from 'src/components/DrawAppFormUtils';
const pslDrawStore = usePslDrawStore();
const pslLightModel = reactive(new PslLightData());
pslDrawStore.$subscribe;
watch(
() => pslDrawStore.selectedGraphic,
(val) => {
if (val && val.type == PslLight.Type) {
pslLightModel.copyFrom(val.saveData() as PslLightData);
}
}
const { data: pslLightModel, onUpdate } = useFormData(
new PslLightData(),
pslDrawStore.getDrawApp()
);
const optionsLightColor = [
@ -54,18 +45,4 @@ const optionsLightColor = [
{ label: '绿色', value: pslGraphicData.PslElementColor.green },
{ label: '蓝色', value: pslGraphicData.PslElementColor.blue },
];
onMounted(() => {
const pslLight = pslDrawStore.selectedGraphic as PslLight;
if (pslLight) {
pslLightModel.copyFrom(pslLight.saveData());
}
});
function onUpdate() {
const pslLight = pslDrawStore.selectedGraphic as PslLight;
if (pslLight) {
pslDrawStore.getDrawApp().updateGraphicAndRecord(pslLight, pslLightModel);
}
}
</script>

View File

@ -67,34 +67,12 @@
<script setup lang="ts">
import { RectData } from 'src/drawApp/graphics/RectInteraction';
import { Rect } from 'src/graphics/rect/Rect';
import { useDrawStore } from 'src/stores/draw-store';
import { onMounted, reactive, watch } from 'vue';
import { useFormData } from 'src/components/DrawAppFormUtils';
const drawStore = useDrawStore();
const rectModel = reactive(new RectData());
drawStore.$subscribe;
watch(
() => drawStore.selectedGraphic,
(val) => {
if (val && val.type == Rect.Type) {
rectModel.copyFrom(val.saveData() as RectData);
}
}
const { data: rectModel, onUpdate } = useFormData(
new RectData(),
drawStore.getDrawApp()
);
onMounted(() => {
const Rect = drawStore.selectedGraphic as Rect;
if (Rect) {
rectModel.copyFrom(Rect.saveData());
}
});
function onUpdate() {
const Rect = drawStore.selectedGraphic as Rect;
if (Rect) {
drawStore.getDrawApp().updateGraphicAndRecord(Rect, rectModel);
}
}
</script>

View File

@ -27,7 +27,7 @@
v-for="(
combinationtype, index
) in relateRelayConfig.combinationtypes"
:key="combinationtype"
:key="combinationtype.code"
v-model="combinationtype.expanded"
:label="combinationtype.code"
@click="toggleItem(index)"

View File

@ -14,36 +14,13 @@
<script setup lang="ts">
import { RelayCabinetData } from 'src/drawApp/relayCabinetGraphics/RelayCabinetInteraction';
import { RelayCabinet } from 'src/graphics/relayCabinet/RelayCabinet';
import { useRelayCabinetStore } from 'src/stores/relayCabinet-store';
import { onMounted, reactive, watch } from 'vue';
import { useFormData } from 'src/components/DrawAppFormUtils';
const relayCabinetStore = useRelayCabinetStore();
const relayCabinetModel = reactive(new RelayCabinetData());
relayCabinetStore.$subscribe;
watch(
() => relayCabinetStore.selectedGraphic,
(val) => {
if (val && val.type == RelayCabinet.Type) {
relayCabinetModel.copyFrom(val.saveData() as RelayCabinetData);
}
}
const { data: relayCabinetModel, onUpdate } = useFormData(
new RelayCabinetData(),
relayCabinetStore.getDrawApp()
);
onMounted(() => {
const RelayCabinet = relayCabinetStore.selectedGraphic as RelayCabinet;
if (RelayCabinet) {
relayCabinetModel.copyFrom(RelayCabinet.saveData());
}
});
function onUpdate() {
const RelayCabinet = relayCabinetStore.selectedGraphic as RelayCabinet;
if (RelayCabinet) {
relayCabinetStore
.getDrawApp()
.updateGraphicAndRecord(RelayCabinet, relayCabinetModel);
}
}
</script>

View File

@ -24,12 +24,14 @@
<script setup lang="ts">
import { RelayData } from 'src/drawApp/relayCabinetGraphics/RelayInteraction';
import { Relay } from 'src/graphics/relay/Relay';
import { useRelayCabinetStore } from 'src/stores/relayCabinet-store';
import { onMounted, reactive, watch } from 'vue';
import { useFormData } from 'src/components/DrawAppFormUtils';
const relayCabinetStore = useRelayCabinetStore();
const relayModel = reactive(new RelayData());
const { data: relayModel, onUpdate } = useFormData(
new RelayData(),
relayCabinetStore.getDrawApp()
);
const optionsModel = [
'JPXC-1000',
'JPXC-1700',
@ -40,27 +42,4 @@ const optionsModel = [
'JYJXC-160/260',
'JZXC-H18',
];
watch(
() => relayCabinetStore.selectedGraphic,
(val) => {
if (val && val.type == Relay.Type) {
relayModel.copyFrom(val.saveData() as RelayData);
}
}
);
onMounted(() => {
const relay = relayCabinetStore.selectedGraphic as Relay;
if (relay) {
relayModel.copyFrom(relay.saveData());
}
});
function onUpdate() {
const relay = relayCabinetStore.selectedGraphic as Relay;
if (relay) {
relayCabinetStore.getDrawApp().updateGraphicAndRecord(relay, relayModel);
}
}
</script>

View File

@ -68,70 +68,50 @@
import { SectionLink } from 'src/graphics/sectionLink/SectionLink';
import { SectionLinkData } from 'src/drawApp/graphics/SectionLinkInteraction';
import { useDrawStore } from 'src/stores/draw-store';
import { shallowRef, watchEffect, ref } from 'vue';
import { computed } from 'vue';
import { AxleCounting } from 'src/graphics/axleCounting/AxleCounting';
import { Turnout } from 'src/graphics/turnout/Turnout';
import { useFormData } from 'src/components/DrawAppFormUtils';
const drawStore = useDrawStore();
const sectionLinkModel = shallowRef(new SectionLinkData());
const aSimRef = ref('');
const bSimRef = ref('');
const aRef = ref('');
const bRef = ref('');
const { data: sectionLinkModel, onUpdate } = useFormData(
new SectionLinkData(),
drawStore.getDrawApp()
);
watchEffect(() => {
const sectionLink = drawStore.selectedGraphic;
const portList = ['A', 'B', 'C'];
if (sectionLink && sectionLink instanceof SectionLink) {
sectionLinkModel.value = sectionLink.saveData();
aSimRef.value = '';
bSimRef.value = '';
aRef.value = '';
bRef.value = '';
if (sectionLinkModel.value.aSimRef) {
const g = drawStore
const aSimRef = computed(() =>
sectionLinkModel.aSimRef?.id
? drawStore
.getDrawApp()
.queryStore.queryById(sectionLinkModel.value.aSimRef.id) as
| AxleCounting
| Turnout;
aSimRef.value = g.datas.code;
}
if (sectionLinkModel.value.bSimRef) {
const g = drawStore
.queryStore.queryById<AxleCounting | Turnout>(
sectionLinkModel.aSimRef.id
).datas.code
: ''
);
const bSimRef = computed(() =>
sectionLinkModel.bSimRef?.id
? drawStore
.getDrawApp()
.queryStore.queryById(sectionLinkModel.value.bSimRef.id) as
| AxleCounting
| Turnout;
bSimRef.value = g.datas.code;
}
if (sectionLinkModel.value.aRef) {
const g = drawStore
.queryStore.queryById<AxleCounting | Turnout>(
sectionLinkModel.bSimRef.id
).datas.code
: ''
);
const aRef = computed(() =>
sectionLinkModel.aRef?.id
? drawStore
.getDrawApp()
.queryStore.queryById(sectionLinkModel.value.aRef.id) as
| SectionLink
| Turnout;
aRef.value =
g.datas.code + '_' + portList[sectionLinkModel.value.aRef.devicePort];
}
if (sectionLinkModel.value.bRef) {
const g = drawStore
.queryStore.queryById<SectionLink | Turnout>(sectionLinkModel.aRef.id)
.datas.code
: ''
);
const bRef = computed(() =>
sectionLinkModel.bRef?.id
? drawStore
.getDrawApp()
.queryStore.queryById(sectionLinkModel.value.bRef.id) as
| SectionLink
| Turnout;
bRef.value =
g.datas.code + '_' + portList[sectionLinkModel.value.bRef.devicePort];
}
}
});
const onUpdate = () => {
const sectionLink = drawStore.selectedGraphic as SectionLink;
if (sectionLink) {
drawStore
.getDrawApp()
.updateGraphicAndRecord(sectionLink, sectionLinkModel.value);
}
};
.queryStore.queryById<SectionLink | Turnout>(sectionLinkModel.bRef.id)
.datas.code
: ''
);
</script>

View File

@ -12,7 +12,7 @@
outlined
class="q-mt-lg"
v-model="sectionModel.code"
@blur="onUpdate"
@change="onUpdate"
label="编号"
/>
<q-input
@ -105,14 +105,18 @@ import { Section } from 'src/graphics/section/Section';
import { Turnout } from 'src/graphics/turnout/Turnout';
import { graphicData } from 'src/protos/stationLayoutGraphics';
import { useDrawStore } from 'src/stores/draw-store';
import { computed, shallowRef, watchEffect } from 'vue';
import { computed } from 'vue';
import { useFormData } from 'src/components/DrawAppFormUtils';
const drawStore = useDrawStore();
const sectionModel = shallowRef(new SectionData());
const { data: sectionModel, onUpdate } = useFormData(
new SectionData(),
drawStore.getDrawApp()
);
const sectionTypeText = computed(() => {
return ['物理区段', '', '道岔物理区段'][sectionModel.value.sectionType];
return ['物理区段', '', '道岔物理区段'][sectionModel.sectionType];
});
const sectionRelations = computed(() => {
@ -159,18 +163,4 @@ const axleCountingRelations = computed(() => {
(relation) => relation.getOtherGraphic<AxleCounting>(section).datas.code
);
});
watchEffect(() => {
const section = drawStore.selectedGraphic;
if (section && section instanceof Section) {
sectionModel.value = section.saveData();
}
});
const onUpdate = () => {
const section = drawStore.selectedGraphic as Section;
if (section) {
drawStore.getDrawApp().updateGraphicAndRecord(section, sectionModel.value);
}
};
</script>

View File

@ -4,7 +4,7 @@
<q-select
outlined
style="margin-top: 10px"
class="q-mt-sm"
v-model="separatorModel.separatorType"
:options="typeOptions"
:map-options="true"
@ -16,13 +16,14 @@
</template>
<script setup lang="ts">
import { useFormData } from 'src/components/DrawAppFormUtils';
import { SeparatorData } from 'src/drawApp/graphics/SeparatorInteraction';
import { Separator } from 'src/graphics/separator/Separator';
import { useDrawStore } from 'src/stores/draw-store';
import { onMounted, onUnmounted, reactive } from 'vue';
const drawStore = useDrawStore();
const separatorModel = reactive(new SeparatorData());
const { data: separatorModel, onUpdate } = useFormData(
new SeparatorData(),
useDrawStore().getDrawApp()
);
const typeOptions = [
{ label: '区段分隔符', value: 'section' },
@ -30,22 +31,4 @@ const typeOptions = [
{ label: '左断路分隔符', value: 'endA' },
{ label: '右断路分隔符', value: 'endB' },
];
onMounted(() => {
drawStore.bindFormData(separatorModel);
const Separator = drawStore.selectedGraphic as Separator;
if (Separator) {
separatorModel.copyFrom(Separator.saveData());
}
});
onUnmounted(() => {
drawStore.unbindFormData(separatorModel);
});
function onUpdate() {
const Separator = drawStore.selectedGraphic as Separator;
if (Separator) {
drawStore.getDrawApp().updateGraphicAndRecord(Separator, separatorModel);
}
}
</script>

View File

@ -9,6 +9,7 @@
/>
<q-input
outlined
class="q-mt-sm"
v-model.number="signalModel.index"
type="number"
@blur="onUpdate"
@ -16,8 +17,8 @@
/>
<q-select
outlined
style="margin-top: 10px"
v-model="kilometerSystem.coordinateSystem"
class="q-mt-sm"
v-model="signalModel.kilometerSystem.coordinateSystem"
:options="CoordinateSystemOptions"
:map-options="true"
:emit-value="true"
@ -26,8 +27,8 @@
></q-select>
<q-select
outlined
style="margin-top: 10px"
v-model="kilometerSystem.direction"
class="q-mt-sm"
v-model="signalModel.kilometerSystem.direction"
:options="directionOptions"
:map-options="true"
:emit-value="true"
@ -36,51 +37,33 @@
></q-select>
<q-input
outlined
style="margin-top: 10px"
v-model.number="kilometerSystem.kilometer"
class="q-mt-sm"
v-model.number="signalModel.kilometerSystem.kilometer"
type="number"
@blur="onUpdate"
label="公里标(mm):"
/>
<q-select
outlined
style="margin-top: 10px"
v-model="refDevData.deviceType"
class="q-mt-sm"
:model-value="refDevData.deviceType"
:options="DeviceTypeOptions"
:readonly="true"
:map-options="true"
:emit-value="true"
@update:model-value="onUpdate"
readonly
map-options
emit-value
label="关联设备类型:"
></q-select>
<q-select
<q-input
outlined
v-if="refDevData.deviceType === graphicData.RelatedRef.DeviceType.Section"
style="margin-top: 10px"
v-model="refDevData.id"
class="q-mt-sm"
:model-value="refDevData.code"
:readonly="true"
:options="sectionList"
:map-options="true"
:emit-value="true"
@update:model-value="onUpdate"
label="关联设备:"
></q-select>
></q-input>
<q-select
outlined
v-if="refDevData.deviceType === graphicData.RelatedRef.DeviceType.Turnout"
style="margin-top: 10px"
v-model="refDevData.id"
:options="turnoutList"
:readonly="true"
:map-options="true"
:emit-value="true"
@update:model-value="onUpdate"
label="关联设备:"
></q-select>
<q-select
outlined
v-if="refDevData.deviceType === graphicData.RelatedRef.DeviceType.Turnout"
style="margin-top: 10px"
class="q-mt-sm"
v-model="refDevData.devicePort"
:options="DevicePortOptions"
:readonly="true"
@ -93,27 +76,34 @@
</template>
<script setup lang="ts">
import { useFormData } from 'src/components/DrawAppFormUtils';
import { SignalData } from 'src/drawApp/graphics/SignalInteraction';
import { Section } from 'src/graphics/section/Section';
import { Direction, Signal } 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 { onMounted, onUnmounted, reactive } from 'vue';
import { computed } from 'vue';
const drawStore = useDrawStore();
const signalModel = reactive(new SignalData());
const kilometerSystem = reactive({
coordinateSystem: '',
kilometer: 0,
direction: Direction.LEFT,
});
const sectionList: { label: string; value: string }[] = reactive([]);
const turnoutList: { label: string; value: string }[] = reactive([]);
const refDevData = reactive({
id: '',
deviceType: graphicData.RelatedRef.DeviceType.Section,
devicePort: graphicData.RelatedRef.DevicePort.A,
const { data: signalModel, onUpdate } = useFormData(
new SignalData(),
drawStore.getDrawApp()
);
const refDevData = computed(() => {
return signalModel.refDev.id
? {
...signalModel.refDev.toObject(),
code: drawStore
.getDrawApp()
.queryStore.queryById<Section | Turnout>(signalModel.refDev.id).datas
.code,
}
: {
id: '',
deviceType: graphicData.RelatedRef.DeviceType.Section,
devicePort: graphicData.RelatedRef.DevicePort.A,
code: '',
};
});
const DeviceTypeOptions = [
{ label: '区段', value: graphicData.RelatedRef.DeviceType.Section },
@ -134,74 +124,4 @@ const directionOptions = [
{ label: '左行', value: 0 },
{ label: '右行', value: 1 },
];
function initRefData(signal: Signal) {
signalModel.copyFrom(signal.saveData());
if (signalModel.kilometerSystem) {
kilometerSystem.coordinateSystem =
signalModel.kilometerSystem.coordinateSystem;
kilometerSystem.kilometer = signalModel.kilometerSystem.kilometer;
}
if (signalModel.refDev) {
refDevData.id = signalModel.refDev.id;
refDevData.devicePort = signalModel.refDev.devicePort;
refDevData.deviceType = signalModel.refDev.deviceType;
} else {
refDevData.id = '';
refDevData.deviceType = graphicData.RelatedRef.DeviceType.Section;
refDevData.devicePort = graphicData.RelatedRef.DevicePort.A;
}
}
function initDeviceList() {
const sections = drawStore
.getDrawApp()
.queryStore.queryByType<Section>(Section.Type);
sections.forEach((sec) => {
sectionList.push({
label: `${sec.datas.code}[${sec.datas.index}]`,
value: sec.datas.id,
});
});
const trunouts = drawStore
.getDrawApp()
.queryStore.queryByType<Turnout>(Turnout.Type);
trunouts.forEach((tur) => {
turnoutList.push({
label: `${tur.datas.code}[${tur.datas.index}]`,
value: tur.datas.id,
});
});
}
onMounted(() => {
drawStore.bindFormData(signalModel);
const signal = drawStore.selectedGraphic as Signal;
if (signal) {
initDeviceList();
initRefData(signal);
}
});
onUnmounted(() => {
drawStore.unbindFormData(signalModel);
});
function onUpdate() {
const signal = drawStore.selectedGraphic as Signal;
signalModel.kilometerSystem = {
coordinateSystem: kilometerSystem.coordinateSystem,
kilometer: kilometerSystem.kilometer,
direction: kilometerSystem.direction,
};
if (refDevData.id) {
signalModel.refDev = new graphicData.RelatedRef({
id: refDevData.id,
deviceType: refDevData.deviceType,
devicePort:
refDevData.deviceType === graphicData.RelatedRef.DeviceType.Section
? graphicData.RelatedRef.DevicePort.A
: refDevData.devicePort,
});
}
if (signal) {
drawStore.getDrawApp().updateGraphicAndRecord(signal, signalModel);
}
}
</script>

View File

@ -1,23 +1,14 @@
<script setup lang="ts">
import { SlopeKiloMarkerData } from 'src/drawApp/graphics/SlopeKiloMarkerInteraction';
import { SlopeKiloMarker } from 'src/graphics/slopeKiloMarker/SlopeKiloMarker';
import { useDrawStore } from 'src/stores/draw-store';
import { reactive, shallowRef, watchEffect } from 'vue';
import { useFormData } from 'src/components/DrawAppFormUtils';
const drawStore = useDrawStore();
const kiloMarkerModel = shallowRef(new SlopeKiloMarkerData());
const kilometerSystem = reactive([
{
coordinateSystem: '',
kilometer: 0,
direction: 0,
},
{
coordinateSystem: '',
kilometer: 0,
direction: 0,
},
]);
const { data: kiloMarkerModel, onUpdate } = useFormData(
new SlopeKiloMarkerData(),
drawStore.getDrawApp()
);
const CoordinateSystemOptions = [
{ label: '车辆段', value: 'DEPOT' },
@ -29,112 +20,67 @@ const directionOptions = [
{ label: '左行', value: 0 },
{ label: '右行', value: 1 },
];
watchEffect(() => {
const kiloMarker = drawStore.selectedGraphic;
if (kiloMarker && kiloMarker instanceof SlopeKiloMarker) {
kiloMarkerModel.value = kiloMarker.saveData();
if (kiloMarkerModel.value.kilometerSystem.length > 0) {
kilometerSystem.forEach((ks, i) => {
ks.coordinateSystem =
kiloMarkerModel.value.kilometerSystem[i].coordinateSystem;
ks.kilometer = kiloMarkerModel.value.kilometerSystem[i].kilometer;
ks.direction = kiloMarkerModel.value.kilometerSystem[i].direction;
});
} else {
kilometerSystem.forEach((ks) => {
ks.coordinateSystem = '';
ks.kilometer = 0;
ks.direction = 0;
});
}
}
});
const onUpdate = () => {
const kiloMarker = drawStore.selectedGraphic as SlopeKiloMarker;
kiloMarkerModel.value.kilometerSystem = kilometerSystem.map((ks) => ({
coordinateSystem: ks.coordinateSystem,
kilometer: ks.kilometer,
direction: ks.direction,
}));
if (kiloMarker) {
drawStore
.getDrawApp()
.updateGraphicAndRecord(kiloMarker, kiloMarkerModel.value);
}
};
</script>
<template>
<q-form class="q-gutter-sm">
<q-input
outlined
readonly
v-model="kiloMarkerModel.id"
label="id"
hint=""
/>
<!-- <q-input
outlined
label="索引编号"
type="textarea"
@blur="onUpdate"
v-model="logicSectionModel.index"
lazy-rules
autogrow
/> -->
<q-select
outlined
v-model="kilometerSystem[0].coordinateSystem"
:options="CoordinateSystemOptions"
:map-options="true"
:emit-value="true"
@update:model-value="onUpdate"
label="坐标系"
></q-select>
<q-input
outlined
v-model.number="kilometerSystem[0].kilometer"
type="number"
@blur="onUpdate"
label="公里标(mm):"
/>
<q-select
outlined
v-model="kilometerSystem[0].direction"
:options="directionOptions"
:map-options="true"
:emit-value="true"
@update:model-value="onUpdate"
label="方向"
></q-select>
<q-select
outlined
class="q-mt-lg"
v-model="kilometerSystem[1].coordinateSystem"
:options="CoordinateSystemOptions"
:map-options="true"
:emit-value="true"
@update:model-value="onUpdate"
label="坐标系"
></q-select>
<q-input
outlined
v-model.number="kilometerSystem[1].kilometer"
type="number"
@blur="onUpdate"
label="公里标(mm):"
/>
<q-select
outlined
v-model="kilometerSystem[1].direction"
:options="directionOptions"
:map-options="true"
:emit-value="true"
@update:model-value="onUpdate"
label="方向"
></q-select>
</q-form>
<QForm class="q-gutter-sm">
<QInput outlined readonly v-model="kiloMarkerModel.id" label="id" hint="" />
<template v-if="kiloMarkerModel.kilometerSystem[0]">
<QSelect
outlined
v-model="kiloMarkerModel.kilometerSystem[0].coordinateSystem"
:options="CoordinateSystemOptions"
:map-options="true"
:emit-value="true"
@update:model-value="onUpdate"
label="坐标系"
></QSelect>
<QInput
outlined
v-model.number="kiloMarkerModel.kilometerSystem[0].kilometer"
type="number"
@blur="onUpdate"
label="公里标(mm):"
/>
<QSelect
outlined
v-model="kiloMarkerModel.kilometerSystem[0].direction"
:options="directionOptions"
:map-options="true"
:emit-value="true"
@update:model-value="onUpdate"
label="方向"
></QSelect>
</template>
<template v-if="kiloMarkerModel.kilometerSystem[1]">
<QSelect
outlined
class="q-mt-lg"
v-model="kiloMarkerModel.kilometerSystem[1].coordinateSystem"
:options="CoordinateSystemOptions"
:map-options="true"
:emit-value="true"
@update:model-value="onUpdate"
label="坐标系"
></QSelect>
<QInput
outlined
v-model.number="kiloMarkerModel.kilometerSystem[1].kilometer"
type="number"
@blur="onUpdate"
label="公里标(mm):"
/>
<QSelect
outlined
v-model="kiloMarkerModel.kilometerSystem[1].direction"
:options="directionOptions"
:map-options="true"
:emit-value="true"
@update:model-value="onUpdate"
label="方向"
></QSelect>
</template>
</QForm>
</template>
<style scoped></style>

View File

@ -52,47 +52,30 @@
</template>
<script setup lang="ts">
import { useFormData } from 'src/components/DrawAppFormUtils';
import { SlopeData } from 'src/drawApp/graphics/SlopeInteraction';
import { Slope } from 'src/graphics/slope/Slope';
import { SlopeKiloMarker } from 'src/graphics/slopeKiloMarker/SlopeKiloMarker';
import { useDrawStore } from 'src/stores/draw-store';
import { computed, onMounted, reactive, ref, watch } from 'vue';
import { computed } from 'vue';
const drawStore = useDrawStore();
const slopeModel = reactive(new SlopeData());
const direction = ref('无坡度');
const slopeLong = ref(0);
drawStore.$subscribe;
watch(
() => drawStore.selectedGraphic,
(val) => {
if (val && val.type == Slope.Type) {
slopeModel.copyFrom(val.saveData() as SlopeData);
if (slopeModel.slopeNumber !== 0) {
direction.value = slopeModel.slopeNumber > 0 ? '上坡' : '下坡';
}
}
}
const { data: slopeModel, onUpdate } = useFormData(
new SlopeData(),
drawStore.getDrawApp()
);
const direction = computed(() =>
slopeModel.slopeNumber === 0
? '无坡度'
: slopeModel.slopeNumber > 0
? '上坡'
: '下坡'
);
const slopeLong = computed(() =>
drawStore.selectedGraphic instanceof Slope
? drawStore.selectedGraphic.slopeLong.text
: ''
);
onMounted(() => {
const slope = drawStore.selectedGraphic as Slope;
if (slope) {
slopeModel.copyFrom(slope.saveData());
if (slopeModel.slopeNumber !== 0) {
direction.value = slopeModel.slopeNumber > 0 ? '上坡' : '下坡';
}
slopeLong.value = +slope.slopeLong.text;
}
});
function onUpdate() {
const slope = drawStore.selectedGraphic as Slope;
if (slope) {
drawStore.getDrawApp().updateGraphicAndRecord(slope, slopeModel);
}
}
const slopeKiloMarkerRelations = computed(() => {
const slope = drawStore.selectedGraphic as Slope;

View File

@ -44,19 +44,20 @@
</template>
<script setup lang="ts">
import { useFormData } from 'src/components/DrawAppFormUtils';
import { SpksSwitchData } from 'src/drawApp/graphics/SpksSwitchInteraction';
import { Section } from 'src/graphics/section/Section';
import { SpksSwitch } from 'src/graphics/spksSwitch/SpksSwitch';
import { useDrawStore } from 'src/stores/draw-store';
import { onMounted, onUnmounted, reactive } from 'vue';
import { onMounted, reactive } from 'vue';
const drawStore = useDrawStore();
const spksSwitchModel = reactive(new SpksSwitchData());
const { data: spksSwitchModel, onUpdate } = useFormData(
new SpksSwitchData(),
drawStore.getDrawApp()
);
const sectionList: { label: string; value: string }[] = reactive([]);
onMounted(() => {
drawStore.bindFormData(spksSwitchModel);
const spksSwitch = drawStore.selectedGraphic as SpksSwitch;
const sections = drawStore
.getDrawApp()
.queryStore.queryByType<Section>(Section.Type);
@ -66,18 +67,5 @@ onMounted(() => {
label: `${se.datas.code}[${se.datas.index}]`,
});
});
if (spksSwitch) {
spksSwitchModel.copyFrom(spksSwitch.saveData());
}
});
onUnmounted(() => {
drawStore.unbindFormData(spksSwitchModel);
});
function onUpdate() {
const spksSwitch = drawStore.selectedGraphic as SpksSwitch;
if (spksSwitch) {
drawStore.getDrawApp().updateGraphicAndRecord(spksSwitch, spksSwitchModel);
}
}
</script>

View File

@ -17,67 +17,64 @@
@blur="onUpdate"
label="索引"
/>
<q-select
outlined
style="margin-top: 10px"
v-model="kilometerSystem.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="kilometerSystem.kilometer"
type="number"
@blur="onUpdate"
label="公里标(mm):"
/>
<q-select
outlined
class="q-mt-md"
v-model="kilometerSystem.direction"
:options="directionOptions"
:map-options="true"
:emit-value="true"
@update:model-value="onUpdate"
label="方向"
></q-select>
<q-select
outlined
@blur="onUpdate"
v-model="concentrationStations"
:options="optionsControl"
label="是否集中站"
/>
<template v-if="stationModel.kilometerSystem">
<q-select
outlined
class="q-mt-md"
v-model="stationModel.kilometerSystem.coordinateSystem"
:options="CoordinateSystemOptions"
:map-options="true"
:emit-value="true"
@update:model-value="onUpdate"
label="坐标系"
></q-select>
<q-input
outlined
class="q-mt-md"
v-model.number="stationModel.kilometerSystem.kilometer"
type="number"
@blur="onUpdate"
label="公里标(mm):"
/>
<q-select
outlined
class="q-mt-md"
v-model="stationModel.kilometerSystem.direction"
:options="directionOptions"
map-options
emit-value
@update:model-value="onUpdate"
label="方向"
></q-select>
<q-select
outlined
@blur="onUpdate"
v-model="stationModel.concentrationStations"
:options="optionsControl"
map-options
emit-value
label="是否集中站"
/>
</template>
</q-form>
</template>
<script setup lang="ts">
import { useFormData } from 'src/components/DrawAppFormUtils';
import { StationData } from 'src/drawApp/graphics/StationInteraction';
import { Station } from 'src/graphics/station/Station';
import { useDrawStore } from 'src/stores/draw-store';
import { onMounted, onUnmounted, reactive, ref } from 'vue';
const drawStore = useDrawStore();
const stationModel = reactive(new StationData());
const concentrationStations = ref('否');
const optionsControl = ['是', '否'];
enum showSelect {
= 'true',
= 'false',
}
enum showSelectData {
true = '是',
false = '否',
}
const kilometerSystem = reactive({
coordinateSystem: '',
kilometer: 0,
direction: 0,
});
const { data: stationModel, onUpdate } = useFormData(
new StationData(),
drawStore.getDrawApp()
);
const optionsControl = [
{ label: '是', value: true },
{ label: '否', value: false },
];
const CoordinateSystemOptions = [
{ label: '车辆段', value: 'DEPOT' },
@ -90,39 +87,4 @@ const directionOptions = [
{ label: '左行', value: 0 },
{ label: '右行', value: 1 },
];
onMounted(() => {
drawStore.bindFormData(stationModel);
const station = drawStore.selectedGraphic as Station;
if (station) {
stationModel.copyFrom(station.saveData());
concentrationStations.value = (showSelectData as never)[
stationModel.concentrationStations + ''
];
if (stationModel.kilometerSystem) {
kilometerSystem.coordinateSystem =
stationModel.kilometerSystem.coordinateSystem;
kilometerSystem.kilometer = stationModel.kilometerSystem.kilometer;
kilometerSystem.direction = stationModel.kilometerSystem.direction;
}
}
});
onUnmounted(() => {
drawStore.unbindFormData(stationModel);
});
function onUpdate() {
stationModel.concentrationStations = JSON.parse(
(showSelect as never)[concentrationStations.value]
);
stationModel.kilometerSystem = {
coordinateSystem: kilometerSystem.coordinateSystem,
kilometer: kilometerSystem.kilometer,
direction: kilometerSystem.direction,
};
const station = drawStore.selectedGraphic as Station;
if (station) {
drawStore.getDrawApp().updateGraphicAndRecord(station, stationModel);
}
}
</script>

View File

@ -16,7 +16,7 @@
/>
<q-select
outlined
style="margin-top: 10px"
class="q-mt-md"
v-model="stopPositionModel.coachNum"
:options="optionsCoachNum"
:map-options="true"
@ -24,38 +24,40 @@
@update:model-value="onUpdate"
label="编组数量"
/>
<template v-if="stopPositionModel.kilometerSystem">
<q-select
outlined
class="q-mt-md"
v-model="stopPositionModel.kilometerSystem.coordinateSystem"
:options="CoordinateSystemOptions"
:map-options="true"
:emit-value="true"
@update:model-value="onUpdate"
label="坐标系"
></q-select>
<q-select
outlined
class="q-mt-md"
v-model="stopPositionModel.kilometerSystem.direction"
:options="directionOptions"
:map-options="true"
:emit-value="true"
@update:model-value="onUpdate"
label="方向"
></q-select>
<q-input
outlined
class="q-mt-md"
v-model.number="stopPositionModel.kilometerSystem.kilometer"
type="number"
@blur="onUpdate"
label="公里标(mm):"
/>
</template>
<q-select
outlined
style="margin-top: 10px"
v-model="kilometerSystem.coordinateSystem"
:options="CoordinateSystemOptions"
:map-options="true"
:emit-value="true"
@update:model-value="onUpdate"
label="坐标系"
></q-select>
<q-select
outlined
style="margin-top: 10px"
v-model="kilometerSystem.direction"
:options="directionOptions"
:map-options="true"
:emit-value="true"
@update:model-value="onUpdate"
label="方向"
></q-select>
<q-input
outlined
style="margin-top: 10px"
v-model.number="kilometerSystem.kilometer"
type="number"
@blur="onUpdate"
label="公里标(mm):"
/>
<q-select
outlined
style="margin-top: 10px"
v-model="refDevData.id"
class="q-mt-md"
:model-value="stopPositionModel?.refDev?.id ?? ''"
:options="sectionList"
:map-options="true"
:readonly="true"
@ -67,29 +69,19 @@
</template>
<script setup lang="ts">
import { useFormData } from 'src/components/DrawAppFormUtils';
import { StopPositionData } from 'src/drawApp/graphics/StopPositionInteraction';
import { Section } from 'src/graphics/section/Section';
import {
StopPosition,
CoachNum,
Direction,
} from 'src/graphics/stopPosition/StopPosition';
import { graphicData } from 'src/protos/stationLayoutGraphics';
import { StopPosition, CoachNum } from 'src/graphics/stopPosition/StopPosition';
import { useDrawStore } from 'src/stores/draw-store';
import { onMounted, onUnmounted, reactive } from 'vue';
import { onMounted, reactive } from 'vue';
const drawStore = useDrawStore();
const stopPositionModel = reactive(new StopPositionData());
const kilometerSystem = reactive({
coordinateSystem: '',
kilometer: 0,
direction: Direction.LEFT,
});
const refDevData = reactive({
id: '',
deviceType: graphicData.RelatedRef.DeviceType.Section,
devicePort: graphicData.RelatedRef.DevicePort.A,
});
const { data: stopPositionModel, onUpdate } = useFormData(
new StopPositionData(),
drawStore.getDrawApp()
);
const sectionList: { label: string; value: string }[] = reactive([]);
const CoordinateSystemOptions = [
{ label: '车辆段', value: 'DEPOT' },
{ label: '停车场', value: 'PARKING_LOT' },
@ -100,7 +92,6 @@ const directionOptions = [
{ label: '左行', value: 0 },
{ label: '右行', value: 1 },
];
const sectionList: { label: string; value: string }[] = reactive([]);
const optionsCoachNum = [
{
label: 4,
@ -111,7 +102,6 @@ const optionsCoachNum = [
];
onMounted(() => {
drawStore.bindFormData(stopPositionModel);
const stopPosition = drawStore.selectedGraphic as StopPosition;
if (stopPosition) {
const sections = drawStore
@ -123,46 +113,6 @@ onMounted(() => {
value: sec.datas.id,
});
});
initRefData(stopPosition);
}
});
onUnmounted(() => {
drawStore.unbindFormData(stopPositionModel);
});
function initRefData(stopPosition: StopPosition) {
stopPositionModel.copyFrom(stopPosition.saveData());
if (stopPositionModel.kilometerSystem) {
kilometerSystem.coordinateSystem =
stopPositionModel.kilometerSystem.coordinateSystem;
kilometerSystem.kilometer = stopPositionModel.kilometerSystem.kilometer;
kilometerSystem.direction = stopPositionModel.kilometerSystem.direction;
}
if (stopPositionModel.refDev) {
refDevData.id = stopPositionModel.refDev.id;
} else {
refDevData.id = '';
}
}
function onUpdate() {
const stopPosition = drawStore.selectedGraphic as StopPosition;
stopPositionModel.kilometerSystem = {
coordinateSystem: kilometerSystem.coordinateSystem,
kilometer: kilometerSystem.kilometer,
direction: kilometerSystem.direction,
};
if (refDevData.id) {
stopPositionModel.refDev = new graphicData.RelatedRef({
id: refDevData.id,
deviceType: refDevData.deviceType,
devicePort: refDevData.devicePort,
});
}
if (stopPosition) {
drawStore
.getDrawApp()
.updateGraphicAndRecord(stopPosition, stopPositionModel);
}
}
</script>

View File

@ -36,10 +36,14 @@ import { TrackLogicSectionData } from 'src/drawApp/graphics/TrackLogicSectionInt
import { TrackLogicSection } from 'src/graphics/trackLogicSection/TrackLogicSection';
import { TrackSection } from 'src/graphics/trackSection/TrackSection';
import { useDrawStore } from 'src/stores/draw-store';
import { computed, shallowRef, watchEffect } from 'vue';
import { computed } from 'vue';
import { useFormData } from 'src/components/DrawAppFormUtils';
const drawStore = useDrawStore();
const trackLogicSectionModel = shallowRef(new TrackLogicSectionData());
const { data: trackLogicSectionModel, onUpdate } = useFormData(
new TrackLogicSectionData(),
drawStore.getDrawApp()
);
const trackSectionRelations = computed(() => {
const lsec = drawStore.selectedGraphic as TrackLogicSection;
@ -52,21 +56,4 @@ const trackSectionRelations = computed(() => {
(relation) => `${relation.getOtherGraphic<TrackSection>(lsec).datas.code}`
);
});
watchEffect(() => {
const trackLogicSection = drawStore.selectedGraphic;
if (trackLogicSection && trackLogicSection instanceof TrackLogicSection) {
trackLogicSectionModel.value = trackLogicSection.saveData();
console.log(trackLogicSectionModel.value);
}
});
const onUpdate = () => {
const trackLogicSection = drawStore.selectedGraphic as TrackLogicSection;
if (trackLogicSection) {
drawStore
.getDrawApp()
.updateGraphicAndRecord(trackLogicSection, trackLogicSectionModel.value);
}
};
</script>

View File

@ -102,10 +102,14 @@ import {
} from 'src/graphics/trackSection/TrackSection';
import { Turnout } from 'src/graphics/turnout/Turnout';
import { useDrawStore } from 'src/stores/draw-store';
import { computed, shallowRef, watchEffect } from 'vue';
import { computed } from 'vue';
import { useFormData } from 'src/components/DrawAppFormUtils';
const drawStore = useDrawStore();
const trackSectionModel = shallowRef(new TrackSectionData());
const { data: trackSectionModel, onUpdate } = useFormData(
new TrackSectionData(),
drawStore.getDrawApp()
);
const turnoutRelations = computed(() => {
const trackSection = drawStore.selectedGraphic as TrackSection;
@ -148,20 +152,4 @@ const trackLogicSectionRelations = computed(() => {
`${relation.getOtherGraphic<TrackSection>(trackSection).datas.code}`
);
});
watchEffect(() => {
const trackSection = drawStore.selectedGraphic;
if (trackSection && trackSection instanceof TrackSection) {
trackSectionModel.value = trackSection.saveData();
}
});
const onUpdate = () => {
const trackSection = drawStore.selectedGraphic as TrackSection;
if (trackSection) {
drawStore
.getDrawApp()
.updateGraphicAndRecord(trackSection, trackSectionModel.value);
}
};
</script>

View File

@ -1,84 +0,0 @@
<template>
<q-form>
<q-input outlined readonly v-model="trainModel.id" label="id" hint="" />
<q-input
outlined
v-model="trainModel.code"
label="车号"
hint=""
@blur="onUpdate"
/>
<q-select
outlined
@blur="onUpdate"
v-model="hasBorder"
:options="optionsDoor"
label="是否有边框"
/>
<q-select
outlined
@blur="onUpdate"
v-model="trainDirection"
:options="optionsDirection"
label="行驶方向"
/>
</q-form>
</template>
<script setup lang="ts">
import { TrainData } from 'src/drawApp/graphics/TrainInteraction';
import { Train } from 'src/graphics/train/Train';
import { useDrawStore } from 'src/stores/draw-store';
import { onMounted, reactive, ref, watch } from 'vue';
const drawStore = useDrawStore();
const trainModel = reactive(new TrainData());
const hasBorder = ref('是');
const optionsDoor = ['是', '否'];
const trainDirection = ref('向左');
const optionsDirection = ['向左', '向右'];
enum showSelect {
= 'true',
= 'false',
向左 = 'left',
向右 = 'right',
}
enum showSelectData {
true = '是',
false = '否',
left = '向左',
right = '向右',
}
drawStore.$subscribe;
watch(
() => drawStore.selectedGraphic,
(val) => {
if (val && val.type == Train.Type) {
trainModel.copyFrom(val.saveData() as TrainData);
hasBorder.value = (showSelectData as never)[trainModel.hasBorder + ''];
trainDirection.value = (showSelectData as never)[
trainModel.trainDirection
];
}
}
);
onMounted(() => {
const train = drawStore.selectedGraphic as Train;
if (train) {
trainModel.copyFrom(train.saveData());
hasBorder.value = (showSelectData as never)[trainModel.hasBorder + ''];
trainDirection.value = (showSelectData as never)[trainModel.trainDirection];
}
});
function onUpdate() {
trainModel.hasBorder = JSON.parse((showSelect as never)[hasBorder.value]);
trainModel.trainDirection = (showSelect as never)[trainDirection.value];
const train = drawStore.selectedGraphic as Train;
if (train) {
drawStore.getDrawApp().updateGraphicAndRecord(train, trainModel);
}
}
</script>

View File

@ -43,30 +43,14 @@ import { TrainWindowData } from 'src/drawApp/graphics/TrainWindowInteraction';
import { Section } from 'src/graphics/section/Section';
import { TrainWindow } from 'src/graphics/trainWindow/TrainWindow';
import { useDrawStore } from 'src/stores/draw-store';
import { computed, onMounted, onUnmounted, reactive } from 'vue';
import { computed } from 'vue';
import { useFormData } from 'src/components/DrawAppFormUtils';
const drawStore = useDrawStore();
const trainWindowModel = reactive(new TrainWindowData());
onMounted(() => {
drawStore.bindFormData(trainWindowModel);
const trainWindow = drawStore.selectedGraphic as TrainWindow;
if (trainWindow) {
trainWindowModel.copyFrom(trainWindow.saveData());
}
});
onUnmounted(() => {
drawStore.unbindFormData(trainWindowModel);
});
function onUpdate() {
const trainWindow = drawStore.selectedGraphic as TrainWindow;
if (trainWindow) {
drawStore
.getDrawApp()
.updateGraphicAndRecord(trainWindow, trainWindowModel);
}
}
const { data: trainWindowModel, onUpdate } = useFormData(
new TrainWindowData(),
drawStore.getDrawApp()
);
const relatedProcessPositions = computed((): Section[] => {
if (

View File

@ -9,49 +9,51 @@
/>
<q-input
outlined
class="q-mt-lg"
class="q-mt-md"
v-model="transponderModel.code"
@blur="onUpdate"
label="编号"
/>
<q-input
outlined
class="q-mt-lg"
class="q-mt-md"
v-model.number="transponderModel.index"
@blur="onUpdate"
label="索引"
/>
<q-select
outlined
style="margin-top: 10px"
v-model="kilometerSystem.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="kilometerSystem.kilometer"
type="number"
@blur="onUpdate"
label="公里标(mm):"
/>
<template v-if="transponderModel.kilometerSystem">
<q-select
outlined
class="q-mt-md"
v-model="transponderModel.kilometerSystem.coordinateSystem"
:options="CoordinateSystemOptions"
:map-options="true"
:emit-value="true"
@update:model-value="onUpdate"
label="坐标系"
></q-select>
<q-input
outlined
class="q-mt-md"
v-model.number="transponderModel.kilometerSystem.kilometer"
type="number"
@blur="onUpdate"
label="公里标(mm):"
/>
<q-select
outlined
class="q-mt-md"
v-model="transponderModel.kilometerSystem.direction"
:options="directionOptions"
:map-options="true"
:emit-value="true"
@update:model-value="onUpdate"
label="方向"
></q-select>
</template>
<q-select
outlined
class="q-mt-md"
v-model="kilometerSystem.direction"
:options="directionOptions"
:map-options="true"
:emit-value="true"
@update:model-value="onUpdate"
label="方向"
></q-select>
<q-select
outlined
style="margin-top: 10px"
v-model="transponderModel.transponderType"
:options="typeOptions"
:map-options="true"
@ -59,7 +61,7 @@
@update:model-value="onUpdate"
label="应答器类型"
></q-select>
<q-field class="q-mt-lg" outlined label="关联区段" readonly stack-label>
<q-field class="q-mt-md" outlined label="关联区段" readonly stack-label>
<template #control>
<q-chip
color="primary"
@ -71,7 +73,7 @@
>
</template>
</q-field>
<q-field class="q-mt-lg" outlined label="关联道岔" readonly stack-label>
<q-field class="q-mt-md" outlined label="关联道岔" readonly stack-label>
<template #control>
<q-chip
color="primary"
@ -87,6 +89,7 @@
</template>
<script setup lang="ts">
import { useFormData } from 'src/components/DrawAppFormUtils';
import { TransponderData } from 'src/drawApp/graphics/TransponderInteraction';
import { Section } from 'src/graphics/section/Section';
import {
@ -98,7 +101,10 @@ import { useDrawStore } from 'src/stores/draw-store';
import { computed, onMounted, onUnmounted, reactive } from 'vue';
const drawStore = useDrawStore();
const transponderModel = reactive(new TransponderData());
const { data: transponderModel, onUpdate } = useFormData(
new TransponderData(),
drawStore.getDrawApp()
);
const typeOptions = [
{ label: '固定应答器', value: transponderTypeEnum.FB },
{ label: '轮径校正应答器', value: transponderTypeEnum.WB },
@ -107,11 +113,6 @@ const typeOptions = [
{ label: '预告应答器', value: transponderTypeEnum.IB },
];
const kilometerSystem = reactive({
coordinateSystem: '',
kilometer: 0,
direction: 0,
});
const CoordinateSystemOptions = [
{ label: '车辆段', value: 'DEPOT' },
{ label: '停车场', value: 'PARKING_LOT' },
@ -124,37 +125,6 @@ const directionOptions = [
{ label: '右行', value: 1 },
];
onMounted(() => {
drawStore.bindFormData(transponderModel);
const Transponder = drawStore.selectedGraphic as Transponder;
if (Transponder) {
transponderModel.copyFrom(Transponder.saveData());
if (transponderModel.kilometerSystem) {
kilometerSystem.coordinateSystem =
transponderModel.kilometerSystem.coordinateSystem;
kilometerSystem.kilometer = transponderModel.kilometerSystem.kilometer;
kilometerSystem.direction = transponderModel.kilometerSystem.direction;
}
}
});
onUnmounted(() => {
drawStore.unbindFormData(transponderModel);
});
function onUpdate() {
const Transponder = drawStore.selectedGraphic as Transponder;
transponderModel.kilometerSystem = {
coordinateSystem: kilometerSystem.coordinateSystem,
kilometer: kilometerSystem.kilometer,
direction: kilometerSystem.direction,
};
if (Transponder) {
drawStore
.getDrawApp()
.updateGraphicAndRecord(Transponder, transponderModel);
}
}
const sectionRelations = computed(() => {
const transponder = drawStore.selectedGraphic as Transponder;

View File

@ -9,70 +9,75 @@
/>
<q-input
outlined
class="q-mt-sm"
v-model.number="turnoutModel.index"
type="number"
@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
style="margin-top: 10px"
v-model="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="kilometerSystem[0].kilometer"
type="number"
@blur="onUpdate"
label="公里标(mm):"
/>
<q-select
outlined
class="q-mt-md"
v-model="kilometerSystem[0].direction"
:options="directionOptions"
:map-options="true"
:emit-value="true"
@update:model-value="onUpdate"
label="方向"
></q-select>
<q-select
outlined
class="q-mt-md"
v-model="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="kilometerSystem[1].kilometer"
type="number"
@blur="onUpdate"
label="公里标(mm):"
/>
<q-select
outlined
class="q-mt-md"
v-model="kilometerSystem[1].direction"
:options="directionOptions"
:map-options="true"
:emit-value="true"
@update:model-value="onUpdate"
label="方向"
></q-select>
<q-select
outlined
class="q-mt-md"
class="q-mt-sm"
map-options
emit-value
label="转辙机型号"
@ -80,7 +85,7 @@
v-model="turnoutModel.data.switchMachineType"
:options="switchMachineTypeOptions"
></q-select>
<q-field class="q-mt-lg" outlined label="关联区段" readonly stack-label>
<q-field class="q-mt-sm" outlined label="关联区段" readonly stack-label>
<template #control>
<q-chip
color="primary"
@ -92,7 +97,7 @@
>
</template>
</q-field>
<q-field class="q-mt-lg" outlined label="关联道岔" readonly stack-label>
<q-field class="q-mt-sm" outlined label="关联道岔" readonly stack-label>
<template #control>
<q-chip
color="primary"
@ -115,6 +120,7 @@ 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 { useFormData } from 'src/components/DrawAppFormUtils';
const drawStore = useDrawStore();
const CoordinateSystemOptions = [
@ -123,11 +129,14 @@ const CoordinateSystemOptions = [
{ label: '正线', value: 'MAIN_LINE' },
{ label: '换线', value: 'TRANSFER' },
];
const turnoutModel = shallowRef(new TurnoutData());
const kilometerSystem = reactive([
{ coordinateSystem: '', kilometer: 0, direction: Direction.LEFT },
{ coordinateSystem: '', kilometer: 0, direction: Direction.LEFT },
]);
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 },
@ -138,11 +147,11 @@ const switchMachineTypeOptions = [
value: graphicData.Turnout.SwitchMachineType.Unknown,
},
{
label: 'ZDJ6(单机牵引)',
label: 'ZDJ9(单机牵引)',
value: graphicData.Turnout.SwitchMachineType.ZDJ9_Single,
},
{
label: 'ZDJ6(双机牵引)',
label: 'ZDJ9(双机牵引)',
value: graphicData.Turnout.SwitchMachineType.ZDJ9_Double,
},
];
@ -179,30 +188,30 @@ const turnoutRelations = computed(() => {
);
});
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;
});
}
}
});
// 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);
}
};
// 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

@ -33,7 +33,7 @@ export class AxleCountingData
this.data.code = v;
}
get kilometerSystem(): KilometerSystem {
return this.data.kilometerSystem;
return this.data.kilometerSystem ?? new graphicData.KilometerSystem();
}
set kilometerSystem(v: KilometerSystem) {
this.data.kilometerSystem = new graphicData.KilometerSystem(v);

View File

@ -10,6 +10,7 @@ import { GraphicDataBase, GraphicStateBase } from './GraphicDataBase';
import {
GraphicInteractionPlugin,
IGraphicScene,
IGraphicApp,
JlGraphic,
} from 'src/jl-graphic';
import { ContextMenu } from 'src/jl-graphic/ui/ContextMenu';
@ -47,7 +48,13 @@ export class SignalData extends GraphicDataBase implements ISignalData {
this.data.mirror = v;
}
get kilometerSystem(): KilometerSystem {
return this.data.kilometerSystem;
return (
this.data.kilometerSystem ?? {
coordinateSystem: '',
kilometer: 0,
direction: 0,
}
);
}
set kilometerSystem(v: KilometerSystem) {
this.data.kilometerSystem = new graphicData.KilometerSystem(v);
@ -59,7 +66,7 @@ export class SignalData extends GraphicDataBase implements ISignalData {
this.data.index = v;
}
get refDev(): graphicData.RelatedRef {
return this.data.refDev;
return this.data.refDev ?? new graphicData.RelatedRef();
}
set refDev(v: graphicData.RelatedRef) {
this.data.refDev = v;

View File

@ -2420,9 +2420,10 @@ export namespace state {
simulationId?: string;
mapId?: number;
projectId?: number;
mapIds?: number[];
}) {
super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [4], this.#one_of_decls);
if (!Array.isArray(data) && typeof data == "object") {
if ("simulationId" in data && data.simulationId != undefined) {
this.simulationId = data.simulationId;
@ -2433,6 +2434,9 @@ export namespace state {
if ("projectId" in data && data.projectId != undefined) {
this.projectId = data.projectId;
}
if ("mapIds" in data && data.mapIds != undefined) {
this.mapIds = data.mapIds;
}
}
}
get simulationId() {
@ -2453,10 +2457,17 @@ export namespace state {
set projectId(value: number) {
pb_1.Message.setField(this, 3, value);
}
get mapIds() {
return pb_1.Message.getFieldWithDefault(this, 4, []) as number[];
}
set mapIds(value: number[]) {
pb_1.Message.setField(this, 4, value);
}
static fromObject(data: {
simulationId?: string;
mapId?: number;
projectId?: number;
mapIds?: number[];
}): SimulationStatus {
const message = new SimulationStatus({});
if (data.simulationId != null) {
@ -2468,6 +2479,9 @@ export namespace state {
if (data.projectId != null) {
message.projectId = data.projectId;
}
if (data.mapIds != null) {
message.mapIds = data.mapIds;
}
return message;
}
toObject() {
@ -2475,6 +2489,7 @@ export namespace state {
simulationId?: string;
mapId?: number;
projectId?: number;
mapIds?: number[];
} = {};
if (this.simulationId != null) {
data.simulationId = this.simulationId;
@ -2485,6 +2500,9 @@ export namespace state {
if (this.projectId != null) {
data.projectId = this.projectId;
}
if (this.mapIds != null) {
data.mapIds = this.mapIds;
}
return data;
}
serialize(): Uint8Array;
@ -2497,6 +2515,8 @@ export namespace state {
writer.writeInt32(2, this.mapId);
if (this.projectId != 0)
writer.writeInt32(3, this.projectId);
if (this.mapIds.length)
writer.writePackedInt32(4, this.mapIds);
if (!w)
return writer.getResultBuffer();
}
@ -2515,6 +2535,9 @@ export namespace state {
case 3:
message.projectId = reader.readInt32();
break;
case 4:
message.mapIds = reader.readPackedInt32();
break;
default: reader.skipField();
}
}