From 0e76431e5bc06a60c8103b39aa3b26f05bb2b810 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期四, 24 十一月 2022 16:38:02 +0800
Subject: [PATCH] Merge branch 'develop'

---
 src/views/billprint/index.jsx |   45 +++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 43 insertions(+), 2 deletions(-)

diff --git a/src/views/billprint/index.jsx b/src/views/billprint/index.jsx
index bd9e5b0..379eecf 100644
--- a/src/views/billprint/index.jsx
+++ b/src/views/billprint/index.jsx
@@ -26,6 +26,7 @@
 const SandBox = asyncComponent(() => import('@/tabviews/custom/components/code/sand-box'))
 const TimeLine = asyncComponent(() => import('@/tabviews/custom/components/timeline/normal-timeline'))
 const Balcony = asyncComponent(() => import('@/tabviews/custom/components/card/balcony'))
+const AntvG6 = asyncComponent(() => import('@/tabviews/custom/components/chart/antv-G6'))
 const DebugTable = asyncComponent(() => import('@/tabviews/debugtable'))
 
 class BillPrint extends Component {
@@ -308,6 +309,8 @@
           })
         }
 
+        window.GLOB.CacheData.set(tempId, {$BID: BID})
+
         config.components = config.components.map(component => {
           if (component.action) component.action = []
           if (component.search) component.search = []
@@ -315,6 +318,16 @@
 
           if (component.subtype === 'tablecard') { // 鍏煎
             component.type = 'card'
+          }
+
+          component.$pageId = tempId
+          if (component.setting && component.setting.supModule) {
+            let pid = component.setting.supModule.pop()
+            if (pid && pid !== 'empty') {
+              component.setting.supModule = pid
+            } else {
+              component.setting.supModule = ''
+            }
           }
 
           if (component.type === 'table') {
@@ -332,7 +345,7 @@
             component.cols = getColumns(component.cols)
           }
 
-          if (component.wrap.datatype === 'static') {
+          if (component.wrap && component.wrap.datatype === 'static') {
             component.format = ''
           }
     
@@ -691,6 +704,13 @@
     return image
   }
 
+  chartToImage(canvas) {
+    let image = new Image()
+    image.src = canvas.toDataURL('image/jpg')
+    image.style = `width:100%;height:${canvas.style.height || '100%'};`
+    return image
+  }
+
   print = () => {
     const { config, printing } = this.state
     
@@ -706,6 +726,21 @@
   
         canvas.remove()
         qrcodes[i].append(img)
+      }
+    }
+
+    let charts = document.getElementsByTagName('canvas')
+
+    if (charts.length) {
+      for (let i = 0; i < charts.length; i++) {
+        let img = this.chartToImage(charts[i])
+        let parentNode = charts[i].parentNode
+  
+        parentNode.append(img)
+      }
+
+      while (charts[0]) {
+        charts[0].remove()
       }
     }
 
@@ -828,7 +863,13 @@
       } else if (item.type === 'timeline') {
         return (
           <Col span={item.width} style={style} key={item.uuid}>
-            <TimeLine config={item} initdata={item.data}/>
+            <TimeLine config={item} initdata={item.data} mainSearch={[]}/>
+          </Col>
+        )
+      } else if (item.type === 'antvG6') {
+        return (
+          <Col span={item.width} style={style} key={item.uuid}>
+            <AntvG6 config={item} initdata={item.data} mainSearch={[]}/>
           </Col>
         )
       } else {

--
Gitblit v1.8.0