king
2022-10-28 aa41be24e83653077d85860cb70882551912af24
src/tabviews/custom/components/timeline/normal-timeline/index.jsx
@@ -1,13 +1,14 @@
import React, {Component} from 'react'
import PropTypes from 'prop-types'
import { is, fromJS } from 'immutable'
import { Spin, notification, Timeline, Empty } from 'antd'
import { Spin, notification, Timeline, Empty, Modal } from 'antd'
import Api from '@/api'
import MkIcon from '@/components/mk-icon'
import asyncComponent from '@/utils/asyncComponent'
import UtilsDM from '@/utils/utils-datamanage.js'
import MKEmitter from '@/utils/events.js'
import TimerTask from '@/utils/timer-task.js'
import './index.scss'
const CardCellComponent = asyncComponent(() => import('@/tabviews/custom/components/card/cardcellList'))
@@ -109,10 +110,19 @@
  }
  componentDidMount () {
    const { config } = this.state
    MKEmitter.addListener('reloadData', this.reloadData)
    MKEmitter.addListener('resetSelectLine', this.resetParentParam)
    MKEmitter.addListener('queryModuleParam', this.queryModuleParam)
    MKEmitter.addListener('refreshByButtonResult', this.refreshByButtonResult)
    if (config.timer) {
      this.timer = new TimerTask()
      this.timer.init(config.uuid, config.timer, config.timerRepeats, () => {
        this.loadData(true)
      })
    }
  }
  shouldComponentUpdate (nextProps, nextState) {
@@ -127,6 +137,8 @@
    MKEmitter.removeListener('resetSelectLine', this.resetParentParam)
    MKEmitter.removeListener('queryModuleParam', this.queryModuleParam)
    MKEmitter.removeListener('refreshByButtonResult', this.refreshByButtonResult)
    this.timer && this.timer.stop()
  }
  /**
@@ -202,7 +214,7 @@
   /**
   * @description 导出Excel时,获取页面搜索排序等参数
   */
  queryModuleParam = (menuId, btnId) => {
  queryModuleParam = (menuId, callback) => {
    const { mainSearch } = this.props
    const { arr_field, config } = this.state
@@ -218,7 +230,7 @@
      })
    }
    MKEmitter.emit('returnModuleParam', config.uuid, btnId, {
    callback({
      arr_field: arr_field,
      orderBy: config.setting.order || '',
      search: searches,
@@ -226,14 +238,19 @@
    })
  }
  async loadData () {
  async loadData (hastimer) {
    const { mainSearch } = this.props
    const { config, arr_field, BID, BData } = this.state
    if (config.setting.supModule && !BID) { // BID 不存在时,不做查询
      this.setState({
        data: [],
      })
      return
    }
    if (config.setting.interType === 'inner' && config.setting.innerFunc === 'z_mk_express') {
      this.getExpress()
      return
    }
@@ -252,14 +269,11 @@
      return
    }
    if (config.setting.interType === 'inner' && config.setting.innerFunc === 'z_mk_express') {
      this.getExpress()
      return
    if (!hastimer) {
      this.setState({
        loading: true
      })
    }
    this.setState({
      loading: true
    })
    let _orderBy = config.setting.order || ''
    let param = UtilsDM.getQueryDataParams(config.setting, arr_field, searches, _orderBy, 1, config.setting.pageSize, BID)
@@ -281,11 +295,19 @@
      this.setState({
        loading: false
      })
      notification.error({
        top: 92,
        message: result.message,
        duration: 10
      })
      this.timer && this.timer.stop()
      if (result.ErrCode === 'N') {
        Modal.error({
          title: result.message,
        })
      } else {
        notification.error({
          top: 92,
          message: result.message,
          duration: 10
        })
      }
    }
  }