From 34a61df4d4db06405fc366000c8642db94226ab6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E4=BD=B3=E9=91=AB?= <695997094@qq.com> Date: Mon, 22 Jul 2024 17:04:57 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E5=AD=90=E8=A1=A8=E6=8C=89=E9=92=AE?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E5=88=97=E8=A1=A8=E5=A2=9E=E5=8A=A0=E7=BC=96?= =?UTF-8?q?=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Common/ShareShowComp/buttonConfig.tsx | 35 ++++++++++++++----- 1 file changed, 27 insertions(+), 8 deletions(-) diff --git a/src/components/Common/ShareShowComp/buttonConfig.tsx b/src/components/Common/ShareShowComp/buttonConfig.tsx index 452d9f9be..2ff0706b4 100644 --- a/src/components/Common/ShareShowComp/buttonConfig.tsx +++ b/src/components/Common/ShareShowComp/buttonConfig.tsx @@ -79,13 +79,26 @@ const ButtonConfig: React.FC = (props) => { title: '操作', key: 'action', render: (_: any, item: any) => ( - +
+ + +
), }, ]; @@ -268,7 +281,13 @@ const ButtonConfig: React.FC = (props) => { }} onCancel={props.finished}>
-
-- Gitee From bd313f91d52ceb2dca855975c85cbc7f5407f508 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E4=BD=B3=E9=91=AB?= <695997094@qq.com> Date: Mon, 22 Jul 2024 17:33:08 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E6=8C=89=E9=92=AE=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E5=A2=9E=E5=8A=A0=E7=BC=96=E8=BE=91=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Common/ShareShowComp/buttonConfig.tsx | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/components/Common/ShareShowComp/buttonConfig.tsx b/src/components/Common/ShareShowComp/buttonConfig.tsx index 2ff0706b4..76cd676d6 100644 --- a/src/components/Common/ShareShowComp/buttonConfig.tsx +++ b/src/components/Common/ShareShowComp/buttonConfig.tsx @@ -125,7 +125,20 @@ const ButtonConfig: React.FC = (props) => { open={showChildModal} onOk={() => { form.validateFields().then(() => { - setTableData([...tableData, form.getFieldsValue()]); + const rowData = form.getFieldsValue(); + const item = tableData.find((item) => item.code === rowData.code); + let updatedItems: any[] = []; + if (item) { + updatedItems = tableData.map((item) => { + if (item.code === rowData.code) { + return rowData; + } + return item; + }); + } else { + updatedItems = [...tableData, rowData]; + } + setTableData(updatedItems); setFormName(''); setShowChildModal(false); }); -- Gitee