|
@@ -11,6 +11,7 @@ import ProfileSettings from './components/ProfileSettings';
|
|
|
import CockpitDashboard from './components/CockpitDashboard';
|
|
import CockpitDashboard from './components/CockpitDashboard';
|
|
|
import LockCabinetDetail from './components/lockCabinet/LockCabinetDetail';
|
|
import LockCabinetDetail from './components/lockCabinet/LockCabinetDetail';
|
|
|
import NotificationManagement from './components/NotificationManagement';
|
|
import NotificationManagement from './components/NotificationManagement';
|
|
|
|
|
+import FormManagement from './components/FormManagement';
|
|
|
import { authApi } from './api';
|
|
import { authApi } from './api';
|
|
|
import { toast } from 'sonner';
|
|
import { toast } from 'sonner';
|
|
|
import { Toaster } from 'sonner';
|
|
import { Toaster } from 'sonner';
|
|
@@ -104,6 +105,7 @@ export default function Dashboard() {
|
|
|
|
|
|
|
|
// 隔离作业相关
|
|
// 隔离作业相关
|
|
|
if (path === '/jobTicket' || path.startsWith('/jobTicket') || path === '/isolation' || path.startsWith('/isolation') || path === '/CustomWorkflow' || path.startsWith('/CustomWorkflow') || path === '/sopm' || path.startsWith('/sopm')) {
|
|
if (path === '/jobTicket' || path.startsWith('/jobTicket') || path === '/isolation' || path.startsWith('/isolation') || path === '/CustomWorkflow' || path.startsWith('/CustomWorkflow') || path === '/sopm' || path.startsWith('/sopm')) {
|
|
|
|
|
+ if (path.includes('/form') || path.endsWith('/form')) return 'formManagement';
|
|
|
if (path.includes('job') || path.endsWith('/job')) return 'workManagement';
|
|
if (path.includes('job') || path.endsWith('/job')) return 'workManagement';
|
|
|
if (path.includes('sop') || path.endsWith('/sop')) return 'sopManagement';
|
|
if (path.includes('sop') || path.endsWith('/sop')) return 'sopManagement';
|
|
|
if (path.includes('design') || path.endsWith('/design')) return 'processDesign';
|
|
if (path.includes('design') || path.endsWith('/design')) return 'processDesign';
|
|
@@ -180,6 +182,7 @@ export default function Dashboard() {
|
|
|
{ key: 'sopManagement', icon: BookOpen, path: '/isolation/record', name: 'SOP管理' },
|
|
{ key: 'sopManagement', icon: BookOpen, path: '/isolation/record', name: 'SOP管理' },
|
|
|
{ key: 'workManagement', icon: Activity, path: '/isolation/list', name: '作业管理' },
|
|
{ key: 'workManagement', icon: Activity, path: '/isolation/list', name: '作业管理' },
|
|
|
{ key: 'processDesign', icon: Workflow, path: '/jobTicket/design', name: '流程设计' },
|
|
{ key: 'processDesign', icon: Workflow, path: '/jobTicket/design', name: '流程设计' },
|
|
|
|
|
+ { key: 'formManagement', icon: FileText, path: '/jobTicket/form', name: '表单管理' },
|
|
|
],
|
|
],
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|
|
@@ -371,6 +374,7 @@ export default function Dashboard() {
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
let childKey: string = mapBackendPathToFrontendKey(child.path) || '';
|
|
let childKey: string = mapBackendPathToFrontendKey(child.path) || '';
|
|
|
|
|
+ console.log('处理子菜单:', { path: child.path, mappedKey: childKey });
|
|
|
if (!childKey) {
|
|
if (!childKey) {
|
|
|
// 如果无法映射,尝试根据路径推断
|
|
// 如果无法映射,尝试根据路径推断
|
|
|
// 优先处理 clientSystem/IsolationWork 路径
|
|
// 优先处理 clientSystem/IsolationWork 路径
|
|
@@ -386,6 +390,21 @@ export default function Dashboard() {
|
|
|
} else {
|
|
} else {
|
|
|
childKey = 'isolationWork';
|
|
childKey = 'isolationWork';
|
|
|
}
|
|
}
|
|
|
|
|
+ } else if (child.path.includes('/jobTicket') || child.path.startsWith('/jobTicket')) {
|
|
|
|
|
+ // 处理 /jobTicket 路径
|
|
|
|
|
+ if (child.path.includes('/form') || child.path.endsWith('/form')) {
|
|
|
|
|
+ childKey = 'formManagement';
|
|
|
|
|
+ } else if (child.path.includes('/processDesign') || child.path.endsWith('/design')) {
|
|
|
|
|
+ childKey = 'processDesign';
|
|
|
|
|
+ } else if (child.path.includes('/sop') || child.path.endsWith('/sop')) {
|
|
|
|
|
+ childKey = 'sopManagement';
|
|
|
|
|
+ } else if (child.path.includes('/job') || child.path.endsWith('/job')) {
|
|
|
|
|
+ childKey = 'workManagement';
|
|
|
|
|
+ } else if (child.path.includes('/step') || child.path.includes('/template')) {
|
|
|
|
|
+ childKey = 'processTemplate';
|
|
|
|
|
+ } else {
|
|
|
|
|
+ childKey = 'isolationWork';
|
|
|
|
|
+ }
|
|
|
} else if (child.path.includes('/dept')) {
|
|
} else if (child.path.includes('/dept')) {
|
|
|
childKey = 'departmentManagement';
|
|
childKey = 'departmentManagement';
|
|
|
} else if (child.path.includes('/menu')) {
|
|
} else if (child.path.includes('/menu')) {
|
|
@@ -403,6 +422,7 @@ export default function Dashboard() {
|
|
|
childKey = child.path.replace(/[^a-zA-Z0-9]/g, '_') || `child_${child.id}`;
|
|
childKey = child.path.replace(/[^a-zA-Z0-9]/g, '_') || `child_${child.id}`;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+ console.log('最终 childKey:', childKey);
|
|
|
|
|
|
|
|
// 检查是否已经添加过(去重)
|
|
// 检查是否已经添加过(去重)
|
|
|
const subMenuKey = `${frontendKey}_${childKey}`;
|
|
const subMenuKey = `${frontendKey}_${childKey}`;
|
|
@@ -591,6 +611,11 @@ export default function Dashboard() {
|
|
|
// 硬件管理的子菜单
|
|
// 硬件管理的子菜单
|
|
|
setActiveMenu('hardwareManagement');
|
|
setActiveMenu('hardwareManagement');
|
|
|
setActiveSubMenu(menuKey);
|
|
setActiveSubMenu(menuKey);
|
|
|
|
|
+ } else if (menuKey === 'formManagement' || menuKey === 'processDesign' || menuKey === 'sopManagement' ||
|
|
|
|
|
+ menuKey === 'workManagement' || menuKey === 'processTemplate') {
|
|
|
|
|
+ // 隔离作业的子菜单
|
|
|
|
|
+ setActiveMenu('isolationWork');
|
|
|
|
|
+ setActiveSubMenu(menuKey);
|
|
|
} else if (filteredSubMenuConfig[menuKey] && filteredSubMenuConfig[menuKey].length > 0) {
|
|
} else if (filteredSubMenuConfig[menuKey] && filteredSubMenuConfig[menuKey].length > 0) {
|
|
|
// 其他菜单,设置第一个子菜单
|
|
// 其他菜单,设置第一个子菜单
|
|
|
setActiveMenu(menuKey);
|
|
setActiveMenu(menuKey);
|
|
@@ -648,6 +673,11 @@ export default function Dashboard() {
|
|
|
// 硬件管理的子菜单
|
|
// 硬件管理的子菜单
|
|
|
setActiveMenu('hardwareManagement');
|
|
setActiveMenu('hardwareManagement');
|
|
|
setActiveSubMenu(menuKey);
|
|
setActiveSubMenu(menuKey);
|
|
|
|
|
+ } else if (menuKey === 'formManagement' || menuKey === 'processDesign' || menuKey === 'sopManagement' ||
|
|
|
|
|
+ menuKey === 'workManagement' || menuKey === 'processTemplate') {
|
|
|
|
|
+ // 隔离作业的子菜单
|
|
|
|
|
+ setActiveMenu('isolationWork');
|
|
|
|
|
+ setActiveSubMenu(menuKey);
|
|
|
} else if (filteredSubMenuConfig[menuKey] && filteredSubMenuConfig[menuKey].length > 0) {
|
|
} else if (filteredSubMenuConfig[menuKey] && filteredSubMenuConfig[menuKey].length > 0) {
|
|
|
// 其他菜单,设置第一个子菜单
|
|
// 其他菜单,设置第一个子菜单
|
|
|
setActiveMenu(menuKey);
|
|
setActiveMenu(menuKey);
|
|
@@ -1017,9 +1047,19 @@ export default function Dashboard() {
|
|
|
) : activeMenu === 'locationManagement' ? (
|
|
) : activeMenu === 'locationManagement' ? (
|
|
|
<SegregationPointManagement />
|
|
<SegregationPointManagement />
|
|
|
) : activeMenu === 'isolationWork' ? (
|
|
) : activeMenu === 'isolationWork' ? (
|
|
|
- <IsolationWork subMenu={
|
|
|
|
|
- filteredSubMenuConfig[activeMenu]?.find(item => item.key === activeSubMenu)?.name || activeSubMenu
|
|
|
|
|
- } />
|
|
|
|
|
|
|
+ (() => {
|
|
|
|
|
+ // 调试信息
|
|
|
|
|
+ console.log('检查隔离作业子菜单:', { activeMenu, activeSubMenu, location: location.pathname });
|
|
|
|
|
+ // 支持 'formManagement' 和 'form' 两种 key
|
|
|
|
|
+ if (activeSubMenu === 'formManagement' || activeSubMenu === 'form' || location.pathname.includes('/form')) {
|
|
|
|
|
+ console.log('✅ 渲染 FormManagement 组件', { activeMenu, activeSubMenu });
|
|
|
|
|
+ return <FormManagement />;
|
|
|
|
|
+ } else {
|
|
|
|
|
+ const subMenuName = filteredSubMenuConfig[activeMenu]?.find(item => item.key === activeSubMenu)?.name || activeSubMenu;
|
|
|
|
|
+ console.log('⚠️ 渲染 IsolationWork 组件', { activeMenu, activeSubMenu, subMenuName });
|
|
|
|
|
+ return <IsolationWork subMenu={subMenuName} />;
|
|
|
|
|
+ }
|
|
|
|
|
+ })()
|
|
|
) : activeMenu === 'notificationManagement' ? (
|
|
) : activeMenu === 'notificationManagement' ? (
|
|
|
<NotificationManagement />
|
|
<NotificationManagement />
|
|
|
) : (
|
|
) : (
|