继电器起落名字修改

This commit is contained in:
joylink_zhaoerwei 2023-10-08 10:37:57 +08:00
parent 6c1490b3a8
commit f26124de26

View File

@ -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<Relay> {
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);
}