import { createRouter, createWebHashHistory } from "vue-router"; import layout from "@/layout/index"; //layout直接引用 其他使用路由懒加载 import store from "@/store"; // import Home from '../views/Home.vue' /** * 关于路由配置描述 * 1.meta && meta.title && meta.icon 则在菜单栏显示 * 2.如果存在children , 则以el-sub-menu子菜单显示 * 否则不在menu菜单显示 * 如果只展示单级别菜单 需要像developer这样配置 */ /** * 私有路由表 */ export const privateRoutes = []; /** * 公开路由表 */ export const publicRoutes = [ { path: "/login", name: "login", component: () => import("@/views/login/index") }, { path: "/", name: "dataBI", component: () => import("@/views/dataBI/index") //警保 }, { path: "/editPassword", // 注意:带有路径"/"的记录中的组件"默认"是一个不返回 Promise 的函数 component: layout, redirect: "/SecurityPersonnel", children: [ { path: "/systemConfig", name: "systemConfigModel", meta: { title: "系统管理", icon: "personnel" }, children: [ { path: "/user/department-ist", name: "departmentList", component: () => import("@/views/backOfficeSystem/systemConfig/department-list/index"), meta: { title: "部门管理", icon: "personnel-manage" } }, { path: "/user/userList", name: "userList", component: () => import("@/views/backOfficeSystem/systemConfig/user-list/index"), meta: { title: "用户管理", icon: "role" } }, { path: "/user/role", name: "userRoleIndex", component: () => import("@/views/backOfficeSystem/systemConfig/role-list/index"), meta: { title: "角色列表", icon: "role" } }, { path: "/user/menuList", name: "menuList", component: () => import("@/views/backOfficeSystem/systemConfig/menu-list/index"), meta: { title: "菜单管理", icon: "personnel-manage" } }, { path: "/user/publicSecurity", name: "publicSecurity", component: () => import("@/views/backOfficeSystem/systemConfig/publicSecurity/index"), meta: { title: "公安机关要素", icon: "personnel-manage" } }, { path: "/dict/detail", name: "dictDetail", component: () => import("@/views/backOfficeSystem/systemConfig/dict/detail"), meta: { title: "字典数据" } }, { path: "/dict/index", name: "dictIndex", component: () => import("@/views/backOfficeSystem/systemConfig/dict/index"), meta: { title: "字典列表", icon: "article-ranking" } }, { path: "/intelligence", name: "intelligence-zb", component: () => import("@/views/backOfficeSystem/systemConfig/intelligence/index"), meta: { title: "智能装备管理", icon: "article-ranking" } }, ] }, { path: "/basicConfig", name: "basicConfigModel", meta: { title: "基础管理", icon: "personnel" }, children: [ { path: "/SecurityPersonnel", name: "SecurityPersonnel", component: () => import("@/views/backOfficeSystem/AlarmLinkage/SecurityPersonnel/index"), meta: { title: "保安人员管理", icon: "article" } }, { path: "/RequiredPatrolLine", name: "RequiredPatrolLine", component: () => import("@/views/backOfficeSystem/AlarmLinkage/PatrolLine/index"), meta: { title: "必巡线管理", icon: "article" } }, { path: "/FixedDuty", name: "FixedDuty", component: () => import("@/views/backOfficeSystem/AlarmLinkage/FixedDuty/index"), meta: { title: "固定勤务管理", icon: "article" } }, { path: "/GuardPoint", name: "GuardPoint", component: () => import("@/views/backOfficeSystem/AlarmLinkage/GuardPoint/index"), meta: { title: "值守点管理", icon: "article" } }, ] }, { path: "/AlarmLinkage", name: "AlarmLinkage", meta: { title: "工作情况", icon: "article" }, children: [ { path: "/AlarmCoordination", name: "AlarmCoordination", component: () => import("@/views/backOfficeSystem/AlarmLinkage/AlarmCoordination/index"), meta: { title: "警情协调情况统计", icon: "article" } }, { path: "/TemporaryDuty", name: "TemporaryDuty", component: () => import("@/views/backOfficeSystem/AlarmLinkage/TemporaryDuty/index"), meta: { title: "临时任务管理", icon: "article" } }, { path: "/DutyCheckIn", name: "DutyCheckIn", component: () => import("@/views/backOfficeSystem/AlarmLinkage/DutyCheckIn/index"), meta: { title: "勤务打卡统计", icon: "article" } }, { path: "/xlqkStatistics", name: "xlqkStatistics", component: () => import("@/views/backOfficeSystem/AlarmLinkage/xlqkStatistics/index.vue"), meta: { title: "巡逻情况统计", icon: "article" } }, { path: "/GuardPointStatistics", name: "GuardPointStatistics", component: () => import("@/views/backOfficeSystem/AlarmLinkage/GuardPointStatistics/index"), meta: { title: "值守点值守统计", icon: "article" } }, { path: "/sectionalState", name: "sectionalState", component: () => import("@/views/backOfficeSystem/AlarmLinkage/sectionalState/index"), meta: { title: "街面状况", icon: "article" } } ] }, ] } ]; const router = createRouter({ history: createWebHashHistory(), routes: publicRoutes }); //初始化路由表 export function resetRouter() { if (store.getters?.routeReady && store.getters?.userInfo?.permission?.menus) { const menus = store.getters.userInfo.permission.menus; menus.forEach(menu => { router.removeRoute(menu); }); } } export default router;