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/tabledesign/index.jsx |  109 +++++++++++++++++++++++++++++++++++++++---------------
 1 files changed, 79 insertions(+), 30 deletions(-)

diff --git a/src/views/tabledesign/index.jsx b/src/views/tabledesign/index.jsx
index 18311e8..507484b 100644
--- a/src/views/tabledesign/index.jsx
+++ b/src/views/tabledesign/index.jsx
@@ -235,6 +235,26 @@
       _btn.config.MenuID = _btn.uuid
       _btn.config.ParentId = card.uuid
       _btn.config.MenuName = _btn.label
+      _btn.config.components = _btn.config.components || []
+      _btn.config.components.forEach(item => {
+        if (item.type === 'tabs') {
+          item.subtabs.forEach(tab => {
+            tab.components[0].cols = tab.components[0].cols.map(col => {
+              if (col.type === 'action') {
+                col.type = 'custom'
+              }
+              return col
+            })
+          })
+        } else if (item.cols) {
+          item.cols = item.cols.map(col => {
+            if (col.type === 'action') {
+              col.type = 'custom'
+            }
+            return col
+          })
+        }
+      })
     } else {
       _btn.config = {
         uuid: _btn.uuid,
@@ -263,6 +283,21 @@
   submitPopConfig = (btnconfig) => {
     let config = fromJS(this.state.config).toJS()
 
+    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' && cell.uuid === btnconfig.uuid) {
+              cell.config = btnconfig
+            }
+          })
+        }
+      })
+    }
+
     config.components.forEach(item => {
       if (item.type === 'tabs') {
         item.subtabs.forEach(tab => {
@@ -273,14 +308,8 @@
               btn.config = btnconfig
             }
           })
-          tab.components[0].cols.forEach(col => {
-            if (col.type !== 'action') return
-            col.elements.forEach(btn => {
-              if (btn.OpenType === 'popview' && btn.uuid === btnconfig.uuid) {
-                btn.config = btnconfig
-              }
-            })
-          })
+
+          loopCol(tab.components[0].cols)
 
           tab.components[0].$tables = getTables(tab.components[0])
         })
@@ -290,14 +319,8 @@
             btn.config = btnconfig
           }
         })
-        item.cols.forEach(col => {
-          if (col.type !== 'action') return
-          col.elements.forEach(btn => {
-            if (btn.OpenType === 'popview' && btn.uuid === btnconfig.uuid) {
-              btn.config = btnconfig
-            }
-          })
-        })
+
+        loopCol(item.cols)
 
         item.$tables = getTables(item)
       }
@@ -407,8 +430,20 @@
             if (item.type === 'tabs') {
               item.subtabs.forEach(tab => {
                 tab.components[0].name = tab.label
+                tab.components[0].cols = tab.components[0].cols.map(col => {
+                  if (col.type === 'action') {
+                    col.type = 'custom'
+                  }
+                  return col
+                })
               })
             } else {
+              item.cols = item.cols.map(col => {
+                if (col.type === 'action') {
+                  col.type = 'custom'
+                }
+                return col
+              })
               item.name = '涓昏〃'
             }
           })
@@ -457,15 +492,22 @@
             buttons.push(`select '${btn.uuid}' as menuid, '${btn.label}' as menuname, '${_s * 10}' as Sort, '${tab.components[0].uuid}' as parentid, 60 as Type`)
             _s++
           })
-          tab.components[0].cols.forEach(col => {
-            if (col.type !== 'action') return
-            col.elements.forEach(btn => {
-              if (btn.hidden === 'true') return
 
-              buttons.push(`select '${btn.uuid}' as menuid, '${btn.label}' as menuname, '${_s * 10}' as Sort, '${tab.components[0].uuid}' as parentid, 60 as Type`)
-              _s++
+          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, '${cell.label}' as menuname, '${_s * 10}' as Sort, '${tab.components[0].uuid}' as parentid, 60 as Type`)
+                  _s++
+                })
+              }
             })
-          })
+          }
+
+          loopCol(tab.components[0].cols)
         })
       } else {
         if (item.$tables) {
@@ -477,15 +519,22 @@
           buttons.push(`select '${btn.uuid}' as menuid, '${btn.label}' as menuname, '${_sort * 10}' as Sort, '${config.uuid}' as parentid, 40 as Type`)
           _sort++
         })
-        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,  '${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,  '${cell.label}' as menuname, '${_sort * 10}' as Sort, '${config.uuid}' as parentid, 40 as Type`)
+                _sort++
+              })
+            }
           })
-        })
+        }
+
+        loopCol(item.cols)
       }
     })
 

--
Gitblit v1.8.0