diff --git a/src/UI/Components/Modal/HardwareModal.tsx b/src/UI/Components/Modal/HardwareModal.tsx index 3d4d26ab2..0dc33cd64 100644 --- a/src/UI/Components/Modal/HardwareModal.tsx +++ b/src/UI/Components/Modal/HardwareModal.tsx @@ -1,4 +1,4 @@ -import { Button, Classes, Icon } from '@blueprintjs/core'; +import { Button, Classes, Icon, Intent } from '@blueprintjs/core'; import * as React from 'react'; import { MathUtils } from 'three'; import { app } from '../../../ApplicationServices/Application'; @@ -10,6 +10,7 @@ import { PromptStatus } from '../../../Editor/PromptResult'; import { BaseHardwareStore } from '../../Store/RightPanelStore/HardwareStore'; import { BoardModalType } from '../Board/BoardModal'; import { UserConfig } from '../Board/UserConfig'; +import { AppToaster } from '../Toaster'; interface IMetalsModal { @@ -76,14 +77,18 @@ export function GetHardwareModal(Com, props: IMetalsModal) ); } - private ok = () => + private ok = async () => { let en = props.store.Entity; let ro = props.store.rotation; - CommandWrap(() => + await CommandWrap(() => { - if (!en) return;//避免空实体导致的报错 + if (!en) + { + AppToaster.show({ message: "未知错误导致修改五金数据失败,请重新修改!(五金实体丢失)", intent: Intent.DANGER, timeout: 30000 }); + return; + } Object.assign(en.HardwareOption, props.store.option); en.DataList = props.store.KvList; @@ -91,7 +96,6 @@ export function GetHardwareModal(Com, props: IMetalsModal) { en.ContourRotation = MathUtils.degToRad(parseFloat(ro)) ?? en.ContourRotation; } - app.Viewer.UpdateRender(); }, "修改五金"); this.cancel(); };