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/utils/utils-datamanage.js                          |    1 
 src/tabviews/custom/components/code/sand-box/index.jsx |    4 +-
 src/views/billprint/index.jsx                          |   66 ++++++++++++++++++++++++++++-----
 3 files changed, 58 insertions(+), 13 deletions(-)

diff --git a/src/tabviews/custom/components/code/sand-box/index.jsx b/src/tabviews/custom/components/code/sand-box/index.jsx
index 9027a05..6afc90e 100644
--- a/src/tabviews/custom/components/code/sand-box/index.jsx
+++ b/src/tabviews/custom/components/code/sand-box/index.jsx
@@ -319,8 +319,8 @@
       if (js) {
         try {
           // eslint-disable-next-line
-          let evalfunc = eval('(true && function (data, result) {' + js + '})')
-          evalfunc(data, result)
+          let evalfunc = eval('(true && function (data, result, Api, notification) {' + js + '})')
+          evalfunc(data, result, Api, notification)
         } catch (e) {
           console.warn(e)
         }
diff --git a/src/utils/utils-datamanage.js b/src/utils/utils-datamanage.js
index 50ccbeb..32bc369 100644
--- a/src/utils/utils-datamanage.js
+++ b/src/utils/utils-datamanage.js
@@ -209,7 +209,6 @@
     }
 
     if (_customScript) {
-      
       if (window.GLOB.breakpoint) {
         _customScript = _customScript.replace(/\$breakpoint_proc@/ig, window.GLOB.breakpoint)
         param.func = 'sPC_Get_TableData_debug'
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