diff --git a/src/components/Common/ShareShowComp/buttonConfig.tsx b/src/components/Common/ShareShowComp/buttonConfig.tsx index 452d9f9beda0e867163f17ae65bc3effb1b8b390..76cd676d65ebbeba9e78ac3058160934e427f2fc 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) => ( - +
+ + +
), }, ]; @@ -112,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); }); @@ -268,7 +294,13 @@ const ButtonConfig: React.FC = (props) => { }} onCancel={props.finished}>
-