Browse Source

tags 不重复打开

Shannon_mu 3 years ago
parent
commit
746b3d534c

+ 11 - 29
energyManagement/src/components/common/Tags.vue

@@ -78,13 +78,8 @@ export default {
         // 设置标签
         // 设置标签
         setTags(route) {
         setTags(route) {
             const isExist = this.tagsList.some((item) => {
             const isExist = this.tagsList.some((item) => {
-                if (route.path.indexOf('viewDetail') > -1 || route.path.indexOf('installplanView') > -1) {
-                    let itemfullpath = this.setFullPath(item.path);
-                    return itemfullpath === route.fullPath;
-                }
-                return item.path === route.fullPath;
+                return item.path.indexOf(route.path) > -1;
             });
             });
-            // debugger
             if (!isExist) {
             if (!isExist) {
                 if (route.path === '/') {
                 if (route.path === '/') {
                     return;
                     return;
@@ -92,32 +87,19 @@ export default {
                 if (this.tagsList.length >= 8) {
                 if (this.tagsList.length >= 8) {
                     this.tagsList.shift();
                     this.tagsList.shift();
                 }
                 }
-                if (route.path.indexOf('viewDetail') > -1) {
-                    this.tagsList.push({
-                        title: route.query.deviceNo || route.meta.title,
-                        path: { path: route.path, query: { deviceId: route.query.deviceId || '', deviceNo: route.query.deviceNo || '' } }
-                    });
-                } else if (route.path.indexOf('installplanView') > -1) {
-                    this.tagsList.push({
-                        title: route.query.planName,
-                        path: { path: route.path, query: { planName: route.query.planName || '', planId: route.query.planId || '' } }
-                    });
-                } else {
-                    
-                    let tagArr = {
+                let tagArr = {
+                    title: route.title || route.meta.title,
+                    path: route.fullPath
+                };
+                if (!!route.name) {
+                    tagArr = {
                         title: route.title || route.meta.title,
                         title: route.title || route.meta.title,
-                        path: route.fullPath
+                        path: route.fullPath,
+                        name: route.name
                     };
                     };
-                    if (!!route.name) {
-                        tagArr = {
-                            title: route.title || route.meta.title,
-                            path: route.fullPath,
-                            name: route.name
-                        };
-                    }
-
-                    this.tagsList.push(tagArr);
                 }
                 }
+
+                this.tagsList.push(tagArr);
                 this.$store.dispatch('tags', this.tagsList);
                 this.$store.dispatch('tags', this.tagsList);
             }
             }
         }
         }

+ 11 - 29
operationSupport/src/components/common/Tags.vue

@@ -78,13 +78,8 @@ export default {
         // 设置标签
         // 设置标签
         setTags(route) {
         setTags(route) {
             const isExist = this.tagsList.some((item) => {
             const isExist = this.tagsList.some((item) => {
-                if (route.path.indexOf('viewDetail') > -1 || route.path.indexOf('installplanView') > -1) {
-                    let itemfullpath = this.setFullPath(item.path);
-                    return itemfullpath === route.fullPath;
-                }
-                return item.path === route.fullPath;
+                return item.path.indexOf(route.path) > -1;
             });
             });
-            // debugger
             if (!isExist) {
             if (!isExist) {
                 if (route.path === '/') {
                 if (route.path === '/') {
                     return;
                     return;
@@ -92,32 +87,19 @@ export default {
                 if (this.tagsList.length >= 8) {
                 if (this.tagsList.length >= 8) {
                     this.tagsList.shift();
                     this.tagsList.shift();
                 }
                 }
-                if (route.path.indexOf('viewDetail') > -1) {
-                    this.tagsList.push({
-                        title: route.query.deviceNo || route.meta.title,
-                        path: { path: route.path, query: { deviceId: route.query.deviceId || '', deviceNo: route.query.deviceNo || '' } }
-                    });
-                } else if (route.path.indexOf('installplanView') > -1) {
-                    this.tagsList.push({
-                        title: route.query.planName,
-                        path: { path: route.path, query: { planName: route.query.planName || '', planId: route.query.planId || '' } }
-                    });
-                } else {
-                    
-                    let tagArr = {
+                let tagArr = {
+                    title: route.title || route.meta.title,
+                    path: route.fullPath
+                };
+                if (!!route.name) {
+                    tagArr = {
                         title: route.title || route.meta.title,
                         title: route.title || route.meta.title,
-                        path: route.fullPath
+                        path: route.fullPath,
+                        name: route.name
                     };
                     };
-                    if (!!route.name) {
-                        tagArr = {
-                            title: route.title || route.meta.title,
-                            path: route.fullPath,
-                            name: route.name
-                        };
-                    }
-
-                    this.tagsList.push(tagArr);
                 }
                 }
+
+                this.tagsList.push(tagArr);
                 this.$store.dispatch('tags', this.tagsList);
                 this.$store.dispatch('tags', this.tagsList);
             }
             }
         }
         }

+ 11 - 29
userCenter/src/components/common/Tags.vue

@@ -78,13 +78,8 @@ export default {
         // 设置标签
         // 设置标签
         setTags(route) {
         setTags(route) {
             const isExist = this.tagsList.some((item) => {
             const isExist = this.tagsList.some((item) => {
-                if (route.path.indexOf('viewDetail') > -1 || route.path.indexOf('installplanView') > -1) {
-                    let itemfullpath = this.setFullPath(item.path);
-                    return itemfullpath === route.fullPath;
-                }
-                return item.path === route.fullPath;
+                return item.path.indexOf(route.path) > -1;
             });
             });
-            // debugger
             if (!isExist) {
             if (!isExist) {
                 if (route.path === '/') {
                 if (route.path === '/') {
                     return;
                     return;
@@ -92,32 +87,19 @@ export default {
                 if (this.tagsList.length >= 8) {
                 if (this.tagsList.length >= 8) {
                     this.tagsList.shift();
                     this.tagsList.shift();
                 }
                 }
-                if (route.path.indexOf('viewDetail') > -1) {
-                    this.tagsList.push({
-                        title: route.query.deviceNo || route.meta.title,
-                        path: { path: route.path, query: { deviceId: route.query.deviceId || '', deviceNo: route.query.deviceNo || '' } }
-                    });
-                } else if (route.path.indexOf('installplanView') > -1) {
-                    this.tagsList.push({
-                        title: route.query.planName,
-                        path: { path: route.path, query: { planName: route.query.planName || '', planId: route.query.planId || '' } }
-                    });
-                } else {
-                    
-                    let tagArr = {
+                let tagArr = {
+                    title: route.title || route.meta.title,
+                    path: route.fullPath
+                };
+                if (!!route.name) {
+                    tagArr = {
                         title: route.title || route.meta.title,
                         title: route.title || route.meta.title,
-                        path: route.fullPath
+                        path: route.fullPath,
+                        name: route.name
                     };
                     };
-                    if (!!route.name) {
-                        tagArr = {
-                            title: route.title || route.meta.title,
-                            path: route.fullPath,
-                            name: route.name
-                        };
-                    }
-
-                    this.tagsList.push(tagArr);
                 }
                 }
+
+                this.tagsList.push(tagArr);
                 this.$store.dispatch('tags', this.tagsList);
                 this.$store.dispatch('tags', this.tagsList);
             }
             }
         }
         }