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 rolesManage from '../components/rolesManage.vue'
// import userLoginlog from '../components/userLoginlog.vue'
import usersManage from '../components/usersManage.vue'
// import sysPosts from '../components/sysPosts.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 postsManage from '../components/postsManage.vue'
// import userAuthSearch from '../components/userAuthSearch.vue'
// import roleUser from '../components/roleUser.vue'
import backup from '../components/backup.vue'

// 用户审计
import userBehaviorManage from '../components/userBehaviorManage.vue'
// 业务编码
import businessCode from '../components/businessCode/businessCode.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: 'sysPosts', name: 'sysPosts', meta: {code: 'xtpzgl-gwgl'}, component: sysPosts},
      {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: 'postsManage', name: 'postsManage', meta: {code: 'xtpzgl-gwsq'}, component: postsManage},
      {path: 'userAuth', name: 'userAuth', meta: {code: 'xtpzgl-yhsq'}, component: userAuth},
      //   //  用户权限查询
      //   {path: 'userAuthSearch', name: 'userAuthSearch', meta: {code: 'xtpzgl-yhqxcx'}, component: userAuthSearch},
      //   // 根据角色 菜单查询用户
      //   {path: 'roleUser', name: 'roleUser', component: roleUser},
      // 备份数据
      {path: 'backup', name: 'backup', component: backup},
      {path: 'userBehaviorManage', name: 'userBehaviorManage', component: userBehaviorManage},
      {path: 'dataDictionary', name: 'dataDictionary', component: dataDictionary},
      {path: 'businessCode', name: 'businessCode',component: businessCode}
    ]
  }
];

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

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