update 实现部分表单使用detail获取详细数据

This commit is contained in:
2021-06-28 20:45:33 +08:00
parent 54955e26e5
commit e8dd6f4eca
13 changed files with 328 additions and 233 deletions

View File

@@ -1,7 +1,7 @@
import React, { Component } from 'react'
import { Form, Spin } from 'antd'
import { AntIcon } from 'components'
import { cloneDeep } from 'lodash'
import { api } from 'common/api'
const initialValues = {}
@@ -31,14 +31,15 @@ export default class form extends Component {
* @param {*} params
*/
async fillData(params) {
this.record = cloneDeep(params.record)
const state = { loading: false }
//#region 从后端转换成前段所需格式,也可以在此处调用获取详细数据接口
if (params.id) {
this.record = (await api).data
}
//#endregion
this.form.current.setFieldsValue(this.record)
this.setState({
loading: false,
})
this.setState(state)
}
/**