update 实现部分表单使用detail获取详细数据
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user