app.routes.ts 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513
  1. import { Routes } from '@angular/router';
  2. import { WxworkAuthGuard } from './wxwork-auth-guard';
  3. import { CustomWxworkAuthGuard } from './custom-wxwork-auth-guard';
  4. export const routes: Routes = [
  5. // 客服路由
  6. {
  7. path: 'customer-service',
  8. loadComponent: () => import('./pages/customer-service/customer-service-layout/customer-service-layout').then(m => m.CustomerServiceLayout),
  9. canActivate: [WxworkAuthGuard],
  10. children: [
  11. { path: '', redirectTo: 'dashboard', pathMatch: 'full' },
  12. {
  13. path: 'dashboard',
  14. loadComponent: () => import('./pages/customer-service/dashboard/dashboard').then(m => m.Dashboard),
  15. title: '客服工作台'
  16. },
  17. {
  18. path: 'consultation-order',
  19. loadComponent: () => import('./pages/customer-service/consultation-order/consultation-order').then(m => m.ConsultationOrder),
  20. title: '客户咨询与下单'
  21. },
  22. {
  23. path: 'project-list',
  24. loadComponent: () => import('./pages/customer-service/project-list/project-list').then(m => m.ProjectList),
  25. title: '项目列表'
  26. },
  27. {
  28. path: 'case-library',
  29. loadComponent: () => import('./pages/customer-service/case-library/case-library').then(m => m.CaseLibrary),
  30. title: '案例库'
  31. },
  32. {
  33. path: 'case-detail/:id',
  34. loadComponent: () => import('./pages/customer-service/case-detail/case-detail.component').then(m => m.CaseDetailComponent),
  35. title: '案例详情'
  36. },
  37. {
  38. path: 'after-sales',
  39. loadComponent: () => import('./pages/customer-service/dashboard/pages/after-sales/after-sales.component').then(m => m.AfterSalesComponent),
  40. title: '售后服务'
  41. },
  42. // 工作台子页面路由
  43. {
  44. path: 'consultation-list',
  45. loadComponent: () => import('./pages/customer-service/dashboard/pages/consultation-list/consultation-list.component').then(m => m.ConsultationListComponent),
  46. title: '咨询列表'
  47. },
  48. {
  49. path: 'assignment-list',
  50. loadComponent: () => import('./pages/customer-service/dashboard/pages/assignment-list/assignment-list.component').then(m => m.AssignmentListComponent),
  51. title: '待派单列表'
  52. },
  53. {
  54. path: 'exception-list',
  55. loadComponent: () => import('./pages/customer-service/dashboard/pages/exception-list/exception-list.component').then(m => m.ExceptionListComponent),
  56. title: '异常项目列表'
  57. },
  58. ]
  59. },
  60. // 设计师路由(支持cid参数)
  61. {
  62. path: ':cid/designer',
  63. canActivate: [WxworkAuthGuard],
  64. children: [
  65. { path: '', redirectTo: 'dashboard', pathMatch: 'full' },
  66. {
  67. path: 'dashboard',
  68. loadComponent: () => import('./pages/designer/dashboard/dashboard').then(m => m.Dashboard),
  69. title: '设计师工作台'
  70. },
  71. {
  72. path: 'project-detail/:id',
  73. loadComponent: () => import('./pages/designer/project-detail/project-detail').then(m => m.ProjectDetail),
  74. title: '项目详情'
  75. },
  76. {
  77. path: 'personal-board',
  78. loadComponent: () => import('./pages/designer/personal-board/personal-board').then(m => m.PersonalBoard),
  79. title: '个人看板'
  80. }
  81. ]
  82. },
  83. // 兼容旧路由(不带cid)
  84. {
  85. path: 'designer',
  86. canActivate: [WxworkAuthGuard],
  87. children: [
  88. { path: '', redirectTo: 'dashboard', pathMatch: 'full' },
  89. {
  90. path: 'dashboard',
  91. loadComponent: () => import('./pages/designer/dashboard/dashboard').then(m => m.Dashboard),
  92. title: '设计师工作台'
  93. },
  94. {
  95. path: 'project-detail/:id',
  96. loadComponent: () => import('./pages/designer/project-detail/project-detail').then(m => m.ProjectDetail),
  97. title: '项目详情'
  98. },
  99. {
  100. path: 'personal-board',
  101. loadComponent: () => import('./pages/designer/personal-board/personal-board').then(m => m.PersonalBoard),
  102. title: '个人看板'
  103. }
  104. ]
  105. },
  106. // 组长路由
  107. {
  108. path: 'team-leader',
  109. canActivate: [WxworkAuthGuard],
  110. children: [
  111. { path: '', redirectTo: 'dashboard', pathMatch: 'full' },
  112. {
  113. path: 'dashboard',
  114. loadComponent: () => import('./pages/team-leader/dashboard/dashboard').then(m => m.Dashboard),
  115. title: '组长工作台'
  116. },
  117. {
  118. path: 'team-management',
  119. loadComponent: () => import('./pages/team-leader/team-management/team-management').then(m => m.TeamManagementComponent),
  120. title: '团队管理'
  121. },
  122. {
  123. path: 'quality-management',
  124. loadComponent: () => import('./pages/team-leader/quality-management/quality-management').then(m => m.QualityManagementComponent),
  125. title: '质量管理'
  126. },
  127. {
  128. path: 'knowledge-base',
  129. loadComponent: () => import('./pages/team-leader/knowledge-base/knowledge-base').then(m => m.KnowledgeBaseComponent),
  130. title: '知识库与能力复制'
  131. },
  132. {
  133. path: 'workload-calendar',
  134. loadComponent: () => import('./pages/team-leader/workload-calendar/workload-calendar').then(m => m.WorkloadCalendarComponent),
  135. title: '负载日历'
  136. },
  137. // 新增:复用设计师项目详情作为组长查看页面(含审核/同步能力)
  138. {
  139. path: 'project-detail/:id',
  140. loadComponent: () => import('./pages/designer/project-detail/project-detail').then(m => m.ProjectDetail),
  141. title: '项目详情'
  142. }
  143. ]
  144. },
  145. // 财务路由
  146. {
  147. path: 'finance',
  148. canActivate: [WxworkAuthGuard],
  149. children: [
  150. { path: '', redirectTo: 'dashboard', pathMatch: 'full' },
  151. {
  152. path: 'dashboard',
  153. loadComponent: () => import('./pages/finance/dashboard/dashboard').then(m => m.Dashboard),
  154. title: '财务工作台'
  155. },
  156. {
  157. path: 'project-records',
  158. loadComponent: () => import('./pages/finance/project-records/project-records').then(m => m.ProjectRecords),
  159. title: '项目流水'
  160. },
  161. {
  162. path: 'reconciliation',
  163. loadComponent: () => import('./pages/finance/reconciliation/reconciliation').then(m => m.Reconciliation),
  164. title: '对账与结算'
  165. },
  166. {
  167. path: 'reports',
  168. loadComponent: () => import('./pages/finance/reports/reports').then(m => m.Reports),
  169. title: '财务报表'
  170. },
  171. {
  172. path: 'quotation-approval',
  173. loadComponent: () => import('./pages/finance/quotation-approval/quotation-approval.component').then(m => m.QuotationApprovalComponent),
  174. title: '报价审核'
  175. }
  176. ]
  177. },
  178. // 人事/行政路由
  179. {
  180. path: 'hr',
  181. loadComponent: () => import('./pages/hr/hr-layout/hr-layout').then(m => m.HrLayout),
  182. canActivate: [WxworkAuthGuard],
  183. children: [
  184. {
  185. path: 'dashboard',
  186. loadComponent: () => import('./pages/hr/dashboard/dashboard').then(m => m.Dashboard),
  187. title: '人事看板'
  188. },
  189. {
  190. path: 'employee-records',
  191. loadComponent: () => import('./pages/hr/employee-records/employee-records').then(m => m.EmployeeRecords),
  192. title: '员工档案'
  193. },
  194. {
  195. path: 'attendance',
  196. loadComponent: () => import('./pages/hr/attendance/attendance').then(m => m.Attendance),
  197. title: '考勤管理'
  198. },
  199. { path: '', redirectTo: 'dashboard', pathMatch: 'full' }
  200. ]
  201. },
  202. // 管理员路由
  203. {
  204. path: 'admin',
  205. loadComponent: () => import('./pages/admin/admin-layout/admin-layout').then(m => m.AdminLayout),
  206. canActivate: [WxworkAuthGuard],
  207. children: [
  208. { path: '', redirectTo: 'dashboard', pathMatch: 'full' },
  209. {
  210. path: 'dashboard',
  211. loadComponent: () => import('./pages/admin/dashboard/dashboard').then(m => m.AdminDashboard),
  212. title: '总览看板'
  213. },
  214. // 项目管理相关路由
  215. {
  216. path: 'project-management',
  217. loadComponent: () => import('./pages/admin/project-management/project-management').then(m => m.ProjectManagement),
  218. title: '项目管理'
  219. },
  220. // 项目详情页(复用wxwork模块)
  221. {
  222. path: 'project-detail/:projectId',
  223. loadComponent: () => import('../modules/project/pages/project-detail/project-detail.component').then(m => m.ProjectDetailComponent),
  224. title: '项目详情',
  225. children: [
  226. { path: '', redirectTo: 'order', pathMatch: 'full' },
  227. {
  228. path: 'order',
  229. loadComponent: () => import('../modules/project/pages/project-detail/stages/stage-order.component').then(m => m.StageOrderComponent),
  230. title: '订单分配'
  231. },
  232. {
  233. path: 'requirements',
  234. loadComponent: () => import('../modules/project/pages/project-detail/stages/stage-requirements.component').then(m => m.StageRequirementsComponent),
  235. title: '确认需求'
  236. },
  237. {
  238. path: 'delivery',
  239. loadComponent: () => import('../modules/project/pages/project-detail/stages/stage-delivery.component').then(m => m.StageDeliveryComponent),
  240. title: '交付执行'
  241. },
  242. {
  243. path: 'aftercare',
  244. loadComponent: () => import('../modules/project/pages/project-detail/stages/stage-aftercare.component').then(m => m.StageAftercareComponent),
  245. title: '售后归档'
  246. },
  247. {
  248. path: 'issues',
  249. loadComponent: () => import('../modules/project/pages/project-detail/stages/stage-issues.component').then(m => m.StageIssuesComponent),
  250. title: '问题追踪'
  251. }
  252. ]
  253. },
  254. // 用户与角色管理相关路由
  255. {
  256. path: 'user-management',
  257. loadComponent: () => import('./pages/admin/user-management/user-management').then(m => m.UserManagement),
  258. title: '用户与角色管理'
  259. },
  260. // 项目组管理
  261. {
  262. path: 'departments',
  263. loadComponent: () => import('./pages/admin/departments/departments').then(m => m.Departments),
  264. title: '项目组管理'
  265. },
  266. // 员工管理 (原设计师管理)
  267. {
  268. path: 'employees',
  269. loadComponent: () => import('./pages/admin/employees/employees').then(m => m.Employees),
  270. title: '员工管理'
  271. },
  272. // 客户管理
  273. {
  274. path: 'customers',
  275. loadComponent: () => import('./pages/admin/customers/customers').then(m => m.Customers),
  276. title: '客户管理'
  277. },
  278. // 群组管理
  279. {
  280. path: 'groupchats',
  281. loadComponent: () => import('./pages/admin/groupchats/groupchats').then(m => m.GroupChats),
  282. title: '群组管理'
  283. },
  284. // 财务管理 (隐藏)
  285. {
  286. path: 'finance',
  287. loadComponent: () => import('./pages/admin/finance/finance').then(m => m.FinancePage),
  288. title: '财务管理'
  289. },
  290. // 系统设置相关路由
  291. {
  292. path: 'system-settings',
  293. loadComponent: () => import('./pages/admin/system-settings/system-settings').then(m => m.SystemSettings),
  294. title: '系统设置'
  295. },
  296. // 系统日志相关路由
  297. {
  298. path: 'logs',
  299. loadComponent: () => import('./pages/admin/logs/logs').then(m => m.Logs),
  300. title: '系统日志'
  301. },
  302. // API集成管理相关路由
  303. {
  304. path: 'api-integrations',
  305. loadComponent: () => import('./pages/admin/api-integrations/api-integrations').then(m => m.ApiIntegrations),
  306. title: 'API集成管理'
  307. }
  308. ]
  309. },
  310. // 演示页面路由
  311. {
  312. path: 'dropdown-demo',
  313. loadComponent: () => import('./pages/shared/dropdown/dropdown-demo.component').then(m => m.DropdownDemoComponent),
  314. title: '下拉列表组件演示'
  315. },
  316. // 测试页面路由
  317. {
  318. path: 'test-atmosphere-preview',
  319. loadComponent: () => import('./test-atmosphere-preview/test-atmosphere-preview').then(m => m.TestAtmospherePreviewComponent),
  320. title: '氛围感预览图测试'
  321. },
  322. {
  323. path: 'test-wxwork-activation/:cid',
  324. loadComponent: () => import('../test-pages/wxwork-activation-test/wxwork-activation-test.component').then(m => m.WxworkActivationTestComponent),
  325. title: '企微身份激活测试'
  326. },
  327. // 数据清理工具
  328. {
  329. path: 'test-data-cleanup',
  330. loadComponent: () => import('../test-pages/data-cleanup/data-cleanup.component').then(m => m.DataCleanupComponent),
  331. title: '测试数据清理工具'
  332. },
  333. // 企微项目管理模块路由
  334. // 支持两种进入方式:
  335. // 1. 企微端: 通过 external_userid/chat_id 自动查找对应的 ContactInfo/Project
  336. // 2. 网页端: 通过 contactId/projectId 直接加载,配合 profileId 参数
  337. {
  338. path: 'wxwork/:cid',
  339. children: [
  340. // 身份激活页面(不受守卫保护)
  341. {
  342. path: 'activation',
  343. loadComponent: () => import('../modules/profile/pages/profile-activation/profile-activation.component').then(m => m.ProfileActivationComponent),
  344. title: '身份激活'
  345. },
  346. // 设计师工作台(需要认证)
  347. {
  348. path: 'designer',
  349. canActivate: [CustomWxworkAuthGuard],
  350. children: [
  351. { path: '', redirectTo: 'dashboard', pathMatch: 'full' },
  352. {
  353. path: 'dashboard',
  354. loadComponent: () => import('./pages/designer/dashboard/dashboard').then(m => m.Dashboard),
  355. title: '设计师工作台'
  356. },
  357. {
  358. path: 'project-detail/:id',
  359. loadComponent: () => import('./pages/designer/project-detail/project-detail').then(m => m.ProjectDetail),
  360. title: '项目详情'
  361. },
  362. {
  363. path: 'personal-board',
  364. loadComponent: () => import('./pages/designer/personal-board/personal-board').then(m => m.PersonalBoard),
  365. title: '个人看板'
  366. }
  367. ]
  368. },
  369. // 组长工作台(需要认证)
  370. {
  371. path: 'team-leader',
  372. canActivate: [CustomWxworkAuthGuard],
  373. children: [
  374. { path: '', redirectTo: 'dashboard', pathMatch: 'full' },
  375. {
  376. path: 'dashboard',
  377. loadComponent: () => import('./pages/team-leader/dashboard/dashboard').then(m => m.Dashboard),
  378. title: '组长工作台'
  379. },
  380. {
  381. path: 'team-management',
  382. loadComponent: () => import('./pages/team-leader/team-management/team-management').then(m => m.TeamManagementComponent),
  383. title: '团队管理'
  384. },
  385. {
  386. path: 'quality-management',
  387. loadComponent: () => import('./pages/team-leader/quality-management/quality-management').then(m => m.QualityManagementComponent),
  388. title: '质量管理'
  389. }
  390. ]
  391. },
  392. // 项目预加载页(企微上下文入口)
  393. {
  394. path: 'project-loader',
  395. canActivate: [CustomWxworkAuthGuard],
  396. loadComponent: () => import('../modules/project/pages/project-loader/project-loader.component').then(m => m.ProjectLoaderComponent),
  397. title: '加载项目'
  398. },
  399. // 项目问卷页
  400. {
  401. path: 'survey/project/:projectId',
  402. canActivate: [CustomWxworkAuthGuard],
  403. loadComponent: () => import('../modules/project/pages/project-survey/project-survey.component').then(m => m.ProjectSurveyComponent),
  404. title: '项目需求调查'
  405. },
  406. // 员工问卷页
  407. {
  408. path: 'survey/profile',
  409. canActivate: [CustomWxworkAuthGuard],
  410. loadComponent: () => import('../modules/profile/pages/profile-survey/profile-survey.component').then(m => m.ProfileSurveyComponent),
  411. title: '员工技能调研'
  412. },
  413. // 客户画像页
  414. // 路由规则:
  415. // - 企微端: /wxwork/:cid/contact/:contactId?externalUserId=xxx
  416. // - 网页端: /wxwork/:cid/contact/:contactId?profileId=xxx
  417. // 说明:
  418. // - contactId: ContactInfo 的 objectId(后台进入时使用)
  419. // - externalUserId: 企微外部联系人ID(企微端进入时使用,需后台有对应数据)
  420. // - profileId: 当前员工 Profile ID(网页端进入时使用)
  421. {
  422. path: 'contact/:contactId',
  423. canActivate: [CustomWxworkAuthGuard],
  424. loadComponent: () => import('../modules/project/pages/contact/contact.component').then(m => m.CustomerProfileComponent),
  425. title: '客户画像'
  426. },
  427. // 会话激活页(群聊管理)
  428. // 路由规则:
  429. // - /wxwork/:cid/chat-activation/:chatId (可选chatId)
  430. // - /wxwork/:cid/chat-activation (从企微侧边栏打开,自动获取chatId)
  431. // 说明:
  432. // - chatId: GroupChat 的 objectId 或企微 chat_id(可选)
  433. // - 优先从企微 getCurExternalChat() 获取群聊信息
  434. {
  435. path: 'chat-activation/:chatId',
  436. loadComponent: () => import('../modules/project/pages/chat-activation/chat-activation.component').then(m => m.ChatActivationComponent),
  437. title: '会话激活'
  438. },
  439. {
  440. path: 'chat-activation',
  441. loadComponent: () => import('../modules/project/pages/chat-activation/chat-activation.component').then(m => m.ChatActivationComponent),
  442. title: '会话激活'
  443. },
  444. // 项目详情页(含四阶段子路由)
  445. // 路由规则:
  446. // - 企微端: /wxwork/:cid/project/:projectId?chatId=xxx
  447. // - 网页端: /wxwork/:cid/project/:projectId?profileId=xxx
  448. // 说明:
  449. // - projectId: Project 的 objectId(后台进入时使用)
  450. // - chatId: 企微群聊 chat_id(企微端进入时使用,需 GroupChat.chat_id 属性)
  451. // - profileId: 当前员工 Profile ID(网页端进入时使用)
  452. {
  453. path: 'project/:projectId',
  454. canActivate: [CustomWxworkAuthGuard],
  455. loadComponent: () => import('../modules/project/pages/project-detail/project-detail.component').then(m => m.ProjectDetailComponent),
  456. children: [
  457. { path: '', redirectTo: 'order', pathMatch: 'full' },
  458. {
  459. path: 'order',
  460. loadComponent: () => import('../modules/project/pages/project-detail/stages/stage-order.component').then(m => m.StageOrderComponent),
  461. title: '订单分配'
  462. },
  463. {
  464. path: 'requirements',
  465. loadComponent: () => import('../modules/project/pages/project-detail/stages/stage-requirements.component').then(m => m.StageRequirementsComponent),
  466. title: '确认需求'
  467. },
  468. {
  469. path: 'delivery',
  470. loadComponent: () => import('../modules/project/pages/project-detail/stages/stage-delivery.component').then(m => m.StageDeliveryComponent),
  471. title: '交付执行'
  472. },
  473. {
  474. path: 'aftercare',
  475. loadComponent: () => import('../modules/project/pages/project-detail/stages/stage-aftercare.component').then(m => m.StageAftercareComponent),
  476. title: '售后归档'
  477. },
  478. {
  479. path: 'issues',
  480. loadComponent: () => import('../modules/project/pages/project-detail/stages/stage-issues.component').then(m => m.StageIssuesComponent),
  481. title: '问题追踪'
  482. }
  483. ]
  484. }
  485. ]
  486. },
  487. // 默认路由重定向到登录页
  488. {
  489. path: '',
  490. loadComponent: () => import('./pages/auth/login/login').then(m => m.LoginPage),
  491. pathMatch: 'full'
  492. },
  493. { path: '**', redirectTo: '/customer-service/dashboard' }
  494. ];