Files
xzlz_GjWeb/src/router/index.js
2025-06-08 22:44:18 +08:00

301 lines
7.8 KiB
JavaScript

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: "home",
component: () => import("@/views/home/index") //林芝市检查站综合管理
},
{
path: "/editPassword", // 注意:带有路径"/"的记录中的组件"默认"是一个不返回 Promise 的函数
component: layout,
redirect: "/user/department-ist",
children: [
{
path: "/systemConfig",
// component: layout,
name: "systemConfigModel",
redirect: "/user/department-ist",
meta: {
title: "系统管理",
icon: "article"
},
children: [
{
path: "/user/department-ist",
name: "departmentList",
component: () =>
import(
"@/views/backOfficeSystem/systemConfig/department-list/index"
),
meta: {
title: "部门管理",
icon: "article-ranking"
}
},
{
path: "/user/userList",
name: "userList",
component: () =>
import("@/views/backOfficeSystem/systemConfig/user-list/index"),
meta: {
title: "用户管理",
icon: "article-ranking"
}
},
{
path: "/user/role",
name: "userRoleIndex",
component: () =>
import("@/views/backOfficeSystem/systemConfig/role-list/index"),
meta: {
title: "角色列表",
icon: "article-ranking"
}
},
{
path: "/user/menuList",
name: "menuList",
component: () =>
import("@/views/backOfficeSystem/systemConfig/menu-list/index"),
meta: {
title: "菜单管理",
icon: "article-ranking"
}
},
{
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: "/user/deptAllocationUser/:id",
name: "deptAllocationUser",
component: () =>
import(
"@/views/backOfficeSystem/systemConfig/department-list/deptAllocationUser"
),
meta: {
title: "管理用户"
}
},
{
path: "/user/allocationUser/:id",
name: "allocationUser",
component: () =>
import(
"@/views/backOfficeSystem/systemConfig/role-list/allocationUser"
),
meta: {
title: "分配用户"
}
},
{
path: "/user/systemConfig",
name: "systemConfig",
component: () =>
import(
"@/views/backOfficeSystem/systemConfig/system-config-list/index"
),
meta: {
title: "系统配置",
icon: "article-ranking"
}
}
]
},
{
path: "/passengerTransport",
name: "passengerTransport",
meta: {
title: "单位管理",
icon: "article"
},
children: [
{
path: "/passengerTransport",
// name: "departmentList",
component: () =>
import("@/views/backOfficeSystem/passengerTransport/index"),
meta: {
title: "客运单位信息管理",
icon: "article-ranking"
}
}
]
},
{
path: "/routeManagement",
meta: {
title: "公交路线管理",
icon: "article"
},
children: [
{
path: "/routeManagement",
name: "routeManagement",
component: () =>
import("@/views/backOfficeSystem/routeManagement/index"),
meta: {
title: "公交路线管理",
icon: "article-ranking"
}
}
]
},
{
path: "/busStop",
meta: {
title: "公交站点管理",
icon: "article"
},
children: [
{
path: "/busStop",
name: "busStop",
component: () => import("@/views/backOfficeSystem/busStop/index"),
meta: {
title: "公交站点管理",
icon: "article-ranking"
}
}
]
},
{
path: "/ticketPurchase",
meta: {
title: "购票管理",
icon: "article"
},
children: [
{
path: "/ticketPurchase",
name: "ticketPurchase",
component: () =>
import("@/views/backOfficeSystem/ticketPurchase/index"),
meta: {
title: "购票管理",
icon: "article-ranking"
}
}
]
},
{
path: "/forewarning",
meta: {
title: "预警管理",
icon: "article"
},
children: [
{
path: "/forewarning",
name: "forewarning",
component: () =>
import("@/views/backOfficeSystem/forewarning/index"),
meta: {
title: "预警管理",
icon: "article-ranking"
}
}
]
}
// {
// path: "/vehiclesCity",
// meta: {
// title: "车辆管理",
// icon: "article"
// },
// children: [
// {
// path: "/vehiclesCity",
// name: "vehiclesCity",
// component: () =>
// import("@/views/backOfficeSystem/vehiclesCity/index"),
// meta: {
// title: "车辆管理",
// icon: "article-ranking"
// }
// }
// ]
// },
// {
// path: "/practitioner",
// meta: {
// title: "从业人员",
// icon: "article"
// },
// children: [
// {
// path: "/practitioner",
// name: "practitioner",
// component: () =>
// import("@/views/backOfficeSystem/practitioner/index"),
// meta: {
// title: "从业人员",
// icon: "article-ranking"
// }
// }
// ]
// }
]
}
];
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;