feat: 添加部门管理功能、主题切换和多语言支持

refactor(dashboard): 重构用户管理页面和路由结构

feat(server): 实现部门管理API和RBAC增强功能

docs: 更新用户手册和管理员指南文档

style: 统一图标使用和组件命名规范

test: 添加部门服务和数据隔离测试用例

chore: 更新依赖和配置文件
This commit is contained in:
2026-03-28 22:52:12 +08:00
parent 22308fe042
commit d327706087
87 changed files with 21372 additions and 4806 deletions

View File

@@ -46,6 +46,9 @@ import {
import type { MenuProps } from 'antd';
import { UserProvider, useUser, MOCK_USERS, ROLE_CONFIG, FEATURES, PERMISSIONS } from '@/contexts/UserContext';
import { LocaleProvider, useLocale } from '@/contexts/LocaleContext';
import { ThemeProvider } from '@/contexts/ThemeContext';
import ThemeSwitch from '@/components/ThemeSwitch';
import Breadcrumb from '@/components/Breadcrumb';
interface CustomMenuItem {
key: string;
@@ -91,21 +94,21 @@ const MainLayoutContent: FC = () => {
{ key: '/dashboard/strategy-marketplace', label: <Link to="/dashboard/strategy-marketplace">{t('menu.strategyMarketplace')}</Link> },
{ key: '/dashboard/auto-product-selection', label: <Link to="/dashboard/auto-product-selection">{t('menu.autoProductSelection')}</Link> },
{ key: '/dashboard/auto-execution', label: <Link to="/dashboard/auto-execution">{t('menu.autoExecution')}</Link> },
{ key: '/dashboard/workflow', label: <Link to="/dashboard/workflow">{t('menu.workflowManagement')}</Link> },
],
},
{
key: 'product-cycle',
icon: <ShoppingOutlined />,
label: t('menu.productCycle'),
children: [
{ key: '/dashboard/product', label: <Link to="/dashboard/product">{t('menu.productManagement')}</Link>, requiredPermission: PERMISSIONS.PRODUCT_READ },
{ key: '/dashboard/product/publish', label: <Link to="/dashboard/product/publish">{t('menu.productPublish')}</Link>, requiredPermission: PERMISSIONS.PRODUCT_WRITE },
{ key: '/dashboard/inventory', label: <Link to="/dashboard/inventory">{t('menu.inventoryManagement')}</Link>, requiredPermission: PERMISSIONS.INVENTORY_READ },
{ key: '/dashboard/inventory/warehouses', label: <Link to="/dashboard/inventory/warehouses">{t('menu.warehouseManagement')}</Link> },
{ key: '/dashboard/product/ai-pricing', label: <Link to="/dashboard/product/ai-pricing">{t('menu.aiPricing')}</Link>, requiredFeature: FEATURES.AUTO_PRICING },
{ key: '/dashboard/product/profit-monitor', label: <Link to="/dashboard/product/profit-monitor">{t('menu.profitMonitor')}</Link> },
],
},
key: 'product-cycle',
icon: <ShoppingOutlined />,
label: t('menu.productCycle'),
children: [
{ key: '/dashboard/product', label: <Link to="/dashboard/product">{t('menu.productManagement')}</Link>, requiredPermission: PERMISSIONS.PRODUCT_READ },
{ key: '/dashboard/product/publish', label: <Link to="/dashboard/product/publish">{t('menu.productPublish')}</Link>, requiredPermission: PERMISSIONS.PRODUCT_WRITE },
{ key: '/dashboard/inventory', label: <Link to="/dashboard/inventory">{t('menu.inventoryManagement')}</Link>, requiredPermission: PERMISSIONS.INVENTORY_READ },
{ key: '/dashboard/product/ai-pricing', label: <Link to="/dashboard/product/ai-pricing">{t('menu.aiPricing')}</Link>, requiredFeature: FEATURES.AUTO_PRICING },
{ key: '/dashboard/product/profit-monitor', label: <Link to="/dashboard/product/profit-monitor">{t('menu.profitMonitor')}</Link> },
],
},
{
key: 'order-cycle',
icon: <FileTextOutlined />,
@@ -156,6 +159,7 @@ const MainLayoutContent: FC = () => {
label: t('menu.analytics'),
children: [
{ key: '/dashboard/analytics', label: <Link to="/dashboard/analytics">{t('menu.dataAnalysis')}</Link> },
{ key: '/dashboard/analytics/dashboard', label: <Link to="/dashboard/analytics/dashboard">{t('menu.analyticsDashboard')}</Link> },
{ key: '/dashboard/reports', label: <Link to="/dashboard/reports">{t('menu.reportCenter')}</Link> },
{ key: '/dashboard/multi-shop-report', label: <Link to="/dashboard/multi-shop-report">{t('menu.multiShopReport')}</Link>, requiredFeature: FEATURES.MULTI_SHOP },
{ key: '/dashboard/leaderboard', label: <Link to="/dashboard/leaderboard">{t('menu.leaderboard')}</Link> },
@@ -207,17 +211,18 @@ const MainLayoutContent: FC = () => {
],
},
{
key: 'settings',
icon: <SettingOutlined />,
label: t('menu.settings'),
children: [
{ key: '/dashboard/settings', label: <Link to="/dashboard/settings">{t('menu.settingsOverview')}</Link> },
{ key: '/dashboard/settings/platform-auth', label: <Link to="/dashboard/settings/platform-auth">{t('menu.platformAuth')}</Link> },
{ key: '/dashboard/settings/service-manager', label: <Link to="/dashboard/settings/service-manager">{t('menu.serviceManager')}</Link> },
{ key: '/dashboard/user', label: <Link to="/dashboard/user">{t('menu.userManagement')}</Link> },
{ key: '/dashboard/role', label: <Link to="/dashboard/role">{t('menu.rolePermissions')}</Link> },
],
},
key: 'settings',
icon: <SettingOutlined />,
label: t('menu.settings'),
children: [
{ key: '/dashboard/settings', label: <Link to="/dashboard/settings">{t('menu.settingsOverview')}</Link> },
{ key: '/dashboard/settings/platform-auth', label: <Link to="/dashboard/settings/platform-auth">{t('menu.platformAuth')}</Link> },
{ key: '/dashboard/settings/service-manager', label: <Link to="/dashboard/settings/service-manager">{t('menu.serviceManager')}</Link> },
{ key: '/dashboard/settings/subscription', label: <Link to="/dashboard/settings/subscription">{t('menu.subscription')}</Link> },
{ key: '/dashboard/user', label: <Link to="/dashboard/user">{t('menu.userManagement')}</Link> },
{ key: '/dashboard/role', label: <Link to="/dashboard/role">{t('menu.rolePermissions')}</Link> },
],
},
], [t]);
const menuItems = useMemo(() => {
@@ -516,6 +521,8 @@ const MainLayoutContent: FC = () => {
<BellOutlined style={{ fontSize: '18px', cursor: 'pointer', color: '#666' }} />
</Badge>
<ThemeSwitch />
<Dropdown
menu={{
items: [
@@ -573,6 +580,7 @@ const MainLayoutContent: FC = () => {
boxShadow: '0 1px 2px rgba(0, 0, 0, 0.06)',
}}
>
<Breadcrumb />
<Outlet context={{ currentUser, hasPermission, hasFeature, isPaidUser }} />
</div>
</Content>
@@ -583,11 +591,13 @@ const MainLayoutContent: FC = () => {
const MainLayout: FC = () => {
return (
<LocaleProvider>
<UserProvider>
<MainLayoutContent />
</UserProvider>
</LocaleProvider>
<ThemeProvider>
<LocaleProvider>
<UserProvider>
<MainLayoutContent />
</UserProvider>
</LocaleProvider>
</ThemeProvider>
);
};