From f267d04e0561a0a20d1f2a9f558a273558ece90d Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期一, 24 五月 2021 17:50:19 +0800
Subject: [PATCH] 2021-05-24

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

diff --git a/src/tabviews/custom/components/chart/antv-dashboard/index.jsx b/src/tabviews/custom/components/chart/antv-dashboard/index.jsx
index 46a23ab..f0751ee 100644
--- a/src/tabviews/custom/components/chart/antv-dashboard/index.jsx
+++ b/src/tabviews/custom/components/chart/antv-dashboard/index.jsx
@@ -86,12 +86,7 @@
       _sync = false
     }
 
-
-    if (_config.style) {
-      _config.style = {..._config.style, minHeight: (config.plot.height || 400)}
-    } else {
-      _config.style = {minHeight: (config.plot.height || 400)}
-    }
+    _config.style.height = config.plot.height || 400
 
     this.setState({
       config: _config,
@@ -164,16 +159,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 +254,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
@@ -304,27 +298,33 @@
   }
 
   /**
-   * @description 楗煎浘娓叉煋
+   * @description 浠〃鐩樻覆鏌�
    */
   dashboardrender = () => {
     const { plot, chartId, data } = this.state
+
+    let _data = fromJS(data).toJS()
+    if (_data.value && _data.value > plot.maxValue) {
+      _data.value = plot.maxValue
+    }
+
     const chart = new Chart({
       container: chartId,
       autoFit: true,
       height: plot.height ? (plot.height - 80) : 320,
       padding: [0, 0, 0, 0],
     })
-    chart.data([data]);
+    chart.data([_data]);
     chart.scale('value', {
       min: 0,
       max: plot.maxValue,
       tickInterval: plot.tickInterval,
-    });
+    })
     chart.coordinate('polar', {
       startAngle: (-9 / 8) * Math.PI,
       endAngle: (1 / 8) * Math.PI,
       radius: 0.75,
-    });
+    })
 
     chart.axis('1', false);
     chart.axis('value', {
@@ -345,9 +345,9 @@
         }
       },
       grid: null,
-    });
-    chart.legend(false);
-    chart.tooltip(false);
+    })
+    chart.legend(false)
+    chart.tooltip(false)
     chart
       .point()
       .position('value*1')
@@ -371,7 +371,7 @@
         appear: {
           animation: 'fade-in'
         }
-      });
+      })
 
     // 缁樺埗浠〃鐩樿儗鏅�
     chart.annotation().arc({
@@ -394,7 +394,7 @@
           lineWidth: 18,
           lineDash: null,
         },
-      });
+      })
     } else {
       let start = 0
       plot.colors.forEach(item => {
@@ -438,7 +438,7 @@
           textAlign: 'center',
         },
         offsetY: 15,
-      });
+      })
     }
 
     chart.render()

--
Gitblit v1.8.0