import Vue from 'vue'
import Router from 'vue-router'

import routerBefore from '@/config/routerBefore.js'

// 主要
import main from '@/components/main.vue'
// 系统配置管理
import functionMain from '../components/functionMain.vue'
import organizManage from '../components/organizManage.vue'
import transportReserveFu from '../components/transportReserveFu.vue' 
import rolesManage from '../components/rolesManage.vue'
import authManage from '../components/authManage.vue'
import usersManage from '../components/usersManage.vue'
import userAuth from '../components/userAuth.vue'
import dataPermission from '../components/dataPermission.vue'
import dataPermissionAdd from '../components/dataPermissionAdd.vue'
import dataDictionary from '../components/dataDictionary.vue'
import backup from '../components/backup.vue'
// 租户管理
import tenantManage from '../components/tenantManage.vue'
// 公告管理
import noticeUser from '../components/noticeUser.vue'
// 用户审计
import userBehaviorManage from '../components/userBehaviorManage.vue'
// 密码策略
import pwdValidSetting from '../components/pwdValidSetting.vue'
// 职级管理
import dutyManage from '../components/dutyManage.vue'
Vue.use(Router)

const constantRouterMap = [
  {
    path: '/',
    name: 'main',
    meta: {title: '首页', code: 'xtpzgl'},
    component: main,
    redirect: {name: 'usersManage'},
    children: [
      {path: 'organizManage', name: 'organizManage', meta: {code: 'xtpzgl-jggl'}, component: organizManage},
      {path: 'usersManage', name: 'usersManage', meta: {code: 'xtpzgl-yhgl'}, component: usersManage},
      {path: 'transportReserveFu', name: 'transportReserveFu', meta: {code: 'xtpzgl-yhgl'}, component: transportReserveFu},
      {path: 'functionMain', name: 'functionMain', meta: {code: 'xtpzgl-cdgl'}, component: functionMain},
      {path: 'dataPermission', name: 'dataPermission', meta: {code: 'xtpzgl-sjqxpz'}, component: dataPermission},
      {path: 'dataPermission/dataPermissionAdd', name: 'dataPermissionAdd', meta: {code: 'xtpzgl-sjqxpz-add'}, component: dataPermissionAdd},
      {path: 'rolesManage', name: 'rolesManage', meta: {code: 'xtpzgl-jsgl'}, component: rolesManage},
      {path: 'authManage', name: 'authManage', meta: {code: 'xtpzgl-augl'}, component: authManage},
      {path: 'userAuth', name: 'userAuth', meta: {code: 'xtpzgl-yhsq'}, component: userAuth},
      // 备份数据
      {path: 'backup', name: 'backup', component: backup},
      {path: 'dataDictionary', name: 'dataDictionary', component: dataDictionary},
      {path: 'tenantManage', name: 'tenantManage', component: tenantManage},
      {path: 'noticeUser', name: 'noticeUser', component: noticeUser},
      {path: 'userBehaviorManage', name: 'userBehaviorManage', component: userBehaviorManage},
      {path: 'pwdValidSetting', name: 'pwdValidSetting', component: pwdValidSetting},
      {path: 'dutyManage', name: 'dutyManage', component: dutyManage}
    ]
  }
];

const router = new Router({
  routes: constantRouterMap
})
//  before
routerBefore(router, constantRouterMap);

export default router;
//  constantRouterMap
export const routes = constantRouterMap;
