king
2023-07-25 54700ad91869ba468190e1462f2aeef3a9d9a5b7
src/tabviews/custom/components/carousel/prop-card/index.jsx
@@ -49,6 +49,8 @@
    }
    
    if (_config.wrap.datatype === 'dynamic') {
      _config.setting.onload = _config.setting.sync === 'true' ? 'false' : 'true'
      if (_config.setting.sync === 'true' && window.GLOB.SyncData.has(_config.dataName)) {
        _data = window.GLOB.SyncData.get(_config.dataName) || []
@@ -64,8 +66,6 @@
        window.GLOB.SyncData.delete(_config.dataName)
      }
    } else if (_config.wrap.datatype === 'static') {
      this.loaded = true
    }
    _data.$$uuid = _data[_config.setting.primaryKey] || ''
@@ -91,15 +91,7 @@
      BID: BID || '',
      BData: BData || '',
      config: _config,
      arr_field: _config.columns.map(col => col.field).join(','),
    }, () => {
      if (_config.wrap.datatype === 'dynamic' && config.setting.sync !== 'true' && _config.setting.onload === 'true') {
        setTimeout(() => {
          this.loadData()
        }, _config.setting.delay || 0)
      } else if (_config.wrap.display === 'modal' && _config.wrap.datatype === 'static') {
        this.openModal()
      }
      arr_field: _config.columns.map(col => col.field).join(',')
    })
  }
@@ -126,16 +118,7 @@
      })
    }
    if (config.$cache && !this.loaded) {
      Api.getLCacheConfig(config.uuid).then(res => {
        if (!res || this.loaded) return
        let _data = res[0] || {$$empty: true}
        _data.$$uuid = _data[config.setting.primaryKey] || ''
        this.setState({data: _data})
      })
    }
    this.initExec()
  }
  shouldComponentUpdate (nextProps, nextState) {
@@ -156,6 +139,60 @@
    this.timer && this.timer.stop()
  }
  initExec = () => {
    const { config } = this.state
    if (config.wrap.datatype === 'dynamic') {
      if (config.$cache) {
        if (config.$time) {
          if (!this.loaded) {
            Api.getLCacheConfig(config.uuid, config.$time).then(res => {
              if (!res && config.setting.onload === 'true') {
                setTimeout(() => {
                  this.loadData()
                }, config.setting.delay || 0)
              }
              if (!res || this.loaded) return
              let _data = res[0] || {$$empty: true}
              _data.$$uuid = _data[config.setting.primaryKey] || ''
              this.setState({data: _data})
            })
          }
        } else {
          if (!this.loaded) {
            Api.getLCacheConfig(config.uuid, 0).then(res => {
              if (!res || this.loaded) return
              let _data = res[0] || {$$empty: true}
              _data.$$uuid = _data[config.setting.primaryKey] || ''
              this.setState({data: _data})
            })
          }
          if (config.setting.onload === 'true') {
            setTimeout(() => {
              this.loadData()
            }, config.setting.delay || 0)
          } else if (this.loaded) {
            this.openModal()
          }
        }
      } else if (config.setting.onload === 'true') {
        setTimeout(() => {
          this.loadData()
        }, config.setting.delay || 0)
      } else if (this.loaded) {
        this.openModal()
      }
    } else if (config.wrap.display === 'modal' && config.wrap.datatype === 'static') {
      this.openModal()
    }
  }
  transferSyncData = (syncId) => {
    const { config } = this.state