king
2023-04-27 6dd965723be9dc245105296198c25a80cfe51b54
src/tabviews/custom/index.jsx
@@ -70,8 +70,11 @@
    data: null,           // 列表数据集
    loading: false,       // 列表数据加载中
    visible: false,       // 标签页控制
    shortcuts: null       // 快捷键
    shortcuts: null,      // 快捷键
    loadinginter: false
  }
  stepInter = null
  /**
   * @description 获取页面配置信息
@@ -93,6 +96,7 @@
        config = window.decodeURIComponent(window.atob(result.LongParam))
        config = config.replace(/@mywebsite@\//ig, window.GLOB.baseurl)
        config = JSON.parse(config)
        config.MenuID = MenuID
      } catch (e) {
        console.warn('Parse Failure')
        config = ''
@@ -200,7 +204,9 @@
      config.$cache = config.cacheLocal === 'true'
      config.interfaces = this.formatInterSetting(config.interfaces, regs)
      let initInters = []
      config.interfaces = this.formatInterSetting(config.interfaces, regs, MenuID, initInters)
      config.components = this.filterComponent(config.components, roleId, window.GLOB.mkActions, balMap, skip, param, MenuID, config.interfaces, popview, config.$cache)
      
      // 获取主搜索条件
@@ -236,8 +242,17 @@
        config.components = this.filterBalcony(config.components, balMap)
      }
      if (initInters.length > 0) {
        this.stepInter = {
          MenuID: MenuID,
          inters: initInters,
          params: params
        }
      }
      this.setState({
        BID: BID,
        loadinginter: this.stepInter !== null,
        shortcuts: shortcuts.length > 0 ? shortcuts : null,
        config,
        mainSearch
@@ -251,7 +266,10 @@
          ele.innerHTML = config.normalcss
          document.getElementsByTagName('head')[0].appendChild(ele)
        }
        if (params.length === 0) {
        if (this.stepInter) {
        } else if (params.length === 0) {
          setTimeout(() => { // 延时加载状态
            this.setState({
              loadingview: false
@@ -943,13 +961,24 @@
  }
  // 格式化默认设置
  formatInterSetting = (inters, regs) => {
  formatInterSetting = (inters, regs, MenuID, initInters) => {
    if (!inters) return []
    let interfaces = inters.filter(m => m.status === 'true')
    let initlimit = false
    let interfaces = inters.filter(m => {
      if (m.status !== 'true') return false
      if (m.setting.loadlevel === 'init') {
        initlimit = true
        initInters.push(m.uuid)
      }
      return true
    })
    let delay = 15
    return interfaces.map(inter => {
      inter.MenuID = MenuID
      inter.setting.delay = delay
      delay += 15
@@ -960,6 +989,10 @@
        } else {
          inter.setting.supModule = ''
        }
      }
      if (initlimit && inter.setting.loadlevel !== 'init') {
        inter.setting.onload = 'false'
      }
      if (inter.setting.interType !== 'system') return inter
@@ -1076,6 +1109,7 @@
  }
  componentDidMount () {
    MKEmitter.addListener('interFinish', this.interFinish)
    MKEmitter.addListener('debugChange', this.debugChange)
    MKEmitter.addListener('reloadMenuView', this.reloadMenuView)
    MKEmitter.addListener('resetActiveMenu', this.resetActiveMenu)
@@ -1088,6 +1122,7 @@
    this.setState = () => {
      return
    }
    MKEmitter.removeListener('interFinish', this.interFinish)
    MKEmitter.removeListener('debugChange', this.debugChange)
    MKEmitter.removeListener('reloadMenuView', this.reloadMenuView)
    MKEmitter.removeListener('resetActiveMenu', this.resetActiveMenu)
@@ -1098,6 +1133,30 @@
      this.state.config.interfaces.forEach(m => {
        window.GLOB.CacheData.delete(m.uuid)
      })
    }
  }
  interFinish = (MenuID, interId) => {
    if (!this.stepInter || this.stepInter.MenuID !== MenuID) return
    this.stepInter.inters = this.stepInter.inters.filter(item => item !== interId)
    if (this.stepInter.inters.length === 0) {
      this.setState({loadinginter: false})
      if (this.stepInter.params.length === 0) {
        setTimeout(() => { // 延时加载状态
          this.setState({
            loadingview: false
          })
        }, 1000)
      } else {
        this.loadmaindata(this.stepInter.params)
      }
      MKEmitter.emit('initFinish', this.stepInter.MenuID)
      this.stepInter = null
    }
  }
@@ -1129,6 +1188,8 @@
      })
    }
    this.stepInter = null
    this.setState({
      BID: '',              // 页面跳转时携带ID
      loadingview: true,    // 页面加载中
@@ -1149,9 +1210,9 @@
  }
  getComponents = () => {
    const { config, BID, data, mainSearch } = this.state
    const { config, BID, data, mainSearch, loadinginter } = this.state
    if (!config || !config.components) return
    if (!config || !config.components || loadinginter) return
    return config.components.map(item => {
      let style = null