index.ts 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496
  1. import { useIsMicro } from '@/hooks/effect'
  2. import vueRouter, { NavigationFailure, RouteRecordRaw, createRouter, createWebHistory, RouterView } from 'vue-router'
  3. import dashboard from '@/pages/iot/dashboard/deviceAccess/index.vue'
  4. const iot = {
  5. path: '/iot',
  6. name: '物联网',
  7. meta: {
  8. title: '物联网'
  9. },
  10. component: () => import('@/layout/layout.vue'),
  11. redirect: '/dashboard',
  12. children: [
  13. {
  14. path: '/dashboard',
  15. name: '系统概览',
  16. icon: 'DashboardOutlined',
  17. component: dashboard
  18. },
  19. {
  20. path: '/product',
  21. name: '产品模型',
  22. redirect: '/product/index',
  23. icon: 'AppstoreOutlined',
  24. children: [
  25. {
  26. path: '/product/index',
  27. name: '产品模型',
  28. component: () => import('@/pages/iot/model/index.vue')
  29. },
  30. {
  31. path: '/product/models',
  32. name: '产品模型库',
  33. component: () => import('@/pages/iot/model/models.vue')
  34. },
  35. {
  36. path: '/product/detail',
  37. name: '产品模型详情',
  38. hidden: true,
  39. component: () => import('@/pages/iot/model/detail.vue')
  40. }
  41. ]
  42. },
  43. {
  44. path: '/device',
  45. name: '设备管理',
  46. redirect: '/device/index',
  47. icon: 'RobotOutlined',
  48. children: [
  49. {
  50. path: '/device/index',
  51. name: '所有设备',
  52. component: () => import('@/pages/iot/device/index.vue')
  53. },
  54. {
  55. path: '/device/detail',
  56. name: '设备详情',
  57. hidden: true,
  58. component: () => import('@/pages/iot/device/detail.vue')
  59. },
  60. {
  61. path: '/device/group',
  62. name: '设备群组',
  63. component: () => import('@/pages/iot/device/group.vue')
  64. },
  65. {
  66. path: '/device/topology',
  67. name: '设备拓扑',
  68. component: () => import('@/pages/iot/device/topology.vue')
  69. },
  70. {
  71. path: '/device/analysis',
  72. name: '设备分析',
  73. component: () => import('@/pages/iot/device/analysis.vue')
  74. }
  75. // {
  76. // path: '/device/simulator',
  77. // name: '设备模拟',
  78. // component: () => import('@/pages/iot/device/simulator.vue')
  79. // }
  80. ]
  81. },
  82. {
  83. path: '/rule',
  84. name: '数据规则',
  85. redirect: '/rule/forward',
  86. icon: 'AimOutlined',
  87. children: [
  88. {
  89. path: '/rule/forward',
  90. name: '转发规则',
  91. component: () => import('@/pages/iot/rule/forwardRule.vue')
  92. },
  93. {
  94. path: '/rule/link',
  95. name: '联动规则',
  96. component: () => import('@/pages/iot/rule/linkRules.vue')
  97. }
  98. ]
  99. },
  100. {
  101. path: '/devOps',
  102. name: '监控运维',
  103. redirect: '/devOps/report',
  104. icon: 'CodeOutlined',
  105. children: [
  106. {
  107. path: '/devOps/report',
  108. name: '数据监控',
  109. component: () => import('@/pages/iot/devOps/statistReport.vue')
  110. },
  111. {
  112. path: '/devOps/onlineTest',
  113. name: '在线调试',
  114. component: () => import('@/pages/iot/devOps/onlineTest.vue')
  115. },
  116. {
  117. path: '/devOps/mt',
  118. name: '消息追踪',
  119. component: () => import('@/pages/iot/devOps/msgTracking.vue')
  120. },
  121. {
  122. path: '/devOps/nowAlert',
  123. name: '当前告警',
  124. component: () => import('@/pages/iot/devOps/nowAlert.vue')
  125. },
  126. {
  127. path: '/devOps/nowNotice',
  128. name: '当前提醒',
  129. component: () => import('@/pages/iot/devOps/nowNotice.vue')
  130. }
  131. ]
  132. },
  133. {
  134. path: '/dataServer',
  135. name: '数据服务',
  136. icon: 'DatabaseOutlined',
  137. children: [
  138. {
  139. path: '/dataServer/history',
  140. name: '历史数据',
  141. component: () => import('@/pages/iot/dataServer/history.vue')
  142. },
  143. {
  144. path: '/dataServer/openApi',
  145. name: '开放接口',
  146. component: () => import('@/pages/iot/dataServer/openApi.vue')
  147. }
  148. ]
  149. },
  150. {
  151. path: '/task',
  152. name: '任务中心',
  153. redirect: '/task/manage',
  154. icon: 'ContainerOutlined',
  155. children: [
  156. {
  157. path: '/task/manage',
  158. name: '任务管理',
  159. component: () => import('@/pages/iot/task/manage.vue')
  160. },
  161. {
  162. path: '/task/track',
  163. name: '任务追踪',
  164. component: () => import('@/pages/iot/task/track.vue')
  165. }
  166. ]
  167. },
  168. {
  169. path: '/ota',
  170. name: 'OTA程序包',
  171. icon: 'FolderAddOutlined',
  172. component: () => import('@/pages/iot/ota/index.vue')
  173. },
  174. {
  175. path: '/sys',
  176. name: '系统设置',
  177. redirect: '/sys/noticeway',
  178. icon: 'DatabaseOutlined',
  179. children: [
  180. {
  181. path: '/sys/noticeway',
  182. name: '通知方式',
  183. component: () => import('@/pages/iot/sys/noticeway.vue')
  184. },
  185. {
  186. path: '/sys/notice',
  187. name: '通知设置',
  188. component: () => import('@/pages/iot/sys/notice.vue')
  189. }
  190. ]
  191. },
  192. {
  193. path: '/tps',
  194. name: '第三方服务',
  195. redirect: '/sys/noticeway',
  196. icon: 'DatabaseOutlined',
  197. children: [
  198. {
  199. path: '/tps/list',
  200. name: '服务列表',
  201. component: () => import('@/pages/iot/tps/list.vue')
  202. },
  203. {
  204. path: '/tps/device',
  205. name: '设备服务',
  206. component: () => import('@/pages/iot/tps/device.vue')
  207. }
  208. ]
  209. },
  210. {
  211. path: '/doc',
  212. name: '使用文档',
  213. redirect: '',
  214. icon: 'SnippetsOutlined',
  215. children: [
  216. {
  217. path: '/deviceDoc',
  218. name: '设备接入文档',
  219. component: () => import('@/pages/iot/doc/deviceDoc.vue'),
  220. icon: 'BookOutlined'
  221. },
  222. {
  223. path: '/dataDoc',
  224. name: '数据服务文档',
  225. component: () => import('@/pages/iot/doc/dataDoc.vue'),
  226. icon: 'CoffeeOutlined'
  227. }
  228. ]
  229. }
  230. ]
  231. }
  232. const datacenter = {
  233. path: '/datacenter',
  234. name: '数据中台',
  235. meta: {
  236. title: '数据中台'
  237. },
  238. component: () => import('@/layout/layout.vue'),
  239. redirect: '/dataSource',
  240. children: [
  241. {
  242. path: '/dataSource',
  243. name: '数据源',
  244. icon: 'DatabaseOutlined',
  245. redirect: '/dataSource/manage',
  246. children: [
  247. {
  248. path: '/dataSource/manage',
  249. name: '数据源管理',
  250. component: () => import('@/pages/datacenter/dataSource/manage/index.vue')
  251. },
  252. {
  253. path: '/dataSource/metaTool',
  254. name: '元数据管理',
  255. component: () => import('@/pages/datacenter/dataSource/metaTool/index.vue')
  256. }
  257. ]
  258. },
  259. {
  260. path: '/dataLake',
  261. name: '数据湖',
  262. icon: 'LaptopOutlined',
  263. redirect: '/dataLake/dataTool',
  264. children: [
  265. {
  266. path: '/dataLake/dataTool',
  267. name: '数据湖工具',
  268. component: () => import('@/pages/datacenter/dataLake/dataTool/index.vue')
  269. },
  270. {
  271. path: '/dataLake/dataIsland',
  272. name: '数据岛',
  273. component: () => import('@/pages/datacenter/dataLake/dataTool/index.vue')
  274. }
  275. ]
  276. },
  277. {
  278. path: '/APICenter',
  279. name: '数据编排',
  280. icon: 'ApiOutlined',
  281. component: () => import('@/pages/datacenter/APICenter/index.vue')
  282. }
  283. ]
  284. }
  285. const view = {
  286. path: 'http://172.28.0.3:28080/#/project/items',
  287. name: '可视化',
  288. meta: {
  289. title: '可视化'
  290. },
  291. link: true
  292. }
  293. const user = {
  294. path: '/user',
  295. name: '用户权限',
  296. meta: {
  297. title: '用户群组'
  298. },
  299. component: () => import('@/layout/layout.vue'),
  300. redirect: '/manage',
  301. children: [
  302. {
  303. path: '/manage',
  304. name: '用户管理',
  305. icon: 'TeamOutlined',
  306. component: () => import('@/pages/user/manage/index.vue')
  307. },
  308. {
  309. path: '/resource',
  310. name: '资源管理',
  311. icon: 'FolderOpenOutlined',
  312. component: () => import('@/pages/user/resource/index.vue')
  313. }
  314. ]
  315. }
  316. const login = {
  317. path: '/login',
  318. name: '登录',
  319. meta: {
  320. title: '登录'
  321. },
  322. component: () => import('@/pages/login/index.vue')
  323. }
  324. const cvs = {
  325. path: '/cvs',
  326. name: '视联网',
  327. meta: {
  328. title: '视联网'
  329. },
  330. component: () => import('@/layout/layout.vue'),
  331. redirect: '/cvs/video/space',
  332. children: [
  333. {
  334. path: '/cvs/csys',
  335. name: '系统概览 ',
  336. icon: 'PieChartOutlined',
  337. component: () => import('@/pages/cvs/csys/index.vue')
  338. },
  339. {
  340. path: '/cvs/video',
  341. name: '视频接入',
  342. icon: 'VideoCameraAddOutlined',
  343. redirect: '/cvs/video/space',
  344. children: [
  345. {
  346. path: '/cvs/video/space',
  347. name: '空间',
  348. icon: '',
  349. component: () => import('@/pages/cvs/video/space.vue')
  350. },
  351. {
  352. path: '/cvs/video/device',
  353. name: '设备',
  354. icon: '',
  355. component: () => import('@/pages/cvs/video/device.vue')
  356. },
  357. {
  358. path: '/cvs/video/tree',
  359. name: '设备组织树',
  360. icon: '',
  361. component: () => import('@/pages/cvs/video/orgtree.vue')
  362. }
  363. ]
  364. },
  365. {
  366. path: '/cvs/project',
  367. name: '项目管理',
  368. icon: 'GroupOutlined',
  369. component: () => import('@/pages/cvs/project/index.vue')
  370. },
  371. {
  372. path: '/cvs/operator',
  373. name: '算子仓库',
  374. icon: 'CloudServerOutlined',
  375. redirect: '/cvs/operator/manage',
  376. children: [
  377. {
  378. path: '/cvs/operator/manage',
  379. name: '算子管理',
  380. icon: '',
  381. component: () => import('@/pages/cvs/operator/manage.vue')
  382. },
  383. {
  384. path: '/cvs/operator/version',
  385. name: '算子版本',
  386. icon: '',
  387. hidden: true,
  388. component: () => import('@/pages/cvs/operator/version.vue')
  389. }
  390. ]
  391. },
  392. {
  393. path: '/cvs/cvsSever',
  394. name: '数据管理',
  395. icon: 'AppstoreOutlined',
  396. component: () => import('@/pages/cvs/dataServer/dataServer.vue')
  397. },
  398. {
  399. path: '/cvs/edge',
  400. name: '边缘设备',
  401. icon: 'ApiOutlined',
  402. children: [
  403. {
  404. path: '/cvs/edge/list',
  405. name: '设备列表',
  406. icon: '',
  407. component: () => import('@/pages/cvs/edge/list.vue')
  408. },
  409. {
  410. path: '/cvs/edge/task',
  411. name: '设备任务',
  412. icon: '',
  413. component: () => import('@/pages/cvs/edge/task.vue')
  414. },
  415. {
  416. path: '/cvs/dataSever/video',
  417. name: '设备视频',
  418. icon: '',
  419. component: () => import('@/pages/cvs/edge/video.vue')
  420. },
  421. {
  422. path: '/cvs/edge/manage',
  423. name: 'AI事件管理',
  424. icon: '',
  425. component: () => import('@/pages/cvs/edge/manage.vue')
  426. },
  427. {
  428. path: '/cvs/edge/forward',
  429. name: 'AI事件转发',
  430. icon: '',
  431. component: () => import('@/pages/cvs/edge/forward.vue')
  432. }
  433. ]
  434. },
  435. {
  436. path: '/cvs/nodes',
  437. name: '节点管理 ',
  438. icon: 'DeploymentUnitOutlined',
  439. component: () => import('@/pages/cvs/nodes/index.vue')
  440. }
  441. ]
  442. }
  443. const _routes = [iot, cvs] as any
  444. if (_routes[0].link) {
  445. window.open(_routes[0].path)
  446. }
  447. const redirectRoutes = {
  448. path: '/',
  449. name: '',
  450. meta: {
  451. title: ''
  452. },
  453. redirect: _routes[0].redirect
  454. }
  455. export const routes: Array<ROUTER.RoutesProps> = [redirectRoutes, ..._routes, login].map(item => {
  456. const _item = item.link
  457. ? {
  458. ...item,
  459. path: '/' + item.path
  460. }
  461. : item
  462. return _item
  463. })
  464. const microRouter = useIsMicro()
  465. ? [
  466. {
  467. path: '/cloudlink',
  468. name: 'cloudlink',
  469. component: RouterView,
  470. redirect: _routes[0].redirect,
  471. children: _routes
  472. }
  473. ]
  474. : routes
  475. console.log('window.__POWERED_BY_QIANKUN__:', window.__POWERED_BY_QIANKUN__)
  476. const baseUri = window.__POWERED_BY_QIANKUN__ ? '/cloudlink/' : process.env.NODE_ENV === 'development' ? './' : '/child/cloudlink/'
  477. const router = createRouter({
  478. history: createWebHistory(baseUri),
  479. routes: microRouter
  480. })
  481. export default router