import Vue from "vue";
import Router from "vue-router";
import preview from "vue-photo-preview";
import "vue-photo-preview/dist/skin.css";
Vue.use(Router).use(preview);

/* Layout */
import Layout from "@/views/layout/Layout";

import role from "./modules/role";
import article from "./modules/article";
import member from "./modules/member";
import org from "./modules/org";
import marketing_tool from "./modules/marketing_tool";
import system from "./modules/system";
import site from "./modules/site";
import kefu from "./modules/kefu";

/** note: submenu only apppear when children.length>=1
 *   detail see  https://panjiachen.github.io/vue-element-admin-site/guide/essentials/router-and-nav.html
 **/

/**
* hidden: true                   if `hidden:true` will not show in the sidebar(default is false)
* alwaysShow: true               if set true, will always show the root menu, whatever its child routes length

// 详见 xt_permission.xt_filterAsyncRouter 函数的逻辑
is_menu: false               加载路由时验证用的(即该路由是否要在侧边栏展示，需要展示的即需要)，为 false 时表示该路由不需要进行权限验证

*                                if not set alwaysShow, only more than one route under the children
*                                it will becomes nested mode, otherwise not show the root menu
* redirect: noredirect           if `redirect:noredirect` will no redirct in the breadcrumb
* name:'router-name'             the name is used by <keep-alive> (must set!!!)
* meta : {
    title: 'title'               the name show in submenu and breadcrumb (recommend set)
    icon: 'svg-name'             the icon show in the sidebar,
    noCache: true                if true ,the page will no be cached(default is false)

    // 详见 xt_permission.xt_filterAsyncRouter 函数的逻辑
    is_menu: false               加载路由时验证用的，为 false 时表示该路由不需要进行权限验证
    hidden: false                加载路由时验证用的，is_menu 为true时才有作用，为 true 时表示该路由需要进行权限验证
  }
**/
var _constant_router_map = [
  {
    path: "/token/verify",
    component: () => import("@/scrm_pages/index/verify_token"),
    hidden: true
  },
  {
    path: "/404",
    component: () => import("@/views/errorPage/404"),
    hidden: true
  },
  {
    path: "/401",
    component: () => import("@/views/errorPage/401"),
    hidden: true
  },

  // 启始页面
  {
    path: "/startpage",
    component: () => import("@/kpa_pages/index/index")
  },

  // 登录页面
  {
    path: "/login",
    component: () => import("@/kpa_pages/login/login")
  },
  // 输入名字
  {
    path: "/getName",
    component: () => import("@/kpa_pages/getName/index")
  },
  // 已加入的团队
  {
    path: "/joinedGroup",
    component: () => import("@/kpa_pages/joinedGroup/index")
  },
  // 还没加入的团队
  {
    path: "/noJoinedGroup",
    component: () => import("@/kpa_pages/noJoinedGroup/index")
  },
  // 创建机构
  {
    path: "/createOrganization",
    component: () => import("@/kpa_pages/createOrganization/index")
  },
  // 首页
  {
    path: "/home",
    component: () => import("@/kpa_pages/home/index"),
    children: [
      {
        path: "/homeIndex",
        component: () => import("@/kpa_pages/homeIndex/index.vue")
      },
      {
        path: "/study",
        component: () => import("@/kpa_pages/study/index.vue")
      },
      {
        path: "/service",
        component: () => import("@/kpa_pages/service/index.vue")
      },
      {
        path: "/shop",
        component: () => import("@/kpa_pages/shop/index.vue")
      },
      {
        path: "/my",
        component: () => import("@/kpa_pages/my/index.vue")
      }
    ]
  },
  // 管理控制台
  {
    path: "/managementConsole",
    component: () => import("@/kpa_pages/managementConsole/index")
  },
  // 员工管理
  {
    path: "/staffManagement",
    component: () => import("@/kpa_pages/staffManagement/index")
  },
  // 编辑员工
  {
    path: "/editStaff",
    component: () => import("@/kpa_pages/editStaff/index")
  },
  // 新增员工
  {
    path: "/addStaff",
    component: () => import("@/kpa_pages/addStaff/index")
  },
  // 权限管理
  {
    path: "/privilegeManagement",
    component: () => import("@/kpa_pages/privilegeManagement/index")
  },
  // 新增角色
  {
    path: "/newAddRole",
    component: () => import("@/kpa_pages/newAddRole/index")
  },
  // 编辑角色
  {
    path: "/editRole",
    component: () => import("@/kpa_pages/editRole/index")
  },
  // 新增用户
  {
    path: "/newUser",
    component: () => import("@/kpa_pages/newUser/index")
  },
  // 员工列表
  {
    path: "/employeeList",
    component: () => import("@/kpa_pages/employeeList/index")
  },
  // 新增员工
  {
    path: "/newAddStaff",
    component: () => import("@/kpa_pages/newAddStaff/index")
  },
  // 设置工作台
  {
    path: "/setConsole",
    component: () => import("@/kpa_pages/setConsole/index")
  },
  // 机构信息修改
  {
    path: "/modifyOrganization",
    component: () => import("@/kpa_pages/modifyOrganization/index")
  },
  // 管理员转让
  {
    path: "/adminTransfer",
    component: () => import("@/kpa_pages/adminTransfer/index")
  },
  // 选择新管理员
  {
    path: "/chooseNewAdmin",
    component: () => import("@/kpa_pages/chooseNewAdmin/index")
  },
  // 新管理员
  {
    path: "/newAdmin",
    component: () => import("@/kpa_pages/newAdmin/index")
  },
  // 所有的检验检查
  {
    path: "/allCheck",
    component: () => import("@/kpa_pages/allCheck/index")
  },
  // 所有的医嘱管理
  {
    path: "/allDoctorManagement",
    component: () => import("@/kpa_pages/allDoctorManagement/index")
  },
  // 所有的干体重
  {
    path: "/allDryWeight",
    component: () => import("@/kpa_pages/allDryWeight/index")
  },
  // 所有的病程
  {
    path: "/allCourse",
    component: () => import("@/kpa_pages/allCourse/index")
  },
  // 所有的抢救记录
  {
    path: "/allRescue",
    component: () => import("@/kpa_pages/allRescue/index")
  },
  // 所有的宣教信息
  {
    path: "/allEducation",
    component: () => import("@/kpa_pages/allEducation/index")
  },
  // 所有的长期透析处方
  {
    path: "/allLongDialysis",
    component: () => import("@/kpa_pages/allLongDialysis/index")
  },
  // 所有的透析记录
  {
    path: "/allDialysisRecord",
    component: () => import("@/kpa_pages/allDialysisRecord/index")
  },
  // 所有的排班信息
  {
    path: "/allScheduling",
    component: () => import("@/kpa_pages/allScheduling/index")
  },
  // 患者管理
  {
    path: "/patientmanagement",
    component: () => import("@/kpa_pages/patientmanagement/index")
  },
  // s搜索
  {
    path: "/search",
    component: () => import("@/kpa_pages/search/index")
  },
  // 我的信息
  {
    path: "/myInfo",
    component: () => import("@/kpa_pages/myInfo/index")
  },
  // 组织信息
  {
    path: "/organizationInfo",
    component: () => import("@/kpa_pages/organizationInfo/index")
  },
  // 关于我们
  {
    path: "/aboutUs",
    component: () => import("@/kpa_pages/aboutUs/index")
  },
  // 反馈意见
  {
    path: "/feedBack",
    component: () => import("@/kpa_pages/feedBack/index")
  },
  // 透析功能配置
  {
    path: "/dialysisConfiguration",
    component: () => import("@/kpa_pages/dialysisConfiguration/index")
  },
  // 模块功能配置-患者中心
  {
    path: "/patientCenter",
    component: () => import("@/kpa_pages/patientCenter/index")
  },
  // 模块功能配置-排班管理
  {
    path: "/scheduleManagement",
    component: () => import("@/kpa_pages/scheduleManagement/index")
  },
  // 模块功能配置-透析管理
  {
    path: "/dialysisManagement",
    component: () => import("@/kpa_pages/dialysisManagement/index")
  },
  // 模块功能配置-签到称重
  {
    path: "/checkInWeighing",
    component: () => import("@/kpa_pages/checkInWeighing/index")
  },
  // 模块功能配置-库存管理
  {
    path: "/inventoryManagement",
    component: () => import("@/kpa_pages/inventoryManagement/index")
  },
  // 模块功能配置-质控管理
  {
    path: "/qualityControlManagement",
    component: () => import("@/kpa_pages/qualityControlManagement/index")
  },
  // 模块功能配置-慢病管理
  {
    path: "/chronicDisease",
    component: () => import("@/kpa_pages/chronicDisease/index")
  },
  // 模块功能配置-SCRM
  {
    path: "/scrm",
    component: () => import("@/kpa_pages/SCRM/index")
  },
  // 模块功能配置-SCRM-会员管理
  {
    path: "/membershipManagement",
    component: () => import("@/kpa_pages/membershipManagement/index")
  },
  // 模块功能配置-SCRM-营销工具
  {
    path: "/marketingTools",
    component: () => import("@/kpa_pages/marketingTools/index")
  },
  // 模块功能配置-SCRM-营销工具
  {
    path: "/marketingTools",
    component: () => import("@/kpa_pages/marketingTools/index")
  },
  // 模块功能配置-SCRM-文章管理
  {
    path: "/articleManagement",
    component: () => import("@/kpa_pages/articleManagement/index")
  },
  // 模块功能配置-SCRM-微网站
  {
    path: "/microWebsite",
    component: () => import("@/kpa_pages/microWebsite/index")
  },
  // 模块功能配置-设备管理
  {
    path: "/deviceManagement",
    component: () => import("@/kpa_pages/deviceManagement/index")
  },
  // 模块功能配置-质控上报
  {
    path: "/qualityControlReport",
    component: () => import("@/kpa_pages/qualityControlReport/index")
  },
  // 配置中心
  {
    path: "/configureCenter",
    component: () => import("@/kpa_pages/configureCenter/index")
  },
  // 新增分区
  {
    path: "/newPartition",
    component: () => import("@/kpa_pages/configureCenter/newPartition")
  },
  // 新增分组
  {
    path: "/newGrouping",
    component: () => import("@/kpa_pages/configureCenter/newGrouping")
  },
  // 新增床位
  {
    path: "/newBed",
    component: () => import("@/kpa_pages/configureCenter/newBed")
  },
  // 修改头像
  {
    path: "/modifyingHead",
    component: () => import("@/kpa_pages/modifyingHead/index")
  },
  // 修改姓名
  {
    path: "/modifyingName",
    component: () => import("@/kpa_pages/modifyingName/index")
  },
  // 个性签名
  {
    path: "/personalSign",
    component: () => import("@/kpa_pages/personalSign/index")
  },
  // 注册页面
  {
    path: "/register",
    component: () => import("@/kpa_pages/register/register")
  },
  // 机构信息
  {
    path: "/orginfomation",
    component: () => import("@/kpa_pages/agecyInformation/index"),
    // eslint-disable-next-line no-irregular-whitespace
    children: [
      {
        // eslint-disable-next-line no-irregular-whitespace
        path: "/orginfomation/home",
        // eslint-disable-next-line no-irregular-whitespace
        component: () => import("@/kpa_pages/home/index")
      }
    ]
  },

  {
    path: "/forgetpassword",
    component: () => import("@/kpa_pages/forgetpassword/index")
  },
  {
    path: "/forgetpasswordnext",
    component: () => import("@/kpa_pages/forgetpassword/forget")
  },
  {
    path: "/nopassword",
    component: () => import("@/kpa_pages/nopassword/index")
  },
  {
    path: "/addpatient",
    component: () => import("@/kpa_pages/addpatient/index")
  },
  {
    path: "/editpatient",
    component: () => import("@/kpa_pages/editPatient/index")
  },
  {
    path: "/patientdetail",
    component: () => import("@/kpa_pages/patientDetail/index")
  },
  // 医嘱管理
  {
    path: "/doctoradvice",
    component: () => import("@/kpa_pages/doctorAdvice/index")
  },
  // 新增医嘱
  {
    path: "/newAddDoctor",
    component: () => import("@/kpa_pages/doctorAdvice/newAddDoctor")
  },
  {
    path: "/",
    component: () => import("@/kpa_pages/index/index")
  },

  // 病程管理
  {
    path: "/coursemanagement",
    component: () => import("@/kpa_pages/courseManagement/index")
  },
  // 抢救记录
  {
    path: "/saverecord",
    component: () => import("@/kpa_pages/saveRecord/index")
  },
  // 检验检查
  {
    path: "/check",
    component: () => import("@/kpa_pages/check/index")
  },

  // 血管通路

  // 长期处方
  {
    path: "/longDialysis",
    component: () => import("@/kpa_pages/longDialysis/index")
  },

  // 透析记录
  {
    path: "/dialysisrecord",
    component: () => import("@/kpa_pages/dialysisRecord/index")
  },

  // 耗材使用

  // 排班信息
  {
    path: "/scheduleInformation",
    component: () => import("@/kpa_pages/scheduleInformation")
  },

  // 宣教信息
  {
    path: "/missionInformation",
    component: () => import("@/kpa_pages/missionInformation/index")
  }
];

var _asy_router_map = [];

var is_asy_router = process.env.NODE_ENV === "production"; // true; 设置为 true 强制进行路由验证
if (!is_asy_router) {
  _constant_router_map = _constant_router_map.concat(_asy_router_map);
  _asy_router_map = [];
} else {
}

export const xt_constantRouterMap = _constant_router_map;
export const xt_asyncRouterMap = _asy_router_map;

export default new Router({
  // mode: 'history', // require service support
  scrollBehavior: () => ({
    y: 0
  }),
  routes: xt_constantRouterMap
});
