| | |
| | | columnChange: PropTypes.func // 修改函数 |
| | | } |
| | | |
| | | state = { |
| | | editItem: null // 编辑元素 |
| | | } |
| | | |
| | | edit = (record) => { |
| | | this.setState({ |
| | | editItem: record |
| | | }) |
| | | |
| | | this.props.form.setFieldsValue({ |
| | | label: record.label, |
| | | field: record.field, |
| | | datatype: record.datatype |
| | | }) |
| | | } |
| | | |
| | | state = {} |
| | | |
| | | handleConfirm = () => { |
| | | // 表单提交时检查输入值是否正确 |
| | | this.props.form.validateFieldsAndScroll((err, values) => { |
| | | if (!err) { |
| | | values.uuid = this.state.editItem ? this.state.editItem.uuid : '' |
| | | |
| | | this.setState({ |
| | | editItem: null |
| | | }, () => { |
| | | this.props.columnChange(values) |
| | | }) |
| | | this.props.columnChange(values) |
| | | this.props.form.setFieldsValue({ |
| | | label: '', |
| | | field: '' |
| | |
| | | } |
| | | |
| | | render() { |
| | | const { dict } = this.props |
| | | const { getFieldDecorator } = this.props.form |
| | | const formItemLayout = { |
| | | labelCol: { |
| | |
| | | rules: [ |
| | | { |
| | | required: true, |
| | | message: this.props.dict['form.required.input'] + '名称!' |
| | | message: dict['form.required.input'] + '名称!' |
| | | } |
| | | ] |
| | | })(<Input placeholder="" autoComplete="off" />)} |
| | |
| | | rules: [ |
| | | { |
| | | required: true, |
| | | message: this.props.dict['form.required.input'] + '字段!' |
| | | message: dict['form.required.input'] + '字段!' |
| | | } |
| | | ] |
| | | })(<Input placeholder="" autoComplete="off" />)} |
| | |
| | | rules: [ |
| | | { |
| | | required: true, |
| | | message: this.props.dict['form.required.select'] + '数据类型!' |
| | | message: dict['form.required.select'] + '数据类型!' |
| | | } |
| | | ] |
| | | })( |
| | |
| | | </Col> |
| | | <Col span={3} className="add"> |
| | | <Button onClick={this.handleConfirm} type="primary" className="mk-green"> |
| | | 保存 |
| | | {dict['model.add']} |
| | | </Button> |
| | | </Col> |
| | | </Row> |