From 876a5e6657d67df66bb525d02dd6d147ba81cae5 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期四, 05 一月 2023 09:53:37 +0800
Subject: [PATCH] 2023-01-05

---
 src/utils/utils-custom.js |   27 +++++++++++++++++++++++++--
 1 files changed, 25 insertions(+), 2 deletions(-)

diff --git a/src/utils/utils-custom.js b/src/utils/utils-custom.js
index a7a4398..1eaf2e9 100644
--- a/src/utils/utils-custom.js
+++ b/src/utils/utils-custom.js
@@ -896,7 +896,7 @@
 export function getTables (config, pops) {
   let tables = []
   let cuts = []
-  let cutreg = /(from|update|insert\s+into)\s+(@db@)?[a-z_]+/ig
+  let cutreg = /(from|update|insert\s+into)\s+(@db@)?[a-z0-9_]+/ig
   let trimreg = /(from|update|insert\s+into)\s+(@db@)?/ig
 
   if (config.setting && (!config.wrap || !config.wrap.datatype || config.wrap.datatype === 'dynamic')) {
@@ -943,6 +943,8 @@
         if (cell.eleType !== 'button') return
         if (['form', 'pop', 'prompt', 'exec', 'excelIn', 'excelOut'].includes(cell.OpenType)) {
           action.push(cell)
+        } else if (cell.OpenType === 'funcbutton' && cell.funcType === 'print' && cell.verify) {
+          action.push(cell)
         } else if (cell.OpenType === 'popview') {
           if (pops) {
             pops.push({...cell, parentId: config.uuid})
@@ -956,6 +958,8 @@
         item.backElements.forEach(cell => {
           if (cell.eleType !== 'button') return
           if (['form', 'pop', 'prompt', 'exec', 'excelIn', 'excelOut'].includes(cell.OpenType)) {
+            action.push(cell)
+          } else if (cell.OpenType === 'funcbutton' && cell.funcType === 'print' && cell.verify) {
             action.push(cell)
           } else if (cell.OpenType === 'popview') {
             if (pops) {
@@ -974,6 +978,8 @@
       col.elements.forEach(cell => {
         if (['form', 'pop', 'prompt', 'exec', 'excelIn', 'excelOut'].includes(cell.OpenType)) {
           action.push(cell)
+        } else if (cell.OpenType === 'funcbutton' && cell.funcType === 'print' && cell.verify) {
+          action.push(cell)
         } else if (cell.OpenType === 'popview') {
           if (pops) {
             pops.push({...cell, parentId: config.uuid})
@@ -989,6 +995,8 @@
     if (cell.eleType !== 'button') return
     if (['form', 'pop', 'prompt', 'exec', 'excelIn', 'excelOut'].includes(cell.OpenType)) {
       action.push(cell)
+    } else if (cell.OpenType === 'funcbutton' && cell.funcType === 'print' && cell.verify) {
+      action.push(cell)
     } else if (cell.OpenType === 'popview') {
       if (pops) {
         pops.push({...cell, parentId: config.uuid})
@@ -1000,6 +1008,8 @@
 
   config.action && config.action.forEach(cell => {
     if (['pop', 'prompt', 'exec', 'excelIn', 'excelOut'].includes(cell.OpenType)) {
+      action.push(cell)
+    } else if (cell.OpenType === 'funcbutton' && cell.funcType === 'print' && cell.verify) {
       action.push(cell)
     } else if (cell.OpenType === 'popview') {
       if (pops) {
@@ -1021,6 +1031,19 @@
       }
       if (btn.intertype === 'system' && btn.verify.scripts) {
         btn.verify.scripts.forEach(script => {
+          if (script.status === 'false') return
+          let tbs = script.sql.match(cutreg)
+          tbs && cuts.push(...tbs)
+        })
+      }
+    } else if (btn.OpenType === 'funcbutton') {
+      if (btn.intertype !== 'system' || !btn.verify || !btn.verify.setting) return
+      if (btn.verify.dataType === 'custom') {
+        if (btn.verify.setting.defaultSql !== 'false') {
+          let tbs = btn.verify.setting.dataresource.match(cutreg)
+          tbs && cuts.push(...tbs)
+        }
+        btn.verify.scripts && btn.verify.scripts.forEach(script => {
           if (script.status === 'false') return
           let tbs = script.sql.match(cutreg)
           tbs && cuts.push(...tbs)
@@ -1102,7 +1125,7 @@
 
   cuts = cuts.map(item => item.replace(trimreg, ''))
   tables.push(...cuts)
-  tables = tables.filter(Boolean)
+  tables = tables.filter(tb => tb && tb !== 'dbo' && tb.length > 1)
   tables = Array.from(new Set(tables))
 
   return tables

--
Gitblit v1.8.0