index.js 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652
  1. import Vue from 'vue'
  2. import Router from 'vue-router'
  3. import {
  4. // ScheduleType,
  5. Access,
  6. Camera,
  7. CameraInfo,
  8. Sensor,
  9. SensorInfo
  10. } from '@/constant'
  11. import Layout from '@/layout'
  12. import Solo from '@/layout/Solo'
  13. Vue.use(Router)
  14. /**
  15. * sub-menu only appear when route children.length >= 1
  16. * dev: true, if set true, item will not show in production
  17. * hidden: true, if set true, item will not show in the sidebar(default is false)
  18. * name:'router-name' , if it is a manual jump, it must be set!!!
  19. * include: ['admin'], control the page roles (you can set multiple roles)
  20. * access: 'manage-profile', control the page access
  21. * meta : {
  22. * title: 'title', the name show in sidebar and breadcrumb (recommend set)
  23. * icon: 'svg-name'/'el-icon-x', the icon show in the sidebar
  24. * cache: 'router-name' if set, the router will be cached (only in Solo)
  25. * }
  26. */
  27. /**
  28. * constantRoutes
  29. * a base page that does not have permission requirements
  30. * all roles can be accessed
  31. */
  32. export const constantRoutes = [
  33. {
  34. hidden: true,
  35. path: '/error',
  36. component: () => import('@/views/platform/error-page/index')
  37. }
  38. ]
  39. /**
  40. * asyncRoutes
  41. * the routes that need to be dynamically loaded based on user roles
  42. */
  43. export const asyncRoutes = [
  44. {
  45. path: '/',
  46. redirect: '/home',
  47. component: Layout,
  48. meta: { title: '首页', icon: 'home' },
  49. children: [
  50. {
  51. name: 'home',
  52. path: 'home',
  53. component: () => import('@/views/dashboard/index'),
  54. meta: { title: '全局概览' }
  55. },
  56. {
  57. path: 'map',
  58. component: () => import('@/views/dashboard/map/index'),
  59. meta: { title: '地图位置' }
  60. }
  61. ]
  62. },
  63. {
  64. path: '/am',
  65. component: Layout,
  66. access: [Access.MANAGE_CALENDAR, Access.MANAGE_GROUP],
  67. meta: { title: '内容管理', icon: 'am' },
  68. children: [
  69. {
  70. path: 'media',
  71. component: () => import('@/views/screen/material/media/index'),
  72. meta: { title: '资源' }
  73. },
  74. {
  75. path: 'dataset',
  76. component: () => import('@/views/screen/material/dataset/index'),
  77. meta: { title: '素材包' }
  78. },
  79. {
  80. path: 'program',
  81. component: () => import('@/views/screen/material/program/index'),
  82. meta: { title: '节目' }
  83. },
  84. // {
  85. // path: 'recur',
  86. // component: Solo,
  87. // meta: { title: '轮播' },
  88. // children: [
  89. // {
  90. // name: 'recur-list',
  91. // path: '',
  92. // component: () => import('@/views/screen/material/schedule/index'),
  93. // meta: { cache: 'ScheduleList' },
  94. // props: { type: ScheduleType.RECUR, redirect: 'recur-design' }
  95. // },
  96. // {
  97. // hidden: true,
  98. // name: 'recur-design',
  99. // path: ':id',
  100. // component: () => import('@/views/screen/material/schedule/designer/index'),
  101. // access: Access.MANAGE_CALENDAR,
  102. // meta: { title: '编辑', cache: 'ScheduleList' },
  103. // props: { redirect: 'recur-list' }
  104. // }
  105. // ]
  106. // },
  107. // {
  108. // path: 'schedule',
  109. // component: Solo,
  110. // meta: { title: '排期' },
  111. // children: [
  112. // {
  113. // name: 'schedule-list',
  114. // path: '',
  115. // component: () => import('@/views/screen/material/schedule/index'),
  116. // meta: { cache: 'ScheduleList' },
  117. // props: { type: ScheduleType.COMPLEX, redirect: 'schedule-design' }
  118. // },
  119. // {
  120. // hidden: true,
  121. // name: 'schedule-design',
  122. // path: ':id',
  123. // component: () => import('@/views/screen/material/schedule/designer/index'),
  124. // access: Access.MANAGE_CALENDAR,
  125. // meta: { title: '编辑', cache: 'ScheduleList' },
  126. // props: { redirect: 'schedule-list' }
  127. // }
  128. // ]
  129. // },
  130. {
  131. path: 'tag',
  132. component: () => import('@/views/screen/material/tag/index'),
  133. meta: { title: '资源标签' }
  134. }/* ,
  135. {
  136. path: 'review',
  137. component: () => import('@/views/screen/review/single/index'),
  138. access: Access.MANAGE_GROUP,
  139. meta: { title: '审核' }
  140. } */
  141. ]
  142. },
  143. {
  144. path: '/cm',
  145. component: Layout,
  146. meta: { title: '智能信发', icon: 'cm' },
  147. children: [
  148. {
  149. path: 'deploy/device',
  150. component: () => import('@/views/screen/deploy/device/index'),
  151. access: Access.MANAGE_CALENDAR,
  152. meta: { title: '按设备发布' }
  153. },
  154. {
  155. path: 'deploy/ratio',
  156. component: () => import('@/views/screen/deploy/ratio/index'),
  157. access: Access.MANAGE_CALENDAR,
  158. meta: { title: '按宽高比发布' }
  159. },
  160. {
  161. path: 'mine',
  162. component: () => import('@/views/screen/review/workflow/mine/index'),
  163. access: Access.MANAGE_CALENDAR,
  164. meta: { title: '我的流程' }
  165. },
  166. {
  167. path: 'workflow',
  168. component: Solo,
  169. access: [
  170. Access.REVIEW_RELEASE_FIRST,
  171. Access.REVIEW_RELEASE_SECOND,
  172. Access.REVIEW_RELEASE_FINAL
  173. ],
  174. meta: { title: '流程审核' },
  175. children: [
  176. {
  177. name: 'workflow-list',
  178. path: '',
  179. component: () => import('@/views/screen/review/workflow/index'),
  180. meta: { cache: 'WorkflowList' }
  181. },
  182. {
  183. hidden: true,
  184. name: 'workflow-audit',
  185. path: ':id',
  186. component: () => import('@/views/screen/review/workflow/audit/index'),
  187. meta: { title: '审核', cache: 'WorkflowList' }
  188. }
  189. ]
  190. },
  191. {
  192. path: 'history',
  193. component: () => import('@/views/screen/review/workflow/history/index'),
  194. access: [Access.MANAGE_CALENDAR, Access.MANAGE_GROUP],
  195. meta: { title: '发布历史' }
  196. }
  197. ]
  198. },
  199. {
  200. path: '/task',
  201. component: Layout,
  202. access: [Access.MANAGE_CALENDAR, Access.MANAGE_GROUP],
  203. meta: { title: '自动编排', icon: 'ad' },
  204. children: [
  205. {
  206. path: 'asset',
  207. component: () => import('@/views/ad/automation/task/AssetTask.vue'),
  208. access: Access.MANAGE_TENANTS,
  209. meta: { title: '资源上播管理' }
  210. },
  211. {
  212. path: 'screen',
  213. component: () => import('@/views/ad/automation/task/ScreenTask.vue'),
  214. meta: { title: '屏体上播管理' }
  215. },
  216. {
  217. path: 'scheduling',
  218. component: () => import('@/views/ad/automation/scheduling/index'),
  219. meta: { title: '节目单' }
  220. },
  221. {
  222. path: 'dataset',
  223. component: () => import('@/views/ad/automation/dataset/index'),
  224. meta: { title: '填充素材包' }
  225. },
  226. {
  227. path: 'contract',
  228. component: () => import('@/views/ad/automation/contract/index'),
  229. meta: { title: '合同' }
  230. }
  231. ]
  232. },
  233. {
  234. path: '/dm',
  235. component: Layout,
  236. meta: { title: '大屏设备', icon: 'dm' },
  237. children: [
  238. {
  239. path: 'device',
  240. component: Solo,
  241. meta: { title: '我的设备' },
  242. children: [
  243. {
  244. name: 'device-list',
  245. path: '',
  246. component: () => import('@/views/device/index'),
  247. meta: { cache: 'DeviceList' }
  248. },
  249. {
  250. hidden: true,
  251. name: 'device-detail',
  252. path: ':id',
  253. component: () => import('@/views/device/detail/index'),
  254. meta: { title: '设备详情', cache: 'DeviceList' }
  255. }
  256. ]
  257. },
  258. {
  259. path: 'timeline',
  260. component: () => import('@/views/device/timeline/index'),
  261. meta: { title: '排期预览' }
  262. },
  263. {
  264. path: 'record',
  265. component: () => import('@/views/device/record/index'),
  266. meta: { title: '视频回采' }
  267. },
  268. {
  269. path: 'group',
  270. component: () => import('@/views/device/group/index'),
  271. meta: { title: '分组管理' }
  272. },
  273. {
  274. path: 'power',
  275. component: () => import('@/views/device/power/index'),
  276. access: Access.MANAGE_DEVICE,
  277. meta: { title: '批量开关电源' }
  278. }
  279. ]
  280. },
  281. {
  282. path: '/pm',
  283. component: Layout,
  284. access: Access.MANAGE_TENANT,
  285. meta: { title: '平台管理', icon: 'pm' },
  286. children: [
  287. {
  288. path: 'settings',
  289. component: () => import('@/views/realm/settings/index'),
  290. meta: { title: '功能管理' }
  291. },
  292. {
  293. path: 'org',
  294. component: () => import('@/views/realm/org/index'),
  295. meta: { title: '组织管理' }
  296. },
  297. {
  298. path: 'account',
  299. component: () => import('@/views/realm/user/index'),
  300. meta: { title: '账号管理' }
  301. },
  302. {
  303. path: 'device/manage',
  304. component: Solo,
  305. meta: { title: '设备管理' },
  306. children: [
  307. {
  308. name: 'device-management',
  309. path: '',
  310. component: () => import('@/views/realm/device/index'),
  311. meta: { cache: 'DeviceManagement' }
  312. },
  313. {
  314. hidden: true,
  315. name: 'device-management-detail',
  316. path: 'detail/:id',
  317. component: () => import('@/views/device/detail/index'),
  318. meta: { title: '详情', cache: 'DeviceManagement' }
  319. },
  320. {
  321. hidden: true,
  322. name: 'device-management-settings',
  323. path: 'settings/:id',
  324. component: () => import('@/views/external/box/settings/index'),
  325. meta: { title: '配置', cache: 'DeviceManagement' },
  326. props: { redirect: 'device-management' }
  327. }
  328. ]
  329. },
  330. {
  331. path: 'device/assign',
  332. component: () => import('@/views/realm/assign/index'),
  333. meta: { title: '设备分配' }
  334. },
  335. {
  336. path: 'ai/audit',
  337. component: () => import('@/views/realm/ai/ai-audit/index'),
  338. meta: { title: 'AI审核' }
  339. },
  340. {
  341. path: 'ai/timing',
  342. component: () => import('@/views/realm/ai/ai-timing/index'),
  343. meta: { title: 'AI抽帧检测' }
  344. },
  345. {
  346. path: 'ai/camera',
  347. component: () => import('@/views/external/camera/snap/index'),
  348. meta: { title: '摄像头黑屏检测' }
  349. }
  350. ]
  351. },
  352. {
  353. path: '/bm',
  354. component: Layout,
  355. access: Access.MANAGE_TENANT,
  356. meta: { title: '应急广播', icon: 'bm' },
  357. children: [
  358. {
  359. path: 'deploy',
  360. component: () => import('@/views/broadcast/deploy/index'),
  361. meta: { title: '发布' }
  362. },
  363. {
  364. path: 'history',
  365. component: () => import('@/views/broadcast/history/index'),
  366. meta: { title: '发布历史' }
  367. }
  368. ]
  369. },
  370. {
  371. path: '/d',
  372. component: Layout,
  373. meta: { icon: 'logger', title: '数据统计' },
  374. children: [
  375. {
  376. path: 'asset',
  377. component: () => import('@/views/dashboard/statistic/index'),
  378. access: Access.MANAGE_TENANT,
  379. meta: { title: '资源播放' }
  380. },
  381. {
  382. path: 'logger',
  383. component: () => import('@/views/realm/logger/index'),
  384. access: Access.MANAGE_TENANT,
  385. meta: { title: '操作日志' }
  386. },
  387. {
  388. path: 'report',
  389. component: () => import('@/views/realm/report/index'),
  390. access: [
  391. Access.MANAGE_TENANT,
  392. Access.MANAGE_GROUP,
  393. Access.MANAGE_CALENDAR
  394. ],
  395. meta: { title: '报表导出' }
  396. },
  397. // {
  398. // path: 'internal:dashboard/v0',
  399. // access: Access.MANAGE_TENANT,
  400. // meta: { title: '大数据V0', internal: true }
  401. // },
  402. {
  403. path: 'internal:dashboard/devops',
  404. access: Access.MANAGE_TENANT,
  405. meta: { title: '运维大数据', internal: true }
  406. },
  407. {
  408. path: 'internal:dashboard/business',
  409. access: Access.MANAGE_TENANT,
  410. meta: { title: '运营大数据', internal: true }
  411. }
  412. ]
  413. },
  414. {
  415. path: '/super',
  416. component: Layout,
  417. access: Access.MANAGE_TENANTS,
  418. meta: { title: '超管功能', icon: 'pm' },
  419. children: [
  420. {
  421. path: 'tenant',
  422. component: () => import('@/views/platform/tenant/index'),
  423. meta: { title: '租户管理' }
  424. },
  425. {
  426. path: 'template',
  427. component: () => import('@/views/broadcast/template/index'),
  428. meta: { title: '应急广播模板管理' }
  429. },
  430. {
  431. path: 'ai/stock',
  432. component: () => import('@/views/platform/ai-stock/index'),
  433. meta: { title: 'AI审核库存' }
  434. },
  435. {
  436. path: 'mqtt',
  437. component: () => import('@/views/platform/debug/index'),
  438. meta: { title: 'MQTT' }
  439. },
  440. {
  441. path: 'simulator',
  442. component: () => import('@/views/platform/simulator/index'),
  443. meta: { title: '模拟器' }
  444. },
  445. {
  446. path: 'remote/log',
  447. component: () => import('@/views/platform/remote-log/index'),
  448. meta: { title: '日志抓取' }
  449. },
  450. {
  451. path: 'cooperation',
  452. component: () => import('@/views/platform/cooperation/index'),
  453. meta: { title: '合作意向' }
  454. }
  455. ]
  456. },
  457. {
  458. path: '/em',
  459. component: Layout,
  460. access: Access.MANAGE_TENANTS,
  461. meta: { title: '设备录入', icon: 'em' },
  462. children: [
  463. {
  464. path: 'mesh',
  465. component: Solo,
  466. meta: { title: '网点' },
  467. children: [
  468. {
  469. name: 'mesh-list',
  470. path: '',
  471. component: () => import('@/views/external/index'),
  472. meta: { cache: 'MeshList' }
  473. },
  474. {
  475. hidden: true,
  476. name: 'mesh',
  477. path: ':id',
  478. component: () => import('@/views/external/mesh/index'),
  479. meta: { title: '详情', cache: 'MeshList' }
  480. }
  481. ]
  482. },
  483. {
  484. path: 'box',
  485. component: Solo,
  486. meta: { title: '终端设备' },
  487. children: [
  488. {
  489. name: 'box-management',
  490. path: '',
  491. component: () => import('@/views/external/box/index'),
  492. meta: { cache: 'BoxManagement' }
  493. },
  494. {
  495. hidden: true,
  496. name: 'box-settings',
  497. path: 'settings/:id',
  498. component: () => import('@/views/external/box/settings/index'),
  499. meta: { title: '配置', cache: 'BoxManagement' },
  500. props: { redirect: 'box-management' }
  501. }
  502. ]
  503. },
  504. {
  505. path: 'manufacturer',
  506. component: () => import('@/views/external/manufacturer/index'),
  507. meta: { title: '厂商' }
  508. },
  509. {
  510. path: 'screen',
  511. component: () => import('@/views/external/screen/index'),
  512. meta: { title: '屏幕' }
  513. },
  514. {
  515. path: 'sending-card',
  516. component: () => import('@/views/external/sending-card/index'),
  517. meta: { title: '发送控制设备' }
  518. },
  519. {
  520. path: 'receiving-card',
  521. component: () => import('@/views/external/receiving-card/index'),
  522. meta: { title: '接收卡' }
  523. },
  524. ...Object.keys(Camera).map(key => {
  525. return {
  526. path: `camera/${Camera[key]}`,
  527. component: () => import('@/views/external/camera/index'),
  528. meta: { title: CameraInfo[Camera[key]] },
  529. props: { type: Camera[key] }
  530. }
  531. }),
  532. {
  533. path: 'multi',
  534. component: () => import('@/views/external/multifunction-card/index'),
  535. meta: { title: '多功能卡' }
  536. },
  537. ...Object.keys(Sensor).map(key => {
  538. return {
  539. path: `sensor/${Sensor[key]}`,
  540. component: () => import('@/views/external/sensor/index'),
  541. meta: { title: SensorInfo[Sensor[key]] },
  542. props: { type: Sensor[key] }
  543. }
  544. }),
  545. {
  546. path: 'gateway',
  547. component: () => import('@/views/external/gateway/index'),
  548. meta: { title: '网关' }
  549. },
  550. {
  551. path: 'plc',
  552. component: () => import('@/views/external/plc/index'),
  553. meta: { title: 'PLC' }
  554. }
  555. ]
  556. },
  557. {
  558. path: '/ad',
  559. component: Layout,
  560. meta: { title: '自助广告', icon: 'ad' },
  561. access: Access.MANAGE_TENANTS,
  562. children: [
  563. {
  564. path: 'asset/review',
  565. component: () => import('@/views/ad/applet/review-asset/index'),
  566. meta: { title: '资源审核' }
  567. },
  568. {
  569. path: 'order/review',
  570. component: () => import('@/views/ad/applet/review-order/index'),
  571. meta: { title: '订单审核' }
  572. },
  573. {
  574. path: 'order/history',
  575. component: () => import('@/views/ad/applet/history/index'),
  576. meta: { title: '订单记录' }
  577. },
  578. {
  579. path: 'user',
  580. component: () => import('@/views/ad/applet/user/index'),
  581. meta: { title: '注册用户' }
  582. }
  583. ]
  584. },
  585. {
  586. path: '/u',
  587. component: Layout,
  588. access: Access.MANAGE_TENANTS,
  589. meta: { title: '升级管理', icon: 'upgrade' },
  590. children: [
  591. {
  592. path: 'apk',
  593. component: () => import('@/views/platform/upgrade/index'),
  594. meta: { title: '版本管理' }
  595. },
  596. {
  597. path: 'deploy',
  598. component: () => import('@/views/platform/upgrade/deploy/index'),
  599. meta: { title: '发布升级' }
  600. }
  601. ]
  602. },
  603. {
  604. hidden: true,
  605. name: 'program',
  606. path: '/cm/program/:id',
  607. component: () => import('@/views/screen/material/program/ast/index'),
  608. props: true
  609. },
  610. {
  611. hidden: true,
  612. name: 'devops',
  613. path: '/d/dashboard/devops',
  614. component: () => import('@/views/dashboard/v1/index')
  615. },
  616. {
  617. hidden: true,
  618. name: 'business',
  619. path: '/d/dashboard/business',
  620. component: () => import('@/views/dashboard/v2/index')
  621. },
  622. {
  623. dev: !__DEVICE_DASHBARD__,
  624. hidden: true,
  625. name: 'device-dashboard',
  626. path: '/dm/dashboard/:id',
  627. component: () => import('@/views/device/detail/dashboard/index'),
  628. props: true
  629. },
  630. // 404 page must be placed at the end !!!
  631. { hidden: true, path: '*', redirect: '/' }
  632. ]
  633. const createRouter = () => new Router({
  634. // mode: 'history', // require service support
  635. scrollBehavior: () => { return { y: 0 } },
  636. routes: constantRoutes
  637. })
  638. const router = createRouter()
  639. // Detail see: https://github.com/vuejs/vue-router/issues/1234#issuecomment-357941465
  640. export function resetRouter () {
  641. const newRouter = createRouter()
  642. router.matcher = newRouter.matcher
  643. }
  644. export default router