2023-11-06 18:11:01 +08:00
|
|
|
import Vue from 'vue'
|
|
|
|
import Router from 'vue-router'
|
|
|
|
|
|
|
|
Vue.use(Router)
|
|
|
|
/* Layout */
|
|
|
|
import Layout from '@/layout'
|
|
|
|
|
|
|
|
const originalPush = Router.prototype.push
|
|
|
|
Router.prototype.push = function push(location, onResolve, onReject) {
|
|
|
|
if (onResolve || onReject) return originalPush.call(this, location, onResolve, onReject)
|
|
|
|
return originalPush.call(this, location).catch(err => err)
|
|
|
|
}
|
|
|
|
export const constantRoutes = [
|
|
|
|
{
|
|
|
|
path: '/redirect',
|
|
|
|
component: Layout,
|
|
|
|
hidden: true,
|
|
|
|
children: [
|
|
|
|
{
|
|
|
|
path: '/redirect/:path*',
|
|
|
|
component: () => import('@/views/redirect/index')
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
path: '/',
|
|
|
|
hidden: true,
|
|
|
|
redirect: '/login'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
path: '/login',
|
|
|
|
name: '登录',
|
|
|
|
hidden: true,
|
|
|
|
component: () => import('@/views/login/index')
|
|
|
|
},
|
|
|
|
{
|
|
|
|
path: '/',
|
|
|
|
component: Layout,
|
|
|
|
hidden: true,
|
|
|
|
children: [
|
|
|
|
{
|
|
|
|
path: 'index',
|
|
|
|
component: () => import('@/views/index/index'),
|
|
|
|
name: '首页',
|
|
|
|
meta: { title: '首页', affix: true }
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
path: '/monitoringCenter',
|
|
|
|
name: 'monitoringCenter',
|
|
|
|
meta: { name: '监测中心' },
|
|
|
|
component: () => import('../views/bi_onecom/monitoringCenter/monitoringCenter.vue')
|
|
|
|
},
|
|
|
|
{
|
|
|
|
path: '/apiMonitoringCenter',
|
|
|
|
name: 'apiMonitoringCenter',
|
|
|
|
// meta: { name: 'tiao监测中心' },
|
|
|
|
component: () => import('../views/bi_onecom/monitoringCenter/apiMonitoringCenter.vue')
|
|
|
|
},
|
|
|
|
{
|
|
|
|
path: '/intelligentAccessControl',
|
|
|
|
name: 'intelligentAccessControl',
|
|
|
|
meta: { name: '智能门禁' },
|
|
|
|
component: () => import('../views/bi_onecom/intelligentAccessControl/intelligentAccessControl.vue')
|
|
|
|
},
|
|
|
|
{
|
|
|
|
path: '/riskStatistics',
|
|
|
|
name: 'riskStatistics',
|
|
|
|
meta: { name: '风险统计' },
|
|
|
|
component: () => import('../views/bi_onecom/riskStatistics/riskStatistics.vue')
|
|
|
|
},
|
|
|
|
{
|
|
|
|
path: '/highRiskOperation',
|
|
|
|
name: 'highRiskOperation',
|
|
|
|
meta: { name: '高危作业' },
|
|
|
|
component: () => import('../views/bi_onecom/highRiskOperation/highRiskOperation.vue')
|
|
|
|
},
|
|
|
|
{
|
|
|
|
path: '/hiddenDangerAnalysis',
|
|
|
|
name: 'hiddenDangerAnalysis',
|
|
|
|
meta: { name: '隐患分析' },
|
|
|
|
component: () => import('../views/bi_onecom/hiddenDangerAnalysis/hiddenDangerAnalysis.vue')
|
|
|
|
},
|
|
|
|
{
|
|
|
|
path: '/majorHazardSources',
|
|
|
|
name: 'majorHazardSources',
|
|
|
|
meta: { name: '重大危险源' },
|
|
|
|
component: () => import('../views/bi_onecom/majorHazardSources/majorHazardSources.vue')
|
|
|
|
},
|
|
|
|
{
|
|
|
|
path: '/apiMajorHazardSources',
|
|
|
|
name: 'apiMajorHazardSources',
|
|
|
|
// meta: { name: 'tiao重大危险源' },
|
|
|
|
component: () => import('../views/bi_onecom/majorHazardSources/apiMajorHazardSources.vue')
|
2024-01-02 14:12:39 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
path: '/map',
|
|
|
|
name: 'map',
|
|
|
|
hidden: true,
|
|
|
|
component: () => import('@/views/map/index')
|
2023-11-06 18:11:01 +08:00
|
|
|
}
|
2024-09-06 19:38:37 +08:00
|
|
|
// {
|
|
|
|
// path: '/accident/records',
|
|
|
|
// name: 'apiAccidentRecords',
|
|
|
|
// meta: { name: '事故调查' },
|
|
|
|
// component: () => import('@/views/accident/records/index.vue')
|
|
|
|
// }
|
2023-11-06 18:11:01 +08:00
|
|
|
]
|
|
|
|
const createRouter = () => new Router({
|
|
|
|
// mode: 'history', // require service support
|
|
|
|
scrollBehavior: () => ({ y: 0 }),
|
|
|
|
routes: constantRoutes
|
|
|
|
})
|
|
|
|
|
|
|
|
const router = createRouter()
|
|
|
|
export function resetRouter() {
|
|
|
|
const newRouter = createRouter()
|
|
|
|
router.matcher = newRouter.matcher // reset router
|
|
|
|
}
|
|
|
|
export default router
|