king
2020-02-17 0594fe8d97286a535177f8ba05972d0305fc7dee
src/templates/comtableconfig/index.jsx
@@ -1303,9 +1303,10 @@
  verifySubmit = () => {
    const { card } = this.state
    let config = JSON.parse(JSON.stringify(this.state.config))
    let _verify = this.verifyRef.state.verify
    if (card.OpenType !== 'excelIn') {
      let _verify = this.verifyRef.state.verify
      if (_verify.default === 'false' && _verify.scripts.length === 0) {
        notification.warning({
          top: 92,
@@ -1314,57 +1315,38 @@
        })
        return
      }
    } else if (card.OpenType === 'excelIn') {
      let cols = _verify.columns.map(col => col.Column)
      cols = Array.from(new Set(cols))
      if (!_verify.sheet) {
        notification.warning({
          top: 92,
          message: '请设置导入表名!',
          duration: 10
        })
        return
      } else if (_verify.columns.length === 0) {
        notification.warning({
          top: 92,
          message: '请设置Excel列字段!',
          duration: 10
        })
        return
      } else if (_verify.columns.length > cols.length) {
        notification.warning({
          top: 92,
          message: 'Excel列字段名,不可重复!',
          duration: 10
        })
        return
      } else if (_verify.range === 1) {
        let tEmptys = _verify.columns.filter(op => !op.Text)
        if (tEmptys.length > 0) {
          notification.warning({
            top: 92,
            message: '忽略首行时,会使用Text值校验Excel首行内容,Text值与Excel表首行内容相同,且均不可为空!',
            duration: 10
          })
          return
      config.action = config.action.map(item => {
        if (item.uuid === card.uuid) {
          item.verify = _verify
        }
      }
        return item
      })
      this.setState({
        profileVisible: false,
        config: config,
        card: '',
      })
    } else if (card.OpenType === 'excelIn') {
      this.verifyRef.handleConfirm().then(res => {
        config.action = config.action.map(item => {
          if (item.uuid === card.uuid) {
            item.verify = res
          }
          return item
        })
        this.setState({
          profileVisible: false,
          config: config,
          card: '',
        })
      })
    }
    config.action = config.action.map(item => {
      if (item.uuid === card.uuid) {
        item.verify = _verify
      }
      return item
    })
    this.setState({
      profileVisible: false,
      config: config,
      card: '',
    })
  }
  /**