zhuzhuanzhuan
2024-03-20 7036cc397adccb4907b80a30143f7751b4e68db8
src/components/layouts/TabLayout.vue
@@ -4,8 +4,8 @@
    <contextmenu :itemList="menuItemList" :visible.sync="menuVisible" style="z-index: 9999;" @select="onMenuSelect"/>
    <!-- update-end- author:sunjianlei --- date:20191009 --- for: 提升右键菜单的层级 -->
    <a-tabs
      v-if="$route.meta.title!=='首页'&&multipage"
      @contextmenu.native="e => onContextmenu(e)"
      v-if="multipage"
      :active-key="activePage"
      class="tab-layout-tabs"
      style="height:52px"
@@ -14,11 +14,12 @@
      @change="changePage"
      @tabClick="tabCallBack"
      @edit="editPage">
      <a-tab-pane :id="page.fullPath" :key="page.fullPath" v-for="page in pageList" :closable="!(page.meta.title=='首页')">
      <a-tab-pane :id="page.fullPath" :key="page.fullPath" v-for="page in pageList"
                  :closable="!(page.meta.title=='首页')">
        <span slot="tab" :pagekey="page.fullPath">{{ page.meta.title }}</span>
      </a-tab-pane>
    </a-tabs>
    <div style="margin: 12px 12px 0;">
    <div>
      <!-- update-begin-author:taoyan date:20201221 for:此处删掉transition标签 不知道为什么加上后 页面路由切换的时候即1及菜单切到2及菜单的时候 两个菜单页面会同时出现300-500秒左右 -->
      <keep-alive v-if="multipage">
        <router-view v-if="reloadFlag"/>
@@ -143,7 +144,7 @@
        if (this.multipage && this.linkList.indexOf(indexKey) === -1) {
          this.addIndexToFirst()
        }
      },
      }
      // update-end-author:sunjianlei date:20191223 for: 修复从单页模式切换回多页模式后首页不居第一位的 BUG
    },
    methods: {
@@ -165,7 +166,7 @@
      // update-begin-author:sunjianlei date:20200120 for: 动态更改页面标题
      changeTitle(title) {
        let projectTitle = "MDC智慧车间"
        let projectTitle = 'MDC智慧车间'
        // 首页特殊处理
        if (this.$route.path === indexKey) {
          document.title = projectTitle
@@ -200,7 +201,7 @@
          this.$message.warning('这是最后一页,不能再关闭了啦')
          return
        }
        console.log("this.pageList ",this.pageList );
        console.log('this.pageList ', this.pageList)
        let removeRoute = this.pageList.filter(item => item.fullPath == key)
        this.pageList = this.pageList.filter(item => item.fullPath !== key)
        let index = this.linkList.indexOf(key)
@@ -213,8 +214,8 @@
        let cacheRouterArray = Vue.ls.get(CACHE_INCLUDED_ROUTES) || []
        if (removeRoute && removeRoute[0]) {
          let componentName = removeRoute[0].meta.componentName
          console.log("key: ", key);
          console.log("componentName: ", componentName);
          console.log('key: ', key)
          console.log('componentName: ', componentName)
          if(cacheRouterArray.includes(componentName)){
            cacheRouterArray.splice(cacheRouterArray.findIndex(item => item === componentName), 1)
            Vue.ls.set(CACHE_INCLUDED_ROUTES, cacheRouterArray)
@@ -270,7 +271,7 @@
      },
      /* update_begin author:wuxianquan date:20190828 for: 关闭当前tab页,供子页面调用->望菜单能配置外链,直接弹出新页面而不是嵌入iframe #428 */
      closeCurrent(){
        this.remove(this.activePage);
        this.remove(this.activePage)
      },
      /* update_end author:wuxianquan date:20190828 for: 关闭当前tab页,供子页面调用->望菜单能配置外链,直接弹出新页面而不是嵌入iframe #428 */
      closeOthers(pageKey) {
@@ -328,7 +329,7 @@
      //update-begin-author:taoyan date:20191008 for:路由刷新
      routeReload(){
        this.reloadFlag = false
        let ToggleMultipage = "ToggleMultipage"
        let ToggleMultipage = 'ToggleMultipage'
        this.$store.dispatch(ToggleMultipage,false)
        this.$nextTick(()=>{
          this.$store.dispatch(ToggleMultipage,true)
@@ -339,7 +340,7 @@
      //新增一个返回方法
      excuteCallback(callback){
        callback()
      },
      }
    }
  }
</script>