Przeglądaj źródła

Merge branch 'master' of http://120.26.64.82:10880/BFFE/SMAirports

zhaoke 2 lat temu
rodzic
commit
64dab3e098
2 zmienionych plików z 22 dodań i 14 usunięć
  1. 13 3
      src/getMenu.js
  2. 9 11
      src/router/routes/routes-file-temp.js

+ 13 - 3
src/getMenu.js

@@ -42,6 +42,16 @@ router.beforeEach(async (to, from, next) => {
           const treeMenu = setTree(menusArray, 'up_auth_id', 'auth_id')
           const dataMenu = _.unionBy(treeMenu, 'auth_id')
           const menus = parseMenu(dataMenu)
+          staticRoutes.forEach(route => {
+            const routeIndex = menus.findIndex(permissionRoute => permissionRoute.name === route.name)
+            if (routeIndex > -1) {
+              menus[routeIndex] = {
+                ...menus[routeIndex],
+                component: route.component,
+                children: route.children
+              }
+            }
+          })
           store.dispatch("permission/setRoutes", menus)
           router.addRoutes(menus)
           next({ ...to, replace: true })
@@ -131,9 +141,9 @@ function parseMenu (arr) {
   const allMenus = newMenus.length
     ? newMenus.sort((a, b) => a.meta.show_index - b.meta.show_index)
     : []
-  allMenus.map(item => {
-    item.children = item.children ?? item.children.sort((a, b) => a.meta.show_index - b.meta.show_index)
-  })
+  // allMenus.map(item => {
+  //   item.children = item.children ?? item.children.sort((a, b) => a.meta.show_index - b.meta.show_index)
+  // })
   allMenus.push({
     path: '/:pathMatch(.*)',
     redirect: '/404',

+ 9 - 11
src/router/routes/routes-file-temp.js

@@ -2,6 +2,7 @@ import Layout from '@/layout'
 
 const uploadRoutes = {
   path: '/upload',
+  name: 'Upload',
   component: Layout,
   children: [
     {
@@ -20,7 +21,6 @@ const uploadRoutes = {
         {
           path: '/upload',
           name: 'UploadView',
-          meta: { title: '速运行李上传' },
           component: () => import('@/views/upload/index.vue'),
         },
       ],
@@ -30,15 +30,14 @@ const uploadRoutes = {
 
 const statisticsChartsRoutes = {
   path: '/statisticsCharts',
+  name: 'StatisticsCharts',
   component: Layout,
   meta: {
     title: '统计图表',
-    roles: ['statistical_chart'],
   },
   children: [
     {
       path: '/statisticsCharts',
-      name: 'StatisticsCharts',
       redirect: 'airlineCompany',
       component: () => import('@/views/statisticsCharts'),
       meta: {
@@ -457,6 +456,7 @@ const statisticsChartsRoutes = {
         {
           path: 'statisticalAnalysis',
           name: 'statisticalAnalysisContent',
+          meta: { title: '统计分析' },
           component: () => import('@/views/statisticalAnalysis/components'),
         },
       ],
@@ -466,9 +466,8 @@ const statisticsChartsRoutes = {
 
 const departureRoutes = {
   path: '/departure',
-  name: 'departure',
+  name: 'Departure',
   component: Layout,
-  meta: { roles: ['departure_menu'] },
   children: [
     {
       path: '/departure',
@@ -558,9 +557,8 @@ const departureRoutes = {
 
 const arrivalRoutes = {
   path: '/arrival',
-  name: 'arrival',
+  name: 'Arrival',
   component: Layout,
-  meta: { roles: ['inbound_management'] },
   children: [
     {
       path: '/arrival',
@@ -649,8 +647,8 @@ const arrivalRoutes = {
 
 const transferRoutes = {
   path: '/transfer',
+  name: 'Transfer',
   component: Layout,
-  meta: { roles: ['ti_showTransit'] },
   children: [
     {
       path: '/transfer',
@@ -815,8 +813,8 @@ const transferRoutes = {
 
 // 高级查询
 const advanceRoutes = {
-  path: '/',
-  redirect: '/advance',
+  path: '/advance',
+  name: 'Advance',
   component: Layout,
   children: [
     {
@@ -832,7 +830,7 @@ const advanceRoutes = {
           path: '/advance',
           name: 'AdvancedQuery',
           component: () => import('@/views/advancedQuery'),
-          meta: { title: '高级查询', isPage: 'advance_page', keepAlive: true },
+          meta: { keepAlive: true },
           children: [
             {
               path: '/advance',