forked from floraachy/xiuos_IoT
384 lines
11 KiB
JavaScript
384 lines
11 KiB
JavaScript
import Vue from 'vue'
|
|
import Router from 'vue-router'
|
|
|
|
Vue.use(Router)
|
|
|
|
/* Layout */
|
|
import Layout from '@/layout'
|
|
|
|
/**
|
|
* Note: sub-menu only appear when route children.length >= 1
|
|
* Detail see: https://panjiachen.github.io/vue-element-admin-site/guide/essentials/router-and-nav.html
|
|
*
|
|
* hidden: true if set true, item will not show in the sidebar(default is false)
|
|
* alwaysShow: true if set true, will always show the root menu
|
|
* if not set alwaysShow, when item has more than one children route,
|
|
* it will becomes nested mode, otherwise not show the root menu
|
|
* redirect: noRedirect if set noRedirect will no redirect in the breadcrumb
|
|
* name:'router-name' the name is used by <keep-alive> (must set!!!)
|
|
* meta : {
|
|
roles: ['admin','editor'] control the page roles (you can set multiple roles)
|
|
title: 'title' the name show in sidebar and breadcrumb (recommend set)
|
|
icon: 'svg-name'/'el-icon-x' the icon show in the sidebar
|
|
breadcrumb: false if set false, the item will hidden in breadcrumb(default is true)
|
|
activeMenu: '/example/list' if set path, the sidebar will highlight the path you set
|
|
}
|
|
*/
|
|
|
|
/**
|
|
* constantRoutes
|
|
* a base page that does not have permission requirements
|
|
* all roles can be accessed
|
|
*/
|
|
export const constantRoutes = [
|
|
{
|
|
path: '/',
|
|
redirect: '/home'
|
|
},
|
|
{
|
|
path: '/home',
|
|
component: () => import('@/views/home/index'),
|
|
hidden: true
|
|
},
|
|
{
|
|
path: '/product/M168',
|
|
component: () => import('@/views/product/M168'),
|
|
hidden: true
|
|
},
|
|
{
|
|
path: '/product/RV400',
|
|
component: () => import('@/views/product/RV400'),
|
|
hidden: true
|
|
},
|
|
{
|
|
path: '/product/RV400-SR100',
|
|
component: () => import('@/views/product/RV400-SR100'),
|
|
hidden: true
|
|
},
|
|
{
|
|
path: '/product/M168-SM100',
|
|
component: () => import('@/views/product/M168-SM100'),
|
|
hidden: true
|
|
},
|
|
{
|
|
path: '/product/RV400-AR100',
|
|
component: () => import('@/views/product/RV400-AR100'),
|
|
hidden: true
|
|
},
|
|
{
|
|
path: '/product/instructionDetail',
|
|
component: () => import('@/views/product/instructionDetail'),
|
|
hidden: true
|
|
},
|
|
{
|
|
path: '/product/RV400-CR100',
|
|
component: () => import('@/views/product/RV400-CR100'),
|
|
hidden: true
|
|
},
|
|
{
|
|
path: '/product/M528-CM100',
|
|
component: () => import('@/views/product/M528-CM100'),
|
|
hidden: true
|
|
},
|
|
{
|
|
path: '/product/M528',
|
|
component: () => import('@/views/product/M528'),
|
|
hidden: true
|
|
},
|
|
{
|
|
path: '/product/edu-riscv64',
|
|
component: () => import('@/views/product/edu-riscv64'),
|
|
hidden: true
|
|
},
|
|
{
|
|
path: '/product/edu-arm',
|
|
component: () => import('@/views/product/edu-arm'),
|
|
hidden: true
|
|
},
|
|
{
|
|
path: '/solution/shengda',
|
|
component: () => import('@/views/solution/shengda'),
|
|
hidden: true
|
|
},
|
|
{
|
|
path: '/solution/qianjiang',
|
|
component: () => import('@/views/solution/qianjiang'),
|
|
hidden: true
|
|
},
|
|
{
|
|
path: '/configuration/development',
|
|
component: () => import('@/views/configuration/development'),
|
|
hidden: true
|
|
},
|
|
{
|
|
path: '/configuration/transferStation',
|
|
component: () => import('@/views/configuration/transferStation'),
|
|
hidden: true
|
|
},
|
|
{
|
|
path: '/configuration/AiCity',
|
|
component: () => import('@/views/configuration/AiCity'),
|
|
hidden: true
|
|
},
|
|
{
|
|
path: '/configuration/bridgeMachine',
|
|
component: () => import('@/views/configuration/bridgeMachine'),
|
|
hidden: true
|
|
},
|
|
{
|
|
path: '/login',
|
|
component: () => import('@/views/login/index'),
|
|
hidden: true
|
|
},
|
|
{
|
|
path: '/404',
|
|
component: () => import('@/views/404'),
|
|
hidden: true
|
|
},
|
|
{
|
|
path: '/overview',
|
|
component: Layout,
|
|
meta: {},
|
|
children: [{
|
|
path: '',
|
|
name: 'Overview',
|
|
component: () => import('@/views/overview/index'),
|
|
meta: { title: '概览', icon: 'overview' }
|
|
}]
|
|
}
|
|
]
|
|
|
|
export const asyncRouter = [
|
|
{
|
|
path: '/dashboard',
|
|
component: Layout,
|
|
meta: { permission: ['dashengda', 'hangxiao', 'qianjiangdianqi'] },
|
|
children: [{
|
|
path: '',
|
|
name: 'Dashboard',
|
|
component: () => import('@/views/dashboard/index'),
|
|
meta: { title: '看板', icon: 'dashboard', permission: ['dashengda', 'hangxiao', 'qianjiangdianqi'] }
|
|
}]
|
|
},
|
|
{
|
|
path: '/terminal',
|
|
component: Layout,
|
|
name: 'Terminal',
|
|
meta: { title: '设备管理', icon: 'terminal', permission: ['fanzai', 'dashengda', 'hangxiao', 'qianjiangdianqi', 'jiangxishida'] },
|
|
children: [
|
|
{
|
|
path: 'add',
|
|
name: 'Add',
|
|
component: () => import('@/views/terminal/add/index'),
|
|
meta: { title: '设备新增', permission: ['dashengda', 'hangxiao', 'qianjiangdianqi'] }
|
|
},
|
|
{
|
|
path: 'center',
|
|
name: 'Center',
|
|
component: () => import('@/views/terminal/center/index'),
|
|
meta: { title: '设备参数', permission: ['dashengda', 'hangxiao', 'qianjiangdianqi'] }
|
|
},
|
|
{
|
|
path: 'monitor',
|
|
name: 'Monitor',
|
|
component: () => import('@/views/terminal/monitor/index'),
|
|
meta: { title: '设备监控', permission: ['dashengda', 'hangxiao'] }
|
|
},
|
|
{
|
|
path: 'qjdqMonitor',
|
|
name: 'QJDQMonitor',
|
|
component: () => import('@/views/terminal/qjdqMonitor/index'),
|
|
meta: { title: '设备监控', permission: ['qianjiangdianqi'] }
|
|
},
|
|
{
|
|
path: 'elecDetail',
|
|
name: 'ElecDetail',
|
|
hidden: true,
|
|
component: () => import('@/views/terminal/qjdqMonitor/elecDetail'),
|
|
meta: { title: '电表详情', permission: ['qianjiangdianqi'] }
|
|
},
|
|
{
|
|
path: 'alarm',
|
|
name: 'Alarm',
|
|
component: () => import('@/views/terminal/alarm/index'),
|
|
meta: { title: '设备告警', permission: ['dashengda', 'hangxiao', 'qianjiangdianqi'] }
|
|
},
|
|
{
|
|
path: 'plc',
|
|
name: 'PLC',
|
|
component: () => import('@/views/terminal/PLC/index'),
|
|
meta: { title: 'PLC管理', permission: ['dashengda', 'hangxiao', 'qianjiangdianqi'] }
|
|
},
|
|
{
|
|
path: 'plcMonitor',
|
|
name: 'PLCMonitor',
|
|
component: () => import('@/views/terminal/PLC/monitor'),
|
|
meta: { title: 'PLC实时监控', permission: ['jiangxishida'] }
|
|
},
|
|
{
|
|
path: 'ota',
|
|
name: 'OTA',
|
|
component: () => import('@/views/terminal/OTA/index'),
|
|
meta: { title: 'OTA升级', permission: ['dashengda', 'hangxiao', 'qianjiangdianqi', 'fanzai'] }
|
|
},
|
|
{
|
|
path: 'stock',
|
|
name: 'Stock',
|
|
component: () => import('@/views/terminal/stock/index'),
|
|
meta: { title: '库存管理', permission: ['fanzai'] }
|
|
}
|
|
]
|
|
},
|
|
{
|
|
path: '/gateway',
|
|
component: Layout,
|
|
name: 'Gateway',
|
|
meta: { title: '网关管理', icon: 'gateway', permission: ['dashengda', 'hangxiao', 'qianjiangdianqi'] },
|
|
children: [
|
|
{
|
|
path: 'dashboard',
|
|
name: 'GatewayDashboard',
|
|
component: () => import('@/views/gateway/dashboard/index'),
|
|
meta: { title: '看板' }
|
|
},
|
|
{
|
|
path: 'device',
|
|
name: 'GatewayDevice',
|
|
component: () => import('@/views/gateway/device/index'),
|
|
meta: { title: '设备节点' }
|
|
},
|
|
{
|
|
path: 'manage',
|
|
name: 'GatewayManage',
|
|
component: () => import('@/views/gateway/manage/index'),
|
|
meta: { title: '网关' }
|
|
}
|
|
]
|
|
},
|
|
{
|
|
path: '/rule',
|
|
component: Layout,
|
|
name: 'Rule',
|
|
meta: { title: '规则引擎', icon: 'rule', permission: ['dashengda', 'hangxiao', 'qianjiangdianqi'] },
|
|
children: [
|
|
{
|
|
path: 'manage',
|
|
name: 'Manage',
|
|
component: () => import('@/views/rule/ruleManage/index'),
|
|
meta: { title: '规则管理' }
|
|
},
|
|
{
|
|
path: 'dataTransfer',
|
|
name: 'DataTransfer',
|
|
component: () => import('@/views/rule/dataTransfer/index'),
|
|
meta: { title: '数据转发' }
|
|
}
|
|
]
|
|
},
|
|
// {
|
|
// path: '/configuration',
|
|
// component: Layout,
|
|
// name: 'Configuration',
|
|
// meta: { title: '组态管理', icon: 'configuration' },
|
|
// children: [
|
|
// {
|
|
// path: 'development',
|
|
// name: 'Development',
|
|
// component: () => import('@/views/configuration/development'),
|
|
// meta: { title: '组态开发' }
|
|
// },
|
|
// {
|
|
// path: 'transferStation',
|
|
// name: 'TransferStation',
|
|
// component: () => import('@/views/configuration/transferStation'),
|
|
// meta: { title: '变电站' }
|
|
// },
|
|
// {
|
|
// path: 'aicity',
|
|
// name: 'AiCity',
|
|
// component: () => import('@/views/configuration/AiCity'),
|
|
// meta: { title: '智慧城市' }
|
|
// },
|
|
// {
|
|
// path: 'bridgeMachine',
|
|
// name: 'BridgeMachine',
|
|
// component: () => import('@/views/configuration/bridgeMachine'),
|
|
// meta: { title: '大方架桥机' }
|
|
// }
|
|
// ]
|
|
// },
|
|
{
|
|
path: '/configureApp',
|
|
component: Layout,
|
|
name: 'configureApp',
|
|
meta: { title: '组态应用', icon: 'configuration', disabled: true, permission: ['dashengda', 'hangxiao', 'qianjiangdianqi'] }
|
|
},
|
|
{
|
|
path: '/log',
|
|
component: Layout,
|
|
name: 'Log',
|
|
meta: { title: '日志管理', icon: 'log', permission: ['dashengda', 'hangxiao', 'qianjiangdianqi'] },
|
|
children: [
|
|
{
|
|
path: 'accessLog',
|
|
name: 'AccessLog',
|
|
component: () => import('@/views/log/accessLog/index'),
|
|
meta: { title: '访问日志' }
|
|
},
|
|
{
|
|
path: 'systemLog',
|
|
name: 'SystemLog',
|
|
component: () => import('@/views/log/systemLog/index'),
|
|
meta: { title: '系统日志' }
|
|
}
|
|
]
|
|
},
|
|
{
|
|
path: '/data',
|
|
component: Layout,
|
|
name: 'Data',
|
|
meta: { title: '数据管理', icon: 'data', permission: ['dashengda', 'qianjiangdianqi'] },
|
|
children: [
|
|
{
|
|
path: 'realTime',
|
|
name: 'RealTime',
|
|
component: () => import('@/views/data/realTime/index'),
|
|
meta: { title: '实时数据', permission: ['dashengda'] }
|
|
},
|
|
{
|
|
path: 'history',
|
|
name: 'History',
|
|
component: () => import('@/views/data/history/index'),
|
|
meta: { title: '历史数据', permission: ['dashengda'] }
|
|
},
|
|
{
|
|
path: 'qjdq/history',
|
|
name: 'QJDQHistory',
|
|
component: () => import('@/views/data/history/qianjiang'),
|
|
meta: { title: '历史数据', permission: ['qianjiangdianqi'] }
|
|
},
|
|
{
|
|
path: 'value',
|
|
name: 'Value',
|
|
component: () => import('@/views/data/value/index'),
|
|
meta: { title: '数据价值', permission: ['dashengda'] }
|
|
}
|
|
]
|
|
},
|
|
{ path: '*', redirect: '/404', hidden: true }
|
|
]
|
|
|
|
const createRouter = () => new Router({
|
|
mode: 'history', // require service support
|
|
scrollBehavior: () => ({ 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 // reset router
|
|
}
|
|
|
|
export default router
|