full-routes.ts 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951
  1. /**
  2. * 1. 前端维护的完整路由表, 用于创建"菜单"
  3. * 2. component 是 string,并不是 组件对象。
  4. * 3. 生成菜单,关注的 path,name,component,icon。
  5. * 4. 部分路由组件是菜单不可见的,当访问该路由时,左侧菜单的menu item会失去active状态。需要设置 meta.activeMenu 保持选中状态。
  6. */
  7. import { AppRouteRecordRaw } from './types';
  8. import { getTreeItem } from '@/utils';
  9. import { cloneDeep } from 'lodash-es';
  10. import { RouteRecordRaw } from 'vue-router';
  11. import { PageEnum } from '@/enums/pageEnum';
  12. type RouteRecordString = Omit<AppRouteRecordRaw, 'component'> & { component?: string };
  13. export const RootRoute: RouteRecordString = {
  14. path: '/',
  15. name: 'Root',
  16. redirect: PageEnum.BASE_HOME,
  17. meta: {
  18. title: 'Root',
  19. },
  20. };
  21. export const HOME_PAGE: RouteRecordString = {
  22. // 模板管理
  23. path: '/home',
  24. name: 'HomePage',
  25. component: '/home/PageHome',
  26. meta: {
  27. icon: '',
  28. title: '首页',
  29. },
  30. };
  31. /** 灾害防范的路由 */
  32. export const disasterPreventionRoute = {
  33. children: [
  34. {
  35. component: '/disaster/overview/PageOverview',
  36. id: 1025,
  37. meta: {
  38. activeMenu: null,
  39. alwaysShow: false,
  40. frameSrc: '',
  41. hidden: false,
  42. icon: 'OverviewIcon',
  43. isFrame: 0,
  44. isRoot: false,
  45. noCache: false,
  46. query: '',
  47. title: '总览',
  48. },
  49. name: 'disaster-prevention-overview',
  50. parentId: 1022,
  51. path: 'overview',
  52. redirect: '',
  53. },
  54. {
  55. // component: '/disaster/monitor/PageMonitor',
  56. component: '/disaster/monitor/splitScreenRetrieval/SplitScreenRetrieval',
  57. id: 1026,
  58. meta: {
  59. activeMenu: null,
  60. alwaysShow: false,
  61. frameSrc: '',
  62. hidden: false,
  63. icon: 'RiskPointMonitoringIcon',
  64. isFrame: 0,
  65. isRoot: false,
  66. noCache: false,
  67. query: '',
  68. title: '重点区域监测',
  69. },
  70. name: 'risk-point-monitoring',
  71. parentId: 1022,
  72. path: 'risk-point-monitoring',
  73. redirect: '',
  74. },
  75. {
  76. children: [
  77. {
  78. component: '/disaster/disaster-warning/PageWarningInfo',
  79. id: 1035,
  80. meta: {
  81. activeMenu: '/disaster-prevention/disaster-warning',
  82. alwaysShow: false,
  83. frameSrc: '',
  84. hidden: false,
  85. icon: '',
  86. isFrame: 0,
  87. isRoot: false,
  88. noCache: false,
  89. query: '',
  90. title: '预警信息',
  91. },
  92. name: 'disaster-warning-warning-info',
  93. parentId: 1027,
  94. path: 'warning-info',
  95. redirect: '',
  96. },
  97. {
  98. component: '/disaster/disaster-warning/PageDefenseNotice',
  99. id: 1037,
  100. meta: {
  101. activeMenu: null,
  102. alwaysShow: false,
  103. frameSrc: '',
  104. hidden: false,
  105. icon: '',
  106. isFrame: 0,
  107. isRoot: false,
  108. noCache: false,
  109. query: '',
  110. title: '防御通知',
  111. },
  112. name: 'disaster-warning-defense-notice',
  113. parentId: 1027,
  114. path: 'defense-notice',
  115. redirect: '',
  116. },
  117. {
  118. component: '/disaster/disaster-warning/PageDefenseNoticeItem',
  119. id: 1038,
  120. meta: {
  121. activeMenu: null,
  122. alwaysShow: false,
  123. frameSrc: '',
  124. hidden: false,
  125. icon: '',
  126. isFrame: 0,
  127. isRoot: false,
  128. noCache: false,
  129. query: '',
  130. title: '防御通知详情',
  131. },
  132. name: 'defense-notice-item',
  133. parentId: 1027,
  134. path: 'defense-notice-item',
  135. redirect: '',
  136. },
  137. ],
  138. component: '',
  139. id: 1027,
  140. meta: {
  141. activeMenu: null,
  142. alwaysShow: false,
  143. frameSrc: '',
  144. hidden: false,
  145. icon: 'DisasterWarningIcon',
  146. isFrame: 0,
  147. isRoot: false,
  148. noCache: false,
  149. query: '',
  150. title: '灾害预警',
  151. },
  152. name: 'disaster-warning',
  153. parentId: 1022,
  154. path: 'disaster-warning',
  155. redirect: '',
  156. },
  157. {
  158. children: [
  159. {
  160. component: '/disaster/disaster-precaution/PageTaskManagement',
  161. id: 1029,
  162. meta: {
  163. activeMenu: null,
  164. alwaysShow: false,
  165. frameSrc: '',
  166. hidden: false,
  167. icon: '',
  168. isFrame: 0,
  169. isRoot: false,
  170. noCache: false,
  171. query: '',
  172. title: '任务管理',
  173. },
  174. name: 'disaster-precaution-task-management',
  175. parentId: 1028,
  176. path: 'task-management',
  177. redirect: '',
  178. },
  179. {
  180. component: '/disaster/disaster-precaution/PageTaskItem',
  181. id: 1033,
  182. meta: {
  183. activeMenu: null,
  184. alwaysShow: false,
  185. frameSrc: '',
  186. hidden: true,
  187. icon: '',
  188. isFrame: 0,
  189. isRoot: false,
  190. noCache: false,
  191. query: '',
  192. title: '任务列表详情',
  193. },
  194. name: 'disaster-precaution-task-item',
  195. parentId: 1028,
  196. path: 'task-item',
  197. redirect: '',
  198. },
  199. {
  200. component: '/disaster/disaster-precaution/PageTaskExecution',
  201. id: 1030,
  202. meta: {
  203. activeMenu: null,
  204. alwaysShow: false,
  205. frameSrc: '',
  206. hidden: false,
  207. icon: '',
  208. isFrame: 0,
  209. isRoot: false,
  210. noCache: false,
  211. query: '',
  212. title: '任务执行',
  213. },
  214. name: 'disaster-precaution-task-execution',
  215. parentId: 1028,
  216. path: 'task-execution',
  217. redirect: '',
  218. },
  219. {
  220. component: '/disaster/disaster-precaution/PageTaskExecutionDetail',
  221. id: 1034,
  222. meta: {
  223. activeMenu: '/disaster-prevention/disaster-precaution/task-execution',
  224. alwaysShow: false,
  225. frameSrc: '',
  226. hidden: false,
  227. icon: '',
  228. isFrame: 0,
  229. isRoot: false,
  230. noCache: false,
  231. query: '',
  232. title: '任务执行详情',
  233. },
  234. name: 'disaster-precaution-task-execution-detail',
  235. parentId: 1028,
  236. path: 'task-execution-detail/:id',
  237. redirect: '',
  238. },
  239. {
  240. component: '/disaster/disaster-precaution/PageTaskTemplate',
  241. id: 1031,
  242. meta: {
  243. activeMenu: '/disaster-prevention/disaster-precaution/task-execution',
  244. alwaysShow: false,
  245. frameSrc: '',
  246. hidden: false,
  247. icon: '',
  248. isFrame: 0,
  249. isRoot: false,
  250. noCache: false,
  251. query: '',
  252. title: '任务模板',
  253. },
  254. name: 'disaster-precaution-task-template',
  255. parentId: 1028,
  256. path: 'task-template',
  257. redirect: '',
  258. },
  259. {
  260. component: '/todo/todo',
  261. id: 1032,
  262. meta: {
  263. activeMenu: '/disaster-prevention/disaster-precaution/task-template',
  264. alwaysShow: false,
  265. frameSrc: '',
  266. hidden: false,
  267. icon: '',
  268. isFrame: 0,
  269. isRoot: false,
  270. noCache: false,
  271. query: '',
  272. title: '任务模板详情',
  273. },
  274. name: 'disaster-precaution-template-detail',
  275. parentId: 1028,
  276. path: 'template-detail/:id',
  277. redirect: '',
  278. },
  279. ],
  280. component: '',
  281. id: 1028,
  282. meta: {
  283. activeMenu: null,
  284. alwaysShow: false,
  285. frameSrc: '',
  286. hidden: false,
  287. icon: 'DisasterPrecaution',
  288. isFrame: 0,
  289. isRoot: false,
  290. noCache: false,
  291. query: '',
  292. title: '预防检查',
  293. },
  294. name: 'disaster-precaution',
  295. parentId: 1022,
  296. path: 'disaster-precaution',
  297. redirect: '',
  298. },
  299. {
  300. children: [
  301. {
  302. component: '/disaster/disaster-control/PageDisposalManagement',
  303. id: 1038,
  304. meta: {
  305. activeMenu: '',
  306. alwaysShow: false,
  307. frameSrc: '',
  308. hidden: false,
  309. icon: '',
  310. isFrame: 0,
  311. isRoot: false,
  312. noCache: false,
  313. query: '',
  314. title: '处置管理',
  315. },
  316. name: 'disaster-control-disposal-management',
  317. parentId: 1027,
  318. path: 'disposal-management',
  319. redirect: '',
  320. },
  321. {
  322. component: '/disaster/disaster-control/PageDisposalManagementTaskItem',
  323. id: 1041,
  324. meta: {
  325. activeMenu: '/disaster-prevention/disaster-control/disposal-management',
  326. alwaysShow: false,
  327. frameSrc: '',
  328. hidden: false,
  329. icon: '',
  330. isFrame: 0,
  331. isRoot: false,
  332. noCache: false,
  333. query: '',
  334. title: '处置管理详情(任务项)',
  335. },
  336. name: 'disaster-control-disposal-management-task-item',
  337. parentId: 1027,
  338. path: 'disposal-management-task-item',
  339. redirect: '',
  340. },
  341. {
  342. component: '/disaster/disaster-control/PageDisposalManagementItem',
  343. id: 1042,
  344. meta: {
  345. activeMenu: '/disaster-prevention/disaster-control/disposal-management',
  346. alwaysShow: false,
  347. frameSrc: '',
  348. hidden: false,
  349. icon: '',
  350. isFrame: 0,
  351. isRoot: false,
  352. noCache: false,
  353. query: '',
  354. title: '处置管理详情(列表项)',
  355. },
  356. name: 'disaster-control-disposal-management-item',
  357. parentId: 1027,
  358. path: 'disposal-management-item/:id',
  359. redirect: '',
  360. },
  361. {
  362. component: '/disaster/disaster-control/PageLossReport',
  363. id: 1039,
  364. meta: {
  365. activeMenu: '',
  366. alwaysShow: false,
  367. frameSrc: '',
  368. hidden: false,
  369. icon: '',
  370. isFrame: 0,
  371. isRoot: false,
  372. noCache: false,
  373. query: '',
  374. title: '损失上报',
  375. },
  376. name: 'disaster-control-loss-report',
  377. parentId: 1027,
  378. path: 'loss-report',
  379. redirect: '',
  380. },
  381. {
  382. component: '/disaster/disaster-control/PageLossReportItem',
  383. id: 1043,
  384. meta: {
  385. activeMenu: '/disaster-prevention/disaster-control/loss-report',
  386. alwaysShow: false,
  387. frameSrc: '',
  388. hidden: false,
  389. icon: '',
  390. isFrame: 0,
  391. isRoot: false,
  392. noCache: false,
  393. query: '',
  394. title: '损失记录明细',
  395. },
  396. name: 'disaster-control-loss-report-item',
  397. parentId: 1027,
  398. path: 'loss-report-item/:id',
  399. redirect: '',
  400. },
  401. {
  402. component: '/disaster/disaster-control/PageDisposalRectification',
  403. id: 1040,
  404. meta: {
  405. activeMenu: '',
  406. alwaysShow: false,
  407. frameSrc: '',
  408. hidden: false,
  409. icon: '',
  410. isFrame: 0,
  411. isRoot: false,
  412. noCache: false,
  413. query: '',
  414. title: '处置整改',
  415. },
  416. name: 'disaster-control-disposal-rectification',
  417. parentId: 1027,
  418. path: 'disposal-rectification',
  419. redirect: '',
  420. },
  421. {
  422. component: '/disaster/disaster-control/PageDisposalRectificationItem',
  423. id: 1044,
  424. meta: {
  425. activeMenu: '/disaster-prevention/disaster-control/disposal-rectification',
  426. alwaysShow: false,
  427. frameSrc: '',
  428. hidden: false,
  429. icon: '',
  430. isFrame: 0,
  431. isRoot: false,
  432. noCache: false,
  433. query: '',
  434. title: '整改处理',
  435. },
  436. name: 'disaster-control-disposal-rectification-item',
  437. parentId: 1027,
  438. path: 'disposal-rectification-item/:id',
  439. redirect: '',
  440. },
  441. {
  442. component: '/disaster/disaster-control/PageViewDisposalRectification',
  443. id: 1045,
  444. meta: {
  445. activeMenu: '/disaster-prevention/disaster-control/disposal-rectification',
  446. alwaysShow: false,
  447. frameSrc: '',
  448. hidden: false,
  449. icon: '',
  450. isFrame: 0,
  451. isRoot: false,
  452. noCache: false,
  453. query: '',
  454. title: '整改处理明细',
  455. },
  456. name: 'disaster-control-disposal-rectification-item-detail',
  457. parentId: 1027,
  458. path: 'disposal-rectification-item-detail/:id',
  459. redirect: '',
  460. },
  461. ],
  462. component: '',
  463. id: 1032,
  464. meta: {
  465. activeMenu: null,
  466. alwaysShow: false,
  467. frameSrc: '',
  468. hidden: false,
  469. icon: 'DisasterControlIcon',
  470. isFrame: 0,
  471. isRoot: false,
  472. noCache: false,
  473. query: '',
  474. title: '灾害处置',
  475. },
  476. name: 'disaster-control',
  477. parentId: 1022,
  478. path: 'disaster-control',
  479. redirect: '',
  480. },
  481. ],
  482. component: 'MENU_LAYOUT',
  483. id: 1022,
  484. meta: {
  485. activeMenu: null,
  486. alwaysShow: false,
  487. frameSrc: '',
  488. hidden: false,
  489. icon: 'CameraOutlined',
  490. isFrame: 0,
  491. isRoot: false,
  492. noCache: false,
  493. query: '',
  494. title: '灾害防范',
  495. },
  496. name: 'DisasterPrevention',
  497. parentId: -1,
  498. path: '/disaster-prevention',
  499. redirect: '',
  500. };
  501. /** 应急管理 */
  502. export const emergencyManagementRoute = {
  503. id: 2000,
  504. parentId: -1,
  505. name: 'EmergencyManagement',
  506. path: '/emergency-management',
  507. component: 'MENU_LAYOUT',
  508. redirect: '',
  509. meta: {
  510. activeMenu: null,
  511. alwaysShow: false,
  512. frameSrc: '',
  513. hidden: false,
  514. icon: 'CameraOutlined',
  515. isFrame: 0,
  516. isRoot: false,
  517. noCache: false,
  518. query: '',
  519. title: '应急管理',
  520. },
  521. children: [
  522. {
  523. id: 2001,
  524. parentId: 2000,
  525. name: 'emergency-management-overview',
  526. path: 'overview',
  527. component: '/emergency/overview/PageOverview',
  528. redirect: '',
  529. meta: {
  530. activeMenu: null,
  531. alwaysShow: false,
  532. frameSrc: '',
  533. hidden: false,
  534. icon: 'OverviewIcon',
  535. isFrame: 0,
  536. isRoot: false,
  537. noCache: false,
  538. query: '',
  539. title: '总览',
  540. },
  541. },
  542. {
  543. id: 2002,
  544. parentId: 2000,
  545. name: 'emergency-management-organization',
  546. path: 'organization',
  547. component: '/emergency/organization/PageOrganization',
  548. redirect: '',
  549. meta: {
  550. activeMenu: null,
  551. alwaysShow: false,
  552. frameSrc: '',
  553. hidden: false,
  554. icon: 'OverviewIcon',
  555. isFrame: 0,
  556. isRoot: false,
  557. noCache: false,
  558. query: '',
  559. title: '应急架构体系',
  560. },
  561. },
  562. {
  563. id: 2003,
  564. parentId: 2000,
  565. name: 'command-center',
  566. path: 'command-center',
  567. component: '/emergency/command-center/PageCommandCenter',
  568. redirect: '',
  569. meta: {
  570. activeMenu: null,
  571. alwaysShow: false,
  572. frameSrc: '',
  573. hidden: false,
  574. icon: '',
  575. isFrame: 0,
  576. isRoot: false,
  577. noCache: false,
  578. query: '',
  579. title: '应急指挥中心',
  580. },
  581. },
  582. ],
  583. };
  584. /** 平台管理 */
  585. export const platformRoutes = {
  586. path: '/platform',
  587. name: 'Platform',
  588. component: 'MENU_LAYOUT',
  589. meta: {
  590. icon: '',
  591. title: '平台管理',
  592. },
  593. redirect: '',
  594. children: [
  595. {
  596. path: 'user',
  597. name: 'User',
  598. meta: {
  599. icon: 'UserOutlined',
  600. title: '用户管理',
  601. },
  602. children: [
  603. {
  604. // 组织管理
  605. path: 'department',
  606. name: 'UserDepartment',
  607. component: '/auth/dept/dept',
  608. meta: {
  609. icon: '',
  610. title: '组织管理',
  611. },
  612. },
  613. {
  614. // 角色管理
  615. path: 'role',
  616. name: 'UserRole',
  617. component: '/system/role/role',
  618. meta: {
  619. icon: '',
  620. title: '角色管理',
  621. },
  622. },
  623. {
  624. // 账号管理
  625. path: 'account',
  626. name: 'UserAccount',
  627. component: '/system/user/user',
  628. meta: {
  629. icon: '',
  630. title: '账号管理',
  631. },
  632. },
  633. {
  634. // 账号管理
  635. path: 'person',
  636. name: 'Person',
  637. component: '/todo/todo',
  638. meta: {
  639. icon: '',
  640. title: '人员分组',
  641. },
  642. },
  643. ],
  644. },
  645. {
  646. // 菜单管理
  647. path: 'menu',
  648. name: 'SystemMenu',
  649. component: '/system/menu/menu',
  650. meta: {
  651. icon: 'UserOutlined',
  652. title: '菜单管理',
  653. },
  654. },
  655. {
  656. // 权限管理
  657. path: 'permission',
  658. name: 'SystemPermission',
  659. component: '/system/permission/PagePermission',
  660. meta: {
  661. icon: 'UserOutlined',
  662. title: '权限管理',
  663. },
  664. },
  665. {
  666. path: 'dictionary',
  667. name: 'SystemDictionary',
  668. component: '/system/dictionary/dictionary',
  669. meta: {
  670. icon: 'UserOutlined',
  671. title: '字典管理',
  672. },
  673. },
  674. ],
  675. };
  676. export const exceptionRouters =
  677. /**
  678. * 异常页面
  679. */
  680. {
  681. path: '/exception',
  682. name: 'Exception',
  683. component: 'LAYOUT',
  684. redirect: '/exception/403',
  685. meta: {
  686. icon: 'ExclamationCircleOutlined',
  687. title: '异常页面',
  688. ignoreAuth: true,
  689. },
  690. children: [
  691. {
  692. // 403,
  693. path: '403',
  694. name: 'Exception403',
  695. component: '/exception/403',
  696. meta: {
  697. icon: '',
  698. title: '403',
  699. },
  700. },
  701. {
  702. path: '500',
  703. name: 'Exception500',
  704. component: '/exception/500',
  705. meta: {
  706. icon: '',
  707. title: '500',
  708. },
  709. },
  710. {
  711. path: 'stay-tune',
  712. name: 'StayTune',
  713. component: '/exception/stay-tune',
  714. meta: {
  715. icon: '',
  716. title: '敬请期待',
  717. },
  718. },
  719. ],
  720. };
  721. export const fullRoutes: AppRouteRecordRaw[] = [
  722. disasterPreventionRoute,
  723. emergencyManagementRoute,
  724. // userRoutes,
  725. // systemRoutes,
  726. platformRoutes,
  727. /**
  728. * 消息管理
  729. */
  730. {
  731. path: '/message',
  732. name: 'Message',
  733. component: 'LAYOUT',
  734. meta: {
  735. icon: 'SendOutlined',
  736. title: '消息管理',
  737. },
  738. children: [
  739. {
  740. // 报表推送
  741. path: 'report',
  742. name: 'MessageReport',
  743. component: '/message/reportmessage/ReportMessage',
  744. meta: {
  745. icon: '',
  746. title: '报表推送',
  747. },
  748. },
  749. {
  750. // 报表推送配置。二级页面,菜单不可见!!!
  751. path: 'report-config',
  752. name: 'MessageReportConfig',
  753. component: '/message/reportmessage/ReportOperation',
  754. meta: {
  755. icon: '',
  756. title: '报表推送配置',
  757. activeMenu: 'MessageReport',
  758. },
  759. },
  760. {
  761. // 报警推送
  762. path: 'alarm',
  763. name: 'MessageAlarm',
  764. component: '/message/alarmMessages/alarmMessages',
  765. meta: {
  766. icon: '',
  767. title: '报警推送',
  768. },
  769. },
  770. {
  771. // 报警推送配置 。二级页面,菜单不可见!!!
  772. path: 'alarm-config',
  773. name: 'MessageAlarmConfig',
  774. component: '/message/alarm-config/AlarmConfig',
  775. meta: {
  776. icon: '',
  777. title: '报警推送配置',
  778. activeMenu: 'MessageAlarm',
  779. },
  780. },
  781. {
  782. // 系统通知
  783. path: 'sys-notification',
  784. name: 'MessageSysNotification',
  785. component: '/message/systemNotifications/systemNotifications',
  786. meta: {
  787. icon: '',
  788. title: '系统通知',
  789. },
  790. },
  791. {
  792. // 系统通知配置。二级页面,菜单不可见!!!
  793. path: 'sys-notification-config',
  794. name: 'MessageSysNotificationConfig',
  795. component: '/message/sysnotion-config/SysnotionConfig',
  796. meta: {
  797. icon: '',
  798. title: '系统通知配置',
  799. activeMenu: 'MessageSysNotification',
  800. },
  801. },
  802. {
  803. // 人员分组
  804. path: 'personnel-group',
  805. name: 'MessagePersonnelGroup',
  806. component: '/message/persongroup/UserGroup',
  807. meta: {
  808. icon: '',
  809. title: '人员分组',
  810. },
  811. },
  812. {
  813. // 问题处理通知
  814. path: 'question-notification',
  815. name: 'MessageQuestionNotification',
  816. component: '/message/question-notifications/QuestionNotifications',
  817. meta: {
  818. icon: '',
  819. title: '问题处理通知',
  820. },
  821. },
  822. ],
  823. },
  824. /**
  825. * 数据管理
  826. */
  827. {
  828. path: '/data',
  829. name: 'Data',
  830. component: 'LAYOUT',
  831. meta: {
  832. icon: 'LineChartOutlined',
  833. title: '数据管理',
  834. },
  835. children: [
  836. {
  837. // 平台统计
  838. path: 'platform',
  839. name: 'DataPlatform',
  840. component: '/datamanager/platformdata/PlatformData',
  841. meta: {
  842. icon: '',
  843. title: '平台统计',
  844. },
  845. },
  846. {
  847. // 历史视频 (视频回看)
  848. path: 'playback',
  849. name: 'DataPlayback',
  850. component: '/datamanager/playback/Playback',
  851. meta: {
  852. icon: '',
  853. title: '历史视频',
  854. },
  855. },
  856. {
  857. // 违规问题
  858. path: 'violation',
  859. name: 'DataViolation',
  860. component: '/datamanager/alertformdata/AlertformData',
  861. meta: {
  862. icon: '',
  863. title: '违规问题',
  864. },
  865. },
  866. ],
  867. },
  868. ] as const;
  869. /**
  870. * 类型定义。避免与已有的定义冲突,避免与 vue-router的类型定义冲突,前面加 _ 前缀
  871. */
  872. export interface _RouteViewItem {
  873. label: string;
  874. value: string;
  875. }
  876. export type _RouteView = _RouteViewItem & { children?: _RouteViewItem[] | null };
  877. export type _RouteViewTree = _RouteView[];
  878. /**
  879. * 获取指定 父路由 下的子路由。
  880. * 若 父级路由 未指定,则返回一级路由
  881. */
  882. export function getChildRoutesView(parentRouteName?: string | null): _RouteViewItem[] {
  883. // 未指定 parentRouteName, 则返回 level1 的路由
  884. if (parentRouteName == null) {
  885. return fullRoutes.map((route) => ({
  886. label: route.meta.title as string,
  887. value: route.name,
  888. }));
  889. }
  890. // 获取指定父路由的子路由
  891. const parentRoute: AppRouteRecordRaw = cloneDeep(getTreeItem(fullRoutes, parentRouteName, 'name'));
  892. if (parentRoute.children && parentRoute.children.length > 0) {
  893. return parentRoute.children.map((route) => ({
  894. label: route.meta.title as string,
  895. value: route.name,
  896. }));
  897. } else {
  898. return [];
  899. }
  900. }
  901. /**
  902. * 获取指定的 路由信息
  903. */
  904. export function getRouteByName(routeName: string) {
  905. return cloneDeep(getTreeItem(fullRoutes, routeName, 'name')) as AppRouteRecordRaw;
  906. }
  907. /**
  908. * 转换成 el-tree-select 的数据结构形式
  909. */
  910. export function transformToRouteViewTree(routes?: AppRouteRecordRaw[] | null) {
  911. const tree: _RouteViewTree = [];
  912. if (routes == null) return tree;
  913. for (const route of routes) {
  914. const treeItem: _RouteView = {
  915. value: route.name,
  916. label: route.meta.title as string,
  917. children: null,
  918. };
  919. if (route.children && route.children.length > 0) {
  920. treeItem.children = transformToRouteViewTree(route.children);
  921. tree.push(treeItem);
  922. } else {
  923. tree.push(treeItem);
  924. }
  925. }
  926. return tree;
  927. }
  928. export const routeViewTree = transformToRouteViewTree(fullRoutes);