update 实现部分表单使用detail获取详细数据
This commit is contained in:
@@ -20,7 +20,7 @@ export default class data extends Component {
|
||||
form = React.createRef()
|
||||
|
||||
// 初始化数据
|
||||
record = {}
|
||||
id = ''
|
||||
|
||||
/**
|
||||
* mount后回调
|
||||
@@ -29,11 +29,11 @@ export default class data extends Component {
|
||||
this.props.created && this.props.created(this)
|
||||
}
|
||||
async fillData(params) {
|
||||
this.record = cloneDeep(params.record)
|
||||
this.id = params.id
|
||||
//#region 从后端转换成前段所需格式
|
||||
const orgData = await this.loadOrgData()
|
||||
const areaData = await this.loadAreaData()
|
||||
const orgCheckedKeys = await this.loadMemberOwn(this.record.id)
|
||||
const orgCheckedKeys = await this.loadMemberOwn(this.id)
|
||||
this.setState({
|
||||
options: {
|
||||
orgData,
|
||||
@@ -42,7 +42,7 @@ export default class data extends Component {
|
||||
},
|
||||
})
|
||||
this.form.current.setFieldsValue({
|
||||
id: this.record.id,
|
||||
id: this.id,
|
||||
grantOrgIdList: orgCheckedKeys,
|
||||
grantAreaCodeList: [],
|
||||
})
|
||||
@@ -63,8 +63,8 @@ export default class data extends Component {
|
||||
const valid = await form.validateFields()
|
||||
if (valid) {
|
||||
const postData = form.getFieldsValue()
|
||||
if (this.record) {
|
||||
postData.id = this.record.id
|
||||
if (this.id) {
|
||||
postData.id = this.id
|
||||
}
|
||||
//#region 从前段转换后端所需格式
|
||||
//#endregion
|
||||
|
||||
Reference in New Issue
Block a user