king
2023-08-16 d8561eb770249f6fe00aeb3092555188ab6d076c
src/tabviews/custom/components/card/prop-card/index.jsx
@@ -66,7 +66,7 @@
        window.GLOB.SyncData.delete(_config.dataName)
      }
    } else if (_config.wrap.datatype === 'public' && window.GLOB.CacheData.get(_config.wrap.publicId)) {
    } else if (_config.wrap.datatype === 'public' && window.GLOB.CacheData.has(_config.wrap.publicId)) {
      _data = window.GLOB.CacheData.get(_config.wrap.publicId)
      _data = fromJS(_data).toJS()
      this.loaded = true
@@ -146,7 +146,7 @@
    if (config.timer && config.wrap.datatype === 'dynamic') {
      this.timer = new TimerTask()
      this.timer.init(config.uuid, config.timer, config.timerRepeats, () => {this.loadData(true)})
      this.timer.init(config.uuid, config.timer, config.timerRepeats, () => {this.loadData('timer')})
    }
    this.initExec()
@@ -180,26 +180,39 @@
        if (config.$time) {
          if (!this.loaded) {
            Api.getLCacheConfig(config.uuid, config.$time).then(res => {
              if (!res && config.setting.onload === 'true') {
              if (!res.valid && config.setting.onload === 'true') {
                setTimeout(() => {
                  this.loadData()
                  this.loadData('init')
                }, config.setting.delay || 0)
              }
              if (!res || this.loaded) return
              if (!res.data || this.loaded) return
  
              let _data = res[0] || {$$empty: true}
              let _data = res.data[0] || {$$empty: true}
              _data.$$uuid = _data[config.setting.primaryKey] || ''
      
              this.setState({data: _data})
            })
          } else {
            if (config.wrap.goback === 'true' && data.$$empty) {
              this.timer && this.timer.stop()
              MKEmitter.emit('closeTabView', config.$pageId)
            } else {
              if (selected !== 'false') {
                this.checkTopLine()
              } else {
                this.transferLine()
              }
              this.autoExec()
            }
          }
        } else {
          if (!this.loaded) {
            Api.getLCacheConfig(config.uuid, 0).then(res => {
              if (!res || this.loaded) return
              if (!res.data || this.loaded) return
      
              let _data = res[0] || {$$empty: true}
              let _data = res.data[0] || {$$empty: true}
              _data.$$uuid = _data[config.setting.primaryKey] || ''
      
              this.setState({data: _data})
@@ -208,7 +221,7 @@
  
          if (config.setting.onload === 'true') {
            setTimeout(() => {
              this.loadData()
              this.loadData('init')
            }, config.setting.delay || 0)
          } else if (this.loaded) {
            if (config.wrap.goback === 'true' && data.$$empty) {
@@ -260,18 +273,16 @@
      }
    } else {
      if (selected !== 'false') {
        setTimeout(() => {
          this.checkTopLine()
        }, 200)
        this.checkTopLine()
      }
      if (config.$cache && config.$time && config.wrap.autoExec) {
        Api.getLCacheConfig(config.uuid, config.$time).then(res => {
          if (!res) {
            this.autoExec()
          } else {
            Api.writeCacheConfig(config.uuid, [])
          }
          if (res.valid) return
          this.autoExec()
          Api.writeCacheConfig(config.uuid, [])
        })
      } else {
        this.autoExec()
@@ -418,7 +429,7 @@
    if ((position === 'mainline' || position === 'popclose') && config.setting.supModule && BID) { // 刷新源组件时,附带刷新上级行与当前组件
      MKEmitter.emit('reloadData', config.setting.supModule, BID)
    } else {
      this.loadData(false, btn)
      this.loadData('', btn)
    }
  }
@@ -476,7 +487,7 @@
    this.loadData()
  }
  async loadData (hastimer, btn) {
  async loadData (type, btn) {
    const { config, arr_field, BID, BData, selected } = this.state
    if (config.wrap.datatype === 'public') {
@@ -510,7 +521,7 @@
      return
    }
    if (!hastimer) {
    if (type !== 'timer') {
      this.setState({
        loading: true
      })
@@ -524,7 +535,7 @@
      let _data = {}
      this.loaded = true
      if (config.$cache && config.setting.onload !== 'false') {
      if (config.$cache && type === 'init') {
        Api.writeCacheConfig(config.uuid, result.data || [])
      }