From e543372cc70a19ff2630c79d8421c2c593e54e5f Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期三, 02 六月 2021 17:15:21 +0800
Subject: [PATCH] 2021-06-02

---
 src/tabviews/custom/components/chart/antv-dashboard/index.jsx |   32 ++++++++++++++++----------------
 1 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/src/tabviews/custom/components/chart/antv-dashboard/index.jsx b/src/tabviews/custom/components/chart/antv-dashboard/index.jsx
index 2fe7eb4..e702da2 100644
--- a/src/tabviews/custom/components/chart/antv-dashboard/index.jsx
+++ b/src/tabviews/custom/components/chart/antv-dashboard/index.jsx
@@ -86,12 +86,13 @@
       _sync = false
     }
 
-
-    if (_config.style) {
-      _config.style = {..._config.style, minHeight: (config.plot.height || 400)}
+    let height = config.plot.height || 400
+    if (config.plot.title) {
+      _config.plot.height = height - 75
     } else {
-      _config.style = {minHeight: (config.plot.height || 400)}
+      _config.plot.height = height - 30
     }
+    _config.style.height = height
 
     this.setState({
       config: _config,
@@ -164,16 +165,7 @@
 
     if (!config.timer) return
 
-    const _change = {
-      '15s': 15000,
-      '30s': 30000,
-      '1min': 60000,
-      '5min': 300000,
-      '10min': 600000,
-      '15min': 900000,
-      '30min': 1800000,
-      '1hour': 3600000
-    }
+    const _change = { '15s': 15000, '30s': 30000, '1min': 60000, '5min': 300000, '10min': 600000, '15min': 900000, '30min': 1800000, '1hour': 3600000 }
 
     let timer = _change[config.timer]
 
@@ -268,6 +260,14 @@
       })
     }
 
+    let requireFields = searches.filter(item => item.required && (!item.value || item.value.length === 0))
+    if (requireFields.length > 0) {
+      this.setState({
+        loading: false
+      })
+      return
+    }
+
     if (!hastimer) {
       this.setState({
         loading: true
@@ -317,7 +317,7 @@
     const chart = new Chart({
       container: chartId,
       autoFit: true,
-      height: plot.height ? (plot.height - 80) : 320,
+      height: plot.height,
       padding: [0, 0, 0, 0],
     })
     chart.data([_data]);
@@ -463,7 +463,7 @@
         }
         <NormalHeader config={config} />
         <div className="canvas-wrap">
-          <div className={'canvas' + (empty ? ' empty' : '')} id={this.state.chartId}></div>
+          <div className={'canvas' + (empty ? ' empty' : '')} style={{height: config.plot.height + 30}} id={this.state.chartId}></div>
         </div>
       </div>
     )

--
Gitblit v1.8.0