| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478 |
- import Vue from 'vue'
- import Router from 'vue-router'
- import {
- ScheduleType,
- Access
- } 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 not a wrapping layer(Layout or Solo), 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,
- children: [
- {
- name: 'home',
- path: 'home',
- component: () => import('@/views/dashboard/index'),
- meta: { title: '首页', icon: 'home' }
- },
- {
- hidden: true,
- name: 'profile',
- path: 'profile',
- component: () => import('@/views/platform/profile/index'),
- meta: { title: '个人设置' }
- }
- ]
- },
- {
- path: '/cm',
- component: Layout,
- meta: { title: '智能信发', icon: 'cm' },
- children: [
- {
- name: 'media',
- path: 'media',
- component: () => import('@/views/platform/media/index'),
- access: [Access.MANAGE_CALENDAR, Access.MANAGE_GROUP],
- meta: { title: '媒资管理' }
- },
- {
- name: 'program-list',
- path: 'program',
- component: () => import('@/views/bigscreen/index'),
- access: [Access.MANAGE_CALENDAR, Access.MANAGE_GROUP],
- meta: { title: '节目管理' }
- },
- {
- path: 'recur',
- component: Solo,
- meta: { title: '轮播管理' },
- children: [
- {
- name: 'recur-list',
- path: '',
- component: () => import('@/views/schedule/index'),
- access: [Access.MANAGE_CALENDAR, Access.MANAGE_GROUP],
- meta: { cache: 'ScheduleList' },
- props: { type: ScheduleType.RECUR, redirect: 'recur-design' }
- },
- {
- hidden: true,
- name: 'recur-design',
- path: ':id',
- component: () => import('@/views/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/schedule/index'),
- access: [Access.MANAGE_CALENDAR, Access.MANAGE_GROUP],
- meta: { cache: 'ScheduleList' },
- props: { type: ScheduleType.COMPLEX, redirect: 'schedule-design' }
- },
- {
- hidden: true,
- name: 'schedule-design',
- path: ':id',
- component: () => import('@/views/schedule/designer/index'),
- access: Access.MANAGE_CALENDAR,
- meta: { title: '编辑', cache: 'ScheduleList' },
- props: { redirect: 'schedule-list' }
- }
- ]
- },
- {
- name: 'schedule-deploy',
- path: 'deploy',
- component: () => import('@/views/schedule/deploy/index'),
- access: Access.MANAGE_CALENDAR,
- meta: { title: '排期发布' }
- },
- // {
- // path: 'review',
- // component: () => import('@/views/review/index'),
- // access: Access.MANAGE_GROUP,
- // meta: { title: '审核管理' }
- // },
- {
- path: 'workflow',
- component: Solo,
- access: Access.MANAGE_GROUP,
- meta: { title: '流程审核' },
- children: [
- {
- name: 'workflow-list',
- path: '',
- component: () => import('@/views/review/workflow/index'),
- meta: { cache: 'WorkflowList' }
- },
- {
- hidden: true,
- name: 'workflow-detail',
- path: ':id',
- component: () => import('@/views/review/workflow/detail/index'),
- meta: { title: '审核', cache: 'WorkflowList' }
- }
- ]
- },
- {
- path: 'mine',
- component: () => import('@/views/review/workflow/mine/index'),
- access: Access.MANAGE_CALENDAR,
- meta: { title: '我的流程' }
- },
- {
- name: 'deploy-history',
- path: 'history',
- component: () => import('@/views/review/history/index'),
- access: [Access.MANAGE_CALENDAR, Access.MANAGE_GROUP],
- meta: { title: '发布历史' }
- }
- ]
- },
- {
- path: '/dm',
- component: Layout,
- meta: { title: '大屏设备', icon: 'dm' },
- children: [
- {
- name: 'device-timeline',
- path: 'timeline',
- component: () => import('@/views/device/timeline/index'),
- meta: { title: '排期预览' }
- },
- {
- 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' }
- }
- ]
- },
- {
- name: 'group',
- path: 'group',
- component: () => import('@/views/device/group/index'),
- meta: { title: '分组管理' }
- },
- {
- name: 'record',
- path: 'record',
- component: () => import('@/views/device/record/index'),
- meta: { title: '视频回采' }
- }
- ]
- },
- {
- path: '/dashboard',
- component: Solo,
- meta: { title: '大数据', icon: 'dm' },
- access: [Access.MANAGE_TENANTS, Access.MANAGE_TENANT],
- children: [
- {
- name: 'dashboard-v0',
- path: 'v0',
- component: () => import('@/views/dashboard/v0/index'),
- meta: { title: 'V0' }
- },
- {
- name: 'dashboard-v1',
- path: 'v1',
- component: () => import('@/views/dashboard/v1/index'),
- meta: { title: 'V1' }
- }
- ]
- },
- {
- path: '/em',
- component: Layout,
- access: Access.MANAGE_TENANTS,
- meta: { title: '设备录入', icon: 'em' },
- children: [
- {
- path: 'transmitter',
- name: 'transmitter',
- component: () => import('@/views/external/transmitter/index'),
- meta: { title: '发送控制设备' }
- },
- {
- path: 'gateway',
- name: 'gateway',
- component: () => import('@/views/external/gateway/index'),
- meta: { title: '网关' }
- },
- {
- path: 'camera',
- name: 'camera',
- component: () => import('@/views/external/camera/index'),
- meta: { title: '摄像头' }
- }
- ]
- },
- {
- path: '/pm',
- component: Layout,
- access: [Access.MANAGE_TENANTS, Access.MANAGE_TENANT],
- meta: { title: '平台管理', icon: 'pm' },
- children: [
- {
- name: 'settings',
- path: 'settings',
- component: () => import('@/views/realm/settings/index'),
- meta: { title: '功能管理' }
- },
- {
- name: 'org',
- path: 'org',
- component: () => import('@/views/realm/tenant/index'),
- meta: { title: '组织管理' }
- },
- {
- name: 'account',
- 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/realm/device/settings/index'),
- access: Access.MANAGE_TENANTS,
- meta: { title: '配置', cache: 'DeviceManagement' }
- }
- ]
- },
- {
- name: 'device-assign',
- path: 'device/assign',
- component: () => import('@/views/realm/assign/index'),
- meta: { title: '设备分配' }
- },
- {
- name: 'ai-stock',
- path: 'ai/stock',
- component: () => import('@/views/realm/ai-stock/index'),
- meta: { title: 'AI审核库存' }
- },
- {
- name: 'ai-timing',
- path: 'ai/timing',
- component: () => import('@/views/realm/ai-timing/index'),
- meta: { title: 'AI抽帧检测' }
- }
- ]
- },
- {
- path: '/ad',
- component: Layout,
- meta: { title: '广告', icon: 'ad' },
- access: [Access.MANAGE_TENANTS],
- children: [
- {
- name: 'ad-asset-review',
- path: 'asset/review',
- component: () => import('@/views/ad/review-asset/index'),
- meta: { title: '素材审核' }
- },
- {
- name: 'ad-order-review',
- path: 'order/review',
- component: () => import('@/views/ad/review-order/index'),
- meta: { title: '订单审核' }
- }
- ]
- },
- {
- path: '/bm',
- component: Layout,
- meta: { title: '应急广播', icon: 'bm' },
- children: [
- {
- name: 'broadcast-template',
- path: 'template',
- component: () => import('@/views/broadcast/template/index'),
- access: Access.MANAGE_TENANTS,
- meta: { title: '模板管理' }
- },
- {
- name: 'broadcast-deploy',
- path: 'deploy',
- component: () => import('@/views/broadcast/deploy/index'),
- access: [Access.MANAGE_TENANTS, Access.MANAGE_TENANT],
- meta: { title: '广播发布' }
- },
- {
- name: 'broadcast-deploy-history',
- path: 'history',
- component: () => import('@/views/broadcast/history/index'),
- access: [Access.MANAGE_TENANTS, Access.MANAGE_TENANT],
- meta: { title: '发布历史' }
- }
- ]
- },
- {
- path: '/l',
- component: Layout,
- access: Access.VIEW_LOGS,
- meta: { icon: 'logger' },
- children: [
- {
- path: '',
- name: 'logger',
- component: () => import('@/views/platform/logger/index'),
- meta: { title: '操作日志' }
- }
- ]
- },
- {
- path: '/d',
- component: Layout,
- access: Access.MANAGE_TENANTS,
- meta: { icon: 'bug', title: '调试' },
- children: [
- {
- path: 'logger',
- name: 'debug',
- component: () => import('@/views/realm/debug/index'),
- meta: { title: '日志' }
- },
- {
- path: 'simulator',
- name: 'simulator',
- component: () => import('@/views/realm/debug/simulator/index'),
- meta: { title: '模拟器' }
- }
- ]
- },
- {
- path: '/u',
- component: Layout,
- access: Access.MANAGE_TENANTS,
- meta: { title: '升级管理', icon: 'upgrade' },
- children: [
- {
- path: 'apk',
- name: 'upgrade-apk',
- component: () => import('@/views/realm/upgrade/index'),
- meta: { title: '版本管理' }
- },
- {
- path: 'deploy',
- name: 'upgrade-deploy',
- component: () => import('@/views/realm/upgrade/deploy/index'),
- meta: { title: '发布升级' }
- }
- ]
- },
- {
- hidden: true,
- name: 'program',
- path: '/cm/program/:id',
- component: () => import('@/views/bigscreen/ast/index'),
- props: true
- },
- {
- 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
|