king
2020-12-31 eebe63a6727e6495321d1433ebd2779b5a36d45a
src/templates/sharecomponent/actioncomponent/verifyexcelout/columnform/index.jsx
@@ -3,44 +3,21 @@
import { Form, Row, Col, Button, Input, InputNumber } from 'antd'
import './index.scss'
class UniqueForm extends Component {
class ExcelOutColumn extends Component {
  static propTpyes = {
    dict: PropTypes.object,         // 字典项
    columns: PropTypes.array,       // 列名集合
    columnChange: PropTypes.func    // 修改函数
  }
  state = {
    editItem: null // 编辑元素
  }
  edit = (record) => {
    this.setState({
      editItem: record
    })
    this.props.form.setFieldsValue({
      Column: record.Column,
      Text: record.Text,
      Width: record.Width,
    })
  }
  handleConfirm = () => {
    // 表单提交时检查输入值是否正确
    this.props.form.validateFieldsAndScroll((err, values) => {
      if (!err) {
        values.uuid = this.state.editItem ? this.state.editItem.uuid : ''
        this.props.columnChange(values)
        this.setState({
          editItem: null
        })
        this.props.form.setFieldsValue({
          Column: '',
          Text: '',
          Width: 20,
          Width: 20
        })
      }
    })
@@ -104,7 +81,7 @@
          </Col>
          <Col span={3} className="add">
            <Button onClick={this.handleConfirm} type="primary" className="mk-green">
              保存
              添加
            </Button>
          </Col>
        </Row>
@@ -113,4 +90,4 @@
  }
}
export default Form.create()(UniqueForm)
export default Form.create()(ExcelOutColumn)