king
2023-03-11 34e7681fd12b1c4e4994d3bea1a553870e10bc50
src/tabviews/custom/components/interfaces/interItem/index.jsx
@@ -17,20 +17,34 @@
  loading = false
  
  state = {}
  state = {
    BID: ''
  }
  componentDidMount () {
    const { config } = this.props
    const { config, BID } = this.props
    if (config.setting.timer) {
      this.timer = new TimerTask()
      this.timer.init(config.uuid, config.setting.timer, config.setting.timerRepeats, () => {this.loadData()})
    }
    if (!config.setting.supModule) {
      this.setState({ BID: BID || '' })
    } else {
      let BData = window.GLOB.CacheData.get(config.setting.supModule)
      if (BData) {
        this.setState({ BID: BData.$BID || '' })
      }
    }
    setTimeout(() => {
      this.loadData()
    }, config.setting.delay)
    MKEmitter.addListener('reloadData', this.reloadData)
    MKEmitter.addListener('resetSelectLine', this.resetParentParam)
  }
  shouldComponentUpdate (nextProps, nextState) { return false }
@@ -44,6 +58,18 @@
    }
    this.timer && this.timer.stop()
    MKEmitter.removeListener('reloadData', this.reloadData)
    MKEmitter.removeListener('resetSelectLine', this.resetParentParam)
  }
  resetParentParam = (MenuID, id) => {
    const { config } = this.props
    if (!config.setting.supModule || config.setting.supModule !== MenuID) return
    if (id !== this.state.BID || id !== '') {
      this.setState({ BID: id }, () => {
        this.loadData()
      })
    }
  }
  reloadData = (publicId) => {
@@ -53,7 +79,15 @@
  }
  async loadData () {
    const { config, BID } = this.props
    const { config } = this.props
    const { BID } = this.state
    if (config.setting.supModule && !BID) {
      MKEmitter.emit('mkPublicData', config.uuid, { $$empty: true, $$uuid: '' })
      MKEmitter.emit('resetSelectLine', config.uuid, '', { $$empty: true, $$uuid: '' })
      this.loading = false
      return
    }
    if (this.loading) return