From d59f518f466274b2caeb2e01c10c92deafe7c93b Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期三, 09 二月 2022 11:48:29 +0800
Subject: [PATCH] 2022-02-09

---
 src/templates/sharecomponent/treesettingcomponent/settingform/index.jsx |   16 ++++++++++++++--
 1 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/src/templates/sharecomponent/treesettingcomponent/settingform/index.jsx b/src/templates/sharecomponent/treesettingcomponent/settingform/index.jsx
index 38552f7..3f3d3a4 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
         }
   
@@ -192,7 +204,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
       }
 

--
Gitblit v1.8.0