From 682a74e858e5a6cd24d36183931d3afafd6443d7 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期三, 31 三月 2021 10:56:48 +0800
Subject: [PATCH] 2021-03-31
---
src/templates/sharecomponent/settingcomponent/settingform/utils.jsx | 71 +++++++++++++++++++++++++++++++++++
1 files changed, 70 insertions(+), 1 deletions(-)
diff --git a/src/templates/sharecomponent/settingcomponent/settingform/utils.jsx b/src/templates/sharecomponent/settingcomponent/settingform/utils.jsx
index 9bde95a..8e159b0 100644
--- a/src/templates/sharecomponent/settingcomponent/settingform/utils.jsx
+++ b/src/templates/sharecomponent/settingcomponent/settingform/utils.jsx
@@ -43,11 +43,18 @@
let _regoptions = regoptions.map(item => {
return {
reg: new RegExp('@' + item.key + '@', 'ig'),
- value: `'0'`
+ value: `'0'`,
+ type: item.type || ''
}
})
_regoptions.push({
+ reg: new RegExp('@userName@', 'ig'),
+ value: `''`
+ }, {
+ reg: new RegExp('@fullName@', 'ig'),
+ value: `''`
+ }, {
reg: new RegExp('@orderBy@', 'ig'),
value: setting.order
}, {
@@ -65,6 +72,11 @@
_dataresource = _dataresource.replace(item.reg, item.value)
})
_search = ''
+ } else if (_dataresource) {
+ _regoptions.forEach(item => {
+ if (item.type !== 'url') return
+ _dataresource = _dataresource.replace(item.reg, item.value)
+ })
}
if (_customScript) {
@@ -99,4 +111,61 @@
return sql
}
+
+ /**
+ * @description 鐢熸垚鍓嶇疆鎴栧悗缃鍙�
+ * @return {String} scripts 鑴氭湰
+ * @return {Array} regoptions 鎼滅储鏉′欢姝e垯鏇挎崲
+ */
+ static getCustomDebugSql (scripts, regoptions) {
+ let sql = ''
+ let _customScript = ''
+
+ scripts.forEach(script => {
+ if (script.status === 'false') return
+
+ _customScript += `
+ ${script.sql}
+ `
+ })
+
+ if (_customScript) {
+ _customScript = `declare @ErrorCode nvarchar(50),@retmsg nvarchar(4000),@UserName nvarchar(50),@FullName nvarchar(50) select @ErrorCode='',@retmsg =''
+ ${_customScript}
+ `
+ }
+
+ _customScript = _customScript.replace(/@\$|\$@/ig, '')
+ _customScript = _customScript.replace(/@userName@|@fullName@/ig, `''`)
+ // 澶栬仈鏁版嵁搴撴浛鎹�
+ if (window.GLOB.externalDatabase !== null) {
+ _customScript = _customScript.replace(/@db@/ig, window.GLOB.externalDatabase)
+ }
+
+ // 姝e垯鏇挎崲
+ if (regoptions) {
+ let _regoptions = regoptions.map(item => {
+ return {
+ reg: new RegExp('@' + item.key + '@', 'ig'),
+ value: `'0'`
+ }
+ })
+ _regoptions.forEach(item => {
+ _customScript = _customScript.replace(item.reg, item.value)
+ })
+ }
+
+ if (_customScript) {
+ sql = `/* sql 楠岃瘉 */
+ ${_customScript}
+ aaa:
+ if @ErrorCode!=''
+ insert into tmp_err_retmsg (ID, ErrorCode, retmsg, CreateUserID) select @time_id@,@ErrorCode, @retmsg,@UserID@
+ `
+ }
+ sql = sql.replace(/\n\s{8}/ig, '\n')
+ console.info(sql)
+
+ return sql
+ }
}
\ No newline at end of file
--
Gitblit v1.8.0