From 4b467effbc0e3a9199146573c0ceedf404bd07c5 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期四, 07 九月 2023 17:16:01 +0800
Subject: [PATCH] 2023-09-07

---
 src/utils/utils-custom.js |  151 +++++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 143 insertions(+), 8 deletions(-)

diff --git a/src/utils/utils-custom.js b/src/utils/utils-custom.js
index 2fde239..e6dd77b 100644
--- a/src/utils/utils-custom.js
+++ b/src/utils/utils-custom.js
@@ -19,6 +19,8 @@
       } else if (item.type === 'tabs') {
         if (item.subtype === 'tabletabs') {
           item.subtabs.forEach(tab => {
+            if (tab.components[0].uuid === selfId) return
+            
             modules.push({
               value: tab.components[0].uuid,
               label: tab.label,
@@ -268,6 +270,7 @@
 
     if (interfaces && interfaces.length > 0) {
       interfaces.forEach(item => {
+        if (item.uuid === selfId) return
         modules.push({
           value: item.uuid,
           label: item.name
@@ -542,8 +545,12 @@
 
                 return cell
               })
-            } else if (col.editable === 'true' && col.enter) {
-              col.enter = md5(commonId + col.enter)
+            } else if (col.editable === 'true' && col.enter && col.enter !== '$next' && col.enter !== '$sub') {
+              if (/\$next_/.test(col.enter)) {
+                col.enter = '$next_' + md5(commonId + col.enter.split('_')[1])
+              } else {
+                col.enter = md5(commonId + col.enter)
+              }
             }
 
             return col
@@ -655,7 +662,12 @@
     if (btn.anchors && btn.anchors.length > 0) {
       btn.anchors = btn.anchors.map(m => md5(commonId + m))
     }
-    if (btn.syncComponent && btn.syncComponent.length > 0) {
+    if (btn.syncComponent && btn.syncComponent[0] === 'multiComponent' && btn.syncComponents) {
+      btn.syncComponents = btn.syncComponents.map(m => {
+        m.syncComId = m.syncComId.map(n => md5(commonId + n))
+        return m
+      })
+    } else if (btn.syncComponent && btn.syncComponent.length > 0) {
       btn.syncComponent = btn.syncComponent.map(m => md5(commonId + m))
     }
   }
@@ -691,13 +703,13 @@
     // 閲嶇疆缁勪欢鍚嶇О
     let sign = this.getSignName()
     if (item.plot) { // 鍥捐〃
-      item.plot.name = item.plot.name + sign
+      item.plot.name = (item.plot.name || '') + sign
       item.name = item.plot.name
     } else if (item.wrap) { // 閫氱敤
-      item.wrap.name = item.wrap.name + sign
+      item.wrap.name = (item.wrap.name || '') + sign
       item.name = item.wrap.name
     } else if (item.setting) { // 鍒嗙粍銆佹爣绛鹃〉绛�
-      item.setting.name = item.setting.name + sign
+      item.setting.name = (item.setting.name || '') + sign
       item.name = item.setting.name
     }
 
@@ -826,8 +838,12 @@
               }
               return cell
             })
-          } else if (col.editable === 'true' && col.enter) { // 鍙紪杈戣〃
-            col.enter = md5(commonId + col.enter)
+          } else if (col.editable === 'true' && col.enter && col.enter !== '$next' && col.enter !== '$sub') { // 鍙紪杈戣〃
+            if (/\$next_/.test(col.enter)) {
+              col.enter = '$next_' + md5(commonId + col.enter.split('_')[1])
+            } else {
+              col.enter = md5(commonId + col.enter)
+            }
           }
 
           return col
@@ -1208,6 +1224,125 @@
 }
 
 /**
+ * @description 鑾峰彇鎺ュ彛鍙婂嚱鏁�
+ */
+export function getFuncsAndInters (config) {
+  let inters = 'false'
+
+  let filterBtn = (cell) => {
+    if ((cell.intertype === 'outer' && cell.sysInterface !== 'true') || cell.intertype === 'custom') {
+      inters = 'true'
+    }
+  }
+
+  let traversal = (components) => {
+    if (!components || inters === 'true') return
+
+    components.forEach(item => {
+      if (item.type === 'tabs') {
+        item.subtabs.forEach(tab => {
+          traversal(tab.components)
+        })
+      } else if (item.type === 'group') {
+        traversal(item.components)
+      } else {
+        if (item.setting && item.setting.interType === 'outer' && item.setting.sysInterface !== 'true') {
+          inters = 'true'
+        }
+
+        if (item.action) {
+          item.action.forEach(cell => {
+            if (cell.OpenType === 'popview') {
+              if (cell.config) {
+                traversal(cell.config.components)
+              }
+            } else {
+              filterBtn(cell)
+            }
+          })
+        }
+
+        if (item.type === 'card' || item.type === 'carousel' || item.type === 'timeline') {
+          item.subcards.forEach(card => {
+            card.elements && card.elements.forEach(cell => {
+              if (cell.eleType !== 'button') return
+              
+              if (cell.OpenType === 'popview') {
+                if (cell.config) {
+                  traversal(cell.config.components)
+                }
+              } else {
+                filterBtn(cell)
+              }
+            })
+            card.backElements && card.backElements.forEach(cell => {
+              if (cell.eleType !== 'button') return
+              
+              if (cell.OpenType === 'popview') {
+                if (cell.config) {
+                  traversal(cell.config.components)
+                }
+              } else {
+                filterBtn(cell)
+              }
+            })
+          })
+        } else if (item.type === 'balcony') {
+          item.elements && item.elements.forEach(cell => {
+            if (cell.eleType !== 'button') return
+            
+            if (cell.OpenType === 'popview') {
+              if (cell.config) {
+                traversal(cell.config.components)
+              }
+            } else {
+              filterBtn(cell)
+            }
+          })
+        } else if (item.type === 'table') {
+          let loopCol = (cols) => {
+            cols.forEach(col => {
+              if (col.type === 'colspan') {
+                loopCol(col.subcols)
+              } else if (col.type === 'custom') {
+                col.elements.forEach(cell => {
+                  if (cell.eleType !== 'button') return
+                  
+                  if (cell.OpenType === 'popview') {
+                    if (cell.config) {
+                      traversal(cell.config.components)
+                    }
+                  } else {
+                    filterBtn(cell)
+                  }
+                })
+              }
+            })
+          }
+          loopCol(item.cols)
+        } else if (item.type === 'form') {
+          item.subcards.forEach(group => {
+            filterBtn(group.subButton)
+          })
+        }
+      }
+    })
+  }
+
+  if (config.interfaces) {
+    config.interfaces.forEach(item => {
+      if (item.setting && item.setting.interType === 'outer' && item.setting.sysInterface !== 'true') {
+        inters = 'true'
+      }
+    })
+  }
+
+  traversal(config.components)
+
+  return inters
+}
+
+/**
  * @description 妫�娴嬬粍浠跺唴瀹�
  */
 export function checkComponent (card) {

--
Gitblit v1.8.0