king
2020-11-10 5df578ff69f6b02e821d59a8883bc75d78695a62
src/menu/datasource/verifycard/columnform/index.jsx
@@ -10,34 +10,13 @@
    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: ''
@@ -47,6 +26,7 @@
  }
  render() {
    const { dict } = this.props
    const { getFieldDecorator } = this.props.form
    const formItemLayout = {
      labelCol: {
@@ -69,7 +49,7 @@
                rules: [
                  {
                    required: true,
                    message: this.props.dict['form.required.input'] + '名称!'
                    message: dict['form.required.input'] + '名称!'
                  }
                ]
              })(<Input placeholder="" autoComplete="off" />)}
@@ -82,7 +62,7 @@
                rules: [
                  {
                    required: true,
                    message: this.props.dict['form.required.input'] + '字段!'
                    message: dict['form.required.input'] + '字段!'
                  }
                ]
              })(<Input placeholder="" autoComplete="off" />)}
@@ -95,7 +75,7 @@
                rules: [
                  {
                    required: true,
                    message: this.props.dict['form.required.select'] + '数据类型!'
                    message: dict['form.required.select'] + '数据类型!'
                  }
                ]
              })(
@@ -133,7 +113,7 @@
          </Col>
          <Col span={3} className="add">
            <Button onClick={this.handleConfirm} type="primary" className="mk-green">
              保存
              {dict['model.add']}
            </Button>
          </Col>
        </Row>