import Vue from 'vue' import Router from 'vue-router' import { // ScheduleType, Access, Camera, CameraInfo, Sensor, SensorInfo } from '@/constant' import Layout from '@/layout' import Solo from '@/layout/Solo' Vue.use(Router) /** * sub-menu only appear when route children.length >= 1 * dev: true, if set true, item will not show in production * hidden: true, if set true, item will not show in the sidebar(default is false) * name:'router-name' , if it is a manual jump, it must be set!!! * include: ['admin'], control the page roles (you can set multiple roles) * access: 'manage-profile', control the page access * meta : { * title: 'title', the name show in sidebar and breadcrumb (recommend set) * icon: 'svg-name'/'el-icon-x', the icon show in the sidebar * cache: 'router-name' if set, the router will be cached (only in Solo) * } */ /** * constantRoutes * a base page that does not have permission requirements * all roles can be accessed */ export const constantRoutes = [ { hidden: true, path: '/error', component: () => import('@/views/platform/error-page/index') } ] /** * asyncRoutes * the routes that need to be dynamically loaded based on user roles */ export const asyncRoutes = [ { path: '/', redirect: '/home', component: Layout, meta: { title: '首页', icon: 'home' }, children: [ { name: 'home', path: 'home', component: () => import('@/views/dashboard/index'), meta: { title: '全局概览' } }, { path: 'map', component: () => import('@/views/dashboard/map/index'), meta: { title: '地图位置' } } ] }, { path: '/am', component: Layout, access: [Access.MANAGE_CALENDAR, Access.MANAGE_GROUP], meta: { title: '内容管理', icon: 'am' }, children: [ { path: 'media', component: () => import('@/views/screen/material/media/index'), meta: { title: '资源' } }, { path: 'dataset', component: () => import('@/views/screen/material/dataset/index'), meta: { title: '素材包' } }, { path: 'program', component: () => import('@/views/screen/material/program/index'), meta: { title: '节目' } }, // { // path: 'recur', // component: Solo, // meta: { title: '轮播' }, // children: [ // { // name: 'recur-list', // path: '', // component: () => import('@/views/screen/material/schedule/index'), // meta: { cache: 'ScheduleList' }, // props: { type: ScheduleType.RECUR, redirect: 'recur-design' } // }, // { // hidden: true, // name: 'recur-design', // path: ':id', // component: () => import('@/views/screen/material/schedule/designer/index'), // access: Access.MANAGE_CALENDAR, // meta: { title: '编辑', cache: 'ScheduleList' }, // props: { redirect: 'recur-list' } // } // ] // }, // { // path: 'schedule', // component: Solo, // meta: { title: '排期' }, // children: [ // { // name: 'schedule-list', // path: '', // component: () => import('@/views/screen/material/schedule/index'), // meta: { cache: 'ScheduleList' }, // props: { type: ScheduleType.COMPLEX, redirect: 'schedule-design' } // }, // { // hidden: true, // name: 'schedule-design', // path: ':id', // component: () => import('@/views/screen/material/schedule/designer/index'), // access: Access.MANAGE_CALENDAR, // meta: { title: '编辑', cache: 'ScheduleList' }, // props: { redirect: 'schedule-list' } // } // ] // }, { path: 'tag', component: () => import('@/views/screen/material/tag/index'), meta: { title: '资源标签' } }/* , { path: 'review', component: () => import('@/views/screen/review/single/index'), access: Access.MANAGE_GROUP, meta: { title: '审核' } } */ ] }, { path: '/cm', component: Layout, meta: { title: '智能信发', icon: 'cm' }, children: [ { path: 'deploy/device', component: () => import('@/views/screen/deploy/device/index'), access: Access.MANAGE_CALENDAR, meta: { title: '按设备发布' } }, { path: 'deploy/ratio', component: () => import('@/views/screen/deploy/ratio/index'), access: Access.MANAGE_CALENDAR, meta: { title: '按宽高比发布' } }, { path: 'mine', component: () => import('@/views/screen/review/workflow/mine/index'), access: Access.MANAGE_CALENDAR, meta: { title: '我的流程' } }, { path: 'workflow', component: Solo, access: [ Access.REVIEW_RELEASE_FIRST, Access.REVIEW_RELEASE_SECOND, Access.REVIEW_RELEASE_FINAL ], meta: { title: '流程审核' }, children: [ { name: 'workflow-list', path: '', component: () => import('@/views/screen/review/workflow/index'), meta: { cache: 'WorkflowList' } }, { hidden: true, name: 'workflow-audit', path: ':id', component: () => import('@/views/screen/review/workflow/audit/index'), meta: { title: '审核', cache: 'WorkflowList' } } ] }, { path: 'history', component: () => import('@/views/screen/review/workflow/history/index'), access: [Access.MANAGE_CALENDAR, Access.MANAGE_GROUP], meta: { title: '发布历史' } } ] }, { path: '/task', component: Layout, access: [Access.MANAGE_CALENDAR, Access.MANAGE_GROUP], meta: { title: '自动编排', icon: 'ad' }, children: [ { path: 'asset', component: () => import('@/views/ad/automation/task/AssetTask.vue'), access: Access.MANAGE_TENANTS, meta: { title: '资源上播管理' } }, { path: 'screen', component: () => import('@/views/ad/automation/task/ScreenTask.vue'), meta: { title: '屏体上播管理' } }, { path: 'scheduling', component: () => import('@/views/ad/automation/scheduling/index'), meta: { title: '节目单' } }, { path: 'dataset', component: () => import('@/views/ad/automation/dataset/index'), meta: { title: '填充素材包' } }, { path: 'contract', component: () => import('@/views/ad/automation/contract/index'), meta: { title: '合同' } } ] }, { path: '/dm', component: Layout, meta: { title: '大屏设备', icon: 'dm' }, children: [ { path: 'device', component: Solo, meta: { title: '我的设备' }, children: [ { name: 'device-list', path: '', component: () => import('@/views/device/index'), meta: { cache: 'DeviceList' } }, { hidden: true, name: 'device-detail', path: ':id', component: () => import('@/views/device/detail/index'), meta: { title: '设备详情', cache: 'DeviceList' } } ] }, { path: 'timeline', component: () => import('@/views/device/timeline/index'), meta: { title: '排期预览' } }, { path: 'record', component: () => import('@/views/device/record/index'), meta: { title: '视频回采' } }, { path: 'group', component: () => import('@/views/device/group/index'), meta: { title: '分组管理' } }, { path: 'power', component: () => import('@/views/device/power/index'), access: Access.MANAGE_DEVICE, meta: { title: '批量开关电源' } } ] }, { path: '/pm', component: Layout, access: Access.MANAGE_TENANT, meta: { title: '平台管理', icon: 'pm' }, children: [ { path: 'settings', component: () => import('@/views/realm/settings/index'), meta: { title: '功能管理' } }, { path: 'org', component: () => import('@/views/realm/org/index'), meta: { title: '组织管理' } }, { path: 'account', component: () => import('@/views/realm/user/index'), meta: { title: '账号管理' } }, { path: 'device/manage', component: Solo, meta: { title: '设备管理' }, children: [ { name: 'device-management', path: '', component: () => import('@/views/realm/device/index'), meta: { cache: 'DeviceManagement' } }, { hidden: true, name: 'device-management-detail', path: 'detail/:id', component: () => import('@/views/device/detail/index'), meta: { title: '详情', cache: 'DeviceManagement' } }, { hidden: true, name: 'device-management-settings', path: 'settings/:id', component: () => import('@/views/external/box/settings/index'), meta: { title: '配置', cache: 'DeviceManagement' }, props: { redirect: 'device-management' } } ] }, { path: 'device/assign', component: () => import('@/views/realm/assign/index'), meta: { title: '设备分配' } }, { path: 'ai/audit', component: () => import('@/views/realm/ai/ai-audit/index'), meta: { title: 'AI审核' } }, { path: 'ai/timing', component: () => import('@/views/realm/ai/ai-timing/index'), meta: { title: 'AI抽帧检测' } }, { path: 'ai/camera', component: () => import('@/views/external/camera/snap/index'), meta: { title: '摄像头黑屏检测' } } ] }, { path: '/bm', component: Layout, access: Access.MANAGE_TENANT, meta: { title: '应急广播', icon: 'bm' }, children: [ { path: 'deploy', component: () => import('@/views/broadcast/deploy/index'), meta: { title: '发布' } }, { path: 'history', component: () => import('@/views/broadcast/history/index'), meta: { title: '发布历史' } } ] }, { path: '/d', component: Layout, meta: { icon: 'logger', title: '数据统计' }, children: [ { path: 'asset', component: () => import('@/views/dashboard/statistic/index'), access: Access.MANAGE_TENANT, meta: { title: '资源播放' } }, { path: 'logger', component: () => import('@/views/realm/logger/index'), access: Access.MANAGE_TENANT, meta: { title: '操作日志' } }, { path: 'report', component: () => import('@/views/realm/report/index'), access: [ Access.MANAGE_TENANT, Access.MANAGE_GROUP, Access.MANAGE_CALENDAR ], meta: { title: '报表导出' } }, // { // path: 'internal:dashboard/v0', // access: Access.MANAGE_TENANT, // meta: { title: '大数据V0', internal: true } // }, { path: 'internal:dashboard/devops', access: Access.MANAGE_TENANT, meta: { title: '运维大数据', internal: true } }, { path: 'internal:dashboard/business', access: Access.MANAGE_TENANT, meta: { title: '运营大数据', internal: true } } ] }, { path: '/super', component: Layout, access: Access.MANAGE_TENANTS, meta: { title: '超管功能', icon: 'pm' }, children: [ { path: 'tenant', component: () => import('@/views/platform/tenant/index'), meta: { title: '租户管理' } }, { path: 'template', component: () => import('@/views/broadcast/template/index'), meta: { title: '应急广播模板管理' } }, { path: 'ai/stock', component: () => import('@/views/platform/ai-stock/index'), meta: { title: 'AI审核库存' } }, { path: 'mqtt', component: () => import('@/views/platform/debug/index'), meta: { title: 'MQTT' } }, { path: 'simulator', component: () => import('@/views/platform/simulator/index'), meta: { title: '模拟器' } }, { path: 'remote/log', component: () => import('@/views/platform/remote-log/index'), meta: { title: '日志抓取' } }, { path: 'cooperation', component: () => import('@/views/platform/cooperation/index'), meta: { title: '合作意向' } } ] }, { path: '/em', component: Layout, access: Access.MANAGE_TENANTS, meta: { title: '设备录入', icon: 'em' }, children: [ { path: 'mesh', component: Solo, meta: { title: '网点' }, children: [ { name: 'mesh-list', path: '', component: () => import('@/views/external/index'), meta: { cache: 'MeshList' } }, { hidden: true, name: 'mesh', path: ':id', component: () => import('@/views/external/mesh/index'), meta: { title: '详情', cache: 'MeshList' } } ] }, { path: 'box', component: Solo, meta: { title: '终端设备' }, children: [ { name: 'box-management', path: '', component: () => import('@/views/external/box/index'), meta: { cache: 'BoxManagement' } }, { hidden: true, name: 'box-settings', path: 'settings/:id', component: () => import('@/views/external/box/settings/index'), meta: { title: '配置', cache: 'BoxManagement' }, props: { redirect: 'box-management' } } ] }, { path: 'manufacturer', component: () => import('@/views/external/manufacturer/index'), meta: { title: '厂商' } }, { path: 'screen', component: () => import('@/views/external/screen/index'), meta: { title: '屏幕' } }, { path: 'sending-card', component: () => import('@/views/external/sending-card/index'), meta: { title: '发送控制设备' } }, { path: 'receiving-card', component: () => import('@/views/external/receiving-card/index'), meta: { title: '接收卡' } }, ...Object.keys(Camera).map(key => { return { path: `camera/${Camera[key]}`, component: () => import('@/views/external/camera/index'), meta: { title: CameraInfo[Camera[key]] }, props: { type: Camera[key] } } }), { path: 'multi', component: () => import('@/views/external/multifunction-card/index'), meta: { title: '多功能卡' } }, ...Object.keys(Sensor).map(key => { return { path: `sensor/${Sensor[key]}`, component: () => import('@/views/external/sensor/index'), meta: { title: SensorInfo[Sensor[key]] }, props: { type: Sensor[key] } } }), { path: 'gateway', component: () => import('@/views/external/gateway/index'), meta: { title: '网关' } }, { path: 'plc', component: () => import('@/views/external/plc/index'), meta: { title: 'PLC' } } ] }, { path: '/ad', component: Layout, meta: { title: '自助广告', icon: 'ad' }, access: Access.MANAGE_TENANTS, children: [ { path: 'asset/review', component: () => import('@/views/ad/applet/review-asset/index'), meta: { title: '资源审核' } }, { path: 'order/review', component: () => import('@/views/ad/applet/review-order/index'), meta: { title: '订单审核' } }, { path: 'order/history', component: () => import('@/views/ad/applet/history/index'), meta: { title: '订单记录' } }, { path: 'user', component: () => import('@/views/ad/applet/user/index'), meta: { title: '注册用户' } } ] }, { path: '/u', component: Layout, access: Access.MANAGE_TENANTS, meta: { title: '升级管理', icon: 'upgrade' }, children: [ { path: 'apk', component: () => import('@/views/platform/upgrade/index'), meta: { title: '版本管理' } }, { path: 'deploy', component: () => import('@/views/platform/upgrade/deploy/index'), meta: { title: '发布升级' } } ] }, { hidden: true, name: 'program', path: '/cm/program/:id', component: () => import('@/views/screen/material/program/ast/index'), props: true }, { hidden: true, name: 'devops', path: '/d/dashboard/devops', component: () => import('@/views/dashboard/v1/index') }, { hidden: true, name: 'business', path: '/d/dashboard/business', component: () => import('@/views/dashboard/v2/index') }, { dev: !__DEVICE_DASHBARD__, hidden: true, name: 'device-dashboard', path: '/dm/dashboard/:id', component: () => import('@/views/device/detail/dashboard/index'), props: true }, // 404 page must be placed at the end !!! { hidden: true, path: '*', redirect: '/' } ] const createRouter = () => new Router({ // mode: 'history', // require service support scrollBehavior: () => { return { y: 0 } }, routes: constantRoutes }) const router = createRouter() // Detail see: https://github.com/vuejs/vue-router/issues/1234#issuecomment-357941465 export function resetRouter () { const newRouter = createRouter() router.matcher = newRouter.matcher } export default router