From 610916b0e897c4953310bac7c0a9a37c7379ffc0 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期二, 25 五月 2021 16:29:13 +0800
Subject: [PATCH] 2021-05-25

---
 src/menu/components/chart/antv-dashboard/index.jsx |   18 ++++++++----------
 1 files changed, 8 insertions(+), 10 deletions(-)

diff --git a/src/menu/components/chart/antv-dashboard/index.jsx b/src/menu/components/chart/antv-dashboard/index.jsx
index 1e395b6..fea3e2c 100644
--- a/src/menu/components/chart/antv-dashboard/index.jsx
+++ b/src/menu/components/chart/antv-dashboard/index.jsx
@@ -162,7 +162,8 @@
         _element.innerHTML = ''
       }
 
-      setTimeout(this.dashboardrender, 100)
+      this.$timer && clearTimeout(this.$timer)
+      this.$timer = setTimeout(this.dashboardrender, 100)
     }
   }
 
@@ -183,7 +184,7 @@
     const chart = new Chart({
       container: card.uuid + 'dashboard',
       autoFit: true,
-      height: plot.height ? (plot.height - 80) : 320,
+      height: plot.height ? (plot.height - 75) : 325,
       padding: [0, 0, 0, 0],
     })
     chart.data(data);
@@ -315,13 +316,16 @@
 
   updateComponent = (component) => {
     const card = fromJS(this.state.card).toJS()
-    let refresh = false
+
     if (!is(fromJS(component.plot), fromJS(card.plot)) || !is(fromJS(component.style), fromJS(card.style))) {
       let _element = document.getElementById(card.uuid + 'dashboard')
       if (_element) {
         _element.innerHTML = ''
       }
-      refresh = true
+      this.$timer && clearTimeout(this.$timer)
+      this.$timer = setTimeout(() => {
+        this.dashboardrender()
+      }, 150)
     }
 
     component.width = component.plot.width
@@ -329,12 +333,6 @@
     
     this.setState({
       card: component
-    }, () => {
-      if (refresh) {
-        setTimeout(() => {
-          this.dashboardrender()
-        }, 100)
-      }
     })
     this.props.updateConfig(component)
   }

--
Gitblit v1.8.0