Compare commits
2 Commits
f7bf5a86ea
...
36275eb307
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
36275eb307 | ||
|
|
263bba264a |
@@ -1,6 +1,6 @@
|
||||
import { useEffect, lazy, Suspense, useMemo } from 'react';
|
||||
import { HashRouter, Routes, Route, Navigate } from 'react-router-dom';
|
||||
import { ConfigProvider, theme as antdTheme, Spin } from 'antd';
|
||||
import { ConfigProvider, theme as antdTheme, Spin, Result } from 'antd';
|
||||
import zhCN from 'antd/locale/zh_CN';
|
||||
import MainLayout from './layouts/MainLayout';
|
||||
import Login from './pages/Login';
|
||||
@@ -71,6 +71,19 @@ const ArticleEditor = lazy(() => import('./pages/health/ArticleEditor'));
|
||||
const ArticleCategoryManage = lazy(() => import('./pages/health/ArticleCategoryManage'));
|
||||
const ArticleTagManage = lazy(() => import('./pages/health/ArticleTagManage'));
|
||||
|
||||
const FROZEN_ROUTES = [
|
||||
'/health/care-plans',
|
||||
'/health/shifts',
|
||||
'/health/family-proxy',
|
||||
'/health/medications',
|
||||
'/health/dialysis',
|
||||
'/health/schedules',
|
||||
];
|
||||
|
||||
function FrozenRoute() {
|
||||
return <Result status="info" title="功能暂未开放" subTitle="该功能正在优化中,敬请期待" />;
|
||||
}
|
||||
|
||||
function PrivateRoute({ children }: { children: React.ReactNode }) {
|
||||
const isAuthenticated = useAuthStore((s) => s.isAuthenticated);
|
||||
const permissions = useAuthStore((s) => s.permissions);
|
||||
@@ -91,6 +104,11 @@ function PrivateRoute({ children }: { children: React.ReactNode }) {
|
||||
if (!hasAccess) return <Navigate to="/" replace />;
|
||||
}
|
||||
|
||||
// 冻结路由检查
|
||||
if (FROZEN_ROUTES.some((frozen) => path.startsWith(frozen))) {
|
||||
return <FrozenRoute />;
|
||||
}
|
||||
|
||||
return <>{children}</>;
|
||||
}
|
||||
|
||||
|
||||
@@ -123,6 +123,7 @@ mod m20260505_000120_create_ai_knowledge_rules;
|
||||
mod m20260505_000121_create_ai_knowledge_references;
|
||||
mod m20260505_000122_create_ai_knowledge_guides;
|
||||
mod m20260505_000123_update_ai_prompts_system_instruction;
|
||||
mod m20260505_000124_freeze_deferred_menus;
|
||||
|
||||
pub struct Migrator;
|
||||
|
||||
@@ -253,6 +254,7 @@ impl MigratorTrait for Migrator {
|
||||
Box::new(m20260505_000121_create_ai_knowledge_references::Migration),
|
||||
Box::new(m20260505_000122_create_ai_knowledge_guides::Migration),
|
||||
Box::new(m20260505_000123_update_ai_prompts_system_instruction::Migration),
|
||||
Box::new(m20260505_000124_freeze_deferred_menus::Migration),
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
//! 冻结推迟模块的菜单 — 将 visible 设为 false
|
||||
|
||||
use sea_orm_migration::prelude::*;
|
||||
|
||||
#[derive(DeriveMigrationName)]
|
||||
pub struct Migration;
|
||||
|
||||
#[async_trait::async_trait]
|
||||
impl MigrationTrait for Migration {
|
||||
async fn up(&self, manager: &SchemaManager) -> Result<(), DbErr> {
|
||||
let db = manager.get_connection();
|
||||
|
||||
let frozen_paths = [
|
||||
"/health/care-plans",
|
||||
"/health/shifts",
|
||||
"/health/family-proxy",
|
||||
"/health/medications",
|
||||
"/health/dialysis",
|
||||
"/health/schedules",
|
||||
"/health/appointments",
|
||||
];
|
||||
|
||||
for path in &frozen_paths {
|
||||
db.execute(sea_orm::Statement::from_string(
|
||||
sea_orm::DatabaseBackend::Postgres,
|
||||
format!(
|
||||
"UPDATE menus SET visible = false WHERE path = '{}'",
|
||||
path
|
||||
),
|
||||
))
|
||||
.await?;
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
async fn down(&self, manager: &SchemaManager) -> Result<(), DbErr> {
|
||||
let db = manager.get_connection();
|
||||
|
||||
let frozen_paths = [
|
||||
"/health/care-plans",
|
||||
"/health/shifts",
|
||||
"/health/family-proxy",
|
||||
"/health/medications",
|
||||
"/health/dialysis",
|
||||
"/health/schedules",
|
||||
"/health/appointments",
|
||||
];
|
||||
|
||||
for path in &frozen_paths {
|
||||
db.execute(sea_orm::Statement::from_string(
|
||||
sea_orm::DatabaseBackend::Postgres,
|
||||
format!(
|
||||
"UPDATE menus SET visible = true WHERE path = '{}'",
|
||||
path
|
||||
),
|
||||
))
|
||||
.await?;
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user