From 46534cc19d95e611d3bc5bb992fbe2fcd41f335d Mon Sep 17 00:00:00 2001 From: chenxt <10125295+chen-xintao97@user.noreply.gitee.com> Date: Wed, 24 Dec 2025 09:38:54 +0800 Subject: [PATCH] 弹窗关闭后刷新组件 --- src/mes/indexMes/index.js | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/mes/indexMes/index.js b/src/mes/indexMes/index.js index 9747c46..f3063fc 100644 --- a/src/mes/indexMes/index.js +++ b/src/mes/indexMes/index.js @@ -1133,6 +1133,13 @@ const ContentComponent = () => { onOpenFilePreviewModal: handleOpenfilePreviewModal, onOpenCommonModal: rest.onOpenCommonModal, }; + const [key, setKey] = useState(Date.now()); + + useEffect(() => { + if (!hooksProps.refresh) return + setKey(Date.now()); + dispatch(["saveState", { refresh: false }]); + }, [hooksProps.refresh]); let viewComponent = { // 班组信息 @@ -1152,8 +1159,10 @@ const ContentComponent = () => { return ( <> {currentContent ? ( -
- {viewComponent[currentContent]()} +
+ + {viewComponent[currentContent]()} +
) : ( "" @@ -1184,7 +1193,8 @@ const CommonModal = () => { onCancel: () => { window.bXingchejiluModal = false; window.deviceTargetInfoModal = false; - dispatch(["saveState", { [`${sName}Visible`]: false, refresh: true}]); + dispatch(["saveState", { [`${sName}Visible`]: false, refresh: true }]); + }, parentProps: hooksProps[`${sName}parentProps`], modalCallback: hooksProps[`${sName}modalCallback`] -- libgit2 0.22.2