You need to sign in or sign up before continuing.
Commit fe9b0f1d authored by zhangwenshuai's avatar zhangwenshuai

更新formView

parent 1779fb1d
...@@ -309,5 +309,27 @@ class FormWrap extends Component { ...@@ -309,5 +309,27 @@ class FormWrap extends Component {
); );
} }
} }
function mapPropsToFields(props) {
export default Form.create({ name: 'editFormV3' })(FormWrap); 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);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment