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

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

diff --git a/src/utils/utils-custom.js b/src/utils/utils-custom.js
index 2fde239..edd4314 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,157 @@
 }
 
 /**
+ * @description 鑾峰彇鎺ュ彛鍙婂嚱鏁�
+ */
+export function getFuncsAndInters (config) {
+  let inters = []
+  // let funcs = []
+
+  let filterBtn = (cell) => {
+    if (cell.intertype === 'inner') {
+      // funcs.push(cell.innerFunc)
+    } else if (cell.intertype === 'outer' || cell.intertype === 'custom') {
+      // if (cell.innerFunc) {
+      //   funcs.push(cell.innerFunc)
+      // }
+      // if (cell.outerFunc) {
+      //   funcs.push(cell.outerFunc)
+      // }
+      if (cell.interface && cell.sysInterface !== 'true') {
+        inters.push(cell.interface)
+      }
+      if (cell.proInterface) {
+        inters.push(cell.proInterface)
+      }
+      // if (cell.callbackFunc) {
+      //   funcs.push(cell.callbackFunc)
+      // }
+    }
+  }
+
+  let filterSetting = (item) => {
+    if (!item.setting) return
+    if (item.setting.interType === 'inner') {
+      // funcs.push(item.setting.innerFunc)
+    } else if (item.setting.interType === 'outer') {
+      // if (item.setting.outerFunc) {
+      //   funcs.push(item.setting.outerFunc)
+      // }
+      if (item.setting.interface && item.setting.sysInterface !== 'true') {
+        inters.push(item.setting.interface)
+      }
+      if (item.setting.proInterface) {
+        inters.push(item.setting.proInterface)
+      }
+    }
+  }
+
+  let traversal = (components) => {
+    if (!components) return
+
+    components.forEach(item => {
+      if (item.type === 'tabs') {
+        item.subtabs.forEach(tab => {
+          traversal(tab.components)
+        })
+      } else if (item.type === 'group') {
+        traversal(item.components)
+      } else {
+        filterSetting(item)
+
+        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 => {
+      filterSetting(item)
+    })
+  }
+
+  traversal(config.components)
+
+  // inters = Array.from(new Set(inters))
+
+  return inters.length > 0 ? 'true' : 'false'
+}
+
+/**
  * @description 妫�娴嬬粍浠跺唴瀹�
  */
 export function checkComponent (card) {

--
Gitblit v1.8.0