From 1ed217be1abce1a1da18d90a1a9f358beef79acd Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期三, 30 十二月 2020 18:31:28 +0800
Subject: [PATCH] 2020-12-30

---
 src/views/billprint/index.jsx |   73 +++++++++++++++++++++++-------------
 1 files changed, 46 insertions(+), 27 deletions(-)

diff --git a/src/views/billprint/index.jsx b/src/views/billprint/index.jsx
index 3d201ab..cb4e936 100644
--- a/src/views/billprint/index.jsx
+++ b/src/views/billprint/index.jsx
@@ -19,6 +19,8 @@
 const AntvPie = asyncComponent(() => import('@/tabviews/custom/components/chart/antv-pie'))
 const DataCard = asyncComponent(() => import('@/tabviews/custom/components/card/data-card'))
 const PropCard = asyncComponent(() => import('@/tabviews/custom/components/card/prop-card'))
+const TableCard = asyncComponent(() => import('@/tabviews/custom/components/card/table-card'))
+const NormalTable = asyncComponent(() => import('@/tabviews/custom/components/table/normal-table'))
 
 class BillPrint extends Component {
   state = {
@@ -145,7 +147,7 @@
         let params = []
         let _pars = []
 
-        config.components = config.components.filter(item => !['tabs', 'search'].includes(item.type) && item.subtype !== 'tablecard')
+        config.components = config.components.filter(item => !['tabs', 'search'].includes(item.type))
         config.components = config.components.map(component => {
           if (component.action) component.action = []
           if (component.search) component.search = []
@@ -381,29 +383,34 @@
 
         comps.forEach((_item, index) => {
           let item = fromJS(_item).toJS()
+
+          if (index + 1 >= length && !_pageover) {
+            pagesover = true
+          }
+
           if (item.wrap && item.wrap.printType === 'headerOrfooter') { // 椤电湁椤佃剼
             page.push(item)
           } else if (_pageover) {
             return
-          } else if (item.type === 'card' && item.subtype === 'datacard') {
-            if (!_item.dataArray || _item.dataArray.length === 0) return
+          } else if (item.subtype === 'datacard' || item.type === 'table') {
+            if (_item.dataArray && _item.dataArray.length > 0) {
+              item.data = []
 
-            item.data = []
-
-            while (count < limit && _item.dataArray.length > 0) {
-              item.data.push(_item.dataArray.shift())
-              count++
+              while (count < limit && _item.dataArray.length > 0) {
+                item.data.push(_item.dataArray.shift())
+                count++
+              }
+  
+              if (count >= limit) {
+                _pageover = true
+              }
+              page.push(item)
             }
-
-            if (count >= limit) {
-              _pageover = true
-            }
-            page.push(item)
           } else {
             page.push(item)
           }
 
-          if (index + 1 === length && !_pageover) {
+          if (index + 1 >= length && !_pageover) {
             pagesover = true
           }
         })
@@ -430,20 +437,20 @@
               page.push(item)
             } else if (_pageover) {
               return
-            } else if (item.type === 'card' && item.subtype === 'datacard') {
-              if (!_item.dataArray || _item.dataArray.length === 0) return
+            } else if (item.subtype === 'datacard' || item.type === 'table') {
+              if (_item.dataArray && _item.dataArray.length > 0) {
+                item.data = []
   
-              item.data = []
-  
-              while (count < limit && _item.dataArray.length > 0) {
-                item.data.push(_item.dataArray.shift())
-                count++
+                while (count < limit && _item.dataArray.length > 0) {
+                  item.data.push(_item.dataArray.shift())
+                  count++
+                }
+    
+                if (count >= limit) {
+                  _pageover = true
+                }
+                page.push(item)
               }
-  
-              if (count >= limit) {
-                _pageover = true
-              }
-              page.push(item)
             } else {
               page.push(item)
             }
@@ -457,7 +464,7 @@
         pages.push(page)
         pageIndex++
 
-        if (pageIndex >= 2000 || pagesover) {
+        if (pageIndex >= 200 || pagesover) {
           over = true
         }
       }
@@ -537,6 +544,18 @@
             <PropCard config={item} initdata={item.data} mainSearch={[]} menuType="" />
           </Col>
         )
+      } else if (item.type === 'table' && item.subtype === 'tablecard') {
+        return (
+          <Col span={item.width} key={item.uuid}>
+            <TableCard config={item} initdata={item.data} mainSearch={[]} menuType="" />
+          </Col>
+        )
+      } else if (item.type === 'table' && item.subtype === 'normaltable') {
+        return (
+          <Col span={item.width} key={item.uuid}>
+            <NormalTable config={item} initdata={item.data} mainSearch={[]} menuType="" />
+          </Col>
+        )
       } else {
         return null
       }

--
Gitblit v1.8.0