This commit is contained in:
fan 2023-08-01 16:27:04 +08:00
commit c4ed2bde5d
4 changed files with 41 additions and 38 deletions

View File

@ -3,28 +3,27 @@ import { api } from 'src/boot/axios';
const platformUriBase = '/mock/platform/status';
const stationUriBase = '/mock/rtu/status';
export function mockPlatformApi(
lineId: number,
data: {
emergstop: boolean;
trainberth: boolean;
close: boolean;
upHold: boolean;
downHold: boolean;
upOccHold: boolean;
downOccHold: boolean;
psdOpen: boolean;
psdCut: boolean;
upSkipstop: boolean;
downSkipstop: boolean;
upTrainSkipstop: boolean;
downTrainSkipstop: boolean;
id: string;
nextSectionRunTime: number;
nextSectionRunLevel: number;
stopTime: number;
}
) {
export interface mockPlatformParams {
emergstop: boolean;
trainberth: boolean;
close: boolean;
upHold: boolean;
downHold: boolean;
upOccHold: boolean;
downOccHold: boolean;
psdOpen: boolean;
psdCut: boolean;
upSkipstop: boolean;
downSkipstop: boolean;
upTrainSkipstop: boolean;
downTrainSkipstop: boolean;
id: string;
nextSectionRunTime: number;
nextSectionRunLevel: number;
stopTime: number;
}
export function mockPlatformApi(lineId: number, data: mockPlatformParams) {
return api.post(`${platformUriBase}/${lineId}`, data);
}

View File

@ -48,7 +48,7 @@
@blur="onUpdate"
v-model="upHold"
:options="optionsChoose"
label="是否上行扣车"
label="是否上行车站扣车"
/>
<q-select
v-if="lineStore.selectedGraphic.datas.up"
@ -64,7 +64,7 @@
@blur="onUpdate"
v-model="downHold"
:options="optionsChoose"
label="是否下行扣车"
label="是否下行车站扣车"
/>
<q-select
v-if="!lineStore.selectedGraphic.datas.up"
@ -116,7 +116,7 @@ import { PlatformState } from 'src/drawApp/graphics/PlatformInteraction';
import { Platform } from 'src/graphics/platform/Platform';
import { useLineStore } from 'src/stores/line-store';
import { onMounted, reactive, ref, watch } from 'vue';
import { mockPlatformApi } from 'src/api/PlatformApi';
import { mockPlatformApi, mockPlatformParams } from 'src/api/PlatformApi';
const lineStore = useLineStore();
const platformModel = reactive(new PlatformState());
@ -159,12 +159,12 @@ watch(
upSkipstop.value = (showSelectData as never)[
platformModel.upSkipstop + ''
];
downHold.value = (showSelectData as never)[platformModel.upHold + ''];
downHold.value = (showSelectData as never)[platformModel.downHold + ''];
downOccHold.value = (showSelectData as never)[
platformModel.upOccHold + ''
platformModel.downOccHold + ''
];
downSkipstop.value = (showSelectData as never)[
platformModel.upSkipstop + ''
platformModel.downSkipstop + ''
];
}
}
@ -181,8 +181,10 @@ onMounted(() => {
upHold.value = (showSelectData as never)[platformModel.upHold + ''];
upOccHold.value = (showSelectData as never)[platformModel.upOccHold + ''];
upSkipstop.value = (showSelectData as never)[platformModel.upSkipstop + ''];
downHold.value = (showSelectData as never)[platformModel.upHold + ''];
downOccHold.value = (showSelectData as never)[platformModel.upOccHold + ''];
downHold.value = (showSelectData as never)[platformModel.downHold + ''];
downOccHold.value = (showSelectData as never)[
platformModel.downOccHold + ''
];
downSkipstop.value = (showSelectData as never)[
platformModel.upSkipstop + ''
];
@ -209,7 +211,7 @@ function onUpdate() {
platformModel.downSkipstop = JSON.parse(
(showSelect as never)[downSkipstop.value]
);
const data = {
const data: { [key: string]: boolean | number | string } = {
emergstop: false,
trainberth: false,
close: false,
@ -228,11 +230,12 @@ function onUpdate() {
nextSectionRunLevel: 0,
stopTime: 0,
};
type keyData = 'emergstop' | 'trainberth';
Object.keys(data).forEach((i) => {
data[i] = platformModel[i] || (data[i] as boolean);
data[i] = platformModel[i as keyData] || data[i];
});
if (platform) {
mockPlatformApi(3, data)
mockPlatformApi(3, data as unknown as mockPlatformParams)
.then((res) => {
console.log(res, '---res--');
})

View File

@ -1,11 +1,12 @@
<template>
<q-layout view="hHh LpR fFf">
<q-layout view="hHh LpR fFf" style="overflow-y: hidden">
<q-drawer side="right" v-model="drawerRight" show-if-above bordered>
<state-properties></state-properties>
</q-drawer>
<q-page class="row items-center justify-evenly">
<q-resize-observer @resize="onResize" />
<q-page-container>
<div id="line-app-container"></div>
</q-page>
</q-page-container>
</q-layout>
</template>
@ -55,7 +56,7 @@ function onResize() {
const dom = document.getElementById('line-app-container');
if (dom) {
dom.style.width = props.sizeWidth + 'px';
dom.style.height = props.sizeHeight + 'px';
dom.style.height = props.sizeHeight + 50 + 'px';
}
const lineApp = getLineApp();
if (lineApp) {

View File

@ -63,7 +63,7 @@ function onResize() {
}
const lineNetApp = getLineNetApp();
if (lineNetApp) {
lineNetApp.onDomResize(props.sizeWidth, props.sizeHeight - 32);
lineNetApp.onDomResize(props.sizeWidth, props.sizeHeight);
}
}