From 73a5124745890650d0fc91234bdbaa66d9bcbc6a Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期三, 09 六月 2021 17:52:01 +0800
Subject: [PATCH] 2021-06-09

---
 src/menu/datasource/index.jsx |   14 +++++++++++++-
 1 files changed, 13 insertions(+), 1 deletions(-)

diff --git a/src/menu/datasource/index.jsx b/src/menu/datasource/index.jsx
index 9732b5a..01d1c81 100644
--- a/src/menu/datasource/index.jsx
+++ b/src/menu/datasource/index.jsx
@@ -100,7 +100,19 @@
           return item
         })
       }
-      
+
+      if (window.GLOB.funcs && window.GLOB.funcs.length > 0) {
+        window.GLOB.funcs.forEach(m => {
+          let reg = new RegExp('\\$ex@' + m.func_code + '@ex\\$', 'ig')
+          if (res.setting.dataresource) {
+            res.setting.dataresource = res.setting.dataresource.replace(reg, `/*$ex@${m.func_code}-begin*/\n${m.key_sql}\n/*@ex$-end*/`)
+          }
+          res.scripts.forEach(item => {
+            item.sql = item.sql.replace(reg, `/*$ex@${m.func_code}-begin*/\n${m.key_sql}\n/*@ex$-end*/`)
+          })
+        })
+      }
+
       this.setState({loading: false, visible: false})
       this.props.updateConfig({...config, ...res})
     }, () => {

--
Gitblit v1.8.0