From 4e94f50e54271f1be793a9f417cf7e7cc4a13df5 Mon Sep 17 00:00:00 2001
From: 祖安之光 <11848914+light-of-zuan@user.noreply.gitee.com>
Date: Thu, 07 May 2026 10:04:12 +0800
Subject: [PATCH] 增加年份查询

---
 src/permission.js |   42 ++++++++++++++++++++++++++++++++++++++----
 1 files changed, 38 insertions(+), 4 deletions(-)

diff --git a/src/permission.js b/src/permission.js
index eef296e..9eac69c 100644
--- a/src/permission.js
+++ b/src/permission.js
@@ -1,5 +1,5 @@
 import router from './router'
-import { ElMessage } from 'element-plus'
+import { ElMessage, ElLoading } from 'element-plus'
 import NProgress from 'nprogress'
 import 'nprogress/nprogress.css'
 import { getToken } from '@/utils/auth'
@@ -11,7 +11,28 @@
 
 NProgress.configure({ showSpinner: false });
 
-const whiteList = ['/homePage','/fillForm','/checkProgress','/certPdf'];
+const whiteList = ['/homePage'];
+
+// 全局 Loading 实例
+let loadingInstance = null
+
+// 显示 Loading
+const showLoading = () => {
+  loadingInstance = ElLoading.service({
+    fullscreen: false,
+    text: '正在加载系统菜单...',
+    customClass: 'route-loading'
+  })
+}
+
+// 隐藏 Loading
+const hideLoading = () => {
+  if (loadingInstance) {
+    loadingInstance.close()
+    loadingInstance = null
+  }
+}
+
 
 router.beforeEach((to, from, next) => {
   NProgress.start()
@@ -22,9 +43,18 @@
       next({ path: '/' })
       NProgress.done()
     } else if (whiteList.indexOf(to.path) !== -1) {
+      
       next()
     } else {
+      if(to.path ==='/menuPage'){
+          next()
+          return
+        }
       if (useUserStore().roles.length === 0) {
+        if(to.path ==='/menuIndex'){
+          showLoading()
+        }
+        
         isRelogin.show = true
         // 判断当前用户是否已拉取完user_info信息
         useUserStore().getInfo().then(() => {
@@ -36,15 +66,18 @@
                 router.addRoute(route) // 动态添加可访问路由表
               }
             })
-            console.log(to.fullPath,"to.fullPath")
+
+            hideLoading()
+
             if (to.fullPath == '/index') {
+
               // 当登录之后,直接通过ip地址和端口号访问时,跳转到第一个路由页面indexPage
               let pathIndex = ''
               //通过权限返回菜单去避免 如有首页权限 出现//index 情况
               if (accessRoutes[0].path == '/') {
                 pathIndex = accessRoutes[0].path + accessRoutes[0].children[0].path
               } else{
-                pathIndex = accessRoutes[0].path + '/' + accessRoutes[0].children[0].path
+                pathIndex = accessRoutes.filter(path=>path.hidden == false)[0].path + '/' + accessRoutes.filter(path=>path.hidden == false)[0].children.filter(path=>path.hidden == false)[0].path
               }
               next({ path: pathIndex, replace: true }) // hack方法 确保addRoutes已完成
             } else {
@@ -76,5 +109,6 @@
 })
 
 router.afterEach(() => {
+  hideLoading()
   NProgress.done()
 })

--
Gitblit v1.9.2