From 76a4300654a18d228838c3f27455dc8e7a8cd616 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期五, 15 一月 2021 17:04:42 +0800
Subject: [PATCH] Merge branch 'master' into bms

---
 src/templates/zshare/verifycard/customscript/index.jsx |   35 ++++++++++++++++++++++++++---------
 1 files changed, 26 insertions(+), 9 deletions(-)

diff --git a/src/templates/zshare/verifycard/customscript/index.jsx b/src/templates/zshare/verifycard/customscript/index.jsx
index e5058a3..d1a9a85 100644
--- a/src/templates/zshare/verifycard/customscript/index.jsx
+++ b/src/templates/zshare/verifycard/customscript/index.jsx
@@ -37,10 +37,11 @@
   }
 
   handleConfirm = () => {
+    const { editItem } = this.state
     // 琛ㄥ崟鎻愪氦鏃舵鏌ヨ緭鍏ュ�兼槸鍚︽纭�
     this.props.form.validateFieldsAndScroll((err, values) => {
       if (!err) {
-        values.uuid = this.state.editItem ? this.state.editItem.uuid : ''
+        values.uuid = editItem ? editItem.uuid : ''
 
         let _quot = values.sql.match(/'{1}/g)
         let _lparen = values.sql.match(/\({1}/g)
@@ -88,19 +89,35 @@
           aaa:
         `
 
-        let _initsql = ''
-        this.props.customScripts.forEach(script => {
-          if (this.state.editItem && this.state.editItem.uuid === script.uuid) return
-          if (script.status === 'false' || script.position !== 'init') return
+        let _initCustomScript = '' // 鍒濆鍖栬剼鏈�
+        let _prevCustomScript = '' // 榛樿sql鍓嶆墽琛岃剼鏈�
+        let _backCustomScript = '' // 榛樿sql鍚庢墽琛岃剼鏈�
 
-          _initsql += `
-            ${script.sql}
+        this.props.customScripts.forEach(item => {
+          if (item.status === 'false') return
+
+          if (item.position === 'init') {
+            _initCustomScript += `
+            /* 鍒濆鍖栬剼鏈� */
+            ${values.uuid === item.uuid ? values.sql : item.sql}
             `
+          } else if (item.position === 'front') {
+            _prevCustomScript += `
+            /* 榛樿sql鍓嶈剼鏈� */
+            ${values.uuid === item.uuid ? values.sql : item.sql}
+            `
+          } else {
+            _backCustomScript += `
+            /* 榛樿sql鍚庤剼鏈� */
+            ${values.uuid === item.uuid ? values.sql : item.sql}
+            `
+          }
         })
 
         let param = {
           func: 's_debug_sql',
-          LText: this.props.initsql + _initsql + values.sql + tail
+          exec_type: 'y',
+          LText: this.props.initsql + _initCustomScript + _prevCustomScript + _backCustomScript + tail
         }
 
         // 鏁版嵁鏉冮檺
@@ -115,7 +132,7 @@
 
         param.LText = Utils.formatOptions(param.LText)
         param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss')
-        param.secretkey = Utils.encrypt(param.LText, param.timestamp)
+        param.secretkey = Utils.encrypt('', param.timestamp)
         
         this.setState({loading: true})
         Api.getLocalConfig(param).then(res => {

--
Gitblit v1.8.0