From aa8a9f0845ed197adbfdf152376121e172bee574 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期四, 01 六月 2023 10:44:05 +0800
Subject: [PATCH] 2023-06-01

---
 src/tabviews/custom/index.jsx |  178 +++++++++++++++++++++++++++++++++-------------------------
 1 files changed, 101 insertions(+), 77 deletions(-)

diff --git a/src/tabviews/custom/index.jsx b/src/tabviews/custom/index.jsx
index ff11815..42725b3 100644
--- a/src/tabviews/custom/index.jsx
+++ b/src/tabviews/custom/index.jsx
@@ -153,7 +153,7 @@
 
       // 鏁版嵁缂撳瓨璁剧疆
       if (config.cacheUseful === 'true') {
-        if (!['day', 'hour'].includes(config.timeUnit)) {
+        if (!['day', 'hour', 'minute'].includes(config.timeUnit)) {
           config.timeUnit = 'day'
         }
         config.cacheTime = config.cacheTime || 1
@@ -473,6 +473,49 @@
         item.search = Utils.initSearchVal(item.search)
       }
 
+      let mutil = false
+      if (item.wrap && item.wrap.supType === 'multi') { // 鏁版嵁鍗″涓婄骇缁勪欢
+        mutil = true
+        item.setting.supModule = item.supNodes[0].componentId
+      } else if (item.setting && item.setting.supModule && typeof(item.setting.supModule) !== 'string') {
+        let pid = item.setting.supModule.pop()
+        if (pid && pid !== 'empty') {
+          item.setting.supModule = pid
+        } else {
+          item.setting.supModule = ''
+        }
+      }
+
+      let pass = skip
+
+      if (item.wrap && item.wrap.permission === 'false') {
+        pass = true
+      }
+
+      // 鏉冮檺杩囨护
+      if (item.action && item.action.length > 0) {
+        item.action = item.action.filter(cell => {
+          if (cell.hidden === 'true') return false
+
+          cell = this.resetButton(item, cell, popview)
+
+          cell.$toolbtn = true
+
+          if (!mutil && cell.syncComponentId && 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 pass || permAction[cell.uuid]
+        })
+      }
+
       if (item.type === 'table') {
         let statFields = []
         let getCols = (cols) => {
@@ -481,6 +524,8 @@
               return false
             } else if (col.Hide === 'true') {
               return false
+            } else if (col.type === 'action') {
+              col.type = 'custom'
             }
             
             if (col.type === 'number') {
@@ -493,16 +538,43 @@
                   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.map(cell => {
-                cell = this.resetElement(cell)
-                return cell
+              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 && 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 pass || permAction[cell.uuid]
+                } else {
+                  cell = this.resetElement(cell)
+                }
+                return true
               })
+
+              if (col.elements.length === 0) {
+                return false
+              }
             }
       
             if (col.linkmenu && col.linkmenu.length > 0) {
@@ -518,46 +590,20 @@
         
         item.cols = getCols(item.cols)
         item.statFields = statFields
-      }
 
-      let mutil = false
-      if (item.wrap && item.wrap.supType === 'multi') { // 鏁版嵁鍗″涓婄骇缁勪欢
-        mutil = true
-        item.setting.supModule = item.supNodes[0].componentId
-      } else if (item.setting && item.setting.supModule && typeof(item.setting.supModule) !== 'string') {
-        let pid = item.setting.supModule.pop()
-        if (pid && pid !== 'empty') {
-          item.setting.supModule = pid
-        } else {
-          item.setting.supModule = ''
-        }
-      }
+        if (item.subtype === 'editable') {
+          item.submit.logLabel = item.$menuname + '-鎻愪氦'
+          item.submit.$menuId = item.uuid
+          item.submit.syncComponentId = item.submit.syncComponent ? (item.submit.syncComponent.pop() || '') : ''
 
-      // 鏉冮檺杩囨护
-      if (item.action && item.action.length > 0) {
-        item.action = item.action.filter(cell => {
-          if (cell.hidden === 'true') return false
-
-          cell = this.resetButton(item, cell, popview)
-
-          cell.$toolbtn = true
-
-          if (!mutil && cell.syncComponentId === item.setting.supModule) {
-            cell.syncComponentId = ''
-            if (cell.execSuccess === 'line' || cell.execSuccess === 'grid') {
-              cell.execSuccess = 'mainline'
+          if (item.submit.syncComponentId && item.submit.syncComponentId === item.setting.supModule) {
+            item.submit.syncComponentId = ''
+            if (item.submit.execSuccess === 'grid') {
+              item.submit.execSuccess = 'mainline'
             }
           }
-
-          if (cell.OpenType === 'funcbutton' && cell.funcType === 'print' && cell.verify) { // 鎵撳嵃鏈鸿缃�
-            cell = this.getPrinter(cell, item.uuid)
-          }
-
-          return skip || permAction[cell.uuid]
-        })
-      }
-
-      if (item.type === 'card' || item.type === 'carousel' || item.type === 'timeline') {
+        }
+      } 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
@@ -572,7 +618,7 @@
 
               cell = this.resetButton(item, cell, popview)
 
-              if (!mutil && cell.syncComponentId === item.setting.supModule) {
+              if (!mutil && cell.syncComponentId && cell.syncComponentId === item.setting.supModule) {
                 cell.syncComponentId = ''
                 if (cell.execSuccess === 'line' || cell.execSuccess === 'grid') {
                   cell.execSuccess = 'mainline'
@@ -586,7 +632,7 @@
               cell = this.resetElement(cell)
             }
 
-            return cell.eleType !== 'button' || skip || permAction[cell.uuid]
+            return cell.eleType !== 'button' || pass || permAction[cell.uuid]
           })
 
           if (!card.backElements || card.backElements.length === 0) return
@@ -597,7 +643,7 @@
 
               cell = this.resetButton(item, cell, popview)
 
-              if (!mutil && cell.syncComponentId === item.setting.supModule) {
+              if (!mutil && cell.syncComponentId && cell.syncComponentId === item.setting.supModule) {
                 cell.syncComponentId = ''
                 if (cell.execSuccess === 'line' || cell.execSuccess === 'grid') {
                   cell.execSuccess = 'mainline'
@@ -611,7 +657,7 @@
               cell = this.resetElement(cell)
             }
 
-            return cell.eleType !== 'button' || skip || permAction[cell.uuid]
+            return cell.eleType !== 'button' || pass || permAction[cell.uuid]
           })
         })
       } else if (item.type === 'balcony') {
@@ -628,7 +674,7 @@
 
             cell = this.resetButton(item, cell, popview)
 
-            if (cell.syncComponentId === item.wrap.supModule) {
+            if (cell.syncComponentId && cell.syncComponentId === item.wrap.supModule) {
               cell.syncComponentId = ''
               if (cell.execSuccess === 'line' || cell.execSuccess === 'grid') {
                 cell.execSuccess = 'mainline'
@@ -642,36 +688,8 @@
             cell = this.resetElement(cell)
           }
 
-          return cell.eleType !== 'button' || skip || permAction[cell.uuid]
+          return cell.eleType !== 'button' || pass || 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
@@ -686,9 +704,9 @@
             group.subButton.Ot = item.wrap.datatype === 'static' ? 'notRequired' : 'requiredSgl'
           }
 
-          group.subButton.syncComponentId = group.subButton.syncComponent ? group.subButton.syncComponent.pop() : ''
+          group.subButton.syncComponentId = group.subButton.syncComponent ? (group.subButton.syncComponent.pop() || '') : ''
 
-          if (group.subButton.syncComponentId === item.setting.supModule) {
+          if (group.subButton.syncComponentId && group.subButton.syncComponentId === item.setting.supModule) {
             group.subButton.syncComponentId = ''
             if (group.subButton.execSuccess === 'grid') {
               group.subButton.execSuccess = 'mainline'
@@ -716,7 +734,11 @@
           return group
         })
       } else if (item.subtype === 'voucher') {
-        item.wrap.supModule = item.wrap.supModule.pop()
+        if (item.wrap.supModule && item.wrap.supModule.length > 0) {
+          item.wrap.supModule = item.wrap.supModule.pop()
+        } else {
+          item.wrap.supModule = ''
+        }
       }
       
       return true
@@ -801,6 +823,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