king
2025-02-12 c8c8bdf0c362ca76253d8e0cbb0dbaa13efad4a3
src/tabviews/zshare/actionList/excelInbutton/index.jsx
@@ -695,17 +695,34 @@
    for (let i = 0; i < 26; i++) {
      cols.push('A' + cols[i])
    }
    let columns = fromJS(btn.verify.columns).toJS()
    columns = columns.filter((col, index) => {
      col.colIndex = cols[index] || (index + 1)
      if (col.import !== 'init' && (/^Decimal/ig.test(col.type) || /^int/ig.test(col.type))) {
        col.declen = 0
        if (/^Decimal/ig.test(col.type)) {
          col.declen = +col.type.match(/\d+/g)[1]
        }
        col.declen = col.declen || 0
      }
      if (col.required === 'false') {
        delete col.min
        delete col.max
      }
      return col.import !== 'false'
    })
    let lines = data.map((item, lindex) => {
      let vals = []
      btn.verify.columns.forEach((col, cindex) => {
        if (col.import === 'false') return
      columns.forEach(col => {
        let val = item[col.Column] !== undefined ? item[col.Column] : ''
        let _colindex = cols[cindex] || (cindex + 1)
        let _position = (_topline + lindex + 1) + '行 ' + _colindex + '列 '
        let _position = (_topline + lindex + 1) + '行 ' + col.colIndex + '列 '
        let eLen = errors.length
        if (col.import === 'init') {
        if (col.$error) {
        } else if (col.import === 'init') {
          if (/^Nvarchar/ig.test(col.type)) {
            val = ''
          } else if (/^Decimal/ig.test(col.type) || /^int/ig.test(col.type)) {
@@ -741,15 +758,26 @@
            if (!val || isNaN(val)) {
              val = 0
            }
          } else if (!val && val !== 0) {
          }
          if (!val && val !== 0) {
            errors.push(_position + '内容不可为空')
          } else if (isNaN(val)) {                                  // 检验是否为数值
            errors.push(_position + '内容应为数值')
          } else if ((col.min || col.min === 0) && val < col.min) { // 最小值检验
          } else if (typeof(col.min) === 'number' && val < col.min) { // 最小值检验
            errors.push(_position + '小于最小值')
          } else if ((col.max || col.max === 0) && val > col.max) { // 最大值检验
          } else if (typeof(col.max) === 'number' && val > col.max) { // 最大值检验
            errors.push(_position + '大于最大值')
          } else {
            let _float = (val + '').split('.')[1]
            if (_float && _float.length > col.declen) {
              if (col.declen) {
                errors.push(_position + `数值不可大于${col.declen}位小数`)
              } else {
                errors.push(_position + '数值应为整数')
              }
            }
          }
          val = val + ''
        } else if (col.type === 'date' || col.type === 'datetime') {
          if (typeof(val) === 'number') {
            if (val > 2958465 || val <= 0) {                 // 时间过大或小于等于0
@@ -785,6 +813,10 @@
          }
        }
        if (errors.length > eLen) {
          col.$error = true
        }
        vals.push(val)
      })