瀏覽代碼

fix: 菜单重构 + 代理修复

ice_1 2 周之前
父節點
當前提交
70e5b124d1
共有 2 個文件被更改,包括 175 次插入200 次删除
  1. 173 198
      src/api/menu.ts
  2. 2 2
      vite.config.ts

+ 173 - 198
src/api/menu.ts

@@ -2,251 +2,267 @@ import request from '@/utils/request';
 import { AxiosPromise } from 'axios';
 import { RouteRecordRaw } from 'vue-router';
 
-// 获取路由
+// 获取路由 — 本地开发阶段使用模拟菜单(后端运行时替换为实际API调用)
 export function getRouters(): AxiosPromise<RouteRecordRaw[]> {
-  // 返回模拟菜单数据,绕过后端依赖
   const mockMenuData = {
     data: [
+      // ====== 1. 安全隐患 ======
       {
         path: '/riskctrl/hazard',
         component: 'Layout',
         redirect: '/riskctrl/hazard',
         name: 'Hazard',
         meta: { title: '安全隐患', icon: 'warning' },
-        children: [
-          {
-            path: '',
-            component: 'riskctrl/hazard/index',
-            name: 'HazardIndex',
-            meta: { title: '安全隐患', icon: 'warning' }
-          }
-        ]
+        children: [{
+          path: '',
+          component: 'riskctrl/hazard/index',
+          name: 'HazardIndex',
+          meta: { title: '安全隐患', icon: 'warning' }
+        }]
+      },
+      // ====== 2. 危险源上报 ======
+      {
+        path: '/riskctrl/dangerSource',
+        component: 'Layout',
+        redirect: '/riskctrl/dangerSource',
+        name: 'DangerSource',
+        meta: { title: '危险源上报', icon: 'aim' },
+        children: [{
+          path: '',
+          component: 'riskctrl/dangerSource/index',
+          name: 'DangerSourceIndex',
+          meta: { title: '危险源上报', icon: 'aim' }
+        }]
       },
+      // ====== 3. 作业上报 ======
       {
         path: '/riskctrl/workReport',
         component: 'Layout',
         redirect: '/riskctrl/workReport',
         name: 'WorkReport',
         meta: { title: '作业上报', icon: 'edit' },
-        children: [
-          {
-            path: '',
-            component: 'riskctrl/workReport/index',
-            name: 'WorkReportIndex',
-            meta: { title: '作业上报', icon: 'edit' }
-          }
-        ]
+        children: [{
+          path: '',
+          component: 'riskctrl/workReport/index',
+          name: 'WorkReportIndex',
+          meta: { title: '作业上报', icon: 'edit' }
+        }]
       },
+      // ====== 4. 人员信息 ======
       {
         path: '/riskctrl/personInfo',
         component: 'Layout',
         redirect: '/riskctrl/personInfo',
         name: 'PersonInfo',
         meta: { title: '人员信息', icon: 'user' },
-        children: [
-          {
-            path: '',
-            component: 'riskctrl/personInfo/index',
-            name: 'PersonInfoIndex',
-            meta: { title: '人员信息', icon: 'user' }
-          }
-        ]
+        children: [{
+          path: '',
+          component: 'riskctrl/personInfo/index',
+          name: 'PersonInfoIndex',
+          meta: { title: '人员信息', icon: 'user' }
+        }]
       },
+      // ====== 5. 审计工作 ======
       {
-        path: '/riskctrl/audit',
+        path: '/riskctrl/auditPersonChange',
         component: 'Layout',
-        redirect: '/riskctrl/audit',
-        name: 'Audit',
+        redirect: '/riskctrl/auditPersonChange',
+        name: 'AuditPersonChange',
         meta: { title: '审计工作', icon: 'chart' },
-        children: [
-          {
-            path: '',
-            component: 'riskctrl/audit/index',
-            name: 'AuditIndex',
-            meta: { title: '审计工作', icon: 'chart' }
-          }
-        ]
+        children: [{
+          path: '',
+          component: 'riskctrl/auditPersonChange/index',
+          name: 'AuditPersonChangeIndex',
+          meta: { title: '审计工作', icon: 'chart' }
+        }]
       },
+      // ====== 6. 风险警示 ======
       {
         path: '/riskctrl/riskWarning',
         component: 'Layout',
         redirect: '/riskctrl/riskWarning',
         name: 'RiskWarning',
         meta: { title: '风险警示', icon: 'alert' },
-        children: [
-          {
-            path: '',
-            component: 'riskctrl/riskWarning/index',
-            name: 'RiskWarningIndex',
-            meta: { title: '风险警示', icon: 'alert' }
-          }
-        ]
+        children: [{
+          path: '',
+          component: 'riskctrl/riskWarning/index',
+          name: 'RiskWarningIndex',
+          meta: { title: '风险警示', icon: 'alert' }
+        }]
       },
+      // ====== 7. 特种设备 ======
       {
-        path: '/riskctrl/specialEquipment1',
+        path: '/riskctrl/specialEquipment',
         component: 'Layout',
-        redirect: '/riskctrl/specialEquipment1',
-        name: 'SpecialEquipment1',
+        redirect: '/riskctrl/specialEquipment',
+        name: 'SpecialEquipment',
         meta: { title: '特种设备', icon: 'equipment' },
-        children: [
-          {
-            path: '',
-            component: 'riskctrl/specialEquipment/index',
-            name: 'SpecialEquipment1Index',
-            meta: { title: '特种设备', icon: 'equipment' }
-          }
-        ]
-      },
-      {
-        path: '/riskctrl/specialEquipment2',
-        component: 'Layout',
-        redirect: '/riskctrl/specialEquipment2',
-        name: 'SpecialEquipment2',
-        meta: { title: '特种设备', icon: 'equipment' },
-        children: [
-          {
-            path: '',
-            component: 'riskctrl/specialEquipment/index',
-            name: 'SpecialEquipment2Index',
-            meta: { title: '特种设备', icon: 'equipment' }
-          }
-        ]
-      },
-      {
-        path: '/riskctrl/safetyEquipment',
-        component: 'Layout',
-        redirect: '/riskctrl/safetyEquipment',
-        name: 'SafetyEquipment',
-        meta: { title: '安全设备', icon: 'shield' },
-        children: [
-          {
-            path: '',
-            component: 'riskctrl/safetyEquipment/index',
-            name: 'SafetyEquipmentIndex',
-            meta: { title: '安全设备', icon: 'shield' }
-          }
-        ]
+        children: [{
+          path: '',
+          component: 'riskctrl/specialEquipment/index',
+          name: 'SpecialEquipmentIndex',
+          meta: { title: '特种设备', icon: 'equipment' }
+        }]
       },
+      // ====== 8. 安全培训 ======
       {
         path: '/riskctrl/safetyTraining',
         component: 'Layout',
         redirect: '/riskctrl/safetyTraining',
         name: 'SafetyTraining',
         meta: { title: '安全培训', icon: 'education' },
-        children: [
-          {
-            path: '',
-            component: 'riskctrl/safetyTraining/index',
-            name: 'SafetyTrainingIndex',
-            meta: { title: '安全培训', icon: 'education' }
-          }
-        ]
+        children: [{
+          path: '',
+          component: 'riskctrl/safetyTraining/index',
+          name: 'SafetyTrainingIndex',
+          meta: { title: '安全培训', icon: 'education' }
+        }]
       },
+      // ====== 9. 舆情推送 ======
       {
         path: '/riskctrl/publicOpinion',
         component: 'Layout',
         redirect: '/riskctrl/publicOpinion',
         name: 'PublicOpinion',
         meta: { title: '舆情推送', icon: 'message' },
-        children: [
-          {
-            path: '',
-            component: 'riskctrl/publicOpinion/index',
-            name: 'PublicOpinionIndex',
-            meta: { title: '舆情推送', icon: 'message' }
-          }
-        ]
+        children: [{
+          path: '',
+          component: 'riskctrl/publicOpinion/index',
+          name: 'PublicOpinionIndex',
+          meta: { title: '舆情推送', icon: 'message' }
+        }]
       },
+      // ====== 10. 事故上报 ======
       {
         path: '/riskctrl/accidentReport',
         component: 'Layout',
         redirect: '/riskctrl/accidentReport',
         name: 'AccidentReport',
         meta: { title: '事故上报', icon: 'bug' },
+        children: [{
+          path: '',
+          component: 'riskctrl/accidentReport/index',
+          name: 'AccidentReportIndex',
+          meta: { title: '事故上报', icon: 'bug' }
+        }]
+      },
+      // ====== 11. 巡检管理(巡检点 + 巡检记录) ======
+      {
+        path: '/riskctrl/patrol',
+        component: 'Layout',
+        redirect: '/riskctrl/patrolPoint',
+        name: 'Patrol',
+        meta: { title: '巡检管理', icon: 'location', alwaysShow: true },
         children: [
           {
-            path: '',
-            component: 'riskctrl/accidentReport/index',
-            name: 'AccidentReportIndex',
-            meta: { title: '事故上报', icon: 'bug' }
+            path: 'patrolPoint',
+            component: 'riskctrl/patrolPoint/index',
+            name: 'PatrolPoint',
+            meta: { title: '巡检点', icon: 'position' }
+          },
+          {
+            path: 'patrolRecord',
+            component: 'riskctrl/patrolRecord/index',
+            name: 'PatrolRecord',
+            meta: { title: '巡检记录', icon: 'list' }
           }
         ]
       },
+      // ====== 12. 通知公告 ======
       {
-        path: '/system',
+        path: '/riskctrl/noticeAnnouncement',
         component: 'Layout',
-        redirect: '/system/user',
-        name: 'System',
-        meta: { title: '系统管理', icon: 'setting', alwaysShow: true },
+        redirect: '/riskctrl/noticeAnnouncement',
+        name: 'NoticeAnnouncement',
+        meta: { title: '通知公告', icon: 'bell' },
+        children: [{
+          path: '',
+          component: 'riskctrl/noticeAnnouncement/index',
+          name: 'NoticeAnnouncementIndex',
+          meta: { title: '通知公告', icon: 'bell' }
+        }]
+      },
+      // ====== 13. 风控引擎(事件/规则/评分/案例/黑白名单) ======
+      {
+        path: '/riskctrl/engine',
+        component: 'Layout',
+        redirect: '/riskctrl/event',
+        name: 'RiskEngine',
+        meta: { title: '风控引擎', icon: 'monitor', alwaysShow: true },
         children: [
           {
-            path: 'user',
-            component: 'system/user/index',
-            name: 'User',
-            meta: { title: '用户管理', icon: 'user' }
+            path: 'event',
+            component: 'riskctrl/event/index',
+            name: 'RiskEvent',
+            meta: { title: '风控事件', icon: 'list' }
+          },
+          {
+            path: 'rule',
+            component: 'riskctrl/rule/index',
+            name: 'RiskRule',
+            meta: { title: '风控规则', icon: 'guide' }
           },
           {
-            path: 'role',
-            component: 'system/role/index',
-            name: 'Role',
-            meta: { title: '角色管理', icon: 'peoples' }
+            path: 'score',
+            component: 'riskctrl/score/index',
+            name: 'RiskScore',
+            meta: { title: '风险评分', icon: 'data' }
           },
           {
-            path: 'menu',
-            component: 'system/menu/index',
-            name: 'Menu',
-            meta: { title: '菜单管理', icon: 'list' }
+            path: 'case',
+            component: 'riskctrl/case/index',
+            name: 'RiskCase',
+            meta: { title: '风控案例', icon: 'file' }
           },
           {
-            path: 'dept',
-            component: 'system/dept/index',
-            name: 'Dept',
-            meta: { title: '部门管理', icon: 'tree' }
+            path: 'blacklist',
+            component: 'riskctrl/blacklist/index',
+            name: 'BlackList',
+            meta: { title: '黑名单', icon: 'ban' }
+          },
+          {
+            path: 'whitelist',
+            component: 'riskctrl/whitelist/index',
+            name: 'WhiteList',
+            meta: { title: '白名单', icon: 'star' }
           }
         ]
       },
+      // ====== 系统管理 ======
       {
-        path: '/tenant',
+        path: '/system',
         component: 'Layout',
-        redirect: '/tenant/tenantList',
-        name: 'Tenant',
-        meta: { title: '租户管理', icon: 'company', alwaysShow: true },
+        redirect: '/system/user',
+        name: 'System',
+        meta: { title: '系统管理', icon: 'setting', alwaysShow: true },
         children: [
-          {
-            path: 'tenantList',
-            component: 'tenant/tenantList/index',
-            name: 'TenantList',
-            meta: { title: '租户列表', icon: 'list' }
-          },
-          {
-            path: 'tenantDetail',
-            component: 'tenant/tenantDetail/index',
-            name: 'TenantDetail',
-            meta: { title: '租户详情', icon: 'info' }
-          }
+          { path: 'user', component: 'system/user/index', name: 'User', meta: { title: '用户管理', icon: 'user' } },
+          { path: 'role', component: 'system/role/index', name: 'Role', meta: { title: '角色管理', icon: 'peoples' } },
+          { path: 'menu', component: 'system/menu/index', name: 'SysMenu', meta: { title: '菜单管理', icon: 'list' } },
+          { path: 'dept', component: 'system/dept/index', name: 'Dept', meta: { title: '部门管理', icon: 'tree' } },
+          { path: 'post', component: 'system/post/index', name: 'Post', meta: { title: '岗位管理', icon: 'post' } },
+          { path: 'dict', component: 'system/dict/index', name: 'Dict', meta: { title: '字典管理', icon: 'dict' } },
+          { path: 'config', component: 'system/config/index', name: 'Config', meta: { title: '参数设置', icon: 'config' } },
+          { path: 'notice', component: 'system/notice/index', name: 'SysNotice', meta: { title: '通知公告', icon: 'message' } },
+          { path: 'tenant', component: 'system/tenant/index', name: 'Tenant', meta: { title: '租户管理', icon: 'company' } },
+          { path: 'client', component: 'system/client/index', name: 'Client', meta: { title: '客户端管理', icon: 'client' } }
         ]
       },
+      // ====== 系统监控 ======
       {
         path: '/monitor',
         component: 'Layout',
-        redirect: '/monitor/dashboard',
+        redirect: '/monitor/operlog',
         name: 'Monitor',
         meta: { title: '系统监控', icon: 'monitor', alwaysShow: true },
         children: [
-          {
-            path: 'dashboard',
-            component: 'monitor/dashboard/index',
-            name: 'Dashboard',
-            meta: { title: '监控面板', icon: 'dashboard' }
-          },
-          {
-            path: 'server',
-            component: 'monitor/server/index',
-            name: 'Server',
-            meta: { title: '服务监控', icon: 'server' }
-          }
+          { path: 'operlog', component: 'monitor/operlog/index', name: 'OperLog', meta: { title: '操作日志', icon: 'log' } },
+          { path: 'logininfor', component: 'monitor/logininfor/index', name: 'LoginInfo', meta: { title: '登录日志', icon: 'login' } },
+          { path: 'online', component: 'monitor/online/index', name: 'Online', meta: { title: '在线用户', icon: 'people' } },
+          { path: 'cache', component: 'monitor/cache/index', name: 'Cache', meta: { title: '缓存监控', icon: 'redis' } }
         ]
       },
+      // ====== 系统工具 ======
       {
         path: '/tool',
         component: 'Layout',
@@ -254,53 +270,12 @@ export function getRouters(): AxiosPromise<RouteRecordRaw[]> {
         name: 'Tool',
         meta: { title: '系统工具', icon: 'tool', alwaysShow: true },
         children: [
-          {
-            path: 'gen',
-            component: 'tool/gen/index',
-            name: 'Gen',
-            meta: { title: '代码生成', icon: 'code' }
-          },
-          {
-            path: 'swagger',
-            component: 'tool/swagger/index',
-            name: 'Swagger',
-            meta: { title: '接口文档', icon: 'file' }
-          }
-        ]
-      },
-      {
-        path: '/plus',
-        component: 'Layout',
-        redirect: '/plus/index',
-        name: 'Plus',
-        meta: { title: 'PLUS官网', icon: 'link' },
-        children: [
-          {
-            path: 'index',
-            component: 'plus/index',
-            name: 'PlusIndex',
-            meta: { title: 'PLUS官网', icon: 'link' }
-          }
-        ]
-      },
-      {
-        path: '/test',
-        component: 'Layout',
-        redirect: '/test/index',
-        name: 'Test',
-        meta: { title: '测试菜单', icon: 'star', alwaysShow: true },
-        children: [
-          {
-            path: 'index',
-            component: 'test/index',
-            name: 'TestIndex',
-            meta: { title: '测试页面', icon: 'star' }
-          }
+          { path: 'gen', component: 'tool/gen/index', name: 'Gen', meta: { title: '代码生成', icon: 'code' } }
         ]
       }
     ]
   };
-  
+
   return new Promise((resolve) => {
     resolve(mockMenuData);
   }) as unknown as AxiosPromise<RouteRecordRaw[]>;

+ 2 - 2
vite.config.ts

@@ -24,10 +24,10 @@ export default defineConfig(({ mode, command }) => {
       open: true,
       proxy: {
         [env.VITE_APP_BASE_API]: {
-          target: 'http://localhost:9224',
+          target: 'http://134.175.81.27:9223',
           changeOrigin: true,
           ws: true,
-          rewrite: (path) => path.replace(new RegExp('^' + env.VITE_APP_BASE_API), '')
+          rewrite: (path) => path.replace(new RegExp('^' + env.VITE_APP_BASE_API), '/prod-api')
         }
       }
     },