From c98e45bfac25e9110ad0383faac54a54d98ea9d5 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期四, 18 十一月 2021 20:47:04 +0800
Subject: [PATCH] 2021-11-18

---
 src/menu/components/chart/antv-dashboard/index.jsx |   25 ++++++++++++++-----------
 1 files changed, 14 insertions(+), 11 deletions(-)

diff --git a/src/menu/components/chart/antv-dashboard/index.jsx b/src/menu/components/chart/antv-dashboard/index.jsx
index 62bde3e..58f608b 100644
--- a/src/menu/components/chart/antv-dashboard/index.jsx
+++ b/src/menu/components/chart/antv-dashboard/index.jsx
@@ -156,9 +156,12 @@
   }
 
   componentDidMount () {
-    this.viewrender()
     MKEmitter.addListener('tabsChange', this.handleTabsChange)
     MKEmitter.addListener('submitStyle', this.getStyle)
+
+    setTimeout(() => {
+      this.viewrender()
+    }, 1000)
   }
 
   shouldComponentUpdate (nextProps, nextState) {
@@ -231,7 +234,7 @@
     const chart = new Chart({
       container: card.uuid + 'dashboard',
       autoFit: true,
-      height: plot.title ? plot.height - 45 : plot.height,
+      height: this.wrap.offsetHeight - 30,
     })
     
     chart.data(data)
@@ -316,10 +319,10 @@
   getdata = () => {
     const { card } = this.state
 
-    const data = [];
-    const val = (Math.random() * card.plot.maxValue).toFixed(1);
-    data.push({ value: +val });
-    return data;
+    const data = []
+    const val = (Math.random() * card.plot.maxValue).toFixed(1)
+    data.push({ value: +val })
+    return data
   }
 
   dashboardrender = () => {
@@ -330,7 +333,7 @@
     const chart = new Chart({
       container: card.uuid + 'dashboard',
       autoFit: true,
-      height: plot.title ? plot.height - 45 : plot.height,
+      height: this.wrap.offsetHeight - 30,
       padding: [0, 0, 0, 0],
     })
     chart.data(data)
@@ -463,7 +466,7 @@
   updateComponent = (component) => {
     const card = fromJS(this.state.card).toJS()
 
-    if (!is(fromJS(component.plot), fromJS(card.plot)) || !is(fromJS(component.style), fromJS(card.style))) {
+    if (!is(fromJS(component.plot), fromJS(card.plot)) || !is(fromJS(component.style), fromJS(card.style)) || !is(fromJS(component.search), fromJS(card.search))) {
       let _element = document.getElementById(card.uuid + 'dashboard')
       if (_element) {
         _element.innerHTML = ''
@@ -486,7 +489,7 @@
   changeStyle = () => {
     const { card } = this.state
 
-    MKEmitter.emit('changeStyle', [card.uuid], ['background', 'border', 'padding', 'margin'], card.style)
+    MKEmitter.emit('changeStyle', [card.uuid], ['background', 'border', 'padding', 'margin', 'shadow'], card.style)
   }
 
   getStyle = (comIds, style) => {
@@ -525,8 +528,8 @@
         } trigger="hover">
           <Icon type="tool" />
         </Popover>
-        {card.plot.title ? <NormalHeader config={card} updateComponent={this.updateComponent}/> : null}
-        <div className="canvas" id={card.uuid + 'dashboard'}></div>
+        <NormalHeader hideSearch="true" config={card} updateComponent={this.updateComponent}/>
+        <div className="canvas" id={card.uuid + 'dashboard'} ref={ref => this.wrap = ref}></div>
       </div>
     )
   }

--
Gitblit v1.8.0