king
2023-08-24 0c1a33a33b45fc3265cb7fef20beb48407cd6c98
src/tabviews/custom/components/card/prop-card/index.jsx
@@ -47,7 +47,7 @@
    if (BData) {
      BID = BData.$BID || ''
    }
    if (_config.wrap.datatype === 'dynamic') {
      _config.setting.onload = _config.setting.sync === 'true' ? 'false' : 'true'
@@ -55,7 +55,7 @@
        _data = window.GLOB.SyncData.get(_config.dataName) || []
        if (_config.$cache) {
          Api.writeCacheConfig(_config.uuid, fromJS(_data).toJS())
          Api.writeCacheConfig(_config.uuid, fromJS(_data).toJS(), BID)
        }
        _config.setting.sync = 'false'
@@ -118,8 +118,7 @@
      data: _data,
      BID: BID || '',
      BData: BData || '',
      config: _config,
      arr_field: _config.columns.map(col => col.field).join(',')
      config: _config
    })
  }
@@ -173,13 +172,13 @@
  }
  initExec = () => {
    const { config, selected, data } = this.state
    const { config, selected, data, BID } = this.state
    if (config.wrap.datatype === 'dynamic') {
      if (config.$cache) {
        if (config.$time) {
          if (!this.loaded) {
            Api.getLCacheConfig(config.uuid, config.$time).then(res => {
            Api.getLCacheConfig(config.uuid, config.$time, BID).then(res => {
              if (!res.valid && config.setting.onload === 'true') {
                setTimeout(() => {
                  this.loadData('init')
@@ -191,7 +190,11 @@
              let _data = res.data[0] || {$$empty: true}
              _data.$$uuid = _data[config.setting.primaryKey] || ''
      
              this.setState({data: _data})
              this.setState({data: _data}, () => {
                if (selected !== 'false') {
                  this.checkTopLine()
                }
              })
            })
          } else {
            if (config.wrap.goback === 'true' && data.$$empty) {
@@ -209,7 +212,7 @@
          }
        } else {
          if (!this.loaded) {
            Api.getLCacheConfig(config.uuid, 0).then(res => {
            Api.getLCacheConfig(config.uuid, 0, BID).then(res => {
              if (!res.data || this.loaded) return
      
              let _data = res.data[0] || {$$empty: true}
@@ -277,12 +280,12 @@
      }
      if (config.$cache && config.$time && config.wrap.autoExec) {
        Api.getLCacheConfig(config.uuid, config.$time).then(res => {
          if (!res.valid) {
            this.autoExec()
          } else {
            Api.writeCacheConfig(config.uuid, [])
          }
        Api.getLCacheConfig(config.uuid, config.$time, BID).then(res => {
          if (res.valid) return
          this.autoExec()
          Api.writeCacheConfig(config.uuid, [], BID)
        })
      } else {
        this.autoExec()
@@ -300,7 +303,7 @@
    let _data = window.GLOB.SyncData.get(config.dataName) || []
    if (config.$cache) {
      Api.writeCacheConfig(config.uuid, fromJS(_data).toJS())
      Api.writeCacheConfig(config.uuid, fromJS(_data).toJS(), BID)
    }
    _data = _data[0] || {$$empty: true}
@@ -472,10 +475,8 @@
    }
    callback({
      arr_field: '',
      orderBy: '',
      search: searches,
      menuName: config.name
      search: searches
    })
  }
@@ -488,7 +489,7 @@
  }
  async loadData (type, btn) {
    const { config, arr_field, BID, BData, selected } = this.state
    const { config, BID, BData, selected } = this.state
    if (config.wrap.datatype === 'public') {
      MKEmitter.emit('reloadData', config.wrap.publicId)
@@ -528,7 +529,7 @@
    }
    let _orderBy = config.setting.order || ''
    let param = UtilsDM.getQueryDataParams(config.setting, arr_field, searches, _orderBy, 1, 1, BID)
    let param = UtilsDM.getQueryDataParams(config.setting, searches, _orderBy, 1, 1, BID)
    let result = await Api.genericInterface(param)
    if (result.status) {
@@ -536,7 +537,7 @@
      this.loaded = true
      if (config.$cache && type === 'init') {
        Api.writeCacheConfig(config.uuid, result.data || [])
        Api.writeCacheConfig(config.uuid, result.data || [], BID)
      }
      if (!result.data || !result.data[0]) {