king
2023-09-14 be8f81fe2eb52e841efead8586e514842471e0ba
src/menu/datasource/verifycard/index.jsx
@@ -385,7 +385,7 @@
    }
    return new Promise((resolve, reject) => {
      this.sqlverify(resolve, reject, false, scripts)
      this.sqlverify(resolve, reject, 'script', scripts)
    })
  }
@@ -449,7 +449,7 @@
              loading: false
            })
            this.getdefaultSql()
          }, true)
          }, 'change')
        })
      }, () => {
        this.setState({loading: false})
@@ -622,7 +622,7 @@
            defaultSearch: _search,
            setting: res
          }, () => {
            this.sqlverify(() => { resolve({setting: res, columns, subColumns, scripts, cols }) }, reject, false)
            this.sqlverify(() => { resolve({setting: res, columns, subColumns, scripts, cols }) }, reject, 'submit')
          })
        }, () => {
          reject()
@@ -637,7 +637,7 @@
          reject()
          return
        }
        this.sqlverify(() => { resolve({setting, columns, subColumns, scripts, cols }) }, reject, false)
        this.sqlverify(() => { resolve({setting, columns, subColumns, scripts, cols }) }, reject, 'submit')
      } else if (activeKey === 'subcolumns') {
        if (this.subdatasource && this.subdatasource.state.editingKey) {
          notification.warning({
@@ -648,7 +648,7 @@
          reject()
          return
        }
        this.sqlverify(() => { resolve({setting, columns, subColumns, scripts, cols }) }, reject, false)
        this.sqlverify(() => { resolve({setting, columns, subColumns, scripts, cols }) }, reject, 'submit')
      } else if (activeKey === 'scripts') {
        let _loading = false
        if (this.scriptsForm && this.scriptsForm.state.editItem) {
@@ -667,12 +667,12 @@
          return
        }
        this.sqlverify(() => { resolve({setting, columns, subColumns, scripts, cols }) }, reject, false)
        this.sqlverify(() => { resolve({setting, columns, subColumns, scripts, cols }) }, reject, 'submit')
      }
    })
  }
  sqlverify = (resolve, reject, change = false, testScripts) => {
  sqlverify = (resolve, reject, type, testScripts) => {
    const { config } = this.props
    const { columns, setting, scripts, searches, defaultSearch, debugId } = this.state
@@ -681,7 +681,7 @@
    if (testScripts) {
      _scripts = testScripts.filter(item => item.status !== 'false')
    }
    if (!change && setting.interType === 'system' && setting.execute === 'false' && _scripts.length === 0) {
    if (type !== 'change' && setting.interType === 'system' && setting.execute === 'false' && _scripts.length === 0) {
      notification.warning({
        top: 92,
        message: '不执行默认sql时,请添加自定义脚本!',
@@ -691,7 +691,7 @@
      return
    }
    if (change && columns.length === 0) {
    if (type === 'change' && columns.length === 0) {
      reject()
      return
    }
@@ -724,43 +724,31 @@
      param.timestamp = timestamp
      param.secretkey = Utils.encrypt('', timestamp)
      let sumParam = null
      if (r.sumSql) {
        sumParam = {
          func: 's_debug_sql',
          exec_type: 'y',
          LText: r.sumSql
        }
        sumParam.LText = Utils.formatOptions(sumParam.LText)
        sumParam.timestamp = moment().format('YYYY-MM-DD HH:mm:ss')
        sumParam.secretkey = Utils.encrypt('', sumParam.timestamp)
      }
      Api.genericInterface(param).then(result => {
        if (result.status) {
          if (sumParam) {
            Api.genericInterface(sumParam).then(res => {
              if (res.status) {
        if (result.status || result.ErrCode === '-2') {
                this.setState({debugId: _debugId}, () => {
                  resolve()
                })
              } else {
          if (type === 'submit') {
            Modal.confirm({
              title: result.message,
              okText: '知道了',
              cancelText: '强制保存',
              onOk: () => {
                reject()
                Modal.error({
                  title: res.message
                })
              }
            })
          } else {
            this.setState({debugId: _debugId}, () => {
              },
              onCancel() {
              resolve()
            })
          }
            })
        } else {
          reject()
          Modal.error({
            title: result.message
              title: result.message,
              okText: '知道了'
          })
          }
        }
      })
    } else {
@@ -801,7 +789,7 @@
    this.setState({loading: true})
    this.sqlverify(() => {this.setState({scripts: _scripts, script: null, scriptValue: '', loading: false})}, () => {this.setState({loading: false})}, false, _scripts)
    this.sqlverify(() => {this.setState({scripts: _scripts, script: null, scriptValue: '', loading: false})}, () => {this.setState({loading: false})}, 'script', _scripts)
  }
  updatefields = (columns) => {