diff --git a/components/apolloTable/editFormV3/index.tsx b/components/apolloTable/editFormV3/index.tsx index f5ddf656358a8b9a64f228eadafef547b69ff160..dd1f696f79372e3470bf32fcc7452615162bd232 100644 --- a/components/apolloTable/editFormV3/index.tsx +++ b/components/apolloTable/editFormV3/index.tsx @@ -309,5 +309,27 @@ class FormWrap extends Component { ); } } - -export default Form.create({ name: 'editFormV3' })(FormWrap); +function mapPropsToFields(props) { + const { data, rowData } = props; + const returnObj:any = {}; + if (!data || typeof data !== 'object') return returnObj; + Object.keys(data).forEach((key) => { + const col = data[key]; + if (!col) { + return; + } + const { columnType, value, renderEditForm } = col; + let detailConfig: any; + if (typeof renderEditForm === 'function') { + detailConfig = renderEditForm({ cellData: value, rowData, columnConfig: col }); + } else { + detailConfig = config[String(columnType)] || config['1']; + } + const formatValue = getFormat(detailConfig, col, value); + returnObj[columnType] = Form.createFormField({ + value: formatValue, + }); + }); + return returnObj; +} +export default Form.create({ name: 'editFormV3', mapPropsToFields })(FormWrap);