From f6626b05f1275cc2f8ca77f773d4f6a6af1b0a89 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期一, 21 十一月 2022 16:11:55 +0800
Subject: [PATCH] 2022-11-21

---
 src/tabviews/custom/components/chart/antv-pie/index.jsx |   61 +++++++++++++++++++-----------
 1 files changed, 39 insertions(+), 22 deletions(-)

diff --git a/src/tabviews/custom/components/chart/antv-pie/index.jsx b/src/tabviews/custom/components/chart/antv-pie/index.jsx
index 8916b90..8662310 100644
--- a/src/tabviews/custom/components/chart/antv-pie/index.jsx
+++ b/src/tabviews/custom/components/chart/antv-pie/index.jsx
@@ -3,7 +3,7 @@
 import { is, fromJS } from 'immutable'
 import { Chart } from '@antv/g2'
 import DataSet, { DataView } from '@antv/data-set'
-import { Spin, Empty, notification } from 'antd'
+import { Spin, Empty, notification, Modal } from 'antd'
 import { DownloadOutlined } from '@ant-design/icons'
 import moment from 'moment'
 
@@ -64,7 +64,13 @@
       _sync = false
     }
 
-    _config.style.height = config.plot.height || 400
+    _config.plot.height = Utils.getHeight(_config.plot.height)
+    _config.style.height = 'auto'
+    _config.style.minHeight = _config.plot.height + 30
+
+    if (_config.plot.title) {
+      _config.style.minHeight = _config.style.minHeight + 45
+    }
 
     let decimal = 0
     _config.columns.forEach(col => {
@@ -110,7 +116,7 @@
       this.setState({sync: false, data: _data}, () => {
         this.handleData()
       })
-    } else if (config.setting.syncRefresh && nextProps.mainSearch && !is(fromJS(this.props.mainSearch), fromJS(nextProps.mainSearch))) {
+    } else if (config.setting.useMSearch && nextProps.mainSearch && !is(fromJS(this.props.mainSearch), fromJS(nextProps.mainSearch))) {
       this.setState({}, () => {
         this.loadData()
       })
@@ -239,11 +245,18 @@
         loading: false
       })
       this.timer && this.timer.stop()
-      notification.error({
-        top: 92,
-        message: result.message,
-        duration: 10
-      })
+      
+      if (result.ErrCode === 'N') {
+        Modal.error({
+          title: result.message,
+        })
+      } else {
+        notification.error({
+          top: 92,
+          message: result.message,
+          duration: 10
+        })
+      }
     }
   }
 
@@ -371,14 +384,15 @@
           return
         }
 
-        let sign = item[plot.type] + item[plot.Xaxis]
+        item.$type = item[plot.type]
+        let sign = item.$type + item[plot.Xaxis]
 
         if (!_mdata.has(sign)) {
           let _sort = sort
-          if (map.has(item.type)) {
-            _sort = map.get(item.type)
+          if (map.has(item.$type)) {
+            _sort = map.get(item.$type)
           } else {
-            map.set(item.type, _sort)
+            map.set(item.$type, _sort)
             sort++
           }
 
@@ -414,14 +428,15 @@
           return
         }
 
-        let sign = item[plot.type] + item[plot.Xaxis]
+        item.$type = item[plot.type]
+        let sign = item.$type + item[plot.Xaxis]
 
         if (!_mdata.has(sign)) {
           let _sort = sort
-          if (map.has(item.type)) {
-            _sort = map.get(item.type)
+          if (map.has(item.$type)) {
+            _sort = map.get(item.$type)
           } else {
-            map.set(item.type, _sort)
+            map.set(item.$type, _sort)
             sort++
           }
 
@@ -456,11 +471,13 @@
           }
         }
 
+        item.$type = item[plot.type]
+
         let _sort = sort
-        if (map.has(item.type)) {
-          _sort = map.get(item.type)
+        if (map.has(item.$type)) {
+          _sort = map.get(item.$type)
         } else {
-          map.set(item.type, _sort)
+          map.set(item.$type, _sort)
           sort++
         }
 
@@ -528,7 +545,7 @@
     const chart = new Chart({
       container: chartId,
       autoFit: true,
-      height: this.wrap.offsetHeight - 30,
+      height: plot.height,
       padding: 0,
     })
 
@@ -724,7 +741,7 @@
     const chart = new Chart({
       container: chartId,
       autoFit: true,
-      height: this.wrap.offsetHeight - 30
+      height: plot.height
     })
 
     if (plot.shape !== 'nightingale' && plot.show !== 'value') {
@@ -1032,7 +1049,7 @@
           </div> : null
         }
         <NormalHeader config={config} BID={BID} refresh={this.refreshSearch} />
-        <div className="canvas-wrap" ref={ref => this.wrap = ref}>
+        <div className="canvas-wrap">
           {config.plot.download === 'enable' && this.state.chart && !empty ? <DownloadOutlined onClick={this.downloadImage} className="system-color download"/> : null}
           <div className={'canvas' + (empty ? ' empty' : '')} id={this.state.chartId}></div>
         </div>

--
Gitblit v1.8.0