From 3f5457bf0493a3226604be3b98cb879ad44a68a9 Mon Sep 17 00:00:00 2001 From: zsqtony <450952271@qq.com> Date: Sun, 5 Oct 2025 10:39:21 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E6=9B=B4=E6=96=B0=E5=BE=AA=E7=8E=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/MyModal.tsx | 6 +- src/pages/asset/grids/modals/GridShow.tsx | 148 +++++++++++----------- 2 files changed, 79 insertions(+), 75 deletions(-) diff --git a/src/components/MyModal.tsx b/src/components/MyModal.tsx index 4e47799..f13b3f7 100644 --- a/src/components/MyModal.tsx +++ b/src/components/MyModal.tsx @@ -9,10 +9,10 @@ export function MyModal(props?: any) { }; useEffect(() => { - if (open && props?.onOpen) { - props.onOpen(); + if (open) { + props?.onOpen(true); } - }, [open, props?.onOpen]); + }, [open]); useImperativeHandle(props.myRef, () => ({ close, diff --git a/src/pages/asset/grids/modals/GridShow.tsx b/src/pages/asset/grids/modals/GridShow.tsx index 071f4d4..e772375 100644 --- a/src/pages/asset/grids/modals/GridShow.tsx +++ b/src/pages/asset/grids/modals/GridShow.tsx @@ -11,86 +11,90 @@ import { ProCard, ProDescriptions } from '@ant-design/pro-components'; import { Space } from 'antd'; import { useState } from 'react'; -export default function info(props: MyBetaModalFormProps) { - const [show, setShow] = useState({}); - const getShow = () => { - Apis.Grid.Grids.Show({ - id: props?.item?.id, - }) - .then((res) => { - setShow(res?.data); - }) - .catch(() => false); - }; +export default function Info(props: MyBetaModalFormProps) { + const [getShow, setDataShow] = useState({}); // 只在弹窗打开时获取数据 - const handleOpen = () => { - getShow(); - }; return ( { + if (e) { + return Apis.Grid.Grids.Show({ + id: props?.item?.id, + }) + .then((res) => { + console.log(res); + setDataShow(JSON.parse(JSON.stringify(res?.data))); + return false; + }) + .catch(() => false); + } + console.log(e); + }} node={ - - - - - 【{show?.id}】 - {show?.name} - - - - {show?.name} - - - {show?.floor} - - - - - - - - - {show?.built_area}m² - - - {show?.inside_area}m² - - - {show?.chargeable_area}m² - - - - - - {show?.room || ''}房{show?.hall || ''}厅{show?.bathroom || ''}卫 - {show?.kitchen || ''}厨{show?.balcony || ''}阳台 - - - - - - + <> + + + + + 【{getShow?.id}】 + {getShow?.name} + + + + {getShow?.name} + + + {getShow?.floor} + + + + + + + + + {getShow?.built_area}m² + + + {getShow?.inside_area}m² + + + {getShow?.chargeable_area}m² + + + + + + {getShow?.room || ''}房{getShow?.hall || ''}厅 + {getShow?.bathroom || ''}卫{getShow?.kitchen || ''}厨 + {getShow?.balcony || ''}阳台 + + + + + + + } /> );