| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- import { canShowAction, type Capability } from "./capabilities.ts";
- import type { LoginRole } from "./roles";
- export type NavigationItem = {
- id: "home" | "regions" | "operators" | "partners" | "operationsTeams" | "maintenanceTeams" | "packages" | "contracts" | "customers" | "importBatches" | "orders" | "shareRules" | "costs" | "settlementBatches" | "settlementBills" | "correctionNotes" | "reconcileSettings" | "workOrderOverview" | "workOrders" | "workOrderMine" | "workOrderQueue" | "workOrderDelivery" | "workOrderSettings" | "dailyTasks" | "auditLogs";
- title: string;
- path: string;
- section: string;
- capability?: Capability;
- };
- /** 只列已实现页面;后续模块落地时再添加导航,不展示空链接。 */
- export const navigationItems: readonly NavigationItem[] = [
- { id: "home", title: "概览", path: "/", section: "" },
- { id: "regions", title: "区域管理", path: "/organization/regions", section: "组织与区域" },
- { id: "operators", title: "运营商", path: "/organization/operators", section: "组织与区域" },
- { id: "partners", title: "合伙人", path: "/organization/partners", section: "组织与区域" },
- { id: "operationsTeams", title: "运营团队", path: "/organization/operations-teams", section: "组织与区域" },
- { id: "maintenanceTeams", title: "运维团队", path: "/organization/maintenance-teams", section: "组织与区域" },
- { id: "packages", title: "套餐配置", path: "/packages", section: "客户与订阅", capability: "package.manage" },
- { id: "contracts", title: "合同管理", path: "/contracts", section: "客户与订阅" },
- { id: "customers", title: "客户管理", path: "/customers", section: "客户与订阅" },
- { id: "importBatches", title: "批量导入", path: "/import-batches", section: "客户与订阅" },
- { id: "orders", title: "全部订阅", path: "/orders", section: "客户与订阅" },
- { id: "shareRules", title: "分成管理", path: "/share-rules", section: "分成与对账" },
- { id: "costs", title: "成本管理", path: "/costs", section: "分成与对账" },
- { id: "settlementBatches", title: "对账清单", path: "/settlement-batches", section: "分成与对账" },
- { id: "settlementBills", title: "账单明细", path: "/settlement-bills", section: "分成与对账" },
- { id: "correctionNotes", title: "出账更正记录", path: "/correction-notes", section: "分成与对账" },
- { id: "reconcileSettings", title: "出账配置", path: "/reconciliation-settings", section: "分成与对账" },
- /* 2026-11-17 菜单组重构:「工单与开停」→「工单与任务」,拆成总览/台账/待分派/交付与回执/工单配置五个入口;
- * 「定时任务」摘为独立菜单(section 为空=不给分组头),⛔ 再塞回工单组。
- * 2026-11-17 追加:「我的待办」也进运营侧菜单(业主:运营与运维主账号同样要有),
- * 排在总览之后——它与总览是同一件事的两个视角(全区域 vs 我名下)。 */
- { id: "workOrderOverview", title: "工单总览", path: "/work-orders/overview", section: "工单与任务" },
- { id: "workOrderMine", title: "我的待办", path: "/work-orders/mine", section: "工单与任务" },
- { id: "workOrders", title: "全部工单", path: "/work-orders", section: "工单与任务" },
- { id: "workOrderQueue", title: "待分派", path: "/work-orders/queue", section: "工单与任务" },
- { id: "workOrderDelivery", title: "交付与回执", path: "/work-orders/delivery", section: "工单与任务" },
- { id: "workOrderSettings", title: "工单配置", path: "/work-order-settings", section: "工单与任务" },
- { id: "dailyTasks", title: "定时任务", path: "/daily-tasks", section: "" },
- { id: "auditLogs", title: "审计日志", path: "/audit-logs", section: "" },
- ];
- export function getNavigationForRole(role: LoginRole): NavigationItem[] {
- return navigationItems.filter(
- (item) => !item.capability || canShowAction(role, item.capability),
- );
- }
- export function canShowNavigationPath(role: LoginRole, path: string): boolean {
- return getNavigationForRole(role).some((item) => item.path === path);
- }
|