Files
NoticeFront/src/router/routes.ts
T
2026-09-08 20:22:52 +08:00

94 lines
3.8 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import type { RouteRecordRaw } from "vue-router";
/**
* 通知公告模块路由(扁平短路由,与基础平台模块 path 一致)。
* 页面间参数通过 query 传递:
* - /list/new?serid= (编辑)
* - /list/new?fid= (转发)
* - /list/new?tempid=(模板引用)
* - /list/detail?serid=&type=、/noticelist/detail?serid=&type=
* type: 0=编辑视角(不标读) 1=普通查看(标读)
*
* modId 是菜单 ↔ 路由的稳定契约(对照后端 GetUserMod 现行数据):
* 1=已收到 2=已发送 3=全部通知 4=通知统计 21=应用设置
* 发通知为「已发送」的深层子页(modId 22 不在菜单树,meta.parentId=2 关联高亮),
* 与 UserBase「应用管理>应用类型管理」范式一致。
*/
const routes: RouteRecordRaw[] = [
// 已收通知(收件箱):后端菜单 page 配置为 "/",即应用入口页
{
path: "/",
name: "notice_accept",
component: () => import("@/views/notice/NoticeAccept.vue"),
meta: { title: "已收到", modId: 1 },
},
// 已发送
{
path: "/list",
name: "notice_list",
component: () => import("@/views/notice/NoticeList.vue"),
meta: { title: "已发送", modId: 2 },
},
// 发通知(新建/编辑/转发/模板):已发送的深层子页,不在菜单里,
// layout.vue 按.meta.parentId 推导面包屑「已发送>发通知」并高亮父菜单
{
path: "/list/new",
name: "new_notice",
component: () => import("@/views/notice/NewNotice.vue"),
meta: { title: "发通知", modId: 22, parentId: 2 },
},
// 全部通知(管理端)
{
path: "/noticelist",
name: "notice_manage",
component: () => import("@/views/notice/NoticeList.vue"),
meta: { title: "全部通知", modId: 3 },
},
// 通知详情(同一组件挂两个路由,面包屑/菜单高亮由 meta.parentId 确定父节点:
// 已发送下 /list/detail,全部通知下 /noticelist/detail;type 区分是否标读)
{
path: "/list/detail",
name: "notice_list_detail",
component: () => import("@/views/notice/NoticeDetails.vue"),
meta: { title: "通知详情", modId: 23, parentId: 2 },
},
{
path: "/noticelist/detail",
name: "notice_manage_detail",
component: () => import("@/views/notice/NoticeDetails.vue"),
meta: { title: "通知详情", modId: 24, parentId: 3 },
},
// 通知统计(旧版行为:整页跳转外部统计系统)
{
path: "/stats",
name: "notice_stats",
component: () => import("@/views/notice/NoticeStats.vue"),
meta: { title: "通知统计", modId: 4 },
},
// 应用设置(发文部门 + 自定义组)
{
path: "/setting",
name: "notice_setting",
component: () => import("@/views/notice/NoticeSetting.vue"),
meta: { title: "应用设置", modId: 21 },
},
/* ---- 旧版路径兼容重定向(书签、残留的平台模块配置) ---- */
{ path: "/accept", redirect: "/" },
{ path: "/details", redirect: "/list/detail" },
{ path: "/newnotice", redirect: "/list/new" },
{ path: "/edit", redirect: "/list/new" },
{ path: "/manage", redirect: "/noticelist" },
{ path: "/notice", redirect: "/accept" },
{ path: "/notice/newnotice", redirect: "/list/new" },
{ path: "/notice/edit", redirect: "/list/new" },
{ path: "/notice/notice_accept", redirect: "/accept" },
{ path: "/notice/notice_list", redirect: "/list" },
{ path: "/notice/manage", redirect: "/noticelist" },
{ path: "/notice/notice_details", redirect: "/list/detail" },
{ path: "/notice/statistics", redirect: "/stats" },
{ path: "/notice/setting", redirect: "/setting" },
];
export default routes;