import HomeView from '../views/HomeView.vue'
const menuArr = [
    {
        path: '/dashboard',
        name: 'dashboard',
        meta: {
            title: '巡检概览',
            icon: 'xjgl'
        },
        component: () => import('@/views/patrol/dashboard.vue'),
    },
    {
        path: '/worker',
        name: 'worker',
        meta: {
            title: '工作台',
            icon: 'gzt'
        },
        children: [
            {
                path: '/worker/myTodo',
                name: 'todo',
                meta: {
                    title: '我的待办',
                },
                component: () => import('@/views/patrol/worker/myTodo.vue'),
            },
            {
                path: '/worker/myStart',
                name: 'myStart',
                meta: {
                    title: '我发起的',
                },
                component: () => import('@/views/patrol/worker/myStart.vue'),
            },
            {
                path: '/worker/myHandle',
                name: 'myHandle',
                meta: {
                    title: '我处理的',
                },
                component: () => import('@/views/patrol/worker/myHandle.vue'),
            },

        ]
    },
    {
        path: '/order',
        name: 'order',
        meta: {
            title: '全部工单',
            icon: 'qbgd'
        },
        component: () => import('@/views/patrol/order.vue'),
    },
    {
        path: '/document',
        name: 'document',
        meta: {
            title: '文档库',
            icon: 'wdk'
        },
        component: () => import('@/views/patrol/document.vue'),
    },
]

const menuArr1 = [
    {
        path: '/home',
        name: 'home',
        meta: {
            title: 'home'
        },
        component: HomeView,
    },
]
const menuArr2 = [
    {
        name: 'orgChart',
        path: '/orgChart',
        meta: {
            title: '组织架构', 
                icon: 'zzjg'
           
        },
        children: [
            {
                path: '/orgChart/mebAndDep',
                name: 'mebAndDep',
                meta: {
                    title: '成员与部门',
                },
                component: () => import('@/views/configuration/orgChart/mebAndDep.vue'),
            },
            {
                path: '/orgChart/supplier',
                name: 'supplier',
                meta: {
                    title: '供应商管理',
                },
                component: () => import('@/views/configuration/orgChart/supplier.vue'),
            },
            {
                path: '/orgChart/role',
                name: 'role',
                meta: {
                    title: '角色管理',
                },
                component: () => import('@/views/configuration/orgChart/role.vue'),
            },

        ]

    },
    {
        name: 'assetSettings',
        path: '/assetSettings',
        meta: {
            title: '资产设置',
            icon: 'zcsz'
        },
        children: [
            {
                path: '/assetSettings/assetAndCategory',
                name: 'assetAndCategory',
                meta: {
                    title: '资产与分类',
                },
                component: () => import('@/views/configuration/assetSettings/assetAndCategory.vue'),
            },
            {
                path: '/assetSettings/locationManagement',
                name: 'locationManagement',
                meta: {
                    title: '位置管理',
                },
                component: () => import('@/views/configuration/assetSettings/locationManagement.vue'),
            },
        ]

    },
    {
        name: 'inspectionSettings',
        path: '/inspectionSettings',
        meta: {
            title: '巡检设置',icon: 'xjsz'
        },
        children: [
            {
                path: '/inspectionSettings/insServiceManagement',
                name: 'insServiceManagement',
                meta: {
                    title: '巡检服务管理',
                },
                component: () => import('@/views/configuration/inspectionSettings/insServiceManagement.vue'),
            },
            {
                path: '/inspectionSettings/insItemManagement',
                name: 'insItemManagement',
                meta: {
                    title: '巡检项管理',
                },
                component: () => import('@/views/configuration/inspectionSettings/insItemManagement.vue'),
            },
        ]

    },
    {
    name:'companySettings',
    path: '/companySettings',
    meta: {
        title: '企业设置',
        icon: 'qhqy'
    },
    component: () => import('@/views/configuration/companySettings.vue'),
    }

]

export function dynamicRoutes(str) {
  console.log('dynamicRoutes--------');
    if (str == 'first') {
        localStorage.setItem('menuArr', JSON.stringify(menuArr))
        return menuArr
    } else if (str == 'second') {
        localStorage.setItem('menuArr', JSON.stringify(menuArr1))

        return menuArr1
    } else if(str=='third'){
        localStorage.setItem('menuArr', JSON.stringify(menuArr2))

        return menuArr2 }
}
export function newMenuArr(){
    return localStorage.getItem('menuArr')
}
