king
2020-01-08 e7aa72fb3038debcaefba16a98b20f2de495f2fb
src/templates/modalconfig/modalform/index.jsx
@@ -32,7 +32,7 @@
    } else if ((type === 'multiselect' || type === 'select' || type === 'link') && resourceType === '1') { // 选择类型、数据源
      _options = [..._options, 'resourceType', 'dataSource', 'valueField', 'valueText', 'orderBy', 'orderType']
    } else if (type === 'number') {
      _options = [..._options, 'decimal']
      _options = [..._options, 'decimal', 'min', 'max']
    } else if (type === 'fileupload') {
      _options = ['label', 'field', 'type', 'readonly', 'required']
    }
@@ -88,7 +88,7 @@
      } else if ((value === 'multiselect' || value === 'select' || value === 'link') && this.state.resourceType === '1') { // 选择类型、数据源
        _options = [..._options, 'resourceType', 'dataSource', 'valueField', 'valueText', 'orderBy', 'orderType']
      } else if (value === 'number') {
        _options = [..._options, 'decimal']
        _options = [..._options, 'decimal', 'min', 'max']
      } else if (value === 'fileupload') {
        _options = ['label', 'field', 'type', 'readonly', 'required']
      }
@@ -178,8 +178,8 @@
        let rules = []
        if (item.key === 'field') {
          rules = [{
            pattern: /^[\u4E00-\u9FA50-9a-zA-Z,_]*$/ig,
            message: '字段名只允许包含数字、字母、汉字以及_'
            pattern: /^[\u4E00-\u9FA50-9a-zA-Z,_-]*$/ig,
            message: '字段名只允许包含数字、字母、汉字以及_-'
          }, {
            max: 50,
            message: '字段名最多50个字符!'
@@ -223,7 +223,7 @@
            <Col span={12} key={index}>
              <Form.Item label={item.label}>
                {getFieldDecorator(item.key, {
                  initialValue: item.initVal || 0,
                  initialValue: item.initVal,
                  rules: [
                    {
                      required: !!item.required,
@@ -337,21 +337,29 @@
            }
            if (emptys.length > 0) {
              isvalid = false
              notification.warning({
                top: 92,
                message: this.props.dict['header.form.selectItem.error'],
                duration: 10
              })
            }
          } else if ((values.type === 'multiselect' || values.type === 'select' || values.type === 'link') && values.resourceType === '1') {
            values.options = []
          } else if (values.type === 'funcvar') { // 函数变量为只读元素
            values.readonly = 'true'
          } else if (values.type === 'number' && (values.min || values.min === 0) && (values.max || values.max === 0)) { // 数值型验证最小最大值
            if (values.min > values.max) {
              isvalid = false
              notification.warning({
                top: 92,
                message: '最小值不可大于最大值!',
                duration: 10
              })
            }
          }
          if (isvalid) {
            resolve(values)
          } else {
            notification.warning({
              top: 92,
              message: this.props.dict['header.form.selectItem.error'],
              duration: 10
            })
          }
        } else {
          reject(err)