king
2020-04-12 3df2d3624c6b768d29670b537f8d6a71d3ef122c
src/templates/modalconfig/index.jsx
@@ -68,7 +68,8 @@
    curgroup: null,        // 当前组,新建或编辑
    optionLibs: null,      // 自定义下拉选项库
    sources: null,         // 表单类型
    pasteVisible: null     // 表单粘贴
    pasteVisible: null,    // 表单粘贴
    sqlVerifing: false     // sql验证
  }
  /**
@@ -633,13 +634,50 @@
      _config.fields = _config.fields.filter(item => !item.origin)
      this.setState({
        config: _config,
        modalType: null,
        card: null,
        optionLibs: optionLibs,
        visible: false
      })
      if ((res.type === 'select' || res.type === 'multiselect' || res.type === 'link') && res.resourceType === '1' && /\s/.test(res.dataSource)) {
        this.setState({
          sqlVerifing: true
        })
        let param = {
          func: 's_debug_sql',
          LText: res.dataSource
        }
        param.LText = Utils.formatOptions(param.LText)
        param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000'
        param.secretkey = Utils.encrypt(param.LText, param.timestamp)
        if (window.GLOB.mainSystemApi && res.database === 'sso') {
          param.rduri = window.GLOB.mainSystemApi
        }
        Api.getLocalConfig(param).then(result => {
          if (result.status) {
            this.setState({
              sqlVerifing: false,
              config: _config,
              modalType: null,
              card: null,
              optionLibs: optionLibs,
              visible: false
            })
          } else {
            this.setState({sqlVerifing: false})
            Modal.error({
              title: result.message
            })
          }
        })
      } else {
        this.setState({
          config: _config,
          modalType: null,
          card: null,
          optionLibs: optionLibs,
          visible: false
        })
      }
    })
  }
@@ -1341,6 +1379,7 @@
          width={700}
          onCancel={this.editModalCancel}
          onOk={this.handleSubmit}
          confirmLoading={this.state.sqlVerifing}
          destroyOnClose
        >
          {<ModalForm