123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106 |
- import store from '../store/store.js';
- const staticMuen = [
- {
- path: '/msg',
- component: () => import(/* webpackChunkName: "messages" */ '@views/messages'),
- meta: { title: '消息中心' }
- },
- {
- path: '/403',
- component: () => import(/* webpackChunkName: "404" */ '@views/403'),
- meta: { title: '403' }
- },
- {
- path: '/404',
- component: () => import(/* webpackChunkName: "404" */ '@views/404'),
- meta: { title: '404' }
- },
- {
- path: '/parkingLotAdministration/pageJump/partitionManagement',
- component: () => import(/* webpackChunkName: "404" */ '@views/parkingLotAdministration/pageJump/partitionManagement.vue'),
- meta: { title: '车库分区管理' }
- },
- {
- path: '/ownerManagement/details',
- component: () => import(/* webpackChunkName: "404" */ '@views/ownerManagement/details.vue'),
- meta: { title: '住户详情' }
- },
- {
- path: '/housingManagement/details',
- component: () => import(/* webpackChunkName: "404" */ '@views/assetManagement/housingManagement/details.vue'),
- meta: { title: '房屋详情' },
- name: 'housingManagementDetails'
- },
- {
- path: '/shopManagement/details',
- component: () => import(/* webpackChunkName: "404" */ '@views/assetManagement/shopManagement/details.vue'),
- meta: { title: '商铺详情' },
- name: 'shopManagementDetails'
- },
- {
- path: '/invoiceManagement/index',
- component: () => import(/* webpackChunkName: "404" */ '@views/payService/invoiceManagement/index.vue'),
- meta: { title: '发票管理' }
- },
- {
- path: '/expenseReport/index',
- component: () => import(/* webpackChunkName: "404" */ '@views/payService/expenseReport/index.vue'),
- meta: { title: '费用报表' },
- name: 'expenseReport'
- },
- {
- path: '/shannon-transfer',
- component: () => import(/* webpackChunkName: "404" */ '@views/patrolManagement/components/shannon-transfer.vue'),
- meta: { title: '测试' },
- name: 'shannon-transfer'
- },
- {
- path: '*',
- redirect: '/404'
- }
- ];
- //路由格式
- // 自定义路由文件
- const setListMunt = (arrList, item) => {
- let newOb = {};
- newOb = {
- path: `/${item.linkPath}`,
- component: () => import(`@/views/${item.linkPath}.vue`),
- meta: { title: item.name }
- };
- arrList.push(newOb);
- };
- const dimension = (arrList, arr) => {
- arr.forEach((item, index) => {
- //默认去掉第一个添加路由
- // if (item.linkPath !== 'workbench/index') {
- // if (!!item.children) {
- // dimension(arrList, item.children);
- // } else {
- // setListMunt(arrList, item);
- // }
- // }
- if (!!item.children) {
- dimension(arrList, item.children);
- } else {
- setListMunt(arrList, item);
- }
- });
- };
- //添加路由
- const AddRt = (router, dynamicMuenList) => {
- let NEWdynamicMuenList = [...dynamicMuenList, ...staticMuen];
- if (NEWdynamicMuenList.length !== 0) {
- NEWdynamicMuenList.forEach((item) => {
- router.options.routes[0].children.push(item);
- });
- router.addRoutes(router.options.routes);
- }
- };
- export const funcRouter = (arr, data, router) => {
- dimension(arr, data);
- store.commit('setMenuList', data);
- AddRt(router, arr);
- };
|