king
2024-05-22 4f29ad0f9800313ea239064a1b5aab663a794674
src/utils/utils.js
@@ -1048,12 +1048,18 @@
          }
        } else if (typeof(val) === 'string') {
          val = val.replace(/(^\s+$)|\t+|\v+/ig, '')
          if (!val && col.required === 'true') {           // 时间必填校验
            errors.push(_position + '内容不可为空')
          } else if (val && !/^[1-9][0-9]{3}/.test(val)) { // 时间正则校验
          if (!val) {
            if (col.required === 'true') {         // 时间必填校验
              errors.push(_position + '内容不可为空')
            } else if (col.type === 'date') {
              val = '1949-10-01'
            } else if (col.type === 'datetime') {
              val = '1949-10-01 00:00:00'
            }
          } else if (!/^[1-9][0-9]{3}/.test(val)) { // 时间正则校验
            errors.push(_position + '时间格式错误')
          }
        } else {                                           // 时间格式错误
        } else {                                    // 时间格式错误
          errors.push(_position + '时间格式错误')
        }
      }