king
2020-04-15 0c1c59933e95c4c691d6ba3d11bf4aef98fe9e8d
src/templates/comtableconfig/index.jsx
@@ -1397,9 +1397,7 @@
    const { card } = this.state
    let config = JSON.parse(JSON.stringify(this.state.config))
    
    if (card.OpenType === 'excelIn') {
      this.verifyRef.handleConfirm().then(res => {
        config.action = config.action.map(item => {
          if (item.uuid === card.uuid) {
            item.verify = res
@@ -1411,83 +1409,9 @@
        this.setState({
          profileVisible: false,
          config: config,
          card: '',
        card: ''
        })
      })
    } else if (card.execMode) {
      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: '',
        })
      })
    } else {
      let _verify = this.verifyRef.state.verify
      let _loading = this.verifyRef.state.updateloading
      if (card.OpenType !== 'excelOut' && _verify.default === 'false' && _verify.scripts.length === 0) {
        notification.warning({
          top: 92,
          message: '不执行默认sql时,必须设置自定义脚本!',
          duration: 10
        })
        return
      } else if (card.OpenType === 'excelOut') {
        let _cols = _verify.columns.map(col => col.Column)
        let _vcols = Array.from(new Set(_cols))
        if (_cols.length > _vcols.length) {
          notification.warning({
            top: 92,
            message: 'Excel列字段名,不可重复!',
            duration: 10
          })
          return
        }
      }
      config.action = config.action.map(item => {
        if (item.uuid === card.uuid) {
          item.verify = _verify
        }
        return item
      })
      if (_loading) {
        let _this = this
        confirm({
          content: `存在未保存项,确定提交吗?`,
          okText: this.state.dict['header.confirm'],
          cancelText: this.state.dict['header.cancel'],
          onOk() {
            _this.setState({
              profileVisible: false,
              config: config,
              card: '',
            })
          },
          onCancel() {}
        })
      } else {
        this.setState({
          profileVisible: false,
          config: config,
          card: '',
        })
      }
    }
  }
  /**