From 5e871a4164869bac7927ea6884dbadd650b1cadf Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期四, 25 五月 2023 11:25:28 +0800
Subject: [PATCH] Merge branch 'master' into positec

---
 src/views/menudesign/index.jsx |   76 +++++++++++++++++++++++++++++++------
 1 files changed, 63 insertions(+), 13 deletions(-)

diff --git a/src/views/menudesign/index.jsx b/src/views/menudesign/index.jsx
index 57e7d08..f5bc9e6 100644
--- a/src/views/menudesign/index.jsx
+++ b/src/views/menudesign/index.jsx
@@ -370,6 +370,8 @@
       _btn.config.MenuID = _btn.uuid
       _btn.config.ParentId = card.uuid
       _btn.config.MenuName = _btn.label
+
+      _btn.config.components = this.updateComponents(_btn.config.components || [])
     } else {
       _btn.config = {
         uuid: _btn.uuid,
@@ -485,6 +487,7 @@
           })
           this.updatePage(config)
         } else {
+          config.components = this.updateComponents(config.components)
           this.setState({
             oriConfig: fromJS(config).toJS(),
             config: config
@@ -498,6 +501,27 @@
           duration: 5
         })
       }
+    })
+  }
+
+  updateComponents = (components) => { // 鍏煎鎬у崌绾� table
+    return components.map(item => {
+      if (item.type === 'tabs') {
+        item.subtabs.forEach(tab => {
+          tab.components = this.updateComponents(tab.components)
+        })
+      } else if (item.type === 'group') {
+        item.components = this.updateComponents(item.components)
+      } else if (item.type === 'table') {
+        item.cols = item.cols.map(col => {
+          if (col.type === 'action') {
+            col.type = 'custom'
+          }
+          return col
+        })
+      }
+
+      return item
     })
   }
 
@@ -519,6 +543,13 @@
 
       if (item.subtype === 'tablecard') { // 鍏煎
         item.type = 'card'
+      } else if (item.type === 'table') {
+        item.cols = item.cols.map(col => {
+          if (col.type === 'action') {
+            col.type = 'custom'
+          }
+          return col
+        })
       }
 
       delete item.tabId
@@ -556,15 +587,23 @@
       })
     })
 
-    config.cols && config.cols.forEach(col => {
-      if (col.type === 'action') {
-        col.elements.forEach(cell => {
-          if (cell.OpenType === 'popview' && popbtns[cell.uuid]) {
-            cell.config = popbtns[cell.uuid]
+    if (config.cols) {
+      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' && popbtns[cell.uuid]) {
+                cell.config = popbtns[cell.uuid]
+              }
+            })
           }
         })
       }
-    })
+      loopCol(config.cols)
+    }
 
     config.elements && config.elements.forEach(cell => {
       if (cell.eleType !== 'button') return
@@ -684,6 +723,11 @@
         if (item.$tables) {
           tbs.push(...item.$tables)
         }
+
+        if (item.wrap && item.wrap.permission === 'false') {
+          return
+        }
+        
         if (item.action && item.action.length > 0) {
           item.action.forEach(btn => {
             if (btn.hidden === 'true') return
@@ -720,14 +764,20 @@
             _sort++
           })
         } else if (item.type === 'table') {
-          item.cols && item.cols.forEach(col => {
-            if (col.type !== 'action') return
-            col.elements.forEach(btn => {
-              if (btn.hidden === 'true') return
-              buttons.push(`select '${btn.uuid}' as menuid, '${item.name + '-' + btn.label}' as menuname, '${_sort * 10}' as Sort, '${config.uuid}' as parentid, 40 as Type`)
-              _sort++
+          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' || cell.hidden === 'true') return
+                  buttons.push(`select '${cell.uuid}' as menuid, '${item.name + '-' + cell.label}' as menuname, '${_sort * 10}' as Sort, '${config.uuid}' as parentid, 40 as Type`)
+                  _sort++
+                })
+              }
             })
-          })
+          }
+          loopCol(item.cols)
         }
       })
     }

--
Gitblit v1.8.0