From 137fb8ea6af2789b3238b22bac31d80bced41dfe Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期三, 28 七月 2021 11:39:39 +0800
Subject: [PATCH] 2021-07-28

---
 src/templates/sharecomponent/settingcalcomponent/verifycard/index.jsx |   23 ++++++++++++++++++++---
 1 files changed, 20 insertions(+), 3 deletions(-)

diff --git a/src/templates/sharecomponent/settingcalcomponent/verifycard/index.jsx b/src/templates/sharecomponent/settingcalcomponent/verifycard/index.jsx
index 065406a..8e00256 100644
--- a/src/templates/sharecomponent/settingcalcomponent/verifycard/index.jsx
+++ b/src/templates/sharecomponent/settingcalcomponent/verifycard/index.jsx
@@ -71,10 +71,25 @@
   UNSAFE_componentWillMount() {
     const { config } = this.props
 
+    let _setting = fromJS(config.setting).toJS()
+    let _scripts = fromJS(config.scripts).toJS()
+
+    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: fromJS(config.setting).toJS(),
+      setting: _setting,
       columns: fromJS(config.columns).toJS(),
-      scripts: fromJS(config.scripts).toJS()
+      scripts: _scripts
     })
   }
 
@@ -327,6 +342,7 @@
   }
 
   render() {
+    const { config } = this.props
     const { columns, setting, scripts, colColumns, activeKey, loading } = this.state
 
     return (
@@ -350,7 +366,7 @@
               wrappedComponentRef={(inst) => this.contrastForm = inst}
             />
             <FieldsComponent
-              config={{...this.props.config, columns}}
+              config={{...config, columns}}
               type="fields"
               updatefield={this.updatefields}
             />
@@ -373,6 +389,7 @@
               dict={this.props.dict}
               setting={setting}
               scripts={scripts}
+              urlFields={config.urlFields}
               defaultSql={this.state.defaultsql}
               searches={this.props.searches}
               scriptsChange={this.scriptsChange}

--
Gitblit v1.8.0