From 107c861004cf9a129dcc7d7561dd3b21cb760044 Mon Sep 17 00:00:00 2001 From: dong <58670809@qq.com> Date: Thu, 26 Oct 2023 16:00:17 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/drawApp/graphics/SectionInteraction.ts | 11 ++++++++--- src/drawApp/graphics/TurnoutInteraction.ts | 11 ++++++++--- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/src/drawApp/graphics/SectionInteraction.ts b/src/drawApp/graphics/SectionInteraction.ts index 1184fba..72fe762 100644 --- a/src/drawApp/graphics/SectionInteraction.ts +++ b/src/drawApp/graphics/SectionInteraction.ts @@ -14,13 +14,14 @@ import { } from 'src/jl-graphic'; import { useLineStore } from 'src/stores/line-store'; import { SectionGraphicHitArea } from 'src/graphics/section/SectionDrawAssistant'; -import { Dialog } from 'quasar'; +import { Dialog, Notify } from 'quasar'; import AddTrainDialog from '../../components/draw-app/dialogs/AddTrainDialog.vue'; import { addTrain } from 'src/api/Simulation'; -import { successNotify, errorNotify } from '../../utils/CommonNotify'; +import { successNotify } from '../../utils/CommonNotify'; import { MenuItemOptions } from 'src/jl-graphic/ui/Menu'; import { ContextMenu } from 'src/jl-graphic/ui/ContextMenu'; import { AxleCounting } from 'src/graphics/axleCounting/AxleCounting'; +import { ApiError } from 'src/boot/axios'; export class SectionData extends GraphicDataBase implements ISectionData { constructor(data?: graphicData.Section) { @@ -219,7 +220,11 @@ export class SectionOperateInteraction extends GraphicInteractionPlugin
successNotify('添加列车成功!'); }) .catch((err) => { - errorNotify('添加列车失败!', err); + const error = err as ApiError; + Notify.create({ + type: 'negative', + message: `添加列车失败!: ${error.title}`, + }); }); }); }; diff --git a/src/drawApp/graphics/TurnoutInteraction.ts b/src/drawApp/graphics/TurnoutInteraction.ts index 807eb8f..5cee999 100644 --- a/src/drawApp/graphics/TurnoutInteraction.ts +++ b/src/drawApp/graphics/TurnoutInteraction.ts @@ -23,12 +23,13 @@ import { ContextMenu } from 'src/jl-graphic/ui/ContextMenu'; import { MenuItemOptions } from 'src/jl-graphic/ui/Menu'; import { useLineStore } from 'src/stores/line-store'; import { setSwitchPosition } from 'src/api/Simulation'; -import { Dialog } from 'quasar'; +import { Dialog, Notify } from 'quasar'; import AddTrainDialog from '../../components/draw-app/dialogs/AddTrainDialog.vue'; import { addTrain } from 'src/api/Simulation'; -import { errorNotify, successNotify } from 'src/utils/CommonNotify'; +import { successNotify } from 'src/utils/CommonNotify'; import { AxleCounting } from 'src/graphics/axleCounting/AxleCounting'; import { request } from 'src/protos/request'; +import { ApiError } from 'src/boot/axios'; function getDefaultEndPoint() { return { @@ -166,7 +167,11 @@ export class TurnoutOperationPlugin extends GraphicInteractionPlugin { successNotify('添加列车成功!'); }) .catch((err) => { - errorNotify('添加列车失败!', err); + const error = err as ApiError; + Notify.create({ + type: 'negative', + message: `添加列车失败!: ${error.title}`, + }); }); }); };