king
2020-12-10 84804b405cb88f659d055b16eb3bd00b813ccb4a
src/tabviews/custom/components/chart/antv-pie/index.jsx
@@ -12,6 +12,7 @@
import { modifyTabview } from '@/store/action'
import { chartColors } from '@/utils/option.js'
import UtilsDM from '@/utils/utils-datamanage.js'
import MKEmitter from '@/utils/events.js'
import './index.scss'
class PieChart extends Component {
@@ -66,16 +67,10 @@
      _config.style = {minHeight: (config.plot.height || 400)}
    }
    let _BID = BID || ''
    if (config.setting.supModule && config.setting.supModule[0] !== 'empty') {
      _BID = ''
    }
    sessionStorage.setItem(config.uuid, 'bid')
    this.setState({
      config: _config,
      data: _data,
      BID: _BID,
      BID: BID || '',
      arr_field: _config.columns.map(col => col.field).join(','),
      plot: _config.plot,
      sync: _sync,
@@ -89,14 +84,6 @@
        this.handleData()
      }
    })
  }
  /**
   * @description 组件销毁
   */
  componentWillUnmount () {
    const { config } = this.state
    sessionStorage.removeItem(config.uuid)
  }
  /**
@@ -127,6 +114,31 @@
    return !is(fromJS(this.state), fromJS(nextState))
  }
  componentDidMount () {
    MKEmitter.addListener('resetSelectLine', this.resetParentParam)
  }
  /**
   * @description 组件销毁,清除state更新,清除快捷键设置
   */
  componentWillUnmount () {
    this.setState = () => {
      return
    }
    MKEmitter.removeListener('resetSelectLine', this.resetParentParam)
  }
  resetParentParam = (MenuID, id) => {
    const { config } = this.state
    if (!config.setting.supModule || config.setting.supModule !== MenuID) return
    if (id !== this.state.BID) {
      this.setState({ BID: id }, () => {
        this.loadData()
      })
    }
  }
  handleData = () => {
    let _element = document.getElementById(this.state.chartId)
    if (_element) {
@@ -139,6 +151,15 @@
    const { mainSearch, menuType } = this.props
    const { config, arr_field, search, BID } = this.state
    if (config.setting.supModule && !BID) { // BID 不存在时,不做查询
      this.setState({
        data: []
      }, () => {
        this.handleData()
      })
      return
    }
    let searches = fromJS(search).toJS()
    if (mainSearch && mainSearch.length > 0) { // 主表搜索条件
      let keys = searches.map(item => item.key)