scorpio il y a 2 ans
Parent
commit
234521aa6b
2 fichiers modifiés avec 22 ajouts et 16 suppressions
  1. 11 15
      src/layout/left.vue
  2. 11 1
      src/views/home/component/dispatch.vue

+ 11 - 15
src/layout/left.vue

@@ -69,21 +69,13 @@ export default {
   },
   methods: {
     init() {
-      this.data.forEach((item, index) => {
-        if (item.children && item.children.length > 0) {
-          item.children.forEach((sub, subPoint) => {
-            if (this.currentPage.indexOf(sub.path) > -1) {
-              this.subActive = subPoint
-              this.active = index
-            }
-          })
-        } else {
-          const subIndex = this.currentPage.indexOf(item.path)
-          if (subIndex > -1) {
-            this.active = index
-          }
-        }
-      })
+      const item = localStorage.getItem('index')
+      if (item) {
+        console.log(JSON.parse(item))
+        const menu = JSON.parse(item)
+        this.active = menu.active
+        this.subActive = menu.subActive
+      }
     },
     menus() {
       this.$api.common.getMenus().then(res => {
@@ -106,11 +98,15 @@ export default {
         this.$router.push(item.path)
         localStorage.setItem('data-type', item.remark ? item.remark : 'project')
       }
+      const menu = { active: this.active, subActive: this.subActive }
+      localStorage.setItem('index', JSON.stringify(menu))
     },
     subClick(item, index) {
       this.subActive = index
       localStorage.setItem('data-type', item.remark ? item.remark : 'project')
       this.$router.push(item.path)
+      const menu = { active: this.active, subActive: this.subActive }
+      localStorage.setItem('index', JSON.stringify(menu))
     }
   }
 }

+ 11 - 1
src/views/home/component/dispatch.vue

@@ -140,6 +140,9 @@ export default {
       images: []
     }
   },
+  created() {
+    this.projectId = this.$route.query.id
+  },
   methods: {
     rowDel(row, index, done) {
       this.$confirm('确定将选择数据删除?', {
@@ -162,7 +165,14 @@ export default {
         .catch(() => {})
     },
     openFile(row) {
-      console.log(row)
+      const routeUrl = this.$router.resolve({
+        path: '/home/details',
+        query: {
+          id: this.projectId,
+          type: '0'
+        }
+      })
+      window.open(routeUrl.href, '_blank')
     }
   }
 }