| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { is, fromJS } from 'immutable' |
| | | import { Form, Row, Col, Select, Switch } from 'antd' |
| | | import './index.scss' |
| | | |
| | | import { Form, Row, Col, Select, Switch, notification } from 'antd' |
| | | // import './index.scss' |
| | | |
| | | class UniqueForm extends Component { |
| | | static propTpyes = { |
| | | dict: PropTypes.object, // 字典项 |
| | | voucherobj: PropTypes.object, // 凭证信息 |
| | | voucher: PropTypes.array, // 表单 |
| | | columns: PropTypes.array, // 表单 |
| | |
| | | if (!err) { |
| | | values.enabled = true |
| | | let _detail = this.state.voucherDetail.filter(item => item.ModularDetailCode === values.VoucherTypeOne)[0] |
| | | |
| | | if (!_detail) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '凭证类型或凭证标识不存在!', |
| | | duration: 5 |
| | | }) |
| | | return |
| | | } |
| | | values.VoucherTypeTwo = _detail.VoucherTypeTwo |
| | | values.Type = _detail.IDefine1 |
| | | |
| | |
| | | rules: [ |
| | | { |
| | | required: true, |
| | | message: this.props.dict['form.required.select'] + '主类型!' |
| | | message: '请选择主类型!' |
| | | } |
| | | ] |
| | | })( |
| | |
| | | </Form.Item> |
| | | </Col> |
| | | <Col span={11}> |
| | | <Form.Item label={'凭证类型'}> |
| | | <Form.Item label="凭证类型"> |
| | | {getFieldDecorator('VoucherType', { |
| | | initialValue: voucherobj.VoucherType || (this.state.voucher[0] && this.state.voucher[0].ID) || '', |
| | | rules: [ |
| | | { |
| | | required: true, |
| | | message: this.props.dict['form.required.input'] + '凭证类型!' |
| | | message: '请选择凭证类型!' |
| | | } |
| | | ] |
| | | })( |
| | |
| | | </Form.Item> |
| | | </Col> |
| | | <Col span={11}> |
| | | <Form.Item label={'凭证标识'}> |
| | | <Form.Item label="凭证标识"> |
| | | {getFieldDecorator('VoucherTypeOne', { |
| | | initialValue: voucherobj.VoucherTypeOne || (this.state.voucherDetail[0] && this.state.voucherDetail[0].ModularDetailCode) || '', |
| | | rules: [ |
| | | { |
| | | required: true, |
| | | message: this.props.dict['form.required.input'] + '凭证标识!' |
| | | message: '请选择凭证标识!' |
| | | } |
| | | ] |
| | | })( |
| | |
| | | </Form.Item> |
| | | </Col> |
| | | <Col span={11}> |
| | | <Form.Item label={'关联字段'}> |
| | | <Form.Item label="关联字段"> |
| | | {getFieldDecorator('linkField', { |
| | | initialValue: voucherobj.linkField || (columns[0] && columns[0].field) || '', |
| | | rules: [ |
| | | { |
| | | required: true, |
| | | message: this.props.dict['form.required.input'] + '关联字段!' |
| | | message: '请选择关联字段!' |
| | | } |
| | | ] |
| | | })( |
| | |
| | | > |
| | | {columns.map((option, index) => |
| | | <Select.Option title={option.label} id={index + option.uuid} key={index + option.uuid} value={option.field}> |
| | | {option.label} |
| | | {`${option.label}(${option.field})`} |
| | | </Select.Option> |
| | | )} |
| | | </Select> |