import { useIsMicro } from '@/hooks/effect' import vueRouter, { NavigationFailure, RouteRecordRaw, createRouter, createWebHistory, RouterView } from 'vue-router' import dashboard from '@/pages/iot/dashboard/deviceAccess/index.vue' const iot = { path: '/iot', name: '物联网', meta: { title: '物联网' }, component: () => import('@/layout/layout.vue'), redirect: '/dashboard', children: [ { path: '/dashboard', name: '系统概览', icon: 'DashboardOutlined', component: dashboard }, { path: '/product', name: '产品模型', redirect: '/product/index', icon: 'AppstoreOutlined', children: [ { path: '/product/index', name: '产品模型', component: () => import('@/pages/iot/model/index.vue') }, { path: '/product/models', name: '产品模型库', component: () => import('@/pages/iot/model/models.vue') }, { path: '/product/detail', name: '产品模型详情', hidden: true, component: () => import('@/pages/iot/model/detail.vue') } ] }, { path: '/device', name: '设备管理', redirect: '/device/index', icon: 'RobotOutlined', children: [ { path: '/device/index', name: '所有设备', component: () => import('@/pages/iot/device/index.vue') }, { path: '/device/detail', name: '设备详情', hidden: true, component: () => import('@/pages/iot/device/detail.vue') }, { path: '/device/group', name: '设备群组', component: () => import('@/pages/iot/device/group.vue') }, { path: '/device/topology', name: '设备拓扑', component: () => import('@/pages/iot/device/topology.vue') }, { path: '/device/analysis', name: '设备分析', component: () => import('@/pages/iot/device/analysis.vue') } // { // path: '/device/simulator', // name: '设备模拟', // component: () => import('@/pages/iot/device/simulator.vue') // } ] }, { path: '/rule', name: '数据规则', redirect: '/rule/forward', icon: 'AimOutlined', children: [ { path: '/rule/forward', name: '转发规则', component: () => import('@/pages/iot/rule/forwardRule.vue') }, { path: '/rule/link', name: '联动规则', component: () => import('@/pages/iot/rule/linkRules.vue') } ] }, { path: '/devOps', name: '监控运维', redirect: '/devOps/report', icon: 'CodeOutlined', children: [ { path: '/devOps/report', name: '数据监控', component: () => import('@/pages/iot/devOps/statistReport.vue') }, { path: '/devOps/onlineTest', name: '在线调试', component: () => import('@/pages/iot/devOps/onlineTest.vue') }, { path: '/devOps/mt', name: '消息追踪', component: () => import('@/pages/iot/devOps/msgTracking.vue') }, { path: '/devOps/nowAlert', name: '当前告警', component: () => import('@/pages/iot/devOps/nowAlert.vue') }, { path: '/devOps/nowNotice', name: '当前提醒', component: () => import('@/pages/iot/devOps/nowNotice.vue') } ] }, { path: '/dataServer', name: '数据服务', icon: 'DatabaseOutlined', children: [ { path: '/dataServer/history', name: '历史数据', component: () => import('@/pages/iot/dataServer/history.vue') }, { path: '/dataServer/openApi', name: '开放接口', component: () => import('@/pages/iot/dataServer/openApi.vue') } ] }, { path: '/task', name: '任务中心', redirect: '/task/manage', icon: 'ContainerOutlined', children: [ { path: '/task/manage', name: '任务管理', component: () => import('@/pages/iot/task/manage.vue') }, { path: '/task/track', name: '任务追踪', component: () => import('@/pages/iot/task/track.vue') } ] }, { path: '/ota', name: 'OTA程序包', icon: 'FolderAddOutlined', component: () => import('@/pages/iot/ota/index.vue') }, { path: '/sys', name: '系统设置', redirect: '/sys/noticeway', icon: 'DatabaseOutlined', children: [ { path: '/sys/noticeway', name: '通知方式', component: () => import('@/pages/iot/sys/noticeway.vue') }, { path: '/sys/notice', name: '通知设置', component: () => import('@/pages/iot/sys/notice.vue') } ] }, { path: '/tps', name: '第三方服务', redirect: '/sys/noticeway', icon: 'DatabaseOutlined', children: [ { path: '/tps/list', name: '服务列表', component: () => import('@/pages/iot/tps/list.vue') }, { path: '/tps/device', name: '设备服务', component: () => import('@/pages/iot/tps/device.vue') } ] }, { path: '/doc', name: '使用文档', redirect: '', icon: 'SnippetsOutlined', children: [ { path: '/deviceDoc', name: '设备接入文档', component: () => import('@/pages/iot/doc/deviceDoc.vue'), icon: 'BookOutlined' }, { path: '/dataDoc', name: '数据服务文档', component: () => import('@/pages/iot/doc/dataDoc.vue'), icon: 'CoffeeOutlined' } ] } ] } const datacenter = { path: '/datacenter', name: '数据中台', meta: { title: '数据中台' }, component: () => import('@/layout/layout.vue'), redirect: '/dataSource', children: [ { path: '/dataSource', name: '数据源', icon: 'DatabaseOutlined', redirect: '/dataSource/manage', children: [ { path: '/dataSource/manage', name: '数据源管理', component: () => import('@/pages/datacenter/dataSource/manage/index.vue') }, { path: '/dataSource/metaTool', name: '元数据管理', component: () => import('@/pages/datacenter/dataSource/metaTool/index.vue') } ] }, { path: '/dataLake', name: '数据湖', icon: 'LaptopOutlined', redirect: '/dataLake/dataTool', children: [ { path: '/dataLake/dataTool', name: '数据湖工具', component: () => import('@/pages/datacenter/dataLake/dataTool/index.vue') }, { path: '/dataLake/dataIsland', name: '数据岛', component: () => import('@/pages/datacenter/dataLake/dataTool/index.vue') } ] }, { path: '/APICenter', name: '数据编排', icon: 'ApiOutlined', component: () => import('@/pages/datacenter/APICenter/index.vue') } ] } const view = { path: 'http://172.28.0.3:28080/#/project/items', name: '可视化', meta: { title: '可视化' }, link: true } const user = { path: '/user', name: '用户权限', meta: { title: '用户群组' }, component: () => import('@/layout/layout.vue'), redirect: '/manage', children: [ { path: '/manage', name: '用户管理', icon: 'TeamOutlined', component: () => import('@/pages/user/manage/index.vue') }, { path: '/resource', name: '资源管理', icon: 'FolderOpenOutlined', component: () => import('@/pages/user/resource/index.vue') } ] } const login = { path: '/login', name: '登录', meta: { title: '登录' }, component: () => import('@/pages/login/index.vue') } const cvs = { path: '/cvs', name: '视联网', meta: { title: '视联网' }, component: () => import('@/layout/layout.vue'), redirect: '/cvs/video/space', children: [ { path: '/cvs/csys', name: '系统概览 ', icon: 'PieChartOutlined', component: () => import('@/pages/cvs/csys/index.vue') }, { path: '/cvs/video', name: '视频接入', icon: 'VideoCameraAddOutlined', redirect: '/cvs/video/space', children: [ { path: '/cvs/video/space', name: '空间', icon: '', component: () => import('@/pages/cvs/video/space.vue') }, { path: '/cvs/video/device', name: '设备', icon: '', component: () => import('@/pages/cvs/video/device.vue') }, { path: '/cvs/video/tree', name: '设备组织树', icon: '', component: () => import('@/pages/cvs/video/orgtree.vue') } ] }, { path: '/cvs/project', name: '项目管理', icon: 'GroupOutlined', component: () => import('@/pages/cvs/project/index.vue') }, { path: '/cvs/operator', name: '算子仓库', icon: 'CloudServerOutlined', redirect: '/cvs/operator/manage', children: [ { path: '/cvs/operator/manage', name: '算子管理', icon: '', component: () => import('@/pages/cvs/operator/manage.vue') }, { path: '/cvs/operator/version', name: '算子版本', icon: '', hidden: true, component: () => import('@/pages/cvs/operator/version.vue') } ] }, { path: '/cvs/cvsSever', name: '数据管理', icon: 'AppstoreOutlined', component: () => import('@/pages/cvs/dataServer/dataServer.vue') }, { path: '/cvs/edge', name: '边缘设备', icon: 'ApiOutlined', children: [ { path: '/cvs/edge/list', name: '设备列表', icon: '', component: () => import('@/pages/cvs/edge/list.vue') }, { path: '/cvs/edge/task', name: '设备任务', icon: '', component: () => import('@/pages/cvs/edge/task.vue') }, { path: '/cvs/dataSever/video', name: '设备视频', icon: '', component: () => import('@/pages/cvs/edge/video.vue') }, { path: '/cvs/edge/manage', name: 'AI事件管理', icon: '', component: () => import('@/pages/cvs/edge/manage.vue') }, { path: '/cvs/edge/forward', name: 'AI事件转发', icon: '', component: () => import('@/pages/cvs/edge/forward.vue') } ] }, { path: '/cvs/nodes', name: '节点管理 ', icon: 'DeploymentUnitOutlined', component: () => import('@/pages/cvs/nodes/index.vue') } ] } const _routes = [iot, cvs] as any if (_routes[0].link) { window.open(_routes[0].path) } const redirectRoutes = { path: '/', name: '', meta: { title: '' }, redirect: _routes[0].redirect } export const routes: Array = [redirectRoutes, ..._routes, login].map(item => { const _item = item.link ? { ...item, path: '/' + item.path } : item return _item }) const microRouter = useIsMicro() ? [ { path: '/cloudlink', name: 'cloudlink', component: RouterView, redirect: _routes[0].redirect, children: _routes } ] : routes console.log('window.__POWERED_BY_QIANKUN__:', window.__POWERED_BY_QIANKUN__) const baseUri = window.__POWERED_BY_QIANKUN__ ? '/cloudlink/' : process.env.NODE_ENV === 'development' ? './' : '/child/cloudlink/' const router = createRouter({ history: createWebHistory(baseUri), routes: microRouter }) export default router