Преглед изворни кода

feat(permission,map): 智慧连油和智慧注气门户跳转进入系统进入设备地图,同时调整部分设备地图逻辑

Zimo пре 2 дана
родитељ
комит
6df0f656fe

+ 15 - 6
src/layout/components/Menu/src/components/useRenderMenuItem.tsx

@@ -18,13 +18,22 @@ export const useRenderMenuItem = () =>
           if (currentSource === 'zhly') {
             return (
               (!v.meta?.hidden &&
-                ['智慧连油', '连油监控', '监控查询', '视频告警', '告警配置', '连油看板'].includes(
-                  v.meta?.title
-                )) ||
-              (!v.meta?.hidden && ['split_view1'].includes(v.path))
+                [
+                  '智慧连油',
+                  '连油监控',
+                  '监控查询',
+                  '视频告警',
+                  '告警配置',
+                  '连油看板',
+                  '设备地图'
+                ].includes(v.meta?.title)) ||
+              (!v.meta?.hidden && ['split_view1', '/iotmap'].includes(v.path))
+            )
+          } else if (currentSource === 'zhzq') {
+            return (
+              (!v.meta?.hidden && ['设备地图'].includes(v.meta?.title)) ||
+              (!v.meta?.hidden && ['/device_monitor', '/iotmap'].includes(v.path))
             )
-          } else if (currentSource === 'znzq') {
-            return !v.meta?.hidden && ['/device_monitor'].includes(v.path)
           } else if (currentSource === 'spzx') {
             return (
               !v.meta?.hidden &&

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

@@ -5,11 +5,12 @@ export const filterAffixTags = (routes: AppRouteRecordRaw[], parentPath = '') =>
   let tags: RouteLocationNormalizedLoaded[] = []
   routes.forEach((route) => {
     const meta = route.meta as RouteMeta
+    console.log('meta', meta)
     const tagPath = pathResolve(parentPath, route.path)
     const currentSource = sessionStorage.getItem('LOGIN_SOURCE')
-    if (currentSource === 'zhly' && tagPath === '/oli-connection/monitoring') {
+    if (currentSource === 'zhly' && route.meta.title === '设备地图') {
       route.meta.affix = true
-    } else if (currentSource === 'znzq' && route.meta.title === '设备成套监控') {
+    } else if (currentSource === 'zhzq' && route.meta.title === '设备地图') {
       route.meta.affix = true
     } else if (currentSource === 'spzx' && tagPath === '/video_center/protocol') {
       route.meta.affix = true

+ 9 - 9
src/permission.ts

@@ -101,12 +101,12 @@ router.beforeEach(async (to, from, next) => {
       const source = to.query.source
       if (source && source === 'zhly') {
         sessionStorage.setItem('LOGIN_SOURCE', source as string)
-        next({ path: '/oli-connection/monitoring' })
+        next({ path: '/iotmap' })
       }
 
-      if (source && source === 'znzq') {
+      if (source && source === 'zhzq') {
         sessionStorage.setItem('LOGIN_SOURCE', source as string)
-        next({ path: '/device_monitor' })
+        next({ path: '/iotmap' })
       }
 
       if (source && source === 'spzx') {
@@ -183,12 +183,12 @@ router.beforeEach(async (to, from, next) => {
       const source = to.query.source
       if (source && source === 'zhly') {
         sessionStorage.setItem('LOGIN_SOURCE', source as string)
-        next({ path: '/oli-connection/monitoring' })
+        next({ path: '/iotmap' })
       }
 
-      if (source && source === 'znzq') {
+      if (source && source === 'zhzq') {
         sessionStorage.setItem('LOGIN_SOURCE', source as string)
-        next({ path: '/device_monitor' })
+        next({ path: '/iotmap' })
       }
 
       if (source && source === 'spzx') {
@@ -225,9 +225,9 @@ router.beforeEach(async (to, from, next) => {
         sessionStorage.setItem('LOGIN_SOURCE', source as string)
       }
       if (source && source === 'zhly') {
-        next(`/login?redirect=/oli-connection/monitoring`)
-      } else if (source && source === 'znzq') {
-        next(`/login?redirect=/device_monitor`)
+        next(`/login?redirect=/iotmap`)
+      } else if (source && source === 'zhzq') {
+        next(`/login?redirect=/iotmap`)
       } else if (source && source === 'spzx') {
         next(`/login?redirect=/video_center/protocol`)
       } else if (source && source === 'qhse') {

+ 12 - 3
src/views/pms/map/Map.vue

@@ -58,12 +58,16 @@ const keyword = ref('')
 const statusFilter = ref<StatusFilter>('all')
 const mapMode = ref<MapMode>('TMAP_NORMAL_MAP')
 
+const RUIHENG_XINGYU_DEPT_ID = 157
+const DEFAULT_DEPT_ID = 156
 const initialCenter: [number, number] = [104.114129, 36.550339]
 const initialZoom = 5
 const mapControls = ['Scale']
+const isZhzqSource = () => sessionStorage.getItem('LOGIN_SOURCE') === 'zhzq'
+const isZhlySource = () => sessionStorage.getItem('LOGIN_SOURCE') === 'zhly'
 
 const queryParams = reactive({
-  deptId: 156
+  deptId: isZhzqSource() ? RUIHENG_XINGYU_DEPT_ID : DEFAULT_DEPT_ID
 })
 
 const devices = ref<MapDevice[]>([])
@@ -164,7 +168,9 @@ onMounted(async () => {
 })
 
 const loadDeptTree = async () => {
-  const res = await DeptApi.getSimpleDeptList()
+  const res = isZhzqSource()
+    ? await DeptApi.specifiedSimpleDepts(RUIHENG_XINGYU_DEPT_ID)
+    : await DeptApi.getSimpleDeptList()
   deptList.value = res || []
   treeList.value = handleTree(res || [])
 }
@@ -172,7 +178,10 @@ const loadDeptTree = async () => {
 const loadDevices = async () => {
   loading.value = true
   try {
-    const res = await IotDeviceApi.getMapDevice(queryParams)
+    const res = await IotDeviceApi.getMapDevice({
+      ...queryParams,
+      ...(isZhlySource() ? { source: 'ly' } : {})
+    })
     devices.value = res || []
   } catch (error) {
     message.error('地图设备加载失败,请稍后重试')