Merge branch 'master' of https://git.code.tencent.com/beijing-rtss-test/bj-rtss-client
This commit is contained in:
commit
0f7dba3642
@ -22,7 +22,7 @@
|
||||
"default-passive-events": "^2.0.0",
|
||||
"echarts": "^5.4.3",
|
||||
"google-protobuf": "^3.21.2",
|
||||
"jl-graphic": "git+https://git.code.tencent.com/jl-framework/graphic-pixi.git#v0.1.8",
|
||||
"jl-graphic": "git+https://git.code.tencent.com/jl-framework/graphic-pixi.git#v0.1.9",
|
||||
"js-base64": "^3.7.5",
|
||||
"pinia": "^2.0.11",
|
||||
"quasar": "^2.6.0",
|
||||
|
@ -90,8 +90,12 @@ export async function removeTrain(data: {
|
||||
export async function setAxleSectionState(data: {
|
||||
simulationId: string;
|
||||
mapId: number;
|
||||
id: number;
|
||||
operation: number;
|
||||
deviceId: number;
|
||||
operation: request.Section.Operation;
|
||||
param: {
|
||||
mockDrst: boolean;
|
||||
mockPdrst: boolean;
|
||||
};
|
||||
}) {
|
||||
return await api.post(`${UriBase}/axleSection/operation`, data);
|
||||
}
|
||||
|
111
src/components/draw-app/dialogs/SectionOperation.vue
Normal file
111
src/components/draw-app/dialogs/SectionOperation.vue
Normal file
@ -0,0 +1,111 @@
|
||||
<!-- eslint-disable vue/no-mutating-props -->
|
||||
<template>
|
||||
<draggable-dialog
|
||||
v-model="showSectionOperation"
|
||||
seamless
|
||||
:title="title"
|
||||
:width="380"
|
||||
:height="0"
|
||||
>
|
||||
<template v-slot:footer>
|
||||
<q-card>
|
||||
<q-card-section>
|
||||
<q-form ref="myForm" @submit="onCreate" class="q-gutter-md">
|
||||
<q-input
|
||||
dense
|
||||
outlined
|
||||
readonly
|
||||
label="名称"
|
||||
v-model="props.code"
|
||||
/>
|
||||
<div
|
||||
class="q-gutter-sm"
|
||||
style="border: 1px solid #ccc; border-radius: 3px"
|
||||
>
|
||||
<div>模拟CI复位/预复位:</div>
|
||||
<q-toggle v-model="mockDrst" label="是否复位" />
|
||||
<q-toggle v-model="mockPdrst" label="是否预复位" />
|
||||
</div>
|
||||
|
||||
<q-card-actions align="right" class="text-primary">
|
||||
<q-btn
|
||||
flat
|
||||
label="取消"
|
||||
@click="showTurnoutOperation = false"
|
||||
v-close-popup
|
||||
/>
|
||||
<q-btn flat label="确认" type="submit" />
|
||||
</q-card-actions>
|
||||
</q-form>
|
||||
</q-card-section>
|
||||
</q-card>
|
||||
</template>
|
||||
</draggable-dialog>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { QForm } from 'quasar';
|
||||
import { setAxleSectionState } from 'src/api/Simulation';
|
||||
import DraggableDialog from 'src/components/common/DraggableDialog.vue';
|
||||
import { request } from 'src/protos/request';
|
||||
import { useLineStore } from 'src/stores/line-store';
|
||||
import { errorNotify } from 'src/utils/CommonNotify';
|
||||
import { onMounted, onUnmounted, ref } from 'vue';
|
||||
|
||||
const props = defineProps({
|
||||
operateName: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
id: {
|
||||
type: Number,
|
||||
required: true,
|
||||
},
|
||||
code: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
});
|
||||
const lineStore = useLineStore();
|
||||
const title = ref('');
|
||||
const mockDrst = ref(false);
|
||||
const mockPdrst = ref(false);
|
||||
const showSectionOperation = ref(true);
|
||||
const sectionOperation = ref<request.Section.Operation>(0);
|
||||
|
||||
onMounted(() => {
|
||||
title.value = props.operateName;
|
||||
if (props.operateName == '区段设置参数') {
|
||||
sectionOperation.value = request.Section.Operation.SetParams;
|
||||
} else {
|
||||
sectionOperation.value = request.Section.Operation.SetFaultOcc;
|
||||
}
|
||||
});
|
||||
|
||||
const myForm = ref<QForm | null>(null);
|
||||
function onCreate() {
|
||||
myForm.value?.validate().then(async (res) => {
|
||||
if (res) {
|
||||
const obj = {
|
||||
simulationId: lineStore?.simulationId || '',
|
||||
mapId: lineStore.mapId as number,
|
||||
deviceId: props.id,
|
||||
operation: sectionOperation.value,
|
||||
param: {
|
||||
mockDrst: mockDrst.value,
|
||||
mockPdrst: mockPdrst.value,
|
||||
},
|
||||
};
|
||||
setAxleSectionState(obj).catch((e) =>
|
||||
errorNotify('区段操作失败:' + e.title, e)
|
||||
);
|
||||
showSectionOperation.value = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
onUnmounted(() => {
|
||||
lineStore.deviceOpreratDialogInstance = null;
|
||||
});
|
||||
</script>
|
||||
<style scoped></style>
|
@ -11,7 +11,6 @@
|
||||
<q-card>
|
||||
<q-card-section>
|
||||
<q-form ref="myForm" @submit="onCreate" class="q-gutter-md">
|
||||
<div class="text-h6">道岔设置参数</div>
|
||||
<q-input
|
||||
dense
|
||||
outlined
|
||||
|
72
src/components/line-app/dialogs/ConnectInfoDialog.vue
Normal file
72
src/components/line-app/dialogs/ConnectInfoDialog.vue
Normal file
@ -0,0 +1,72 @@
|
||||
<template>
|
||||
<draggable-dialog
|
||||
ref="dialogRef"
|
||||
@show="onDialogShow"
|
||||
seamless
|
||||
title="仿真第三方接口状态信息"
|
||||
:width="300"
|
||||
:height="0"
|
||||
>
|
||||
<template v-slot:footer>
|
||||
<q-table
|
||||
ref="tableRef"
|
||||
row-key="id"
|
||||
:rows="rows"
|
||||
:columns="columns"
|
||||
@request="onRequest"
|
||||
hide-bottom
|
||||
>
|
||||
</q-table>
|
||||
</template>
|
||||
</draggable-dialog>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, watch } from 'vue';
|
||||
import DraggableDialog from 'src/components/common/DraggableDialog.vue';
|
||||
import { QTable } from 'quasar';
|
||||
import { state } from 'src/protos/device_state';
|
||||
import { useTestManageStore } from 'src/stores/testManage-store';
|
||||
|
||||
const testManageStore = useTestManageStore();
|
||||
const dialogRef = ref<InstanceType<typeof DraggableDialog>>();
|
||||
const tableRef = ref<QTable>();
|
||||
enum Type {
|
||||
'未定义',
|
||||
'动力学',
|
||||
'半实物列车',
|
||||
}
|
||||
const columns: QTable['columns'] = [
|
||||
{
|
||||
name: 'type',
|
||||
label: '接口服务',
|
||||
field: (row) => (row.type = Type[row.state]),
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
name: 'state',
|
||||
label: '服务状态',
|
||||
field: (row) => (row.state == 0 ? '正常' : '异常'),
|
||||
align: 'center',
|
||||
},
|
||||
];
|
||||
const rows = ref<state.SimulationThirdPartyApiServiceState[]>([]);
|
||||
|
||||
watch(
|
||||
() => testManageStore.connectInfo,
|
||||
() => {
|
||||
onDialogShow();
|
||||
}
|
||||
);
|
||||
|
||||
const onRequest: QTable['onRequest'] = async () => {
|
||||
const datas = testManageStore.connectInfo?.states;
|
||||
if (datas) {
|
||||
rows.value = datas;
|
||||
}
|
||||
};
|
||||
|
||||
const onDialogShow = () => {
|
||||
tableRef.value?.requestServerInteraction();
|
||||
};
|
||||
</script>
|
@ -9,7 +9,7 @@
|
||||
:key="index"
|
||||
clickable
|
||||
v-close-popup
|
||||
@click="toDo(item)"
|
||||
@click="doSectionOperation(item)"
|
||||
>
|
||||
<q-item-section>
|
||||
<q-item-label>{{ item.label }}</q-item-label>
|
||||
@ -58,6 +58,28 @@
|
||||
/>
|
||||
</q-item-section>
|
||||
</q-item>
|
||||
<q-item>
|
||||
<q-item-section>
|
||||
<q-checkbox
|
||||
dense
|
||||
v-model="sectionState.axleDrst"
|
||||
outlined
|
||||
label="是否计轴复位"
|
||||
:disable="true"
|
||||
/>
|
||||
</q-item-section>
|
||||
</q-item>
|
||||
<q-item>
|
||||
<q-item-section>
|
||||
<q-checkbox
|
||||
dense
|
||||
v-model="sectionState.axlePdrst"
|
||||
outlined
|
||||
label="是否计轴预复位"
|
||||
:disable="true"
|
||||
/>
|
||||
</q-item-section>
|
||||
</q-item>
|
||||
</q-list>
|
||||
</q-card-section>
|
||||
</q-card>
|
||||
@ -67,18 +89,18 @@ import { useLineStore } from 'src/stores/line-store';
|
||||
import { ref, watch, onMounted } from 'vue';
|
||||
import { Section, type ISectionState } from 'src/graphics/section/Section';
|
||||
import { request } from 'src/protos/request';
|
||||
import { setAxleSectionState } from 'src/api/Simulation';
|
||||
import { useQuasar } from 'quasar';
|
||||
import { ApiError } from 'src/boot/axios';
|
||||
import { Dialog } from 'quasar';
|
||||
import { SectionStates } from 'src/drawApp/graphics/SectionInteraction';
|
||||
import SectionOperation from 'src/components/draw-app/dialogs/SectionOperation.vue';
|
||||
|
||||
const $q = useQuasar();
|
||||
const lineStore = useLineStore();
|
||||
const sectionState = ref({
|
||||
id: 0,
|
||||
code: '',
|
||||
axleFault: false,
|
||||
occupied: false,
|
||||
axleDrst: false,
|
||||
axlePdrst: false,
|
||||
});
|
||||
|
||||
watch(
|
||||
@ -92,6 +114,8 @@ watch(
|
||||
code: '',
|
||||
axleFault: false,
|
||||
occupied: false,
|
||||
axleDrst: false,
|
||||
axlePdrst: false,
|
||||
};
|
||||
}
|
||||
}
|
||||
@ -102,6 +126,8 @@ function setSectionState(section: Section) {
|
||||
code: section.datas.code,
|
||||
axleFault: section.states.axleFault ?? false,
|
||||
occupied: section.states.occupied ?? false,
|
||||
axleDrst: section.states.axleDrst ?? false,
|
||||
axlePdrst: section.states.axlePdrst ?? false,
|
||||
};
|
||||
}
|
||||
|
||||
@ -113,49 +139,35 @@ onMounted(() => {
|
||||
|
||||
const options = [
|
||||
{
|
||||
label: '设置计轴直接复位',
|
||||
value: request.Section.Operation.SetDrst,
|
||||
label: '设置参数',
|
||||
value: request.Section.Operation.SetParams,
|
||||
},
|
||||
{
|
||||
label: '取消计轴直接复位',
|
||||
value: request.Section.Operation.CancelDrst,
|
||||
},
|
||||
{
|
||||
label: '设置计轴预复位',
|
||||
value: request.Section.Operation.SetPdrst,
|
||||
},
|
||||
{
|
||||
label: '取消计轴预复位',
|
||||
value: request.Section.Operation.CancelPdrst,
|
||||
},
|
||||
{
|
||||
label: '设置区段故障占用',
|
||||
label: '设置故障占用',
|
||||
value: request.Section.Operation.SetFaultOcc,
|
||||
},
|
||||
{
|
||||
label: '取消区段故障占用',
|
||||
value: request.Section.Operation.CancelFaultOcc,
|
||||
},
|
||||
];
|
||||
function toDo(item: { label: string; value: number }) {
|
||||
function doSectionOperation(item: { label: string; value: number }) {
|
||||
if (!lineStore.simulationId) return;
|
||||
const obj = {
|
||||
simulationId: lineStore?.simulationId || '',
|
||||
mapId: lineStore.mapId as number,
|
||||
id: sectionState.value.id,
|
||||
operation: item.value,
|
||||
};
|
||||
setAxleSectionState(obj)
|
||||
// .then(() => {
|
||||
// $q.notify({ type: 'positive', message: '修改区段状态成功' });
|
||||
// })
|
||||
.catch((err) => {
|
||||
const error = err as ApiError;
|
||||
$q.notify({
|
||||
type: 'negative',
|
||||
message: error.title,
|
||||
});
|
||||
if (item.label == '设置参数' || item.label == '设置故障占用') {
|
||||
if (lineStore.deviceOpreratDialogInstance) return;
|
||||
const operateName =
|
||||
item.label == '设置参数' ? '区段设置参数' : '区段设置故障占用';
|
||||
lineStore.deviceOpreratDialogInstance = Dialog.create({
|
||||
component: SectionOperation,
|
||||
componentProps: {
|
||||
operateName,
|
||||
id: sectionState.value.id,
|
||||
code: sectionState.value.code,
|
||||
axleDrst: sectionState.value.axleDrst,
|
||||
axlePdrst: sectionState.value.axlePdrst,
|
||||
},
|
||||
cancel: true,
|
||||
persistent: true,
|
||||
}).onCancel(() => {
|
||||
lineStore.deviceOpreratDialogInstance = null;
|
||||
});
|
||||
}
|
||||
}
|
||||
watch(
|
||||
() => lineStore.socketStates,
|
||||
@ -173,6 +185,8 @@ watch(
|
||||
code: find.code,
|
||||
axleFault: find.axleFault,
|
||||
occupied: find.occupied,
|
||||
axleDrst: find.axleDrst,
|
||||
axlePdrst: find.axlePdrst,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -208,7 +208,7 @@ watch(
|
||||
function setTurnoutState(turnout: Turnout) {
|
||||
graphic.value = turnout;
|
||||
turnoutState.value = turnout.states.clone() as TurnoutStates;
|
||||
forcePosition.value = turnoutState.value.param.forcePosition;
|
||||
forcePosition.value = turnoutState.value.param?.forcePosition;
|
||||
name.value = turnout.datas.code;
|
||||
subscribeState(turnout as JlGraphic);
|
||||
}
|
||||
@ -254,7 +254,7 @@ function unSubscribeState(g: JlGraphic) {
|
||||
}
|
||||
function updateState(newVal: TurnoutStates) {
|
||||
turnoutState.value = newVal.clone() as TurnoutStates;
|
||||
forcePosition.value = turnoutState.value.param.forcePosition;
|
||||
forcePosition.value = turnoutState.value.param?.forcePosition;
|
||||
}
|
||||
|
||||
onUnmounted(() => {
|
||||
|
@ -17,15 +17,12 @@ import {
|
||||
} from 'jl-graphic';
|
||||
import { useLineStore } from 'src/stores/line-store';
|
||||
import { SectionGraphicHitArea } from 'src/graphics/section/SectionDrawAssistant';
|
||||
import { Dialog, Notify } from 'quasar';
|
||||
import { Dialog } from 'quasar';
|
||||
import AddTrainDialog from '../../components/draw-app/dialogs/AddTrainDialog.vue';
|
||||
import { addTrain } from 'src/api/Simulation';
|
||||
import { TrainConfigData } from 'src/api/TrainModelApi'
|
||||
import { successNotify } from '../../utils/CommonNotify';
|
||||
import { AxleCounting } from 'src/graphics/axleCounting/AxleCounting';
|
||||
import { ApiError } from 'src/boot/axios';
|
||||
import { state } from 'src/protos/device_state';
|
||||
import { getKmDistance } from '../lineScene';
|
||||
import SectionOperation from 'src/components/draw-app/dialogs/SectionOperation.vue';
|
||||
|
||||
export class SectionData extends GraphicDataBase implements ISectionData {
|
||||
constructor(data?: graphicData.Section) {
|
||||
@ -164,6 +161,18 @@ export class SectionStates extends GraphicStateBase implements ISectionState {
|
||||
set axleFault(axleFault: boolean) {
|
||||
this.states.axleFault = axleFault;
|
||||
}
|
||||
get axleDrst(): boolean {
|
||||
return this.states.axleDrst;
|
||||
}
|
||||
set axleDrst(axleDrst: boolean) {
|
||||
this.states.axleDrst = axleDrst;
|
||||
}
|
||||
get axlePdrst(): boolean {
|
||||
return this.states.axlePdrst;
|
||||
}
|
||||
set axlePdrst(axlePdrst: boolean) {
|
||||
this.states.axlePdrst = axlePdrst;
|
||||
}
|
||||
get states(): state.SectionState {
|
||||
return this.getState<state.SectionState>();
|
||||
}
|
||||
@ -181,11 +190,13 @@ export class SectionStates extends GraphicStateBase implements ISectionState {
|
||||
const addTrainConfig: MenuItemOptions = {
|
||||
name: '添加列车',
|
||||
};
|
||||
const setSectionParam: MenuItemOptions = { name: '设置参数' };
|
||||
const setFaultOcc: MenuItemOptions = { name: '设置故障占用' };
|
||||
const SectionOperateMenu: ContextMenu = ContextMenu.init({
|
||||
name: '区段操作菜单',
|
||||
groups: [
|
||||
{
|
||||
items: [addTrainConfig],
|
||||
items: [setSectionParam, setFaultOcc, addTrainConfig],
|
||||
},
|
||||
],
|
||||
});
|
||||
@ -236,6 +247,26 @@ export class SectionOperateInteraction extends GraphicInteractionPlugin<Section>
|
||||
if (!section || section.datas.sectionType != SectionType.Physical) return;
|
||||
this.app.updateSelected(section);
|
||||
const lineStore = useLineStore();
|
||||
const operations = [setSectionParam, setFaultOcc];
|
||||
operations.forEach((operation) => {
|
||||
const operateName =
|
||||
operation.name == '设置参数' ? '区段设置参数' : '区段设置故障占用';
|
||||
operation.handler = async () => {
|
||||
if (lineStore.deviceOpreratDialogInstance) return;
|
||||
lineStore.deviceOpreratDialogInstance = Dialog.create({
|
||||
component: SectionOperation,
|
||||
componentProps: {
|
||||
operateName,
|
||||
id: section.id,
|
||||
code: section.datas.code,
|
||||
axleDrst: section.states.axleDrst,
|
||||
axlePdrst: section.states.axlePdrst,
|
||||
},
|
||||
cancel: true,
|
||||
persistent: true,
|
||||
});
|
||||
};
|
||||
});
|
||||
addTrainConfig.disabled = !lineStore.trainConfigList;
|
||||
addTrainConfig.handler = () => {
|
||||
const relations =
|
||||
@ -251,7 +282,7 @@ export class SectionOperateInteraction extends GraphicInteractionPlugin<Section>
|
||||
if (
|
||||
(other.datas.axleCountingRef.length > 1 &&
|
||||
other.datas.type ==
|
||||
graphicData.AxleCounting.TypeDetectionPoint.AxleCounting) ||
|
||||
graphicData.AxleCounting.TypeDetectionPoint.AxleCounting) ||
|
||||
other.datas.axleCountingRef.length == 1
|
||||
) {
|
||||
if (rp.getParam() == 'A') {
|
||||
|
@ -34,6 +34,10 @@ export function initLineApp(): IGraphicApp {
|
||||
destination: `/rtsts/simulation/${simulationId}/state`,
|
||||
messageHandle: testManage.socketHandler,
|
||||
});
|
||||
lineApp.subscribe({
|
||||
destination: `/rtsts/simulation/${simulationId}/tpis`,
|
||||
messageHandle: testManage.socketHandlerConnectInfo,
|
||||
});
|
||||
return lineApp;
|
||||
}
|
||||
|
||||
|
@ -69,8 +69,10 @@ export interface ISectionData extends GraphicData {
|
||||
export interface ISectionState extends GraphicState {
|
||||
id: number;
|
||||
type?: state.SectionType;
|
||||
occupied?: boolean;
|
||||
axleFault?: boolean;
|
||||
occupied?: boolean; //区段占用
|
||||
axleFault?: boolean; //计轴故障
|
||||
axleDrst: boolean; // 计轴复位
|
||||
axlePdrst: boolean; // 计轴预复位
|
||||
}
|
||||
|
||||
export const SectionConsts = {
|
||||
@ -397,7 +399,8 @@ export interface ISectionTemplateProperty {
|
||||
|
||||
export class SectionTemplate
|
||||
extends JlGraphicTemplate<Section>
|
||||
implements ISectionTemplateProperty {
|
||||
implements ISectionTemplateProperty
|
||||
{
|
||||
isCurve = false;
|
||||
segmentsCount = 10;
|
||||
constructor(dataTemplate: ISectionData, stateTemplate?: ISectionState) {
|
||||
|
@ -13,6 +13,15 @@
|
||||
label="切换场景"
|
||||
></q-select>
|
||||
<q-toolbar-title> {{ projectName }} </q-toolbar-title>
|
||||
<q-btn
|
||||
flat
|
||||
dense
|
||||
round
|
||||
icon="connected_tv"
|
||||
class="q-mr-md"
|
||||
:color="testManageStore.connectButtonColor"
|
||||
@click="openConnectInfoDialog"
|
||||
/>
|
||||
<q-btn
|
||||
color="red"
|
||||
label="结束"
|
||||
@ -90,7 +99,7 @@ import StateProperties from 'src/components/line-app/StateProperties.vue';
|
||||
import LayerControlDialog from 'src/components/draw-app/dialogs/LayerControlDialog.vue';
|
||||
import DeviceSearchDialog from 'src/components/draw-app/dialogs/DeviceSearchDialog.vue';
|
||||
import TrainSearchDialog from 'src/components/draw-app/dialogs/TrainSearchDialog.vue';
|
||||
import { useQuasar } from 'quasar';
|
||||
import { DialogChainObject, useQuasar } from 'quasar';
|
||||
import { LinkInfo, MapInfo, getProjectLinkInfo } from 'src/api/ProjectLinkApi';
|
||||
import { ApiError } from 'src/boot/axios';
|
||||
import { layerList } from 'src/drawApp/lineScene';
|
||||
@ -102,6 +111,7 @@ import TrainInfoEcharts from 'src/components/line-app/infos/TrainInfoEcharts.vue
|
||||
import { useIbpStore } from 'src/stores/ibp-store';
|
||||
import { state } from 'src/protos/device_state';
|
||||
import { PictureType } from 'src/protos/picture';
|
||||
import ConnectInfoDialog from 'src/components/line-app/dialogs/ConnectInfoDialog.vue';
|
||||
|
||||
const $q = useQuasar();
|
||||
const canvasWidth = ref(0);
|
||||
@ -209,17 +219,6 @@ onMounted(async () => {
|
||||
}
|
||||
// drawerRight.value = false;
|
||||
});
|
||||
onUnmounted(() => {
|
||||
lineStore.deviceOpreratDialogInstance?.hide();
|
||||
lineStore.setCategoryType(null);
|
||||
if (echartsDialog.value) {
|
||||
echartsDialog.value.hide();
|
||||
lineStore.setEchartsTrainId('');
|
||||
}
|
||||
lineStore.clearTrainStateMap();
|
||||
lineStore.setSimulationId(null);
|
||||
lineStore.destroy();
|
||||
});
|
||||
|
||||
const pslCanvasWidth = ref(500);
|
||||
const pslCanvasHeight = ref(600);
|
||||
@ -450,4 +449,27 @@ watch(
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
let connectInfoDialogInstance: DialogChainObject | null = null;
|
||||
function openConnectInfoDialog() {
|
||||
if (connectInfoDialogInstance) return;
|
||||
connectInfoDialogInstance = $q
|
||||
.dialog({ component: ConnectInfoDialog })
|
||||
.onCancel(() => {
|
||||
connectInfoDialogInstance = null;
|
||||
});
|
||||
}
|
||||
|
||||
onUnmounted(() => {
|
||||
lineStore.deviceOpreratDialogInstance?.hide();
|
||||
connectInfoDialogInstance?.hide();
|
||||
lineStore.setCategoryType(null);
|
||||
if (echartsDialog.value) {
|
||||
echartsDialog.value.hide();
|
||||
lineStore.setEchartsTrainId('');
|
||||
}
|
||||
lineStore.clearTrainStateMap();
|
||||
lineStore.setSimulationId(null);
|
||||
lineStore.destroy();
|
||||
});
|
||||
</script>
|
||||
|
@ -110,6 +110,8 @@ export namespace state {
|
||||
id?: number;
|
||||
occupied?: boolean;
|
||||
axleFault?: boolean;
|
||||
axleDrst?: boolean;
|
||||
axlePdrst?: boolean;
|
||||
}) {
|
||||
super();
|
||||
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
|
||||
@ -123,6 +125,12 @@ export namespace state {
|
||||
if ("axleFault" in data && data.axleFault != undefined) {
|
||||
this.axleFault = data.axleFault;
|
||||
}
|
||||
if ("axleDrst" in data && data.axleDrst != undefined) {
|
||||
this.axleDrst = data.axleDrst;
|
||||
}
|
||||
if ("axlePdrst" in data && data.axlePdrst != undefined) {
|
||||
this.axlePdrst = data.axlePdrst;
|
||||
}
|
||||
}
|
||||
}
|
||||
get id() {
|
||||
@ -143,10 +151,24 @@ export namespace state {
|
||||
set axleFault(value: boolean) {
|
||||
pb_1.Message.setField(this, 4, value);
|
||||
}
|
||||
get axleDrst() {
|
||||
return pb_1.Message.getFieldWithDefault(this, 5, false) as boolean;
|
||||
}
|
||||
set axleDrst(value: boolean) {
|
||||
pb_1.Message.setField(this, 5, value);
|
||||
}
|
||||
get axlePdrst() {
|
||||
return pb_1.Message.getFieldWithDefault(this, 6, false) as boolean;
|
||||
}
|
||||
set axlePdrst(value: boolean) {
|
||||
pb_1.Message.setField(this, 6, value);
|
||||
}
|
||||
static fromObject(data: {
|
||||
id?: number;
|
||||
occupied?: boolean;
|
||||
axleFault?: boolean;
|
||||
axleDrst?: boolean;
|
||||
axlePdrst?: boolean;
|
||||
}): SectionState {
|
||||
const message = new SectionState({});
|
||||
if (data.id != null) {
|
||||
@ -158,6 +180,12 @@ export namespace state {
|
||||
if (data.axleFault != null) {
|
||||
message.axleFault = data.axleFault;
|
||||
}
|
||||
if (data.axleDrst != null) {
|
||||
message.axleDrst = data.axleDrst;
|
||||
}
|
||||
if (data.axlePdrst != null) {
|
||||
message.axlePdrst = data.axlePdrst;
|
||||
}
|
||||
return message;
|
||||
}
|
||||
toObject() {
|
||||
@ -165,6 +193,8 @@ export namespace state {
|
||||
id?: number;
|
||||
occupied?: boolean;
|
||||
axleFault?: boolean;
|
||||
axleDrst?: boolean;
|
||||
axlePdrst?: boolean;
|
||||
} = {};
|
||||
if (this.id != null) {
|
||||
data.id = this.id;
|
||||
@ -175,6 +205,12 @@ export namespace state {
|
||||
if (this.axleFault != null) {
|
||||
data.axleFault = this.axleFault;
|
||||
}
|
||||
if (this.axleDrst != null) {
|
||||
data.axleDrst = this.axleDrst;
|
||||
}
|
||||
if (this.axlePdrst != null) {
|
||||
data.axlePdrst = this.axlePdrst;
|
||||
}
|
||||
return data;
|
||||
}
|
||||
serialize(): Uint8Array;
|
||||
@ -187,6 +223,10 @@ export namespace state {
|
||||
writer.writeBool(3, this.occupied);
|
||||
if (this.axleFault != false)
|
||||
writer.writeBool(4, this.axleFault);
|
||||
if (this.axleDrst != false)
|
||||
writer.writeBool(5, this.axleDrst);
|
||||
if (this.axlePdrst != false)
|
||||
writer.writeBool(6, this.axlePdrst);
|
||||
if (!w)
|
||||
return writer.getResultBuffer();
|
||||
}
|
||||
@ -205,6 +245,12 @@ export namespace state {
|
||||
case 4:
|
||||
message.axleFault = reader.readBool();
|
||||
break;
|
||||
case 5:
|
||||
message.axleDrst = reader.readBool();
|
||||
break;
|
||||
case 6:
|
||||
message.axlePdrst = reader.readBool();
|
||||
break;
|
||||
default: reader.skipField();
|
||||
}
|
||||
}
|
||||
|
@ -827,12 +827,261 @@ export namespace request {
|
||||
}
|
||||
export namespace Section {
|
||||
export enum Operation {
|
||||
SetDrst = 0,
|
||||
CancelDrst = 1,
|
||||
SetPdrst = 2,
|
||||
CancelPdrst = 3,
|
||||
SetFaultOcc = 4,
|
||||
CancelFaultOcc = 5
|
||||
Undefined = 0,
|
||||
SetParams = 1,
|
||||
SetFaultOcc = 4
|
||||
}
|
||||
}
|
||||
export class SectionOperationReq extends pb_1.Message {
|
||||
#one_of_decls: number[][] = [];
|
||||
constructor(data?: any[] | {
|
||||
simulationId?: string;
|
||||
mapId?: number;
|
||||
deviceId?: number;
|
||||
operation?: Section.Operation;
|
||||
param?: SectionParam;
|
||||
}) {
|
||||
super();
|
||||
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
|
||||
if (!Array.isArray(data) && typeof data == "object") {
|
||||
if ("simulationId" in data && data.simulationId != undefined) {
|
||||
this.simulationId = data.simulationId;
|
||||
}
|
||||
if ("mapId" in data && data.mapId != undefined) {
|
||||
this.mapId = data.mapId;
|
||||
}
|
||||
if ("deviceId" in data && data.deviceId != undefined) {
|
||||
this.deviceId = data.deviceId;
|
||||
}
|
||||
if ("operation" in data && data.operation != undefined) {
|
||||
this.operation = data.operation;
|
||||
}
|
||||
if ("param" in data && data.param != undefined) {
|
||||
this.param = data.param;
|
||||
}
|
||||
}
|
||||
}
|
||||
get simulationId() {
|
||||
return pb_1.Message.getFieldWithDefault(this, 1, "") as string;
|
||||
}
|
||||
set simulationId(value: string) {
|
||||
pb_1.Message.setField(this, 1, value);
|
||||
}
|
||||
get mapId() {
|
||||
return pb_1.Message.getFieldWithDefault(this, 2, 0) as number;
|
||||
}
|
||||
set mapId(value: number) {
|
||||
pb_1.Message.setField(this, 2, value);
|
||||
}
|
||||
get deviceId() {
|
||||
return pb_1.Message.getFieldWithDefault(this, 3, 0) as number;
|
||||
}
|
||||
set deviceId(value: number) {
|
||||
pb_1.Message.setField(this, 3, value);
|
||||
}
|
||||
get operation() {
|
||||
return pb_1.Message.getFieldWithDefault(this, 4, Section.Operation.Undefined) as Section.Operation;
|
||||
}
|
||||
set operation(value: Section.Operation) {
|
||||
pb_1.Message.setField(this, 4, value);
|
||||
}
|
||||
get param() {
|
||||
return pb_1.Message.getWrapperField(this, SectionParam, 5) as SectionParam;
|
||||
}
|
||||
set param(value: SectionParam) {
|
||||
pb_1.Message.setWrapperField(this, 5, value);
|
||||
}
|
||||
get has_param() {
|
||||
return pb_1.Message.getField(this, 5) != null;
|
||||
}
|
||||
static fromObject(data: {
|
||||
simulationId?: string;
|
||||
mapId?: number;
|
||||
deviceId?: number;
|
||||
operation?: Section.Operation;
|
||||
param?: ReturnType<typeof SectionParam.prototype.toObject>;
|
||||
}): SectionOperationReq {
|
||||
const message = new SectionOperationReq({});
|
||||
if (data.simulationId != null) {
|
||||
message.simulationId = data.simulationId;
|
||||
}
|
||||
if (data.mapId != null) {
|
||||
message.mapId = data.mapId;
|
||||
}
|
||||
if (data.deviceId != null) {
|
||||
message.deviceId = data.deviceId;
|
||||
}
|
||||
if (data.operation != null) {
|
||||
message.operation = data.operation;
|
||||
}
|
||||
if (data.param != null) {
|
||||
message.param = SectionParam.fromObject(data.param);
|
||||
}
|
||||
return message;
|
||||
}
|
||||
toObject() {
|
||||
const data: {
|
||||
simulationId?: string;
|
||||
mapId?: number;
|
||||
deviceId?: number;
|
||||
operation?: Section.Operation;
|
||||
param?: ReturnType<typeof SectionParam.prototype.toObject>;
|
||||
} = {};
|
||||
if (this.simulationId != null) {
|
||||
data.simulationId = this.simulationId;
|
||||
}
|
||||
if (this.mapId != null) {
|
||||
data.mapId = this.mapId;
|
||||
}
|
||||
if (this.deviceId != null) {
|
||||
data.deviceId = this.deviceId;
|
||||
}
|
||||
if (this.operation != null) {
|
||||
data.operation = this.operation;
|
||||
}
|
||||
if (this.param != null) {
|
||||
data.param = this.param.toObject();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
serialize(): Uint8Array;
|
||||
serialize(w: pb_1.BinaryWriter): void;
|
||||
serialize(w?: pb_1.BinaryWriter): Uint8Array | void {
|
||||
const writer = w || new pb_1.BinaryWriter();
|
||||
if (this.simulationId.length)
|
||||
writer.writeString(1, this.simulationId);
|
||||
if (this.mapId != 0)
|
||||
writer.writeInt32(2, this.mapId);
|
||||
if (this.deviceId != 0)
|
||||
writer.writeUint32(3, this.deviceId);
|
||||
if (this.operation != Section.Operation.Undefined)
|
||||
writer.writeEnum(4, this.operation);
|
||||
if (this.has_param)
|
||||
writer.writeMessage(5, this.param, () => this.param.serialize(writer));
|
||||
if (!w)
|
||||
return writer.getResultBuffer();
|
||||
}
|
||||
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): SectionOperationReq {
|
||||
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new SectionOperationReq();
|
||||
while (reader.nextField()) {
|
||||
if (reader.isEndGroup())
|
||||
break;
|
||||
switch (reader.getFieldNumber()) {
|
||||
case 1:
|
||||
message.simulationId = reader.readString();
|
||||
break;
|
||||
case 2:
|
||||
message.mapId = reader.readInt32();
|
||||
break;
|
||||
case 3:
|
||||
message.deviceId = reader.readUint32();
|
||||
break;
|
||||
case 4:
|
||||
message.operation = reader.readEnum();
|
||||
break;
|
||||
case 5:
|
||||
reader.readMessage(message.param, () => message.param = SectionParam.deserialize(reader));
|
||||
break;
|
||||
default: reader.skipField();
|
||||
}
|
||||
}
|
||||
return message;
|
||||
}
|
||||
serializeBinary(): Uint8Array {
|
||||
return this.serialize();
|
||||
}
|
||||
static deserializeBinary(bytes: Uint8Array): SectionOperationReq {
|
||||
return SectionOperationReq.deserialize(bytes);
|
||||
}
|
||||
}
|
||||
export class SectionParam extends pb_1.Message {
|
||||
#one_of_decls: number[][] = [];
|
||||
constructor(data?: any[] | {
|
||||
mockDrst?: boolean;
|
||||
mockPdrst?: boolean;
|
||||
}) {
|
||||
super();
|
||||
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
|
||||
if (!Array.isArray(data) && typeof data == "object") {
|
||||
if ("mockDrst" in data && data.mockDrst != undefined) {
|
||||
this.mockDrst = data.mockDrst;
|
||||
}
|
||||
if ("mockPdrst" in data && data.mockPdrst != undefined) {
|
||||
this.mockPdrst = data.mockPdrst;
|
||||
}
|
||||
}
|
||||
}
|
||||
get mockDrst() {
|
||||
return pb_1.Message.getFieldWithDefault(this, 2, false) as boolean;
|
||||
}
|
||||
set mockDrst(value: boolean) {
|
||||
pb_1.Message.setField(this, 2, value);
|
||||
}
|
||||
get mockPdrst() {
|
||||
return pb_1.Message.getFieldWithDefault(this, 3, false) as boolean;
|
||||
}
|
||||
set mockPdrst(value: boolean) {
|
||||
pb_1.Message.setField(this, 3, value);
|
||||
}
|
||||
static fromObject(data: {
|
||||
mockDrst?: boolean;
|
||||
mockPdrst?: boolean;
|
||||
}): SectionParam {
|
||||
const message = new SectionParam({});
|
||||
if (data.mockDrst != null) {
|
||||
message.mockDrst = data.mockDrst;
|
||||
}
|
||||
if (data.mockPdrst != null) {
|
||||
message.mockPdrst = data.mockPdrst;
|
||||
}
|
||||
return message;
|
||||
}
|
||||
toObject() {
|
||||
const data: {
|
||||
mockDrst?: boolean;
|
||||
mockPdrst?: boolean;
|
||||
} = {};
|
||||
if (this.mockDrst != null) {
|
||||
data.mockDrst = this.mockDrst;
|
||||
}
|
||||
if (this.mockPdrst != null) {
|
||||
data.mockPdrst = this.mockPdrst;
|
||||
}
|
||||
return data;
|
||||
}
|
||||
serialize(): Uint8Array;
|
||||
serialize(w: pb_1.BinaryWriter): void;
|
||||
serialize(w?: pb_1.BinaryWriter): Uint8Array | void {
|
||||
const writer = w || new pb_1.BinaryWriter();
|
||||
if (this.mockDrst != false)
|
||||
writer.writeBool(2, this.mockDrst);
|
||||
if (this.mockPdrst != false)
|
||||
writer.writeBool(3, this.mockPdrst);
|
||||
if (!w)
|
||||
return writer.getResultBuffer();
|
||||
}
|
||||
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): SectionParam {
|
||||
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new SectionParam();
|
||||
while (reader.nextField()) {
|
||||
if (reader.isEndGroup())
|
||||
break;
|
||||
switch (reader.getFieldNumber()) {
|
||||
case 2:
|
||||
message.mockDrst = reader.readBool();
|
||||
break;
|
||||
case 3:
|
||||
message.mockPdrst = reader.readBool();
|
||||
break;
|
||||
default: reader.skipField();
|
||||
}
|
||||
}
|
||||
return message;
|
||||
}
|
||||
serializeBinary(): Uint8Array {
|
||||
return this.serialize();
|
||||
}
|
||||
static deserializeBinary(bytes: Uint8Array): SectionParam {
|
||||
return SectionParam.deserialize(bytes);
|
||||
}
|
||||
}
|
||||
export class Psd extends pb_1.Message {
|
||||
|
@ -4,11 +4,27 @@ import { state } from 'src/protos/device_state';
|
||||
export const useTestManageStore = defineStore('testManage', {
|
||||
state: () => ({
|
||||
socketInfo: new state.SimulationStatus(),
|
||||
connectInfo: null as null | state.SimulationThirdPartyApiService, //仿真在用的第三方接口状态列表
|
||||
connectButtonColor: 'green',
|
||||
}),
|
||||
actions: {
|
||||
socketHandler(message: Uint8Array) {
|
||||
const storage = state.SimulationStatus.deserialize(message);
|
||||
this.socketInfo = storage;
|
||||
},
|
||||
socketHandlerConnectInfo(message: Uint8Array) {
|
||||
const storage = state.SimulationThirdPartyApiService.deserialize(message);
|
||||
this.connectInfo = storage;
|
||||
this.connectButtonColor = 'green';
|
||||
for (let i = 0; i < storage.states.length; i++) {
|
||||
if (
|
||||
storage.states[i].state ==
|
||||
state.SimulationThirdPartyApiService.State.Error
|
||||
) {
|
||||
this.connectButtonColor = 'red';
|
||||
break;
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user