feature: Simulation Control Center (Dashboard)
CI / backend (push) Successful in 8m43s
CI / frontend (push) Successful in 2m0s

This commit is contained in:
voltsrage
2026-08-06 02:22:55 +08:00
parent 24f45851e9
commit 1d28880920
91 changed files with 1943 additions and 25 deletions
+17 -1
View File
@@ -1,5 +1,6 @@
import { createRouter, createWebHistory } from 'vue-router'
import { useAuthStore } from '@/stores/auth'
import { useSimulationStore } from '@/stores/simulation'
import { canAccessOps, defaultRouteForRole, isDashboardRole, roleCanAccessRoute } from '@/composables/roleAccess'
const CLINICAL = ['NURSE', 'PHYSICIAN', 'ADMIN']
@@ -45,6 +46,12 @@ const routes = [
component: () => import('@/views/SepsisBoardView.vue'),
meta: { title: 'Sepsis Bundle Board', layout: 'default', allowedRoles: CLINICAL },
},
{
path: '/simulation',
name: 'SimulationControl',
component: () => import('@/views/SimulationControlView.vue'),
meta: { title: 'Simulation', layout: 'default', allowedRoles: CLINICAL, requiresSimulation: true },
},
{
path: '/admin/thresholds',
name: 'ThresholdManagement',
@@ -92,7 +99,7 @@ const router = createRouter({
routes,
})
router.beforeEach((to) => {
router.beforeEach(async (to) => {
document.title = `${to.meta.title ?? 'VigilCare'} — VigilCare`
const auth = useAuthStore()
@@ -108,6 +115,15 @@ router.beforeEach((to) => {
if (!to.meta.public && auth.isAuthenticated && !roleCanAccessRoute(auth.role, to.meta)) {
return { path: defaultRouteForRole(auth.role) }
}
if (to.meta.requiresSimulation && auth.isAuthenticated) {
const simulation = useSimulationStore()
if (!simulation.enabled) {
await simulation.loadConfig()
}
if (!simulation.enabled) {
return { path: '/ward' }
}
}
})
export default router