From fec6c24bc3fd902f8ced64bc2600c0b0836f7e52 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期五, 10 一月 2025 11:34:58 +0800
Subject: [PATCH] 2025-01-10

---
 src/views/billprint/index.jsx |  155 +++++++++++++++++++++++++++++++--------------------
 1 files changed, 93 insertions(+), 62 deletions(-)

diff --git a/src/views/billprint/index.jsx b/src/views/billprint/index.jsx
index 0ea001b..bb22cfb 100644
--- a/src/views/billprint/index.jsx
+++ b/src/views/billprint/index.jsx
@@ -99,10 +99,22 @@
         configurable: true,
         enumerable: true,
         set(value) {
-          if (value + '' === 'false') {
-            window.GLOB.debugger = false
-          } else {
+          if (value === true) {
             window.GLOB.debugger = true
+          } else if (value === 0) {
+            if (window.backend) {
+              sessionStorage.setItem('systemRun', 'front')
+              window.location.reload()
+            } else {
+              window.mkInfo('绯荤粺褰撳墠鏈娇鐢ㄥ悗绔剼鏈紒')
+            }
+          } else if (value === false) {
+            if (sessionStorage.getItem('systemRun') === 'front') {
+              sessionStorage.removeItem('systemRun')
+              window.location.reload()
+            } else {
+              window.GLOB.debugger = false
+            }
           }
         }
       })
@@ -176,6 +188,10 @@
           func: 's_Get_style',
           TypeCharOne: 'PC',
           LText: `select '${window.GLOB.appkey}'`,
+        }
+
+        if (window.GLOB.style_appkey) {
+          _param.style_appkey = window.GLOB.style_appkey
         }
 
         _param.userid = result.UserID
@@ -598,6 +614,7 @@
           if (data.length > 0) {
             params.push({
               $backend: true,
+              $type: 's_Get_TableData',
               componentId: '',
               data
             })
@@ -961,7 +978,6 @@
 
     let deffers = params.map(item => {
       let componentId = item.componentId
-      let ispublic = item.public
       delete item.componentId
       delete item.public
       return new Promise(resolve => {
@@ -983,13 +999,12 @@
           } else {
             res.componentId = componentId
 
-            if (ispublic) {
-              let _data = { $$empty: true }
-              if (res.data && res.data[0]) {
-                _data = res.data[0]
-              }
-              window.GLOB.CacheData.set(componentId, _data)
+            let _data = { $$empty: true }
+            if (res.data && res.data[0]) {
+              _data = res.data[0]
             }
+            window.GLOB.CacheData.set(componentId, _data)
+
             resolve(res)
           }
         })
@@ -1044,63 +1059,79 @@
         }
       }
 
-      while (!over) {
-        let page = []
-        let count = 0
-        let _pageover = false
-
-        comps.forEach(comp => {
-          let item = fromJS(comp).toJS()
-
-          if (item.wrap.printType === 'headerOrfooter') { // 椤电湁椤佃剼
-            item.data = item.dataArray || null
-            setData(item)
-            page.push(item)
-            comp.added = true
-          }
-
-          if (_pageover) return
-
-          if (item.$page && comp.dataArray.length > 0) {
-            item.data = []
-
-            while (count + 1 <= limit && comp.dataArray.length > 0) {
-              item.data.push(comp.dataArray.shift())
-              count++
-            }
-
-            if (count >= limit || comp.dataArray.length > 0) {
-              _pageover = true
-            }
-
-            if (comp.dataArray.length === 0) {
+      if (this.state.config.printPage === 'custom' && this.state.config.printScripts) {
+        try {
+          // eslint-disable-next-line
+          let func = new Function('components', 'pages', 'notification', this.state.config.printScripts)
+          func(comps, pages, notification)
+        } catch (e) {
+          console.warn(e)
+    
+          notification.warning({
+            top: 92,
+            message: '鑷畾涔夎剼鏈墽琛岄敊璇紒',
+            duration: 5
+          })
+        }
+      } else {
+        while (!over) {
+          let page = []
+          let count = 0
+          let _pageover = false
+  
+          comps.forEach(comp => {
+            let item = fromJS(comp).toJS()
+  
+            if (item.wrap.printType === 'headerOrfooter') { // 椤电湁椤佃剼
+              item.data = item.dataArray || null
+              setData(item)
+              page.push(item)
               comp.added = true
             }
-
-            setData(item)
-            page.push(item)
-          } else if (!comp.added) {
-            if (item.wrap.printHeight) {
-              count += item.wrap.printHeight
-              if (count >= limit) {
-                _pageover = true
-                return
+  
+            if (_pageover) return
+  
+            if (item.$page && comp.dataArray.length > 0) {
+              item.data = []
+  
+              while (count + 1 <= limit && comp.dataArray.length > 0) {
+                item.data.push(comp.dataArray.shift())
+                count++
               }
+  
+              if (count >= limit || comp.dataArray.length > 0) {
+                _pageover = true
+              }
+  
+              if (comp.dataArray.length === 0) {
+                comp.added = true
+              }
+  
+              setData(item)
+              page.push(item)
+            } else if (!comp.added) {
+              if (item.wrap.printHeight) {
+                count += item.wrap.printHeight
+                if (count >= limit) {
+                  _pageover = true
+                  return
+                }
+              }
+  
+              item.data = item.dataArray || null
+  
+              setData(item)
+              page.push(item)
+              comp.added = true
             }
-
-            item.data = item.dataArray || null
-
-            setData(item)
-            page.push(item)
-            comp.added = true
+          })
+  
+          pages.push(page)
+          pageIndex++
+  
+          if (pageIndex >= 2000 || comps.findIndex(comp => !comp.added) === -1) {
+            over = true
           }
-        })
-
-        pages.push(page)
-        pageIndex++
-
-        if (pageIndex >= 2000 || comps.findIndex(comp => !comp.added) === -1) {
-          over = true
         }
       }
 

--
Gitblit v1.8.0