import Vue from 'vue';
import Router from 'vue-router';
import { AuthGuard } from '@/utils';
import qs from 'qs';
import { globalRoutes, indexRoutes} from '@/router'
import { AppService } from '@/studio-core/service/app-service/AppService';

Vue.use(Router);

const appService = new AppService();

const router = new Router({
    routes: [
        {
            path: '/pim/:pim?',
            beforeEnter: async (to: any, from: any, next: any) => {
                const routerParamsName = 'pim';
                const params: any = {};
                if (to.params && to.params[routerParamsName]) {
                    params[routerParamsName] = to.params[routerParamsName];
                }
                const url: string = '/appdata';
                await AuthGuard.getInstance().authGuard(url, params, router);
                appService.navHistory.indexMeta = {
                    caption: 'app.views.pim.title',
                    info:'',
                    viewType: 'APPINDEX',
                    parameters: [
                        { pathName: 'pim', parameterName: 'pim' },
                    ],
                    requireAuth: true,
                };
                next();
            },
            meta: {  
                caption: 'app.views.pim.title',
                info:'',
                viewType: 'APPINDEX',
                parameters: [
                    { pathName: 'pim', parameterName: 'pim' },
                ],
                requireAuth: true,
            },
            component: () => import('@pages/ungroup/pim/pim.vue'),
            children: [
                {
                    path: 'hroperationunits/:hroperationunit?/editview/:editview?',
                    meta: {
                        caption: 'entities.hroperationunit.views.editview.title',
                        info:'',
                        parameters: [
                            { pathName: 'pim', parameterName: 'pim' },
                            { pathName: 'hroperationunits', parameterName: 'hroperationunit' },
                            { pathName: 'editview', parameterName: 'editview' },
                        ],
                        requireAuth: true,
                    },
                    component: () => import('@pages/base/hroperation-unit-edit-view/hroperation-unit-edit-view.vue'),
                },
                {
                    path: 'hroperationunits/:hroperationunit?/hrorgaddresses/:hrorgaddress?/editview/:editview?',
                    meta: {
                        caption: 'entities.hrorgaddress.views.editview.title',
                        info:'',
                        parameters: [
                            { pathName: 'pim', parameterName: 'pim' },
                            { pathName: 'hroperationunits', parameterName: 'hroperationunit' },
                            { pathName: 'hrorgaddresses', parameterName: 'hrorgaddress' },
                            { pathName: 'editview', parameterName: 'editview' },
                        ],
                        requireAuth: true,
                    },
                    component: () => import('@pages/base/hrorg-address-edit-view/hrorg-address-edit-view.vue'),
                },
                {
                    path: 'hrlegals/:hrlegal?/hrorgaddresses/:hrorgaddress?/editview/:editview?',
                    meta: {
                        caption: 'entities.hrorgaddress.views.editview.title',
                        info:'',
                        parameters: [
                            { pathName: 'pim', parameterName: 'pim' },
                            { pathName: 'hrlegals', parameterName: 'hrlegal' },
                            { pathName: 'hrorgaddresses', parameterName: 'hrorgaddress' },
                            { pathName: 'editview', parameterName: 'editview' },
                        ],
                        requireAuth: true,
                    },
                    component: () => import('@pages/base/hrorg-address-edit-view/hrorg-address-edit-view.vue'),
                },
                {
                    path: 'hrorgaddresses/:hrorgaddress?/editview/:editview?',
                    meta: {
                        caption: 'entities.hrorgaddress.views.editview.title',
                        info:'',
                        parameters: [
                            { pathName: 'pim', parameterName: 'pim' },
                            { pathName: 'hrorgaddresses', parameterName: 'hrorgaddress' },
                            { pathName: 'editview', parameterName: 'editview' },
                        ],
                        requireAuth: true,
                    },
                    component: () => import('@pages/base/hrorg-address-edit-view/hrorg-address-edit-view.vue'),
                },
                {
                    path: 'hroperationunits/:hroperationunit?/hrorgcontacts/:hrorgcontact?/gridview/:gridview?',
                    meta: {
                        caption: 'entities.hrorgcontact.views.gridview.title',
                        info:'',
                        parameters: [
                            { pathName: 'pim', parameterName: 'pim' },
                            { pathName: 'hroperationunits', parameterName: 'hroperationunit' },
                            { pathName: 'hrorgcontacts', parameterName: 'hrorgcontact' },
                            { pathName: 'gridview', parameterName: 'gridview' },
                        ],
                        requireAuth: true,
                    },
                    component: () => import('@pages/base/hrorg-contact-grid-view/hrorg-contact-grid-view.vue'),
                },
                {
                    path: 'hrlegals/:hrlegal?/hrorgcontacts/:hrorgcontact?/gridview/:gridview?',
                    meta: {
                        caption: 'entities.hrorgcontact.views.gridview.title',
                        info:'',
                        parameters: [
                            { pathName: 'pim', parameterName: 'pim' },
                            { pathName: 'hrlegals', parameterName: 'hrlegal' },
                            { pathName: 'hrorgcontacts', parameterName: 'hrorgcontact' },
                            { pathName: 'gridview', parameterName: 'gridview' },
                        ],
                        requireAuth: true,
                    },
                    component: () => import('@pages/base/hrorg-contact-grid-view/hrorg-contact-grid-view.vue'),
                },
                {
                    path: 'hrorgcontacts/:hrorgcontact?/gridview/:gridview?',
                    meta: {
                        caption: 'entities.hrorgcontact.views.gridview.title',
                        info:'',
                        parameters: [
                            { pathName: 'pim', parameterName: 'pim' },
                            { pathName: 'hrorgcontacts', parameterName: 'hrorgcontact' },
                            { pathName: 'gridview', parameterName: 'gridview' },
                        ],
                        requireAuth: true,
                    },
                    component: () => import('@pages/base/hrorg-contact-grid-view/hrorg-contact-grid-view.vue'),
                },
                {
                    path: 'hromhierarchycats/:hromhierarchycat?/gridview/:gridview?',
                    meta: {
                        caption: 'entities.hromhierarchycat.views.gridview.title',
                        info:'',
                        parameters: [
                            { pathName: 'pim', parameterName: 'pim' },
                            { pathName: 'hromhierarchycats', parameterName: 'hromhierarchycat' },
                            { pathName: 'gridview', parameterName: 'gridview' },
                        ],
                        requireAuth: true,
                    },
                    component: () => import('@pages/base/hromhierarchy-cat-grid-view/hromhierarchy-cat-grid-view.vue'),
                },
                {
                    path: 'hrorganizations/:hrorganization?/editview/:editview?',
                    meta: {
                        caption: 'entities.hrorganization.views.editview.title',
                        info:'',
                        parameters: [
                            { pathName: 'pim', parameterName: 'pim' },
                            { pathName: 'hrorganizations', parameterName: 'hrorganization' },
                            { pathName: 'editview', parameterName: 'editview' },
                        ],
                        requireAuth: true,
                    },
                    component: () => import('@pages/base/hrorganization-edit-view/hrorganization-edit-view.vue'),
                },
                {
                    path: 'hroperationunits/:hroperationunit?/v_001/:v_001?',
                    meta: {
                        caption: 'entities.hroperationunit.views.v_001.title',
                        info:'',
                        parameters: [
                            { pathName: 'pim', parameterName: 'pim' },
                            { pathName: 'hroperationunits', parameterName: 'hroperationunit' },
                            { pathName: 'v_001', parameterName: 'v_001' },
                        ],
                        requireAuth: true,
                    },
                    component: () => import('@pages/base/hroperation-unit-v-001/hroperation-unit-v-001.vue'),
                },
                {
                    path: 'hroperationunits/:hroperationunit?/gridview/:gridview?',
                    meta: {
                        caption: 'entities.hroperationunit.views.gridview.title',
                        info:'',
                        parameters: [
                            { pathName: 'pim', parameterName: 'pim' },
                            { pathName: 'hroperationunits', parameterName: 'hroperationunit' },
                            { pathName: 'gridview', parameterName: 'gridview' },
                        ],
                        requireAuth: true,
                    },
                    component: () => import('@pages/base/hroperation-unit-grid-view/hroperation-unit-grid-view.vue'),
                },
                {
                    path: 'hromhierarchycats/:hromhierarchycat?/hromhierarchies/:hromhierarchy?/pickupview/:pickupview?',
                    meta: {
                        caption: 'entities.hromhierarchy.views.pickupview.title',
                        info:'',
                        parameters: [
                            { pathName: 'pim', parameterName: 'pim' },
                            { pathName: 'hromhierarchycats', parameterName: 'hromhierarchycat' },
                            { pathName: 'hromhierarchies', parameterName: 'hromhierarchy' },
                            { pathName: 'pickupview', parameterName: 'pickupview' },
                        ],
                        requireAuth: true,
                    },
                    component: () => import('@pages/base/hromhierarchy-pickup-view/hromhierarchy-pickup-view.vue'),
                },
                {
                    path: 'hromhierarchies/:hromhierarchy?/pickupview/:pickupview?',
                    meta: {
                        caption: 'entities.hromhierarchy.views.pickupview.title',
                        info:'',
                        parameters: [
                            { pathName: 'pim', parameterName: 'pim' },
                            { pathName: 'hromhierarchies', parameterName: 'hromhierarchy' },
                            { pathName: 'pickupview', parameterName: 'pickupview' },
                        ],
                        requireAuth: true,
                    },
                    component: () => import('@pages/base/hromhierarchy-pickup-view/hromhierarchy-pickup-view.vue'),
                },
                {
                    path: 'hremployees/:hremployee?/gridview/:gridview?',
                    meta: {
                        caption: 'entities.hremployee.views.gridview.title',
                        info:'',
                        parameters: [
                            { pathName: 'pim', parameterName: 'pim' },
                            { pathName: 'hremployees', parameterName: 'hremployee' },
                            { pathName: 'gridview', parameterName: 'gridview' },
                        ],
                        requireAuth: true,
                    },
                    component: () => import('@pages/human-resource/hremployee-grid-view/hremployee-grid-view.vue'),
                },
                {
                    path: 'hrlegals/:hrlegal?/tabexpview/:tabexpview?',
                    meta: {
                        caption: 'entities.hrlegal.views.tabexpview.title',
                        info:'',
                        parameters: [
                            { pathName: 'pim', parameterName: 'pim' },
                            { pathName: 'hrlegals', parameterName: 'hrlegal' },
                            { pathName: 'tabexpview', parameterName: 'tabexpview' },
                        ],
                        requireAuth: true,
                    },
                    component: () => import('@pages/base/hrlegal-tab-exp-view/hrlegal-tab-exp-view.vue'),
                },
                {
                    path: 'hroperationunits/:hroperationunit?/hrorgcontacts/:hrorgcontact?/v_001/:v_001?',
                    meta: {
                        caption: 'entities.hrorgcontact.views.v_001.title',
                        info:'',
                        parameters: [
                            { pathName: 'pim', parameterName: 'pim' },
                            { pathName: 'hroperationunits', parameterName: 'hroperationunit' },
                            { pathName: 'hrorgcontacts', parameterName: 'hrorgcontact' },
                            { pathName: 'v_001', parameterName: 'v_001' },
                        ],
                        requireAuth: true,
                    },
                    component: () => import('@pages/base/hrorg-contact-v-001/hrorg-contact-v-001.vue'),
                },
                {
                    path: 'hrlegals/:hrlegal?/hrorgcontacts/:hrorgcontact?/v_001/:v_001?',
                    meta: {
                        caption: 'entities.hrorgcontact.views.v_001.title',
                        info:'',
                        parameters: [
                            { pathName: 'pim', parameterName: 'pim' },
                            { pathName: 'hrlegals', parameterName: 'hrlegal' },
                            { pathName: 'hrorgcontacts', parameterName: 'hrorgcontact' },
                            { pathName: 'v_001', parameterName: 'v_001' },
                        ],
                        requireAuth: true,
                    },
                    component: () => import('@pages/base/hrorg-contact-v-001/hrorg-contact-v-001.vue'),
                },
                {
                    path: 'hrorgcontacts/:hrorgcontact?/v_001/:v_001?',
                    meta: {
                        caption: 'entities.hrorgcontact.views.v_001.title',
                        info:'',
                        parameters: [
                            { pathName: 'pim', parameterName: 'pim' },
                            { pathName: 'hrorgcontacts', parameterName: 'hrorgcontact' },
                            { pathName: 'v_001', parameterName: 'v_001' },
                        ],
                        requireAuth: true,
                    },
                    component: () => import('@pages/base/hrorg-contact-v-001/hrorg-contact-v-001.vue'),
                },
                {
                    path: 'hroperationunits/:hroperationunit?/hrorgaddresses/:hrorgaddress?/v_001/:v_001?',
                    meta: {
                        caption: 'entities.hrorgaddress.views.v_001.title',
                        info:'',
                        parameters: [
                            { pathName: 'pim', parameterName: 'pim' },
                            { pathName: 'hroperationunits', parameterName: 'hroperationunit' },
                            { pathName: 'hrorgaddresses', parameterName: 'hrorgaddress' },
                            { pathName: 'v_001', parameterName: 'v_001' },
                        ],
                        requireAuth: true,
                    },
                    component: () => import('@pages/base/hrorg-address-v-001/hrorg-address-v-001.vue'),
                },
                {
                    path: 'hrlegals/:hrlegal?/hrorgaddresses/:hrorgaddress?/v_001/:v_001?',
                    meta: {
                        caption: 'entities.hrorgaddress.views.v_001.title',
                        info:'',
                        parameters: [
                            { pathName: 'pim', parameterName: 'pim' },
                            { pathName: 'hrlegals', parameterName: 'hrlegal' },
                            { pathName: 'hrorgaddresses', parameterName: 'hrorgaddress' },
                            { pathName: 'v_001', parameterName: 'v_001' },
                        ],
                        requireAuth: true,
                    },
                    component: () => import('@pages/base/hrorg-address-v-001/hrorg-address-v-001.vue'),
                },
                {
                    path: 'hrorgaddresses/:hrorgaddress?/v_001/:v_001?',
                    meta: {
                        caption: 'entities.hrorgaddress.views.v_001.title',
                        info:'',
                        parameters: [
                            { pathName: 'pim', parameterName: 'pim' },
                            { pathName: 'hrorgaddresses', parameterName: 'hrorgaddress' },
                            { pathName: 'v_001', parameterName: 'v_001' },
                        ],
                        requireAuth: true,
                    },
                    component: () => import('@pages/base/hrorg-address-v-001/hrorg-address-v-001.vue'),
                },
                {
                    path: 'hroperationunits/:hroperationunit?/dashboardview/:dashboardview?',
                    meta: {
                        caption: 'entities.hroperationunit.views.dashboardview.title',
                        info:'',
                        parameters: [
                            { pathName: 'pim', parameterName: 'pim' },
                            { pathName: 'hroperationunits', parameterName: 'hroperationunit' },
                            { pathName: 'dashboardview', parameterName: 'dashboardview' },
                        ],
                        requireAuth: true,
                    },
                    component: () => import('@pages/base/hroperation-unit-dashboard-view/hroperation-unit-dashboard-view.vue'),
                },
                {
                    path: 'hromhierarchycats/:hromhierarchycat?/hromhierarchies/:hromhierarchy?/gridview/:gridview?',
                    meta: {
                        caption: 'entities.hromhierarchy.views.gridview.title',
                        info:'',
                        parameters: [
                            { pathName: 'pim', parameterName: 'pim' },
                            { pathName: 'hromhierarchycats', parameterName: 'hromhierarchycat' },
                            { pathName: 'hromhierarchies', parameterName: 'hromhierarchy' },
                            { pathName: 'gridview', parameterName: 'gridview' },
                        ],
                        requireAuth: true,
                    },
                    component: () => import('@pages/base/hromhierarchy-grid-view/hromhierarchy-grid-view.vue'),
                },
                {
                    path: 'hromhierarchies/:hromhierarchy?/gridview/:gridview?',
                    meta: {
                        caption: 'entities.hromhierarchy.views.gridview.title',
                        info:'',
                        parameters: [
                            { pathName: 'pim', parameterName: 'pim' },
                            { pathName: 'hromhierarchies', parameterName: 'hromhierarchy' },
                            { pathName: 'gridview', parameterName: 'gridview' },
                        ],
                        requireAuth: true,
                    },
                    component: () => import('@pages/base/hromhierarchy-grid-view/hromhierarchy-grid-view.vue'),
                },
                {
                    path: 'hromhierarchycats/:hromhierarchycat?/pickupgridview/:pickupgridview?',
                    meta: {
                        caption: 'entities.hromhierarchycat.views.pickupgridview.title',
                        info:'',
                        parameters: [
                            { pathName: 'pim', parameterName: 'pim' },
                            { pathName: 'hromhierarchycats', parameterName: 'hromhierarchycat' },
                            { pathName: 'pickupgridview', parameterName: 'pickupgridview' },
                        ],
                        requireAuth: true,
                    },
                    component: () => import('@pages/base/hromhierarchy-cat-pickup-grid-view/hromhierarchy-cat-pickup-grid-view.vue'),
                },
                {
                    path: 'hroperationunits/:hroperationunit?/v_002/:v_002?',
                    meta: {
                        caption: 'entities.hroperationunit.views.v_002.title',
                        info:'',
                        parameters: [
                            { pathName: 'pim', parameterName: 'pim' },
                            { pathName: 'hroperationunits', parameterName: 'hroperationunit' },
                            { pathName: 'v_002', parameterName: 'v_002' },
                        ],
                        requireAuth: true,
                    },
                    component: () => import('@pages/base/hroperation-unit-v-002/hroperation-unit-v-002.vue'),
                },
                {
                    path: 'hromhierarchycats/:hromhierarchycat?/pickupview/:pickupview?',
                    meta: {
                        caption: 'entities.hromhierarchycat.views.pickupview.title',
                        info:'',
                        parameters: [
                            { pathName: 'pim', parameterName: 'pim' },
                            { pathName: 'hromhierarchycats', parameterName: 'hromhierarchycat' },
                            { pathName: 'pickupview', parameterName: 'pickupview' },
                        ],
                        requireAuth: true,
                    },
                    component: () => import('@pages/base/hromhierarchy-cat-pickup-view/hromhierarchy-cat-pickup-view.vue'),
                },
                {
                    path: 'hrlegals/:hrlegal?/editview/:editview?',
                    meta: {
                        caption: 'entities.hrlegal.views.editview.title',
                        info:'',
                        parameters: [
                            { pathName: 'pim', parameterName: 'pim' },
                            { pathName: 'hrlegals', parameterName: 'hrlegal' },
                            { pathName: 'editview', parameterName: 'editview' },
                        ],
                        requireAuth: true,
                    },
                    component: () => import('@pages/base/hrlegal-edit-view/hrlegal-edit-view.vue'),
                },
                {
                    path: 'hrorganizations/:hrorganization?/pickupview/:pickupview?',
                    meta: {
                        caption: 'entities.hrorganization.views.pickupview.title',
                        info:'',
                        parameters: [
                            { pathName: 'pim', parameterName: 'pim' },
                            { pathName: 'hrorganizations', parameterName: 'hrorganization' },
                            { pathName: 'pickupview', parameterName: 'pickupview' },
                        ],
                        requireAuth: true,
                    },
                    component: () => import('@pages/base/hrorganization-pickup-view/hrorganization-pickup-view.vue'),
                },
                {
                    path: 'hrorganizations/:hrorganization?/gridview/:gridview?',
                    meta: {
                        caption: 'entities.hrorganization.views.gridview.title',
                        info:'',
                        parameters: [
                            { pathName: 'pim', parameterName: 'pim' },
                            { pathName: 'hrorganizations', parameterName: 'hrorganization' },
                            { pathName: 'gridview', parameterName: 'gridview' },
                        ],
                        requireAuth: true,
                    },
                    component: () => import('@pages/base/hrorganization-grid-view/hrorganization-grid-view.vue'),
                },
                {
                    path: 'hromhierarchycats/:hromhierarchycat?/hromhierarchies/:hromhierarchy?/editview/:editview?',
                    meta: {
                        caption: 'entities.hromhierarchy.views.editview.title',
                        info:'',
                        parameters: [
                            { pathName: 'pim', parameterName: 'pim' },
                            { pathName: 'hromhierarchycats', parameterName: 'hromhierarchycat' },
                            { pathName: 'hromhierarchies', parameterName: 'hromhierarchy' },
                            { pathName: 'editview', parameterName: 'editview' },
                        ],
                        requireAuth: true,
                    },
                    component: () => import('@pages/base/hromhierarchy-edit-view/hromhierarchy-edit-view.vue'),
                },
                {
                    path: 'hromhierarchies/:hromhierarchy?/editview/:editview?',
                    meta: {
                        caption: 'entities.hromhierarchy.views.editview.title',
                        info:'',
                        parameters: [
                            { pathName: 'pim', parameterName: 'pim' },
                            { pathName: 'hromhierarchies', parameterName: 'hromhierarchy' },
                            { pathName: 'editview', parameterName: 'editview' },
                        ],
                        requireAuth: true,
                    },
                    component: () => import('@pages/base/hromhierarchy-edit-view/hromhierarchy-edit-view.vue'),
                },
                {
                    path: 'hromhierarchycats/:hromhierarchycat?/editview/:editview?',
                    meta: {
                        caption: 'entities.hromhierarchycat.views.editview.title',
                        info:'',
                        parameters: [
                            { pathName: 'pim', parameterName: 'pim' },
                            { pathName: 'hromhierarchycats', parameterName: 'hromhierarchycat' },
                            { pathName: 'editview', parameterName: 'editview' },
                        ],
                        requireAuth: true,
                    },
                    component: () => import('@pages/base/hromhierarchy-cat-edit-view/hromhierarchy-cat-edit-view.vue'),
                },
                {
                    path: 'hroperationunits/:hroperationunit?/hrorgcontacts/:hrorgcontact?/editview/:editview?',
                    meta: {
                        caption: 'entities.hrorgcontact.views.editview.title',
                        info:'',
                        parameters: [
                            { pathName: 'pim', parameterName: 'pim' },
                            { pathName: 'hroperationunits', parameterName: 'hroperationunit' },
                            { pathName: 'hrorgcontacts', parameterName: 'hrorgcontact' },
                            { pathName: 'editview', parameterName: 'editview' },
                        ],
                        requireAuth: true,
                    },
                    component: () => import('@pages/base/hrorg-contact-edit-view/hrorg-contact-edit-view.vue'),
                },
                {
                    path: 'hrlegals/:hrlegal?/hrorgcontacts/:hrorgcontact?/editview/:editview?',
                    meta: {
                        caption: 'entities.hrorgcontact.views.editview.title',
                        info:'',
                        parameters: [
                            { pathName: 'pim', parameterName: 'pim' },
                            { pathName: 'hrlegals', parameterName: 'hrlegal' },
                            { pathName: 'hrorgcontacts', parameterName: 'hrorgcontact' },
                            { pathName: 'editview', parameterName: 'editview' },
                        ],
                        requireAuth: true,
                    },
                    component: () => import('@pages/base/hrorg-contact-edit-view/hrorg-contact-edit-view.vue'),
                },
                {
                    path: 'hrorgcontacts/:hrorgcontact?/editview/:editview?',
                    meta: {
                        caption: 'entities.hrorgcontact.views.editview.title',
                        info:'',
                        parameters: [
                            { pathName: 'pim', parameterName: 'pim' },
                            { pathName: 'hrorgcontacts', parameterName: 'hrorgcontact' },
                            { pathName: 'editview', parameterName: 'editview' },
                        ],
                        requireAuth: true,
                    },
                    component: () => import('@pages/base/hrorg-contact-edit-view/hrorg-contact-edit-view.vue'),
                },
                {
                    path: 'hromhierarchycats/:hromhierarchycat?/hromhierarchies/:hromhierarchy?/treeexpview/:treeexpview?',
                    meta: {
                        caption: 'entities.hromhierarchy.views.treeexpview.title',
                        info:'',
                        parameters: [
                            { pathName: 'pim', parameterName: 'pim' },
                            { pathName: 'hromhierarchycats', parameterName: 'hromhierarchycat' },
                            { pathName: 'hromhierarchies', parameterName: 'hromhierarchy' },
                            { pathName: 'treeexpview', parameterName: 'treeexpview' },
                        ],
                        requireAuth: true,
                    },
                    component: () => import('@pages/base/hromhierarchy-tree-exp-view/hromhierarchy-tree-exp-view.vue'),
                },
                {
                    path: 'hromhierarchies/:hromhierarchy?/treeexpview/:treeexpview?',
                    meta: {
                        caption: 'entities.hromhierarchy.views.treeexpview.title',
                        info:'',
                        parameters: [
                            { pathName: 'pim', parameterName: 'pim' },
                            { pathName: 'hromhierarchies', parameterName: 'hromhierarchy' },
                            { pathName: 'treeexpview', parameterName: 'treeexpview' },
                        ],
                        requireAuth: true,
                    },
                    component: () => import('@pages/base/hromhierarchy-tree-exp-view/hromhierarchy-tree-exp-view.vue'),
                },
                {
                    path: 'hrlegals/:hrlegal?/gridview/:gridview?',
                    meta: {
                        caption: 'entities.hrlegal.views.gridview.title',
                        info:'',
                        parameters: [
                            { pathName: 'pim', parameterName: 'pim' },
                            { pathName: 'hrlegals', parameterName: 'hrlegal' },
                            { pathName: 'gridview', parameterName: 'gridview' },
                        ],
                        requireAuth: true,
                    },
                    component: () => import('@pages/base/hrlegal-grid-view/hrlegal-grid-view.vue'),
                },
                {
                    path: 'hrlegals/:hrlegal?/v_002/:v_002?',
                    meta: {
                        caption: 'entities.hrlegal.views.v_002.title',
                        info:'',
                        parameters: [
                            { pathName: 'pim', parameterName: 'pim' },
                            { pathName: 'hrlegals', parameterName: 'hrlegal' },
                            { pathName: 'v_002', parameterName: 'v_002' },
                        ],
                        requireAuth: true,
                    },
                    component: () => import('@pages/base/hrlegal-v-002/hrlegal-v-002.vue'),
                },
                {
                    path: 'hroperationunits/:hroperationunit?/tabexpview/:tabexpview?',
                    meta: {
                        caption: 'entities.hroperationunit.views.tabexpview.title',
                        info:'',
                        parameters: [
                            { pathName: 'pim', parameterName: 'pim' },
                            { pathName: 'hroperationunits', parameterName: 'hroperationunit' },
                            { pathName: 'tabexpview', parameterName: 'tabexpview' },
                        ],
                        requireAuth: true,
                    },
                    component: () => import('@pages/base/hroperation-unit-tab-exp-view/hroperation-unit-tab-exp-view.vue'),
                },
                {
                    path: 'hromhierarchycats/:hromhierarchycat?/v_002/:v_002?',
                    meta: {
                        caption: 'entities.hromhierarchycat.views.v_002.title',
                        info:'',
                        parameters: [
                            { pathName: 'pim', parameterName: 'pim' },
                            { pathName: 'hromhierarchycats', parameterName: 'hromhierarchycat' },
                            { pathName: 'v_002', parameterName: 'v_002' },
                        ],
                        requireAuth: true,
                    },
                    component: () => import('@pages/base/hromhierarchy-cat-v-002/hromhierarchy-cat-v-002.vue'),
                },
                {
                    path: 'hroperationunits/:hroperationunit?/hrorgaddresses/:hrorgaddress?/gridview/:gridview?',
                    meta: {
                        caption: 'entities.hrorgaddress.views.gridview.title',
                        info:'',
                        parameters: [
                            { pathName: 'pim', parameterName: 'pim' },
                            { pathName: 'hroperationunits', parameterName: 'hroperationunit' },
                            { pathName: 'hrorgaddresses', parameterName: 'hrorgaddress' },
                            { pathName: 'gridview', parameterName: 'gridview' },
                        ],
                        requireAuth: true,
                    },
                    component: () => import('@pages/base/hrorg-address-grid-view/hrorg-address-grid-view.vue'),
                },
                {
                    path: 'hrlegals/:hrlegal?/hrorgaddresses/:hrorgaddress?/gridview/:gridview?',
                    meta: {
                        caption: 'entities.hrorgaddress.views.gridview.title',
                        info:'',
                        parameters: [
                            { pathName: 'pim', parameterName: 'pim' },
                            { pathName: 'hrlegals', parameterName: 'hrlegal' },
                            { pathName: 'hrorgaddresses', parameterName: 'hrorgaddress' },
                            { pathName: 'gridview', parameterName: 'gridview' },
                        ],
                        requireAuth: true,
                    },
                    component: () => import('@pages/base/hrorg-address-grid-view/hrorg-address-grid-view.vue'),
                },
                {
                    path: 'hrorgaddresses/:hrorgaddress?/gridview/:gridview?',
                    meta: {
                        caption: 'entities.hrorgaddress.views.gridview.title',
                        info:'',
                        parameters: [
                            { pathName: 'pim', parameterName: 'pim' },
                            { pathName: 'hrorgaddresses', parameterName: 'hrorgaddress' },
                            { pathName: 'gridview', parameterName: 'gridview' },
                        ],
                        requireAuth: true,
                    },
                    component: () => import('@pages/base/hrorg-address-grid-view/hrorg-address-grid-view.vue'),
                },
                {
                    path: 'hremployees/:hremployee?/editview/:editview?',
                    meta: {
                        caption: 'entities.hremployee.views.editview.title',
                        info:'',
                        parameters: [
                            { pathName: 'pim', parameterName: 'pim' },
                            { pathName: 'hremployees', parameterName: 'hremployee' },
                            { pathName: 'editview', parameterName: 'editview' },
                        ],
                        requireAuth: true,
                    },
                    component: () => import('@pages/human-resource/hremployee-edit-view/hremployee-edit-view.vue'),
                },
                {
                    path: 'hromhierarchycats/:hromhierarchycat?/hromhierarchies/:hromhierarchy?/pickupgridview/:pickupgridview?',
                    meta: {
                        caption: 'entities.hromhierarchy.views.pickupgridview.title',
                        info:'',
                        parameters: [
                            { pathName: 'pim', parameterName: 'pim' },
                            { pathName: 'hromhierarchycats', parameterName: 'hromhierarchycat' },
                            { pathName: 'hromhierarchies', parameterName: 'hromhierarchy' },
                            { pathName: 'pickupgridview', parameterName: 'pickupgridview' },
                        ],
                        requireAuth: true,
                    },
                    component: () => import('@pages/base/hromhierarchy-pickup-grid-view/hromhierarchy-pickup-grid-view.vue'),
                },
                {
                    path: 'hromhierarchies/:hromhierarchy?/pickupgridview/:pickupgridview?',
                    meta: {
                        caption: 'entities.hromhierarchy.views.pickupgridview.title',
                        info:'',
                        parameters: [
                            { pathName: 'pim', parameterName: 'pim' },
                            { pathName: 'hromhierarchies', parameterName: 'hromhierarchy' },
                            { pathName: 'pickupgridview', parameterName: 'pickupgridview' },
                        ],
                        requireAuth: true,
                    },
                    component: () => import('@pages/base/hromhierarchy-pickup-grid-view/hromhierarchy-pickup-grid-view.vue'),
                },
                {
                    path: 'hrorganizations/:hrorganization?/pickupgridview/:pickupgridview?',
                    meta: {
                        caption: 'entities.hrorganization.views.pickupgridview.title',
                        info:'',
                        parameters: [
                            { pathName: 'pim', parameterName: 'pim' },
                            { pathName: 'hrorganizations', parameterName: 'hrorganization' },
                            { pathName: 'pickupgridview', parameterName: 'pickupgridview' },
                        ],
                        requireAuth: true,
                    },
                    component: () => import('@pages/base/hrorganization-pickup-grid-view/hrorganization-pickup-grid-view.vue'),
                },
                {
                    path: 'hrlegals/:hrlegal?/dashboardview/:dashboardview?',
                    meta: {
                        caption: 'entities.hrlegal.views.dashboardview.title',
                        info:'',
                        parameters: [
                            { pathName: 'pim', parameterName: 'pim' },
                            { pathName: 'hrlegals', parameterName: 'hrlegal' },
                            { pathName: 'dashboardview', parameterName: 'dashboardview' },
                        ],
                        requireAuth: true,
                    },
                    component: () => import('@pages/base/hrlegal-dashboard-view/hrlegal-dashboard-view.vue'),
                },
                {
                    path: 'hrlegals/:hrlegal?/v_001/:v_001?',
                    meta: {
                        caption: 'entities.hrlegal.views.v_001.title',
                        info:'',
                        parameters: [
                            { pathName: 'pim', parameterName: 'pim' },
                            { pathName: 'hrlegals', parameterName: 'hrlegal' },
                            { pathName: 'v_001', parameterName: 'v_001' },
                        ],
                        requireAuth: true,
                    },
                    component: () => import('@pages/base/hrlegal-v-001/hrlegal-v-001.vue'),
                },
            ...indexRoutes,
            ],
        },
        ...globalRoutes,
        {
            path: '/login/:login?',
            name: 'login',
            meta: {  
                caption: '登录',
                viewType: 'login',
                requireAuth: false,
                ignoreAddPage: true,
            },
            beforeEnter: (to: any, from: any, next: any) => {
                appService.navHistory.reset();
                next();
            },
            component: () => import('@components/login/login'),
        },
        {
            path: '/404',
            component: () => import('@components/404/404.vue')
        },
        {
            path: '/500',
            component: () => import('@components/500/500.vue')
        },
        {
            path: '*',
            redirect: 'pim'
        }
    ]
});

router.beforeEach((to: any, from: any, next: any) => {
    if (to.meta && !to.meta.ignoreAddPage) {
        appService.navHistory.add(to);
    }
    next();
});

export default router;