king
2020-11-24 0f79daefced8980fa571dd3d2c781a0e3646614f
src/templates/zshare/verifycard/contrastform/index.jsx
@@ -3,43 +3,17 @@
import { Form, Row, Col, Select, Button, Input } from 'antd'
import './index.scss'
class UniqueForm extends Component {
  static propTpyes = {
    dict: PropTypes.object,       // 字典项
    contrastChange: PropTypes.func  // 修改函数
  }
  state = {
    editItem: null // 编辑元素
  }
  edit = (record) => {
    this.setState({
      editItem: record
    })
    this.props.form.setFieldsValue({
      frontfield: record.frontfield,
      operator: record.operator,
      backfield: record.backfield,
      errmsg: record.errmsg,
      errorCode: record.errorCode
    })
  }
  handleConfirm = () => {
    // 表单提交时检查输入值是否正确
    this.props.form.validateFieldsAndScroll((err, values) => {
      if (!err) {
        values.uuid = this.state.editItem ? this.state.editItem.uuid : ''
        this.setState({
          editItem: null
        }, () => {
          this.props.contrastChange(values)
        })
        this.props.contrastChange(values)
        this.props.form.setFieldsValue({
          frontfield: '',
          backfield: '',
@@ -117,7 +91,7 @@
          </Col>
          <Col span={3} className="add">
            <Button onClick={this.handleConfirm} type="primary" className="mk-green">
              保存
              {this.props.dict['model.add']}
            </Button>
          </Col>
          <Col span={7}>