king
2023-07-25 2a3cc4e6cecfc6dab8b60adf93f7fde898ddc939
src/tabviews/custom/components/tree/antd-tree/index.jsx
@@ -53,7 +53,10 @@
      BID = BData.$BID || ''
    }
    if (_config.setting.sync === 'true' && window.GLOB.SyncData.has(_config.dataName)) {
    if (_config.setting.sync === 'true') {
      _config.setting.onload = 'false'
      if (window.GLOB.SyncData.has(_config.dataName)) {
      _data = window.GLOB.SyncData.get(_config.dataName) || []
      if (_config.$cache) {
@@ -66,6 +69,7 @@
      window.GLOB.SyncData.delete(_config.dataName)
    }
    }
    _config.wrap.contentHeight = config.wrap.title || config.wrap.searchable === 'true' ? 'calc(100% - 45px)' : '100%'
@@ -74,15 +78,7 @@
      config: _config,
      data: _data,
      BID: BID || '',
      arr_field: _config.columns.map(col => col.field).join(','),
    }, () => {
      if (config.setting.sync !== 'true' && config.setting.onload === 'true') {
        setTimeout(() => {
          this.loadData()
        }, config.setting.delay || 0)
      } else if (config.setting.sync === 'true' && _data) {
        this.handleData()
      }
      arr_field: _config.columns.map(col => col.field).join(',')
    })
  }
@@ -113,15 +109,7 @@
      })
    }
    if (config.$cache && !this.loaded) {
      Api.getLCacheConfig(config.uuid).then(res => {
        if (!res || this.loaded) return
        this.setState({data: res}, () => {
          this.handleData()
        })
      })
    }
    this.initExec()
  }
  /**
@@ -141,6 +129,56 @@
    this.timer && this.timer.stop()
  }
  initExec = () => {
    const { config } = this.state
    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
            this.setState({data: res}, () => {
              this.handleData()
            })
          })
        } else {
          this.handleData()
        }
      } else {
        if (!this.loaded) {
          Api.getLCacheConfig(config.uuid, 0).then(res => {
            if (!res || this.loaded) return
            this.setState({data: res}, () => {
              this.handleData()
            })
          })
        }
        if (config.setting.onload === 'true') {
          setTimeout(() => {
            this.loadData()
          }, config.setting.delay || 0)
        } else if (this.loaded) {
          this.handleData()
        }
      }
    } else if (config.setting.onload === 'true') {
      setTimeout(() => {
        this.loadData()
      }, config.setting.delay || 0)
    } else if (this.loaded) {
      this.handleData()
    }
  }
  transferSyncData = (syncId) => {
    const { config } = this.state