From eebe63a6727e6495321d1433ebd2779b5a36d45a Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期四, 31 十二月 2020 22:08:14 +0800
Subject: [PATCH] 2020-12-31

---
 src/templates/sharecomponent/settingcomponent/settingform/utils.jsx |   19 ++++++++++++++-----
 1 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/src/templates/sharecomponent/settingcomponent/settingform/utils.jsx b/src/templates/sharecomponent/settingcomponent/settingform/utils.jsx
index b5c6d98..9bde95a 100644
--- a/src/templates/sharecomponent/settingcomponent/settingform/utils.jsx
+++ b/src/templates/sharecomponent/settingcomponent/settingform/utils.jsx
@@ -9,7 +9,7 @@
    */
   static getDebugSql (setting, scripts, arr_field, regoptions, search) {
     let sql = ''
-    let _dataresource = setting.dataresource
+    let _dataresource = setting.dataresource || ''
     let _customScript = ''
     scripts && scripts.forEach(script => {
       _customScript += `
@@ -18,7 +18,7 @@
     })
 
     if (_customScript) {
-      _customScript = `declare @ErrorCode nvarchar(50),@retmsg nvarchar(4000) select @ErrorCode='',@retmsg =''
+      _customScript = `declare @ErrorCode nvarchar(50),@retmsg nvarchar(4000),@UserName nvarchar(50),@FullName nvarchar(50) select @ErrorCode='',@retmsg =''
         ${_customScript}
       `
     }
@@ -33,12 +33,17 @@
     if (_customScript) {
       _customScript = _customScript.replace(/@\$|\$@/ig, '')
     }
+    // 澶栬仈鏁版嵁搴撴浛鎹�
+    if (window.GLOB.externalDatabase !== null) {
+      _dataresource = _dataresource.replace(/@db@/ig, window.GLOB.externalDatabase)
+      _customScript = _customScript.replace(/@db@/ig, window.GLOB.externalDatabase)
+    }
     
     // 姝e垯鏇挎崲
     let _regoptions = regoptions.map(item => {
       return {
         reg: new RegExp('@' + item.key + '@', 'ig'),
-        value: `'${item.value}'`
+        value: `'0'`
       }
     })
 
@@ -78,15 +83,19 @@
     }
 
     if (_customScript) {
-      sql = `${_customScript}
+      sql = `/* sql 楠岃瘉 */
+        ${_customScript}
         ${_dataresource}
         aaa:
         if @ErrorCode!=''
           insert into tmp_err_retmsg (ID, ErrorCode, retmsg, CreateUserID) select @time_id@,@ErrorCode, @retmsg,@UserID@
       `
     } else {
-      sql = _dataresource
+      sql = `/* sql 楠岃瘉 */
+        ${_dataresource}`
     }
+    sql = sql.replace(/\n\s{8}/ig, '\n')
+    console.info(sql)
 
     return sql
   }

--
Gitblit v1.8.0