| | |
| | | this.form = form |
| | | const { children, dataIndex, record } = this.props |
| | | const { editing } = this.state |
| | | |
| | | return editing ? ( |
| | | <Form.Item style={{ margin: 0 }}> |
| | | {form.getFieldDecorator(dataIndex, { |
| | | rules: [ |
| | | { |
| | | required: true, |
| | | required: dataIndex === 'Value' || dataIndex === 'Text', |
| | | message: 'NOT NULL.', |
| | | }, |
| | | ], |
| | |
| | | columns: columns, |
| | | dataSource: props.data, |
| | | count: props.data.length, |
| | | type: props.type |
| | | type: props.type, |
| | | linkSubFields: props.linkSubFields |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | resetColumn = (type, linkSubFields) => { |
| | | let dataSource = JSON.parse(JSON.stringify(this.state.dataSource)) |
| | | let _width = '40%' |
| | | let fields = [] |
| | | |
| | | if (type === 'select' && linkSubFields.length > this.state.linkSubFields) { |
| | | let addcol = linkSubFields[linkSubFields.length - 1] |
| | | dataSource = dataSource.map(data => { |
| | | data[addcol.field] = data.Text |
| | | return data |
| | | }) |
| | | } |
| | | |
| | | if (type === 'link') { |
| | | _width = '27%' |
| | |
| | | |
| | | this.setState({ |
| | | columns: columns, |
| | | dataSource: dataSource, |
| | | type: type |
| | | }) |
| | | } |