king
2022-09-13 b8cde0c39d7b6d58ceff3adf6dea3cb3118ea602
src/templates/sharecomponent/settingcomponent/settingform/index.jsx
@@ -323,15 +323,24 @@
    } else if (type === 'scripts' && _scripts.length === 0) {
      _resolve()
    } else { // type 为 submit 、 verify ,以及其他需要验证的场景
      let r = SettingUtils.getDebugSql(setting, _scripts, arr_field, regoptions, search)
      let timestamp = moment().format('YYYY-MM-DD HH:mm:ss')
      let r = SettingUtils.getDebugSql(setting, _scripts, arr_field, regoptions, search, timestamp)
      let param = {
        func: 's_debug_sql',
        exec_type: 'y',
        LText: r.sql
      }
      param.LText = Utils.formatOptions(param.LText)
      param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss')
      param.secretkey = Utils.encrypt('', param.timestamp)
      param.timestamp = timestamp
      param.secretkey = Utils.encrypt('', timestamp)
      if (r.errors) {
        notification.warning({
          top: 92,
          message: r.errors,
          duration: 5
        })
      }
      let sumParam = null
      if (r.sumSql) {
@@ -345,10 +354,10 @@
        sumParam.secretkey = Utils.encrypt('', sumParam.timestamp)
      }
      
      Api.getLocalConfig(param).then(result => {
      Api.genericInterface(param).then(result => {
        if (result.status) {
          if (sumParam) {
            Api.getLocalConfig(sumParam).then(res => {
            Api.genericInterface(sumParam).then(res => {
              if (res.status) {
                _resolve()
              } else {
@@ -567,7 +576,7 @@
    const { loading, activeKey, setting, defaultSql, columns, scripts, preScripts, cbScripts, status, regoptions, visible, script, scriptValue } = this.state
    return (
      <div className="model-table-setting-form-box" id="model-setting-form-body">
      <div className="model-table-setting-form-box">
        {loading && <Spin size="large" />}
        <Tabs activeKey={activeKey} onChange={this.changeTab}>
          <TabPane tab="数据源" key="setting">
@@ -587,8 +596,8 @@
              自定义脚本
              {scripts.length ? <span className="count-tip">{scripts.length}</span> : null}
            </span>
          } disabled={!(status.interType === 'system' || (status.interType === 'custom' && status.requestMode === 'system'))} key="scripts">
            <BorderOutlined className="full-scripts" onClick={() => {
          } disabled={!(status.interType === 'system' || (status.interType === 'custom' && status.requestMode === 'system'))} key="scripts" id="mk-setting-scripts">
            {scripts.length ? <BorderOutlined className="full-scripts" onClick={() => {
              if (this.scriptsForm && (this.scriptsForm.state.editItem || (this.scriptsForm.props.form.getFieldValue('sql') && !/^\s+$/.test(this.scriptsForm.props.form.getFieldValue('sql'))))) {
                notification.warning({
                  top: 92,
@@ -598,7 +607,7 @@
                return
              }
              this.setState({visible: true, script: null, scriptValue: ''})
            }}/>
            }}/> : null}
            <CustomScript
              dict={dict}
              setting={setting}