From 4453a9e63e8e176c70c432b03fd4ba3ebf00a04c Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期四, 09 二月 2023 14:55:20 +0800
Subject: [PATCH] 2023-02-09

---
 src/utils/utils-custom.js |   68 ++++++++++++++++++++++++++--------
 1 files changed, 52 insertions(+), 16 deletions(-)

diff --git a/src/utils/utils-custom.js b/src/utils/utils-custom.js
index eb23ab6..1eaf2e9 100644
--- a/src/utils/utils-custom.js
+++ b/src/utils/utils-custom.js
@@ -623,6 +623,9 @@
         if (em) {
           item.setting.supModule = ''
         }
+        if (item.wrap && item.wrap.supModule) {
+          item.wrap.supModule = item.setting.supModule
+        }
       }
 
       if (item.wrap && item.wrap.doubleClick) {
@@ -830,19 +833,10 @@
     }
 
     if (item.setting && item.setting.supModule && item.setting.supModule[0] !== 'empty') {
-      let em = false
-      item.setting.supModule = item.setting.supModule.map(c => {
-        if (!uuids[c]) {
-          em = true
-        }
-        return uuids[c] || ''
-      })
-      if (em) {
-        item.setting.supModule = ''
-      }
-      if (item.wrap && item.wrap.supModule) {
-        item.wrap.supModule = item.setting.supModule
-      }
+      item.setting.supModule = ''
+    }
+    if (item.wrap && item.wrap.supModule) {
+      item.wrap.supModule = ''
     }
 
     if (item.wrap && item.wrap.doubleClick) {
@@ -878,17 +872,36 @@
 }
 
 /**
+ * @description 鑾峰彇鍥捐〃楂樺害
+ */
+export function getHeight (val) {
+  if (typeof(val) === 'string') {
+    if (val.indexOf('px') > -1) {
+      val = parseFloat(val)
+    } else if (val.indexOf('vw') > -1) {
+      val = parseFloat(val)
+      val = document.body.clientWidth * val / 100
+    } else if (val.indexOf('vh') > -1) {
+      val = parseFloat(val)
+      val = document.body.clientHeight * val / 100
+    }
+  }
+
+  return parseInt(val || 400) - 30
+}
+
+/**
  * @description 鑾峰彇琛ㄥ悕
  */
 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')) {
     if (config.setting.interType === 'system') {
-      if (config.setting.execute !== 'false') {
+      if (config.setting.execute !== 'false' && config.setting.dataresource) {
         let tbs = config.setting.dataresource.match(cutreg)
         tbs && cuts.push(...tbs)
       }
@@ -930,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})
@@ -943,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) {
@@ -961,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})
@@ -976,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})
@@ -987,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) {
@@ -1008,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)
@@ -1089,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