Zimo пре 7 часа
родитељ
комит
cc17d11988

+ 5 - 0
src/layout/components/Menu/src/components/useRenderMenuItem.tsx

@@ -36,6 +36,11 @@ export const useRenderMenuItem = () =>
                 '通道管理'
               ].includes(v.meta?.title)
             )
+          } else if (currentSource === 'qhse') {
+            return (
+              !v.meta?.hidden &&
+              ['QHSE', '台账管理', '证书管理', '仪器检测', '使用记录'].includes(v.meta?.title)
+            )
           } else {
             return !v.meta?.hidden
           }

+ 2 - 0
src/layout/components/TagsView/src/helper.ts

@@ -13,6 +13,8 @@ export const filterAffixTags = (routes: AppRouteRecordRaw[], parentPath = '') =>
       route.meta.affix = true
     } else if (currentSource === 'spzx' && tagPath === '/video_center/protocol') {
       route.meta.affix = true
+    } else if (currentSource === 'qhse' && tagPath === '/qhse/ledger') {
+      route.meta.affix = true
     }
     if (meta?.affix) {
       tags.push({ ...route, path: tagPath, fullPath: tagPath } as RouteLocationNormalizedLoaded)

+ 33 - 6
src/permission.ts

@@ -113,6 +113,11 @@ router.beforeEach(async (to, from, next) => {
         next({ path: '/video_center/protocol' })
       }
 
+      if (source && source === 'qhse') {
+        sessionStorage.setItem('LOGIN_SOURCE', source as string)
+        next({ path: '/qhse/ledger' })
+      }
+
       next({ path: '/' })
     } else {
       // 获取所有字典
@@ -124,6 +129,7 @@ router.beforeEach(async (to, from, next) => {
       }
 
       if (!userStore.getIsSetUser) {
+        console.log(from, to)
         isRelogin.show = true
         await userStore.setUserInfoAction()
         isRelogin.show = false
@@ -151,11 +157,26 @@ router.beforeEach(async (to, from, next) => {
 
       authUtil.setToken(res)
 
-      // const source = to.query.source
-      // if (source) {
-      //   sessionStorage.setItem('LOGIN_SOURCE', source as string)
-      //   next({ path: '/oli-connection/monitoring' })
-      // }
+      const source = to.query.source
+      if (source && source === 'zhly') {
+        sessionStorage.setItem('LOGIN_SOURCE', source as string)
+        next({ path: '/oli-connection/monitoring' })
+      }
+
+      if (source && source === 'znzq') {
+        sessionStorage.setItem('LOGIN_SOURCE', source as string)
+        next({ path: '/device_monitor' })
+      }
+
+      if (source && source === 'spzx') {
+        sessionStorage.setItem('LOGIN_SOURCE', source as string)
+        next({ path: '/video_center/protocol' })
+      }
+
+      if (source && source === 'qhse') {
+        sessionStorage.setItem('LOGIN_SOURCE', source as string)
+        next({ path: '/qhse/ledger' })
+      }
 
       next({ path: '/index' })
     } else if (whiteList.indexOf(to.path) !== -1) {
@@ -175,8 +196,14 @@ router.beforeEach(async (to, from, next) => {
       if (source) {
         sessionStorage.setItem('LOGIN_SOURCE', source as string)
       }
-      if (source) {
+      if (source && source === 'zhly') {
         next(`/login?redirect=/oli-connection/monitoring`)
+      } else if (source && source === 'znzq') {
+        next(`/login?redirect=/device_monitor`)
+      } else if (source && source === 'spzx') {
+        next(`/login?redirect=/video_center/protocol`)
+      } else if (source && source === 'qhse') {
+        next(`/login?redirect=/qhse/ledger`)
       } else next(`/login?redirect=${to.fullPath}`) // 否则全部重定向到登录页
     }
   }