From 66551ce2db74ccd54226fb78a640d07f04519917 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期一, 27 一月 2025 22:32:15 +0800
Subject: [PATCH] 2025-01-27

---
 src/menu/debug/index.jsx |  142 +++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 142 insertions(+), 0 deletions(-)

diff --git a/src/menu/debug/index.jsx b/src/menu/debug/index.jsx
index 939a5d3..faff4b8 100644
--- a/src/menu/debug/index.jsx
+++ b/src/menu/debug/index.jsx
@@ -27,6 +27,8 @@
   sqlList = []
   verSqls = []
   linkMain = null
+  modules = null
+  supError = null
 
   trigger = () => {
     let config = fromJS(this.props.config).toJS()
@@ -61,6 +63,30 @@
     if (error) {
       Modal.warning({
         title: error,
+        okText: '鐭ラ亾浜�'
+      })
+      return
+    }
+
+    this.modules = {}
+    this.supError = null
+
+    this.getModules(config.components, config.interfaces)
+
+    config.interfaces && config.interfaces.forEach(item => {
+      if (item.setting && item.setting.supModule && item.setting.supModule[0] !== 'empty') {
+        let id = item.setting.supModule[item.setting.supModule.length - 1]
+        if (!this.modules[id]) {
+          this.supError = item.name + '锛堝叕鍏辨暟鎹簮锛�'
+        }
+      }
+    })
+
+    this.checklink(config.components)
+
+    if (this.supError) {
+      Modal.warning({
+        title: this.supError + '锛氫笂绾х粍浠朵笉瀛樺湪锛�',
         okText: '鐭ラ亾浜�'
       })
       return
@@ -286,6 +312,122 @@
     this.sqlList = []
   }
 
+  getModules = (components, interfaces, sups = []) => {
+    components.forEach(item => {
+      this.modules[item.uuid] = [...sups, item.uuid]
+      if (item.type === 'tabs') {
+        item.subtabs.forEach(f_tab => {
+          this.getModules(f_tab.components, null, [...sups, item.uuid, f_tab.uuid])
+        })
+      } else if (item.type === 'group') {
+        item.components.forEach(cell => {
+          this.modules[cell.uuid] = [...sups, item.uuid, cell.uuid]
+        })
+      }
+    })
+
+    if (interfaces && interfaces.length > 0) {
+      interfaces.forEach(item => {
+        this.modules[item.uuid] = [item.uuid]
+      })
+    }
+  }
+
+  checklink = (components, suplabel = '') => {
+    if (this.supError) return
+    components.forEach(item => {
+      if (this.supError) return
+      if (item.type === 'tabs') {
+        item.subtabs.forEach(f_tab => {
+          this.checklink(f_tab.components, suplabel)
+        })
+      } else if (item.type === 'group' ) {
+        item.components && this.checklink(item.components, suplabel)
+      } else {
+        if (item.wrap && item.wrap.supType === 'multi') {
+          if (item.setting && item.setting.supModule) {
+            item.setting.supModule = ''
+          }
+          if (item.supNodes) {
+            item.supNodes.forEach(cell => {
+              let id = cell.nodes[cell.nodes.length - 1]
+              if (!this.modules[id]) {
+                this.supError = suplabel + item.name
+              }
+            })
+          }
+        } else if ((item.wrap && item.wrap.datatype === 'static') || (['mainsearch', 'voucher'].includes(item.subtype))) {
+          if (item.wrap && item.wrap.supModule && item.wrap.supModule[0]) {
+            let id = item.wrap.supModule[item.wrap.supModule.length - 1]
+            if (!this.modules[id]) {
+              this.supError = suplabel + item.name
+            }
+          }
+        } else if (item.setting && item.setting.supModule && item.setting.supModule[0] !== 'empty') {
+          let id = item.setting.supModule[item.setting.supModule.length - 1]
+          if (!this.modules[id]) {
+            this.supError = suplabel + item.name
+          }
+        }
+
+        if (this.supError) return
+
+        if (['card', 'carousel', 'timeline'].includes(item.type)) {
+          item.subcards.forEach(card => {
+            card.elements && card.elements.forEach(cell => {
+              if (cell.eleType === 'button' && cell.OpenType === 'popview') {
+                if (cell.config && cell.config.components && cell.config.enabled) {
+                  this.checklink(cell.config.components, item.name + '-' + cell.label + '锛堝脊绐楁爣绛撅級-')
+                }
+              }
+            })
+            card.backElements && card.backElements.forEach(cell => {
+              if (cell.eleType === 'button' && cell.OpenType === 'popview') {
+                if (cell.config && cell.config.components && cell.config.enabled) {
+                  this.checklink(cell.config.components, item.name + '-' + cell.label + '锛堝脊绐楁爣绛撅級-')
+                }
+              }
+            })
+          })
+        } else if (item.type === 'balcony') {
+          item.elements && item.elements.forEach(cell => {
+            if (cell.eleType === 'button' && cell.OpenType === 'popview') {
+              if (cell.config && cell.config.components && cell.config.enabled) {
+                this.checklink(cell.config.components, item.name + '-' + cell.label + '锛堝脊绐楁爣绛撅級-')
+              }
+            }
+          })
+        } else if (item.type === 'table' && item.cols) {
+          let loopCol = (cols) => {
+            cols.forEach(col => {
+              if (col.type === 'colspan' && col.subcols) {
+                loopCol(col.subcols)
+              } else if (col.type === 'custom' && col.elements) {
+                col.elements.forEach(cell => {
+                  if (cell.eleType === 'button' && cell.OpenType === 'popview') {
+                    if (cell.config && cell.config.components && cell.config.enabled) {
+                      this.checklink(cell.config.components, item.name + '-' + cell.label + '锛堝脊绐楁爣绛撅級-')
+                    }
+                  }
+                })
+              }
+            })
+          }
+    
+          loopCol(item.cols)
+        }
+    
+        item.action && item.action.forEach(cell => {
+          if (cell.OpenType === 'popview') {
+            if (cell.config && cell.config.components && cell.config.enabled) {
+              this.checklink(cell.config.components, item.name + '-' + cell.label + '锛堝脊绐楁爣绛撅級-')
+            }
+          }
+        })
+      }
+    })
+  }
+
   filterComponent = (components, mainSearch, regs, process, ispop = false) => {
     let appType = sessionStorage.getItem('appType')
 

--
Gitblit v1.8.0