liukangdong
2025-03-11 6cfd5d9a0c8f7bacbe2d3d1b1d84511207789ca6
admin/src/components/common/Menu.vue
@@ -50,9 +50,16 @@
    // 默认展开的菜单index
    defaultOpeneds() {
      // return this.menuData.list.map(menu => menu.index)
      return [this.menuData.list[0].index]
    }
  },
  watch: {
   /* $route (to, from) {
      var that =this
      this.$nextTick(() => {
        setTimeout(function(){ that.computeTableHeight()},1000)
      })
    }*/
  },
  methods: {
    // 处理菜单选中
@@ -73,10 +80,12 @@
        return
      }
      if (menuConfig.params != null && menuConfig.params != '') {
        this.$router.push({ path: menuConfig.url, query: { index: menuConfig.index, param: menuConfig.params } })
        // this.$router.push({ path: menuConfig.url, query: { index: menuConfig.index, param: menuConfig.params } })
      } else {
        this.$router.push(menuConfig.url)
        // this.$router.push(menuConfig.url)
      }
      this.$router.push({ path: menuConfig.url, query: { index: menuConfig.index, param: menuConfig.params, time: (Math.random().toString()) } })
      this.$store.commit('pushtags', menuConfig)
    },
    // 获取菜单配置
@@ -93,6 +102,49 @@
        }
      }
      return null
    },
    computeTableHeight () {
      this.$nextTick(() => {
        const height = window.innerHeight
        console.log('main_app========================:'+height)
        const height13 = this.getEleHeghtByClassName('common-header',0)
        const height5 = document.getElementsByTagName('thead') && document.getElementsByTagName('thead')[0] ? document.getElementsByTagName('thead')[0].clientHeight : 0
        if (document.getElementsByClassName('main_app') && document.getElementsByClassName('main_app')[0]) {
          console.log('main_app========================')
          // alert(height)
          const height3 = this.getEleHeghtByClassName('main-header',0)
          const height4 = this.getEleHeghtByClassName('table-pagination',0)
          const height2 = this.getEleHeghtByClassName('toolbar',0)
          const height6 = this.getEleHeghtByClassName('doumee-filter',0,16)
          const height7 = this.getEleHeghtByClassName('pt16',0,0)
          const height9 = this.getEleHeghtByClassName('static_wrap',0)
          const height10 = this.getEleHeghtByClassName('query_btns',0)
          const height11 = this.getEleHeghtByClassName('el-tabs-ele',0)
          const height12 = this.getEleHeghtByClassName('platgroup_tabs',0)
          this.$router.app.$store.commit('setTableHeightNew', height - height13- height3 - height5 - height6 - height2 - height7 - height4 - height9 - height10 - height11 - height12)
          console.log('gableHeightNew', this.$router.app.$store.state.tableHeightNew)
        } else {
          console.log('tableLayout========================')
          const height1 = this.getEleHeghtByClassName('table-search-form', 40,16)
          const height3 = this.getEleHeghtByClassName('main-header', 0)
          const height4 = this.getEleHeghtByClassName('table-pagination', 0)
          const height2 = this.getEleHeghtByClassName('toolbar', 0)
          console.log('defualtlength', document.getElementsByClassName('table-search-form').length)
          this.$router.app.$store.commit('setTableHeightNew', height - height4 - height3 - height2 - height1 - height5 - height13)
          console.log('gableHeightNew', this.$router.app.$store.state.tableHeightNew)
        }
      })
    },
    getEleHeghtByClassName (name, dv,margin) {
      if ((document.getElementsByClassName(name) && document.getElementsByClassName(name)[0])) {
        let t = 0
        document.getElementsByClassName(name).forEach(e => {
          console.log(name+'========================' + t + ':' + e.clientHeight)
          t++
        })
        return document.getElementsByClassName(name)[document.getElementsByClassName(name).length - 1].clientHeight+(margin||0)
      }
      return dv || 0
    }
  }
}