king
2020-01-08 e7aa72fb3038debcaefba16a98b20f2de495f2fb
src/tabviews/tableshare/mutilform/index.jsx
@@ -184,6 +184,16 @@
    })
  }
  handleInputNumber = (rule, value, callback, item) => {
    if (item.required === 'true' && (!value && value !== 0)) {
      callback()
    } else if ((item.min || item.min === 0) && (value || value === 0) && value < item.min) {
      callback(item.label + '最小值为' + item.min + '!')
    } else if ((item.max || item.max === 0) && (value || value === 0) && value > item.max) {
      callback(item.label + '最大值为' + item.max + '!')
    }
  }
  getFields() {
    const { getFieldDecorator } = this.props.form
@@ -226,6 +236,12 @@
        let max = (item.max || item.max === 0) ? item.max : Infinity
        let _initval = item.initval
        let precision = (item.decimal || item.decimal === 0) ? item.decimal : null
        let rules = []
        if ((item.min || item.min === 0) || (item.max || item.max === 0)) {
          rules.push({
            validator: (rule, value, callback) => {this.handleInputNumber(rule, value, callback, item)}
          })
        }
        
        fields.push(
          <Col span={24 / cols} key={index}>
@@ -236,7 +252,8 @@
                  {
                    required: item.required === 'true',
                    message: this.props.dict['form.required.input'] + item.label + '!'
                  }
                  },
                  ...rules
                ]
              })(
                precision === null ?