| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { is, fromJS } from 'immutable' |
| | | import { Form, Row, Col, Input, InputNumber, Select, DatePicker, notification, Collapse } from 'antd' |
| | | import moment from 'moment' |
| | | import { formRule } from '@/utils/option.js' |
| | |
| | | record: {} |
| | | } |
| | | |
| | | UNSAFE_componentWillReceiveProps (nextProps) { |
| | | if (nextProps.data && !is(fromJS(this.props.data), fromJS(nextProps.data))) { |
| | | |
| | | let _fieldsvalue = {} |
| | | let _record = {} |
| | | Object.keys(nextProps.data).forEach(key => { |
| | | if (this.props.form.getFieldValue(key) !== undefined) { |
| | | _fieldsvalue[key] = nextProps.data[key] |
| | | } else { |
| | | _record[key] = nextProps.data[key] |
| | | } |
| | | }) |
| | | |
| | | if (Object.keys(_fieldsvalue).length > 0) { |
| | | this.props.form.setFieldsValue(_fieldsvalue) |
| | | } |
| | | |
| | | this.setState({ |
| | | record: _record |
| | | }) |
| | | } |
| | | } |
| | | |
| | | UNSAFE_componentWillMount () { |
| | | const { data, groups } = this.props |
| | | |