From 72419e2f826031a158173f46d723a672064e37cd Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期二, 31 八月 2021 22:42:51 +0800
Subject: [PATCH] 2021-08-31

---
 src/tabviews/custom/components/chart/antv-scatter/index.jsx |   87 +++++++++++++++++++++----------------------
 1 files changed, 43 insertions(+), 44 deletions(-)

diff --git a/src/tabviews/custom/components/chart/antv-scatter/index.jsx b/src/tabviews/custom/components/chart/antv-scatter/index.jsx
index 7781e86..a085d4e 100644
--- a/src/tabviews/custom/components/chart/antv-scatter/index.jsx
+++ b/src/tabviews/custom/components/chart/antv-scatter/index.jsx
@@ -7,14 +7,16 @@
 
 import Api from '@/api'
 import Utils from '@/utils/utils.js'
-import asyncComponent from './asyncButtonComponent'
+// import asyncComponent from '@/utils/asyncComponent'
+import asyncBtnComponent from './asyncButtonComponent'
 import UtilsDM from '@/utils/utils-datamanage.js'
 import MKEmitter from '@/utils/events.js'
+import NormalHeader from '@/tabviews/custom/components/share/normalheader'
 import './index.scss'
 
-const NormalHeader = asyncComponent(() => import('@/tabviews/custom/components/share/normalheader'))
-const ExcelOutButton = asyncComponent(() => import('@/tabviews/zshare/actionList/exceloutbutton'))
-const ExcelInButton = asyncComponent(() => import('@/tabviews/zshare/actionList/excelInbutton'))
+// const NormalHeader = asyncComponent(() => import('@/tabviews/custom/components/share/normalheader'))
+const ExcelOutButton = asyncBtnComponent(() => import('@/tabviews/zshare/actionList/exceloutbutton'))
+const ExcelInButton = asyncBtnComponent(() => import('@/tabviews/zshare/actionList/excelInbutton'))
 
 class ScatterChart extends Component {
   static propTpyes = {
@@ -51,13 +53,7 @@
       _sync = false
     }
 
-    if (config.plot.title || config.search.length > 0) {
-      _config.plot.height = _config.plot.height - 80
-    } else {
-      _config.plot.height = _config.plot.height - 30
-    }
-
-    _config.style = {..._config.style, minHeight: config.plot.height}
+    _config.style.height = config.plot.height || 400
 
     this.setState({
       config: _config,
@@ -92,12 +88,10 @@
       this.setState({sync: false, data: _data, empty: !_data,}, () => {
         this.handleData()
       })
-    } else if (nextProps.mainSearch && !is(fromJS(this.props.mainSearch), fromJS(nextProps.mainSearch))) {
-      if (config.setting.syncRefresh === 'true') {
-        this.setState({}, () => {
-          this.loadData()
-        })
-      }
+    } else if (config.setting.syncRefresh && nextProps.mainSearch && !is(fromJS(this.props.mainSearch), fromJS(nextProps.mainSearch))) {
+      this.setState({}, () => {
+        this.loadData()
+      })
     }
   }
 
@@ -108,7 +102,7 @@
   componentDidMount () {
     MKEmitter.addListener('reloadData', this.reloadData)
     MKEmitter.addListener('resetSelectLine', this.resetParentParam)
-    MKEmitter.addListener('getexceloutparam', this.getexceloutparam)
+    MKEmitter.addListener('queryModuleParam', this.queryModuleParam)
     MKEmitter.addListener('refreshByButtonResult', this.refreshByButtonResult)
     this.handleTimer()
   }
@@ -123,7 +117,7 @@
     }
     MKEmitter.removeListener('reloadData', this.reloadData)
     MKEmitter.removeListener('resetSelectLine', this.resetParentParam)
-    MKEmitter.removeListener('getexceloutparam', this.getexceloutparam)
+    MKEmitter.removeListener('queryModuleParam', this.queryModuleParam)
     MKEmitter.removeListener('refreshByButtonResult', this.refreshByButtonResult)
   }
 
@@ -132,16 +126,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]
 
@@ -230,14 +215,14 @@
   /**
    * @description 瀵煎嚭Excel鏃讹紝鑾峰彇椤甸潰鎼滅储鎺掑簭绛夊弬鏁�
    */
-  getexceloutparam = (menuId, btnId) => {
+  queryModuleParam = (menuId, btnId) => {
     const { mainSearch } = this.props
     const { arr_field, config, search } = this.state
 
     if (config.uuid !== menuId) return
 
     let searches = search ? fromJS(search).toJS() : []
-    if (mainSearch && mainSearch.length > 0) { // 涓昏〃鎼滅储鏉′欢
+    if (config.setting.useMSearch && mainSearch && mainSearch.length > 0) { // 涓昏〃鎼滅储鏉′欢
       let keys = searches.map(item => item.key.toLowerCase())
       mainSearch.forEach(item => {
         if (!keys.includes(item.key.toLowerCase())) {
@@ -246,7 +231,7 @@
       })
     }
 
-    MKEmitter.emit('execExcelout', config.uuid, btnId, {
+    MKEmitter.emit('returnModuleParam', config.uuid, btnId, {
       arr_field: arr_field,
       orderBy: config.setting.order || '',
       search: searches,
@@ -272,13 +257,18 @@
     }
 
     let searches = search ? fromJS(search).toJS() : []
-    if (mainSearch && mainSearch.length > 0) { // 涓昏〃鎼滅储鏉′欢
+    if (config.setting.useMSearch && mainSearch && mainSearch.length > 0) { // 涓昏〃鎼滅储鏉′欢
       let keys = searches.map(item => item.key)
       mainSearch.forEach(item => {
         if (!keys.includes(item.key)) {
           searches.push(item)
         }
       })
+    }
+
+    let requireFields = searches.filter(item => item.required && item.value === '')
+    if (requireFields.length > 0) {
+      return
     }
 
     if (!hastimer) {
@@ -324,14 +314,14 @@
   }
 
   /**
-   * @description 鎶樼嚎鍥炬覆鏌�
+   * @description 鏁g偣鍥炬覆鏌�
    */
   scatterrender = () => {
     const { plot, data, chartId } = this.state
     const chart = new Chart({
       container: chartId,
       autoFit: true,
-      height: plot.height
+      height: this.wrap.offsetHeight - 25
     })
 
     chart.data(data);
@@ -347,13 +337,18 @@
       itemName: { style: { fill: plot.color } }
     })
 
-    chart.tooltip({
-      showTitle: false,
-      showCrosshairs: true,
-      crosshairs: {
-        type: 'xy',
-      }
-    })
+    if (plot.tooltip !== 'true') {
+      chart.tooltip(false)
+    } else {
+      chart.tooltip({
+        showTitle: false,
+        showCrosshairs: true,
+        crosshairs: {
+          type: 'xy',
+        }
+      })
+    }
+
     chart
       .point()
       .position(`${plot.Xaxis}*${plot.Yaxis}`)
@@ -368,7 +363,11 @@
       .style({
         fillOpacity: 0.85
       })
-    chart.interaction('legend-highlight');
+    if (plot.interaction && plot.interaction.length) {
+      plot.interaction.forEach(t => {
+        chart.interaction(t)
+      })
+    }
     chart.render()
   }
 
@@ -390,7 +389,7 @@
           </div> : null
         }
         <NormalHeader config={config} BID={BID} menuType={this.props.menuType} refresh={this.refreshSearch} />
-        <div className="canvas-wrap">
+        <div className="canvas-wrap" ref={ref => this.wrap = ref}>
           <div className="chart-action">
             {config.action.map(item => {
               if (item.OpenType === 'excelOut') {

--
Gitblit v1.8.0