import type { RouteRecordRaw } from 'vue-router' const pageTitle = (name: string): string => { return `pagesTitle.${name}` } /** * 后台基础路由路径 */ export const adminBaseRoutePath = '/admin' export const adminBaseRoute = { path: adminBaseRoutePath, name: 'admin', component: () => import('@/layouts/admin/index.vue'), // 直接重定向到 loading 路由 redirect: adminBaseRoutePath + '/loading', meta: { title: `pagesTitle.admin` }, children: [ { path: 'loading/:to?', name: 'adminMainLoading', component: () => import('@/layouts/common/components/loading.vue'), meta: { title: `pagesTitle.loading` } }, { path: 'businessUserRouter', name: '业务管理员页面', meta: { title: pageTitle('businessUser'), icon: 'ep:management', alwaysShow: true }, children: [ { path: 'eventView', component: () => import('@/views/pqs/voltageSags/sagGovern/businessUser/event/eventView.vue'), name: '暂降事件查看页面', meta: { title: pageTitle('router.eventView') } }, { path: 'productLine', component: () => import('@/views/pqs/voltageSags/sagGovern/businessUser/productLine/index.vue'), name: '生产线查看页面', meta: { title: pageTitle('router.eventView') } }, { path: 'machine', component: () => import('@/views/pqs/voltageSags/sagGovern/businessUser/machine/index.vue'), name: '设备查看页面', meta: { title: pageTitle('router.eventView') } } ] }, { path: 'sagGovernScheme', name: '暂降治理评估方案', meta: { title: pageTitle('sagGovernScheme'), icon: 'ep:management', alwaysShow: true }, children: [ { path: 'schemeCalc', component: () => import('@/views/pqs/voltageSags/sagGovern/scheme/schemeCalc/index.vue'), name: '治理评估页面', meta: { title: pageTitle('router.schemeCalc') } }, { path: 'schemeHistory', component: () => import('@/views/pqs/voltageSags/sagGovern/scheme/history/index.vue'), name: '治理方案结果详情', meta: { title: pageTitle('router.schemeHistory') } }, ] }, { path: 'form', name: '表单', meta: { title: pageTitle('form'), icon: 'ep:management', alwaysShow: true }, children: [ { path: 'formDesigner', component: () => import('@/views/system/workflow/form/formDesigner.vue'), name: '表单设计器页面', meta: { title: pageTitle('router.formDesigner') } } ] }, { path: 'model', name: '模型', meta: { title: pageTitle('model'), icon: 'ep:management', alwaysShow: true }, children: [ { path: 'processDesigner', component: () => import('@/views/system/workflow/model/processDesigner.vue'), name: '模型设计器页面', meta: { title: pageTitle('router.formDesigner') } }, { path: 'configSteps', component: () => import('@/views/system/workflow/model/configSteps.vue'), name: '模型设计器页面', meta: { title: pageTitle('router.formDesigner') } } ] } ] } /* * 静态路由 * 自动加载 ./static 目录的所有文件,并 push 到以下数组 */ const staticRoutes: Array = [ adminBaseRoute, { path: '/', redirect: (to) => { return { name: 'adminMainLoading' } } }, { // 管理员登录页 - 不放在 adminBaseRoute.children 因为登录页不需要使用后台的布局 path: '/login', name: 'login', component: () => import('@/views/user/login.vue'), meta: { title: pageTitle('login') } }, { path: '/:path(.*)*', redirect: '/404' }, { path: '/404', name: 'notFound', component: () => import('@/views/common/error/404.vue'), meta: { title: pageTitle('notFound') // 页面不存在 } }, { // 后台找不到页面了-可能是路由未加载上 path: adminBaseRoutePath + ':path(.*)*', redirect: (to) => { return { name: 'adminMainLoading', params: { to: JSON.stringify({ path: to.path, query: to.query }) } } } } ] export default staticRoutes