diff --git a/src/drawApp/relayCabinetGraphics/RelayInteraction.ts b/src/drawApp/relayCabinetGraphics/RelayInteraction.ts index 78b10ba..d34ed8c 100644 --- a/src/drawApp/relayCabinetGraphics/RelayInteraction.ts +++ b/src/drawApp/relayCabinetGraphics/RelayInteraction.ts @@ -13,6 +13,8 @@ import { } from 'src/jl-graphic'; import { DisplayObject, FederatedMouseEvent } from 'pixi.js'; import { setRelayState } from 'src/api/Simulation'; +import { ApiError } from 'src/boot/axios'; +import { errorNotify, successNotify } from 'src/utils/CommonNotify'; export class RelayData extends GraphicDataBase implements IRelayData { constructor(data?: relayCabinetGraphicData.Relay) { @@ -87,8 +89,8 @@ export class RelayState extends GraphicStateBase implements IRelayState { } } -const setOpen: MenuItemOptions = { name: '设置打开' }; -const setClose: MenuItemOptions = { name: '设置闭合' }; +const setOpen: MenuItemOptions = { name: '驱动落下' }; +const setClose: MenuItemOptions = { name: '驱动吸起' }; const RelayOperationMenu: ContextMenu = ContextMenu.init({ name: 'Turnout操作', @@ -136,13 +138,20 @@ export class RelayOperationPlugin extends GraphicInteractionPlugin { mapId, simulationId, td, - }); + }) + .then(() => { + successNotify('修改继电器状态成功'); + }) + .catch((err) => { + const error = err as ApiError; + errorNotify(error.title, error); + }); }; - setOpen.handler = async () => { - await changeRelayState(false); + setOpen.handler = () => { + changeRelayState(false); }; - setClose.handler = async () => { - await changeRelayState(true); + setClose.handler = () => { + changeRelayState(true); }; RelayOperationMenu.open(e.global); }