linwenxin 1 rok pred
rodič
commit
54a0fa4806
2 zmenil súbory, kde vykonal 32 pridanie a 13 odobranie
  1. 30 11
      src/layout/components/TagsView/index.vue
  2. 2 2
      src/permission.js

+ 30 - 11
src/layout/components/TagsView/index.vue

@@ -1,16 +1,11 @@
 <template>
   <div id="tags-view-container" class="tags-view-container">
     <scroll-pane ref="scrollPane" class="tags-view-wrapper" @scroll="handleScroll">
-      <div
-        v-for="(tag, index) in visitedViews"
-        ref="tag"
-        :key="tag.path + index"
+      <div v-for="(tag, index) in visitedViews" ref="tag" :key="tag.path + index"
         :class="['tags-view-item', isActive(tag) ? 'active' : '']"
         :data="JSON.stringify({ path: tag.path, query: tag.query, fullPath: tag.fullPath })"
-        @click="djclick({ path: tag.path, query: tag.query, fullPath: tag.fullPath })"
-        @dblclick="sjclick(tag)"
-        @contextmenu.prevent="openMenu(tag, $event)"
-      >
+        @click="djclick({ path: tag.path, query: tag.query, fullPath: tag.fullPath })" @dblclick="sjclick(tag)"
+        @contextmenu.prevent="openMenu(tag, $event)">
         {{ tag.title }}
         <span v-if="!isAffix(tag)" class="el-icon-close" @click.prevent.stop="closeSelectedTag(tag)" />
       </div>
@@ -111,10 +106,24 @@ export default {
       }
     },
     addTags() {
-      const { name,params } = this.$route
-      const {pageType,pageCode,pagePam} =params
+      const { name, meta, params } = this.$route
+      const { pageName, pageType, pageCode, pagePam } = params
       if (name) {
-        this.$store.dispatch('tagsView/addView', {...this.$route, nameKey:`${name}_${pageType}_${pageCode}_${pagePam}_${Math.floor(Date.now() / 1000)}`})
+        this.$store.dispatch('tagsView/addView', {
+          ...this.$route,
+          meta: {
+            ...meta,
+            ...(() => {
+              if (pageName) {
+                return {
+                  title: `${meta.title}-${pageName}`
+                }
+              }
+              return {}
+            })(),
+          },
+          nameKey: `${name}_${pageType}_${pageCode}_${pagePam}_${Math.floor(Date.now() / 1000)}`,
+        })
       }
       return false
     },
@@ -213,6 +222,7 @@ export default {
   background: #fff;
   border-bottom: 1px solid #d8dce5;
   box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.12), 0 0 3px 0 rgba(0, 0, 0, 0.04);
+
   .tags-view-wrapper {
     .tags-view-item {
       user-select: none;
@@ -228,16 +238,20 @@ export default {
       font-size: 12px;
       margin-left: 5px;
       margin-top: 4px;
+
       &:first-of-type {
         margin-left: 15px;
       }
+
       &:last-of-type {
         margin-right: 15px;
       }
+
       &.active {
         background-color: #42b983;
         color: #fff;
         border-color: #42b983;
+
         &::before {
           content: '';
           background: #fff;
@@ -251,6 +265,7 @@ export default {
       }
     }
   }
+
   .contextmenu {
     margin: 0;
     background: #fff;
@@ -263,10 +278,12 @@ export default {
     font-weight: 400;
     color: #333;
     box-shadow: 2px 2px 3px 0 rgba(0, 0, 0, 0.3);
+
     li {
       margin: 0;
       padding: 7px 16px;
       cursor: pointer;
+
       &:hover {
         background: #eee;
       }
@@ -286,11 +303,13 @@ export default {
       text-align: center;
       transition: all 0.3s cubic-bezier(0.645, 0.045, 0.355, 1);
       transform-origin: 100% 50%;
+
       &:before {
         transform: scale(0.6);
         display: inline-block;
         vertical-align: -3px;
       }
+
       &:hover {
         background-color: #b4bccc;
         color: #fff;

+ 2 - 2
src/permission.js

@@ -159,7 +159,7 @@ function buildRoute(route, parentUrl = '', bool = true) {
       item.meta.roleItems = roleItems
 
       if (!pages.find(ite => ite.path === item.path)) {
-        item.path = `${item.path}${bool?'/:pageType?/:pageCode?/:pagePam?':''}`
+        item.path = `${item.path}${bool?'/:pageName?/:pageType?/:pageCode?/:pagePam?':''}`
         pages.push(item)
       }
 
@@ -181,7 +181,7 @@ function buildRoute(route, parentUrl = '', bool = true) {
         item.component = _import(`${fullUrl}/index`)
         item.component.name = item.name
         if (!pages.find(ite => ite.path === item.path)) {
-          item.path = `${item.path}${bool?'/:pageType?/:pageCode?/:pagePam?':''}`
+          item.path = `${item.path}${bool?'/:pageName?/:pageType?/:pageCode?/:pagePam?':''}`
           pages.push(item)
         }