Files
his/healthlink-his-ui/src/router/index.js
华佗 a1e77e0962 fix: resolve login failure - fix Invalid path errors
Root causes:
1. Menu 2084 (门诊医生工作站) path='/' → getRouterPath() produces '//'
   which is an invalid Vue Router path. Disabled since doctor station
   routes are already hardcoded in router/index.js
2. Menu 4 (经创贺联官网) outer link at root level created conflicting
   route at path='/'. Disabled.
3. 38 orphaned menus (children of disabled parents) became unexpected
   top-level routes. Disabled all.
4. 16 name conflicts between API routes and hardcoded dynamicRoutes.
   Removed duplicate hardcoded routes (Monitor, Tool, DoctorStation,
   AppoinmentManage, ClinicManagement, ConsultationManagement,
   MedicationManagement, Inspection). Kept only unique parameterized
   routes (SetUser, SetContract, AuthRole, AuthUser, JobLog, GenEdit,
   HelpCenter, Todo, Features).
5. Fixed consultationapplication component path to correct location.
6. Created missing infection/antibiotic-usage/index.vue placeholder.
7. Disabled menus with missing Vue components (表单构建, 业务规则配置).

Database changes (via direct SQL):
- Disabled menus: 4, 115, 2073, 2084, 20211
- Fixed menu 2161 component path
- Disabled 38 orphaned child menus

Verification:
- Login: 200 
- GetRouters: 200 
- All 12 key APIs: 200 
- 0 path issues, 0 name conflicts, 0 missing components
- 342 total routes, 45 top-level directories
2026-06-07 15:04:28 +08:00

318 lines
10 KiB
JavaScript
Executable File
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 {createWebHistory, createRouter} from 'vue-router'
/* Layout */
import Layout from '@/layout'
/**
* Note: 路由配置项
*
* hidden: true // 当设置 true 的时候该路由不会再侧边栏出现 如401login等页面或者如一些编辑页面/edit/1
* alwaysShow: true // 当你一个路由下面的 children 声明的路由大于1个时自动会变成嵌套的模式--如组件页面
* // 只有一个时,会将那个子路由当做根路由显示在侧边栏--如引导页面
* // 若你想不管路由下面的 children 声明的个数都显示你的根路由
* // 你可以设置 alwaysShow: true这样它就会忽略之前定义的规则一直显示根路由
* redirect: noRedirect // 当设置 noRedirect 的时候该路由在面包屑导航中不可被点击
* name:'router-name' // 设定路由的名字,一定要填写不然使用<keep-alive>时会出现各种问题
* query: '{"id": 1, "name": "ry"}' // 访问路由的默认传递参数
* roles: ['admin', 'common'] // 访问路由的角色权限
* permissions: ['a:a:a', 'b:b:b'] // 访问路由的菜单权限
* meta : {
noCache: true // 如果设置为true则不会被 <keep-alive> 缓存(默认 false)
title: 'title' // 设置该路由在侧边栏和面包屑中展示的名字
icon: 'svg-name' // 设置该路由的图标对应路径src/assets/icons/svg
breadcrumb: false // 如果设置为false则不会在breadcrumb面包屑中显示
activeMenu: '/system/user' // 当路由设置了该属性,则会高亮相对应的侧边栏。
}
*/
// 公共路由
export const constantRoutes = [
{
path: '/redirect',
component: Layout,
hidden: true,
children: [
{
path: '/redirect/:path(.*)',
component: () => import('@/views/redirect/index.vue')
}
]
},
{
path: '/login',
component: () => import('@/views/login'),
hidden: true
},
{
path: '/register',
component: () => import('@/views/register'),
hidden: true
},
{
path: '/401',
component: () => import('@/views/error/401'),
hidden: true
},
{
path: '/lock',
component: () => import('@/views/lock'),
hidden: true
},
{
path: '',
component: Layout,
redirect: '/index',
children: [
{
path: '/index',
component: () => import('@/views/index'),
name: 'Index',
meta: {title: '首页', icon: 'dashboard', affix: true}
}
]
},
{
path: '/user',
component: Layout,
hidden: true,
redirect: 'noredirect',
children: [
{
path: 'profile',
component: () => import('@/views/system/user/profile/index'),
name: 'Profile',
meta: {title: '个人中心', icon: 'user'}
}
]
},
// 住院护士站 — 快捷访问路由(与 sys_menu 中 menu_id=295 的动态路由并存,路径不同不冲突)
{
path: '/inpatientNurse',
component: Layout,
hidden: true,
redirect: '/inpatientNurse/inpatientNurseStation',
children: [
{
path: 'inpatientNurseStation',
component: () => import('@/views/inpatientNurse/inpatientNurseStation/index.vue'),
name: 'InpatientNurseStation',
meta: {title: '住院护士站'}
},
{
path: 'medicalOrderExecution',
component: () => import('@/views/inpatientNurse/medicalOrderExecution/index.vue'),
name: 'MedicalOrderExecution',
meta: {title: '医嘱执行'}
},
{
path: 'medicalOrderProofread',
component: () => import('@/views/inpatientNurse/medicalOrderProofread/index.vue'),
name: 'MedicalOrderProofread',
meta: {title: '医嘱校对'}
},
{
path: 'medicineCollect',
component: () => import('@/views/inpatientNurse/medicineCollect/index.vue'),
name: 'MedicineCollect',
meta: {title: '领药管理'}
},
{
path: 'tprsheet',
component: () => import('@/views/inpatientNurse/tprsheet/index.vue'),
name: 'TprSheet',
meta: {title: '体温单'}
},
{
path: 'nursingRecord',
component: () => import('@/views/inpatientNurse/nursingRecord/index.vue'),
name: 'NursingRecord',
meta: {title: '护理记录'}
}
]
},
// 添加套餐管理相关路由到公共路由,确保始终可用
{
path: '/maintainSystem/Inspection/PackageManagement',
component: Layout,
hidden: true,
children: [
{
path: '',
component: () => import('@/views/maintainSystem/Inspection/PackageManagement.vue'),
name: 'DirectPackageManagement',
meta: {title: '套餐管理'}
}
]
}
]
// 动态路由,基于用户权限动态去加载
export const dynamicRoutes = [
// ===== 系统管理子路由(含动态参数,无法由后端菜单生成)=====
{
path: '/system/tenant-user',
component: Layout,
hidden: true,
permissions: ['*:*:*'],
children: [
{
path: 'set/:tenantId(\\d+)',
component: () => import('@/views/system/tenant/setUser'),
name: 'SetUser',
meta: {title: '所属用户', activeMenu: '/system/tenant'}
}
]
},
{
path: '/system/tenant-contract',
component: Layout,
hidden: true,
permissions: ['*:*:*'],
children: [
{
path: 'set/:tenantId(\\d+)',
component: () => import('@/views/system/tenant/setContract'),
name: 'SetContract',
meta: {title: '合同管理', activeMenu: '/system/tenant'}
}
]
},
{
path: '/system/user-auth',
component: Layout,
hidden: true,
permissions: ['system:user:edit'],
children: [
{
path: 'role/:userId(\\d+)',
component: () => import('@/views/system/user/authRole'),
name: 'AuthRole',
meta: {title: '分配角色', activeMenu: '/system/user'}
}
]
},
{
path: '/system/role-auth',
component: Layout,
hidden: true,
permissions: ['system:role:edit'],
children: [
{
path: 'user/:roleId(\\d+)',
component: () => import('@/views/system/role/authUser'),
name: 'AuthUser',
meta: {title: '分配用户', activeMenu: '/system/role'}
}
]
},
// ===== 监控/工具子路由(含动态参数)=====
{
path: '/monitor/job-log',
component: Layout,
hidden: true,
permissions: ['monitor:job:list'],
children: [
{
path: 'index/:jobId(\\d+)',
component: () => import('@/views/monitor/job/log'),
name: 'JobLog',
meta: {title: '调度日志', activeMenu: '/monitor/job'}
}
]
},
{
path: '/tool/gen-edit',
component: Layout,
hidden: true,
permissions: ['tool:gen:edit'],
children: [
{
path: 'index/:tableId(\\d+)',
component: () => import('@/views/tool/gen/editTable'),
name: 'GenEdit',
meta: {title: '修改生成配置', activeMenu: '/tool/gen'}
}
]
},
// ===== 帮助中心 =====
{
path: '/help-center',
component: Layout,
hidden: true,
children: [
{
path: '',
component: () => import('@/views/helpcenter/index.vue'),
name: 'HelpCenter',
meta: {
title: '帮助中心',
link: '/help-center/vuepress-theme-vdoing-doc/docs/.vuepress/dist/pages/520e67/index.html'
},
},
],
},
// ===== 待办事项 =====
{
path: '/todo',
component: Layout,
name: 'Todo',
meta: {title: '待办事项', icon: 'todo'},
children: [
{
path: '',
component: () => import('@/views/todo/index.vue'),
name: 'TodoIndex',
meta: {title: '待办列表', icon: 'todo'}
}
]
},
// ===== 功能特性 =====
{
path: '/features',
component: Layout,
name: 'Features',
meta: {title: '功能特性', icon: 'feature'},
children: [
{
path: '',
component: () => import('@/views/features/index.vue'),
name: 'FeaturesIndex',
meta: {title: '功能列表', icon: 'feature'}
},
{
path: 'config',
component: () => import('@/views/features/config.vue'),
name: 'FeaturesConfig',
meta: {title: '功能配置', icon: 'setting'}
}
]
},
];
const router = createRouter({
history: createWebHistory(),
routes: [...constantRoutes, ...dynamicRoutes],
scrollBehavior(to, from, savedPosition) {
if (savedPosition) {
return savedPosition
} else {
return {top: 0}
}
},
});
// 动态路由加载完成后再添加 404 catch-allVue Router 4 要求)
export function addNotFoundRoute() {
if (!router.hasRoute('not-found')) {
router.addRoute({
path: '/:pathMatch(.*)*',
name: 'not-found',
component: () => import('@/views/error/404'),
hidden: true
})
}
}
export default router;