From 66b240b674c174f1fb930655c8a5322ff6e668e2 Mon Sep 17 00:00:00 2001 From: dong <58670809@qq.com> Date: Mon, 28 Aug 2023 14:32:42 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=88=97=E8=BD=A6=E6=80=BB?= =?UTF-8?q?=E9=95=BF=E9=80=89=E6=8B=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/ProjectLinkApi.ts | 2 +- src/api/Simulation.ts | 2 + .../draw-app/dialogs/AddTrainDialog.vue | 39 +++++++++++++++++-- src/drawApp/graphics/SectionInteraction.ts | 10 +++-- src/pages/ProjectManage.vue | 2 + src/pages/TrainModelManage.vue | 12 ++---- 6 files changed, 52 insertions(+), 15 deletions(-) diff --git a/src/api/ProjectLinkApi.ts b/src/api/ProjectLinkApi.ts index 03f1542..48a6425 100644 --- a/src/api/ProjectLinkApi.ts +++ b/src/api/ProjectLinkApi.ts @@ -55,7 +55,7 @@ export async function getProjectLinkInfo(id: number): Promise { */ export async function getProjectLinkTrainSizeByMapId( id: number -): Promise { +): Promise { const response = await api.get(`${UriBase}/mapInfo/trainSize/${id}`); return response.data; } diff --git a/src/api/Simulation.ts b/src/api/Simulation.ts index c132518..7240edc 100644 --- a/src/api/Simulation.ts +++ b/src/api/Simulation.ts @@ -27,6 +27,7 @@ export async function destroySimulation(data: { simulationId: string }) { * @param id 区段或者道岔的索引 * @param devicePort 道岔的端口 * @param headOffset 偏移量(区段从A端为偏移原点,道岔从岔芯为偏移原点) + * @param trainLength 列车总长 */ export async function addTrain(data: { simulationId: string; @@ -34,6 +35,7 @@ export async function addTrain(data: { id: string; devicePort?: string; headOffset: number; + trainLength?: number; }) { const response = await api.post(`${UriBase}/train/add`, data); return response.data; diff --git a/src/components/draw-app/dialogs/AddTrainDialog.vue b/src/components/draw-app/dialogs/AddTrainDialog.vue index be0fb05..09ca166 100644 --- a/src/components/draw-app/dialogs/AddTrainDialog.vue +++ b/src/components/draw-app/dialogs/AddTrainDialog.vue @@ -12,7 +12,7 @@ v-model="props.dev.code" /> - + + + + + @@ -51,9 +62,11 @@ diff --git a/src/drawApp/graphics/SectionInteraction.ts b/src/drawApp/graphics/SectionInteraction.ts index 3683b29..2304a90 100644 --- a/src/drawApp/graphics/SectionInteraction.ts +++ b/src/drawApp/graphics/SectionInteraction.ts @@ -180,13 +180,17 @@ export class SectionOperateInteraction extends GraphicInteractionPlugin
componentProps: { dev: section, kmLength: d }, cancel: true, persistent: true, - }).onOk((data: { offset: number; dir: 1 | 0 }) => { - addTrain({ + }).onOk((data: { offset: number; dir: 1 | 0; trainLength: string }) => { + const params = { simulationId, up: !!data.dir, id: section.datas.index + '', headOffset: data.offset, - }) + }; + if (data.trainLength) { + Object.assign(params, { trainLength: +data.trainLength }); + } + addTrain(params) .then(() => { successNotify('添加列车成功!'); }) diff --git a/src/pages/ProjectManage.vue b/src/pages/ProjectManage.vue index d596b25..072c452 100644 --- a/src/pages/ProjectManage.vue +++ b/src/pages/ProjectManage.vue @@ -115,6 +115,7 @@