From 4e570c993e66a47ead0f83de76b63b0a2f8c5446 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期一, 05 六月 2023 17:28:16 +0800
Subject: [PATCH] 2023-06-05

---
 src/tabviews/custom/index.jsx |  203 +++++++++++++++++++++++++++-----------------------
 1 files changed, 108 insertions(+), 95 deletions(-)

diff --git a/src/tabviews/custom/index.jsx b/src/tabviews/custom/index.jsx
index ff11815..0eef227 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,40 @@
         item.search = Utils.initSearchVal(item.search)
       }
 
+      if (item.wrap && item.wrap.supType === 'multi') { // 鏁版嵁鍗″涓婄骇缁勪欢
+        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 (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 +515,8 @@
               return false
             } else if (col.Hide === 'true') {
               return false
+            } else if (col.type === 'action') {
+              col.type = 'custom'
             }
             
             if (col.type === 'number') {
@@ -493,16 +529,36 @@
                   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.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 +574,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,13 +602,6 @@
 
               cell = this.resetButton(item, cell, popview)
 
-              if (!mutil && 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)
               }
@@ -586,7 +609,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,13 +620,6 @@
 
               cell = this.resetButton(item, cell, popview)
 
-              if (!mutil && 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)
               }
@@ -611,7 +627,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,13 +644,6 @@
 
             cell = this.resetButton(item, cell, popview)
 
-            if (cell.syncComponentId === item.wrap.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)
             }
@@ -642,36 +651,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 +667,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 +697,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
@@ -783,6 +768,32 @@
       }
     }
 
+    if (cell.syncComponentId) {
+      if (cell.syncComponentId === item.setting.supModule) {
+        cell.syncComponentId = ''
+        if (cell.execSuccess === 'line' || cell.execSuccess === 'grid') {
+          cell.execSuccess = 'mainline'
+        }
+      } else if (cell.syncComponentId === 'multiComponent') {
+        let ids = cell.syncComponents.map(m => {
+          return m.syncComId.pop() || ''
+        })
+
+        if (item.setting.supModule && ids.includes(item.setting.supModule)) {
+          if (cell.execSuccess === 'line' || cell.execSuccess === 'grid') {
+            cell.execSuccess = 'mainline'
+          }
+          ids = ids.filter(id => id !== item.setting.supModule)
+        }
+        
+        if (ids.length === 0) {
+          cell.syncComponentId = ''
+        } else {
+          cell.syncComponentIds = ids
+        }
+      }
+    }
+
     return cell
   }
 
@@ -801,6 +812,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