king
2023-01-14 004176924ce35c96600f5c18e85478944de8bec6
src/tabviews/custom/components/chart/antv-bar-line/index.jsx
@@ -37,7 +37,7 @@
    transfield: {},            // 字段名称翻译
    sync: false,               // 是否统一请求数据
    plot: null,                // 图表设置
    data: null,                // 数据
    data: [],                  // 数据
    search: null,              // 搜索条件
    vFields: [],               // 数值字段
    vstFields: null,           // 统计数据值字段信息
@@ -335,7 +335,7 @@
    this.setState({
      config: _config,
      data: _data,
      data: _data || [],
      BID: BID || '',
      vFields: vFields,
      vstFields: vstFields,
@@ -359,7 +359,7 @@
   * @description 图表数据更新,刷新内容
   */
  UNSAFE_componentWillReceiveProps (nextProps) {
    const { sync, config } = this.state
    const { sync, config, data } = this.state
    if (sync && !is(fromJS(this.props.data), fromJS(nextProps.data))) {
      let _data = []
@@ -367,9 +367,11 @@
        _data = nextProps.data[config.dataName] || []
      }
      this.setState({sync: false, data: _data}, () => {
      this.setState({sync: false, data: _data})
      if (!is(fromJS(data), fromJS(_data))) {
        this.handleData()
      })
      }
    } else if (config.setting.useMSearch && nextProps.mainSearch && !is(fromJS(this.props.mainSearch), fromJS(nextProps.mainSearch))) {
      this.setState({}, () => {
        this.loadData()
@@ -382,7 +384,7 @@
  }
  componentDidMount () {
    const { config } = this.state
    const { config, sync } = this.state
    MKEmitter.addListener('reloadData', this.reloadData)
    MKEmitter.addListener('resetSelectLine', this.resetParentParam)
@@ -393,6 +395,16 @@
      this.timer = new TimerTask()
      this.timer.init(config.uuid, config.timer, config.timerRepeats, () => {
        this.loadData(true)
      })
    }
    if (config.$cache && (config.setting.sync !== 'true' || sync)) {
      Api.getLCacheConfig(config.uuid).then(res => {
        if (!res) return
        this.setState({data: res}, () => {
          this.handleData()
        })
      })
    }
  }
@@ -522,19 +534,18 @@
    let result = await Api.genericInterface(param)
    if (result.status) {
      let reset = true
      if (hastimer && is(fromJS(result.data), fromJS(this.state.data))) {
        reset = false
      if (config.$cache) {
        Api.writeCacheConfig(config.uuid, result.data || '')
      }
      this.setState({
        data: result.data,
        data: result.data || [],
        loading: false
      }, () => {
        if (!reset) return
        this.handleData()
      })
      if (!is(fromJS(this.state.data), fromJS(result.data || []))) {
        this.handleData()
      }
    } else {
      this.setState({
        loading: false
@@ -577,7 +588,7 @@
  getdata = () => {
    const { data, plot, vFields, config } = this.state
    if (!data || data.length === 0) {
    if (data.length === 0) {
      this.setState({empty: true})
      return []
    }
@@ -726,7 +737,7 @@
      percent = true
    }
    if (!data || data.length === 0) {
    if (data.length === 0) {
      this.setState({empty: true})
      return []
    }