From 8d66ff34fae5b048a6b7923cc75d34f13a08be9d Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期二, 02 八月 2022 11:42:43 +0800
Subject: [PATCH] Merge branch 'develop'

---
 src/templates/sharecomponent/treesettingcomponent/settingform/index.jsx |   25 +++++++++++++++++++------
 1 files changed, 19 insertions(+), 6 deletions(-)

diff --git a/src/templates/sharecomponent/treesettingcomponent/settingform/index.jsx b/src/templates/sharecomponent/treesettingcomponent/settingform/index.jsx
index 38552f7..b3958a5 100644
--- a/src/templates/sharecomponent/treesettingcomponent/settingform/index.jsx
+++ b/src/templates/sharecomponent/treesettingcomponent/settingform/index.jsx
@@ -35,6 +35,18 @@
     let _setting = fromJS(config.setting).toJS()
     let _scripts = _setting.scripts || []
 
+    if (window.GLOB.funcs && window.GLOB.funcs.length > 0) {
+      window.GLOB.funcs.forEach(m => {
+        let reg = new RegExp(`\\/\\*\\$ex@${m.func_code}-begin\\*\\/[\\s\\S]+\\/\\*@ex\\$-end\\*\\/`, 'ig')
+        _scripts.forEach(item => {
+          item.sql = item.sql.replace(reg, `$ex@${m.func_code}@ex$`)
+        })
+        if (_setting.dataresource) {
+          _setting.dataresource = _setting.dataresource.replace(reg, `$ex@${m.func_code}@ex$`)
+        }
+      })
+    }
+
     this.setState({
       setting: _setting,
       scripts: _scripts
@@ -74,7 +86,7 @@
         let _loading = false
         if (this.scriptsForm && this.scriptsForm.state.editItem) {
           _loading = true
-        } else if (this.scriptsForm && this.scriptsForm.props.form.getFieldValue('sql')) {
+        } else if (this.scriptsForm && this.scriptsForm.props.form.getFieldValue('sql') && !/^\s+$/.test(this.scriptsForm.props.form.getFieldValue('sql'))) {
           _loading = true
         }
   
@@ -123,14 +135,15 @@
     } else if (type === 'scripts' && _scripts.length === 0) {
       _resolve()
     } else { // type 涓� submit 銆� verify 锛屼互鍙婂叾浠栭渶瑕侀獙璇佺殑鍦烘櫙
+      let timestamp = moment().format('YYYY-MM-DD HH:mm:ss')
       let param = {
         func: 's_debug_sql',
         exec_type: 'y',
-        LText: SettingUtils.getDebugSql(setting, _scripts)
+        LText: SettingUtils.getDebugSql(setting, _scripts, timestamp)
       }
       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)
       
       Api.getLocalConfig(param).then(result => {
         if (result.status) {
@@ -192,7 +205,7 @@
       let _loading = false
       if (this.scriptsForm && this.scriptsForm.state.editItem) {
         _loading = true
-      } else if (this.scriptsForm && this.scriptsForm.props.form.getFieldValue('sql')) {
+      } else if (this.scriptsForm && this.scriptsForm.props.form.getFieldValue('sql') && !/^\s+$/.test(this.scriptsForm.props.form.getFieldValue('sql'))) {
         _loading = true
       }
 
@@ -238,7 +251,7 @@
     return (
       <div className="model-tree-setting-form-box" id="model-setting-form-body">
         {loading && <Spin size="large" />}
-        <Tabs activeKey={activeKey} className="verify-card-box" onChange={this.changeTab}>
+        <Tabs activeKey={activeKey} onChange={this.changeTab}>
           <TabPane tab="鏁版嵁婧�" key="setting">
             <DataSource
               menu={menu}

--
Gitblit v1.8.0