From d91fa969e6044f6b22554a80c8c0e8aeb22820bb Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期二, 01 八月 2023 09:50:21 +0800
Subject: [PATCH] Merge branch 'master' into positec

---
 src/views/billprint/index.jsx |   66 ++++++++++++++++++++++++++++-----
 1 files changed, 56 insertions(+), 10 deletions(-)

diff --git a/src/views/billprint/index.jsx b/src/views/billprint/index.jsx
index 86b8204..fbcc397 100644
--- a/src/views/billprint/index.jsx
+++ b/src/views/billprint/index.jsx
@@ -314,7 +314,14 @@
         window.GLOB.CacheData.set(tempId, {$BID: BID})
 
         config.components = config.components.map(component => {
-          if (component.action) component.action = []
+          if (component.action) {
+            component.action = component.action.filter(cell => {
+              cell = this.resetButton(component, cell)
+              cell.$toolbtn = true
+    
+              return !cell.hidden
+            })
+          }
           if (component.search) {
             component.search = []
             component.$searches = []
@@ -345,10 +352,15 @@
                   }
                 } else if (item.type === 'custom') {
                   item.elements = item.elements.filter(cell => {
-                    if (cell.eleType === 'button') return false
+                    if (cell.eleType === 'button') {
+                      cell = this.resetButton(component, cell)
+
+                      return !cell.hidden
+                    }
 
                     cell = this.resetElement(cell)
-                    return cell
+
+                    return true
                   })
                   if (item.elements.length === 0) {
                     return false
@@ -372,18 +384,26 @@
               }
     
               card.elements = card.elements.filter(cell => {
-                if (cell.eleType === 'button') return false
-   
+                if (cell.eleType === 'button') {
+                  cell = this.resetButton(component, cell)
+
+                  return !cell.hidden
+                }
+
                 cell = this.resetElement(cell)
-    
+   
                 return true
               })
     
               if (!card.backElements || card.backElements.length === 0) return
     
               card.backElements = card.backElements.filter(cell => {
-                if (cell.eleType === 'button') return false
-   
+                if (cell.eleType === 'button') {
+                  cell = this.resetButton(component, cell)
+
+                  return !cell.hidden
+                }
+
                 cell = this.resetElement(cell)
     
                 return true
@@ -391,8 +411,12 @@
             })
           } else if (component.type === 'balcony') {
             component.elements = component.elements.filter(cell => {
-              if (cell.eleType === 'button') return false
-                
+              if (cell.eleType === 'button') {
+                cell = this.resetButton(component, cell)
+
+                return !cell.hidden
+              }
+              
               cell = this.resetElement(cell)
     
               return true
@@ -504,6 +528,28 @@
     })
   }
 
+  resetButton = (item, cell) => {
+    cell.logLabel = item.$menuname + '-' + cell.label
+    cell.Ot = cell.Ot || 'requiredSgl'
+    cell.syncComponentId = ''
+    cell.$menuId = item.uuid
+
+    cell.hidden = cell.hidden === 'true'
+    if (!['pop', 'prompt', 'exec', 'innerpage', 'form'].includes(cell.OpenType)) {
+      cell.hidden = true
+    }
+
+    if (cell.controlField) {
+      if (/,/ig.test(cell.controlVal)) {
+        cell.controlVals = cell.controlVal.split(',')
+      } else {
+        cell.controlVals = [(cell.controlVal || '')]
+      }
+    }
+
+    return cell
+  }
+
   resetElement = (cell) => {
     cell.style = cell.style || {}
     if (['text', 'number', 'formula'].includes(cell.eleType)) {

--
Gitblit v1.8.0