From 249a533d0883343b503b36e02b8d7fc3a1a93fd7 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期日, 24 九月 2023 11:59:11 +0800
Subject: [PATCH] 2023-09-24

---
 src/tabviews/zshare/actionList/normalbutton/index.jsx |   36 ++++++++++++++++++++++++++++++++++--
 1 files changed, 34 insertions(+), 2 deletions(-)

diff --git a/src/tabviews/zshare/actionList/normalbutton/index.jsx b/src/tabviews/zshare/actionList/normalbutton/index.jsx
index cc4a956..e3a10b6 100644
--- a/src/tabviews/zshare/actionList/normalbutton/index.jsx
+++ b/src/tabviews/zshare/actionList/normalbutton/index.jsx
@@ -1442,7 +1442,22 @@
   getCallBackSql = (result, record) => {
     const { btn } = this.props
     let lines = []
-    let pre = btn.callbackType === 'script' ? '@' : ''
+    let pre = ''
+    let tables = []
+
+    if (btn.callbackType === 'script') { // 浣跨敤鑷畾涔夎剼鏈�
+      pre = '@'
+
+      btn.verify.cbScripts.forEach(script => {
+        if (script.status === 'false') return
+
+        if (/\s#[a-z0-9_]+(\s|\()/ig.test(script.sql)) {
+          tables.push(...script.sql.match(/\s#[a-z0-9_]+(\s|\()/ig))
+        }
+      })
+
+      tables = tables.map(tb => tb.replace(/\s|\(/g, ''))
+    }
 
     let errSql = ''
     if (result.$ErrCode === 'E') {
@@ -1459,6 +1474,11 @@
       let vals = []
       let subObjs = []
       let id = Utils.getuuid()
+      let tbName = pre + tb
+
+      if (tables.includes('#' + tb)) {
+        tbName = '#' + tb
+      }
 
       delete obj.$$key
 
@@ -1491,7 +1511,7 @@
 
       lines.push({
         table: md5(tb + keys),
-        insert: `Insert into ${pre}${tb} (${keys},[mk_level],[mk_id],[mk_bid])`,
+        insert: `Insert into ${tbName} (${keys},[mk_level],[mk_id],[mk_bid])`,
         select: `Select ${vals.join(',')},'${level}','${id}','${bid}'`
       })
 
@@ -1819,6 +1839,18 @@
         result.rduri = btn.interface
       }
 
+      if (/function:/i.test(result.rduri)) {
+        let rduri = result.rduri
+        try {
+          rduri = rduri.replace(/function:/i, '')
+          // eslint-disable-next-line
+          let func = new Function(rduri)
+          result.rduri = func()
+        } catch (e) {
+          console.warn(e)
+        }
+      }
+
       let host = window.GLOB.baseurl.replace(/http(s):\/\//, '')
       if (result.rduri.indexOf(host) === -1 && /\/dostars/.test(result.rduri)) {
         result.$login = true

--
Gitblit v1.8.0