From af6486b3629d23e426ce85b87dbc20dfa15b1afe Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期一, 07 十一月 2022 18:50:27 +0800
Subject: [PATCH] 2022-11-07

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

diff --git a/src/utils/utils-custom.js b/src/utils/utils-custom.js
index 2ea10f9..162b4cb 100644
--- a/src/utils/utils-custom.js
+++ b/src/utils/utils-custom.js
@@ -277,6 +277,31 @@
   }
 
   /**
+   * @description 鑾峰彇涓婄骇妯″潡
+   * @return {String}  selfId  褰撳墠缁勪欢id
+   */
+  static checkSupModules (modules, supId) {
+    let has = false
+
+    let check = (list) => {
+      list.forEach(m => {
+        if (has) return
+        if (supId === m.value) {
+          has = true
+          return
+        }
+        if (m.children) {
+          check(m.children)
+        }
+      })
+    }
+
+    check(modules)
+   
+    return has
+  }
+
+  /**
    * @description 鑾峰彇鍙叧鑱旀ā鍧�
    */
   static getLinkModules (components) {
@@ -598,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) {
@@ -805,16 +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 = ''
-      }
+      item.setting.supModule = ''
+    }
+    if (item.wrap && item.wrap.supModule) {
+      item.wrap.supModule = ''
     }
 
     if (item.wrap && item.wrap.doubleClick) {
@@ -858,32 +880,43 @@
   let cutreg = /(from|update|insert\s+into)\s+(@db@)?[a-z_]+/ig
   let trimreg = /(from|update|insert\s+into)\s+(@db@)?/ig
 
-  if (!config.wrap || !config.wrap.datatype || config.wrap.datatype === 'dynamic') {
-    if (config.setting) {
-      if (config.setting.interType === 'system') {
-        if (config.setting.execute !== 'false') {
-          let tbs = config.setting.dataresource.match(cutreg)
-          tbs && cuts.push(...tbs)
-        }
-        config.scripts && config.scripts.forEach(script => {
-          if (script.status === 'false') return
-          let tbs = script.sql.match(cutreg)
-          tbs && cuts.push(...tbs)
-        })
-      } else {
-        let tb = config.setting.tableName.replace(/@db@|\s+/ig, '')
-        if (/[a-z_]+/ig.test(tb)) {
-          tables.push(tb)
-        }
+  if (config.setting && (!config.wrap || !config.wrap.datatype || config.wrap.datatype === 'dynamic')) {
+    if (config.setting.interType === 'system') {
+      if (config.setting.execute !== 'false') {
+        let tbs = config.setting.dataresource.match(cutreg)
+        tbs && cuts.push(...tbs)
+      }
+      config.scripts && config.scripts.forEach(script => {
+        if (script.status === 'false') return
+        let tbs = script.sql.match(cutreg)
+        tbs && cuts.push(...tbs)
+      })
+    } else if (config.setting.tableName) {
+      let tb = config.setting.tableName.replace(/@db@|\s+/ig, '')
+      if (/[a-z_]+/ig.test(tb)) {
+        tables.push(tb)
       }
     }
   }
+
+  config.search && config.search.forEach(cell => {
+    if (cell.resourceType === '1' && cell.dataSource) {
+      let tbs = cell.dataSource.match(cutreg)
+      tbs && cuts.push(...tbs)
+    }
+  })
 
   let action = []
 
   if (config.type === 'form') {
     config.subcards.forEach(item => {
       action.push(item.subButton)
+      item.fields && item.fields.forEach(cell => {
+        if (cell.resourceType === '1' && cell.dataSource) {
+          let tbs = cell.dataSource.match(cutreg)
+          tbs && cuts.push(...tbs)
+        }
+      })
     })
   } else if (config.subcards) {
     config.subcards.forEach(item => {
@@ -916,6 +949,7 @@
       }
     })
   }
+
   config.cols && config.cols.forEach(col => {
     if (col.type === 'action') {
       col.elements.forEach(cell => {
@@ -991,6 +1025,14 @@
         tbs && cuts.push(...tbs)
       }
     } else {
+      if (btn.OpenType === 'pop' && btn.modal && btn.modal.fields) {
+        btn.modal.fields.forEach(cell => {
+          if (cell.resourceType === '1' && cell.dataSource) {
+            let tbs = cell.dataSource.match(cutreg)
+            tbs && cuts.push(...tbs)
+          }
+        })
+      }
       if (btn.intertype === 'inner') return
       if (btn.intertype === 'outer' || btn.intertype === 'custom') {
         if (btn.procMode === 'system' && btn.verify) {

--
Gitblit v1.8.0