From e9e8b1c7b481415714fff9a0d83099fd5a7d6ff0 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期四, 18 五月 2023 17:25:11 +0800
Subject: [PATCH] 2023-05-18

---
 src/tabviews/custom/index.jsx |  158 +++++++++++++++++++++++++++-------------------------
 1 files changed, 82 insertions(+), 76 deletions(-)

diff --git a/src/tabviews/custom/index.jsx b/src/tabviews/custom/index.jsx
index 1ddc4d0..bf7075e 100644
--- a/src/tabviews/custom/index.jsx
+++ b/src/tabviews/custom/index.jsx
@@ -473,53 +473,6 @@
         item.search = Utils.initSearchVal(item.search)
       }
 
-      if (item.type === 'table') {
-        let statFields = []
-        let getCols = (cols) => {
-          return cols.filter(col => {
-            if (col.blacklist && col.blacklist.filter(v => roleId.indexOf(v) > -1).length > 0) {
-              return false
-            } else if (col.Hide === 'true') {
-              return false
-            }
-            
-            if (col.type === 'number') {
-              if (col.sum === 'true' && !statFields.includes(col.field)) {
-                statFields.push(col)
-              }
-              if (typeof(col.decimal) === 'number') {
-                col.round = Math.pow(10, col.decimal)
-                if (col.format === 'percent') {
-                  col.decimal = col.decimal > 2 ? col.decimal - 2 : 0
-                }
-              }
-            } else if (col.type === 'colspan') {
-              col.subcols = getCols(col.subcols || [])
-              if (col.subcols.length === 0) {
-                return false
-              }
-            } else if (col.type === 'custom') {
-              col.elements = col.elements.map(cell => {
-                cell = this.resetElement(cell)
-                return cell
-              })
-            }
-      
-            if (col.linkmenu && col.linkmenu.length > 0) {
-              let menu_id = col.linkmenu.pop()
-              col.linkThdMenu = window.GLOB.mkThdMenus.filter(m => m.MenuID === menu_id)[0] || ''
-            } else {
-              col.linkThdMenu = ''
-            }
-
-            return true
-          })
-        }
-        
-        item.cols = getCols(item.cols)
-        item.statFields = statFields
-      }
-
       let mutil = false
       if (item.wrap && item.wrap.supType === 'multi') { // 鏁版嵁鍗″涓婄骇缁勪欢
         mutil = true
@@ -557,7 +510,86 @@
         })
       }
 
-      if (item.type === 'card' || item.type === 'carousel' || item.type === 'timeline') {
+      if (item.type === 'table') {
+        let statFields = []
+        let getCols = (cols) => {
+          return cols.filter(col => {
+            if (col.blacklist && col.blacklist.filter(v => roleId.indexOf(v) > -1).length > 0) {
+              return false
+            } else if (col.Hide === 'true') {
+              return false
+            } else if (col.type === 'action') {
+              col.type = 'custom'
+            }
+            
+            if (col.type === 'number') {
+              if (col.sum === 'true' && !statFields.includes(col.field)) {
+                statFields.push(col)
+              }
+              if (typeof(col.decimal) === 'number') {
+                col.round = Math.pow(10, col.decimal)
+                if (col.format === 'percent') {
+                  col.decimal = col.decimal > 2 ? col.decimal - 2 : 0
+                }
+              }
+            } else if (col.type === 'formula') {
+              if (typeof(col.decimal) === 'number') {
+                col.round = Math.pow(10, col.decimal)
+              }
+            } else if (col.type === 'colspan') {
+              col.subcols = getCols(col.subcols || [])
+              if (col.subcols.length === 0) {
+                return false
+              }
+            } else if (col.type === 'custom') {
+              col.elements = col.elements.filter(cell => {
+                if (cell.eleType === 'button') {
+                  if (cell.hidden === 'true') return false
+
+                  cell = this.resetButton(item, cell, popview)
+
+                  if (cell.syncComponentId === item.setting.supModule) {
+                    cell.syncComponentId = ''
+                    if (cell.execSuccess === 'line' || cell.execSuccess === 'grid') {
+                      cell.execSuccess = 'mainline'
+                    }
+                  }
+
+                  if (cell.OpenType === 'funcbutton' && cell.funcType === 'print' && cell.verify) { // 鎵撳嵃鏈鸿缃�
+                    cell = this.getPrinter(cell, item.uuid)
+                  }
+
+                  return skip || permAction[cell.uuid]
+                } else {
+                  cell = this.resetElement(cell)
+                }
+                return true
+              })
+
+              if (col.elements.length === 0) {
+                return false
+              }
+            }
+      
+            if (col.linkmenu && col.linkmenu.length > 0) {
+              let menu_id = col.linkmenu.pop()
+              col.linkThdMenu = window.GLOB.mkThdMenus.filter(m => m.MenuID === menu_id)[0] || ''
+            } else {
+              col.linkThdMenu = ''
+            }
+
+            return true
+          })
+        }
+        
+        item.cols = getCols(item.cols)
+        item.statFields = statFields
+
+        if (item.subtype === 'editable') {
+          item.submit.logLabel = item.$menuname + '-鎻愪氦'
+          item.submit.$menuId = item.uuid
+        }
+      } else if (item.type === 'card' || item.type === 'carousel' || item.type === 'timeline') {
         item.subcards && item.subcards.forEach(card => {
           if (card.style.boxShadow) {
             delete card.style.hShadow
@@ -644,34 +676,6 @@
 
           return cell.eleType !== 'button' || skip || permAction[cell.uuid]
         })
-      } else if (item.type === 'table') {
-        item.cols = item.cols.filter(col => {
-          if (col.type !== 'action') return true
-          col.elements = col.elements.filter(cell => {
-            if (cell.hidden === 'true') return false
-
-            cell = this.resetButton(item, cell, popview)
-
-            if (cell.syncComponentId === item.setting.supModule) {
-              cell.syncComponentId = ''
-              if (cell.execSuccess === 'line' || cell.execSuccess === 'grid') {
-                cell.execSuccess = 'mainline'
-              }
-            }
-
-            if (cell.OpenType === 'funcbutton' && cell.funcType === 'print' && cell.verify) { // 鎵撳嵃鏈鸿缃�
-              cell = this.getPrinter(cell, item.uuid)
-            }
-
-            return skip || permAction[cell.uuid]
-          })
-          return col.elements.length !== 0
-        })
-
-        if (item.subtype === 'editable') {
-          item.submit.logLabel = item.$menuname + '-鎻愪氦'
-          item.submit.$menuId = item.uuid
-        }
       } else if (item.type === 'form') {
         item.subcards = item.subcards.map(group => {
           group.subButton.uuid = group.uuid
@@ -805,6 +809,8 @@
         if (cell.format === 'percent') {
           cell.decimal = cell.decimal > 2 ? cell.decimal - 2 : 0
         }
+      } else if (cell.eleType === 'formula' && typeof(cell.decimal) === 'number') {
+        cell.round = Math.pow(10, cell.decimal)
       }
     } else if (cell.eleType === 'icon') {
       if (!cell.innerHeight) { // 鍏煎

--
Gitblit v1.8.0