king
2020-02-21 063b983daaf51a7f1e8677bde1e9c0e618866c91
src/templates/tableshare/verifycardexcelin/columnform/index.jsx
@@ -13,7 +13,8 @@
  state = {
    editItem: null, // 编辑元素
    type: 'Nvarchar(50)'
    type: 'Nvarchar(50)',
    locked: false
  }
  edit = (record) => {
@@ -35,11 +36,33 @@
      required: record.required,
      type: record.type
    })
    if (record.type === 'Int' || /^Decimal/ig.test(record.type)) {
      this.setState({
        locked: true
      })
    } else {
      this.setState({
        locked: false
      })
    }
  }
  typeChange = (val) => {
    this.setState({
      type: val
    }, () => {
      if (val === 'Int' || /^Decimal/ig.test(val)) {
        this.props.form.setFieldsValue({
          required: 'true',
        })
        this.setState({
          locked: true
        })
      } else {
        this.setState({
          locked: false
        })
      }
    })
  }
@@ -50,9 +73,18 @@
      if (!err) {
        values.uuid = this.state.editItem ? this.state.editItem.uuid : ''
        if (/^Nvarchar/ig.test(values.type)) {
          values.limit = values.type.match(/\d+/)[0]
        } else if (/^Decimal/ig.test(values.type)) {
          values.limit = values.type.match(/\d+/ig)[1]
        } else {
          values.limit = ''
        }
        this.props.columnChange(values)
        this.setState({
          editItem: null
          editItem: null,
          locked: false
        })
        this.props.form.setFieldsValue({
          Column: '',
@@ -109,23 +141,6 @@
            </Form.Item>
          </Col>
          <Col span={7}>
            <Form.Item label={'是否必填'}>
              {getFieldDecorator('required', {
                initialValue: 'true'
              })(
                <Select>
                  <Select.Option value="false"> 否 </Select.Option>
                  <Select.Option value="true"> 是 </Select.Option>
                </Select>
              )}
            </Form.Item>
          </Col>
          <Col span={3} className="add">
            <Button onClick={this.handleConfirm} type="primary" className="add-row">
              确定
            </Button>
          </Col>
          <Col span={7}>
            <Form.Item label={'类型'}>
              {getFieldDecorator('type', {
                initialValue: 'Nvarchar(50)'
@@ -145,6 +160,23 @@
              )}
            </Form.Item>
          </Col>
          <Col span={3} className="add">
            <Button onClick={this.handleConfirm} type="primary" className="add-row">
              确定
            </Button>
          </Col>
          <Col span={7}>
            <Form.Item label={'是否必填'}>
              {getFieldDecorator('required', {
                initialValue: 'true'
              })(
                <Select disabled={this.state.locked}>
                  <Select.Option value="false"> 否 </Select.Option>
                  <Select.Option value="true"> 是 </Select.Option>
                </Select>
              )}
            </Form.Item>
          </Col>
          {haslimit ? <Col span={7}>
            <Form.Item label={'最小值'}>
              {getFieldDecorator('min', {