From ad654ff1218c55f45714af367dd1134761be9494 Mon Sep 17 00:00:00 2001 From: fuguobin Date: Mon, 25 Mar 2024 17:08:39 +0800 Subject: [PATCH] =?UTF-8?q?=E9=97=AE=E9=A2=98=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/types/auto-imports.d.ts | 6 ++++++ src/views/monitoring/components/menu.vue | 13 +++++++++++-- .../monitoring/screenData/components/header.vue | 2 +- src/views/monitoring/screenData/components/main.vue | 2 +- 4 files changed, 19 insertions(+), 4 deletions(-) diff --git a/src/types/auto-imports.d.ts b/src/types/auto-imports.d.ts index 6f8d200..acba637 100644 --- a/src/types/auto-imports.d.ts +++ b/src/types/auto-imports.d.ts @@ -2,6 +2,9 @@ export {} declare global { const EffectScope: typeof import('vue')['EffectScope'] + const ElMessage: typeof import('element-plus/es')['ElMessage'] + const ElMessageBox: typeof import('element-plus/es')['ElMessageBox'] + const ElNotification: typeof import('element-plus/es')['ElNotification'] const asyncComputed: typeof import('@vueuse/core')['asyncComputed'] const autoResetRef: typeof import('@vueuse/core')['autoResetRef'] const computed: typeof import('vue')['computed'] @@ -268,6 +271,9 @@ import { UnwrapRef } from 'vue' declare module 'vue' { interface ComponentCustomProperties { readonly EffectScope: UnwrapRef + readonly ElMessage: UnwrapRef + readonly ElMessageBox: UnwrapRef + readonly ElNotification: UnwrapRef readonly asyncComputed: UnwrapRef readonly autoResetRef: UnwrapRef readonly computed: UnwrapRef diff --git a/src/views/monitoring/components/menu.vue b/src/views/monitoring/components/menu.vue index 0714389..b2f9960 100644 --- a/src/views/monitoring/components/menu.vue +++ b/src/views/monitoring/components/menu.vue @@ -58,7 +58,7 @@ onMounted(() => { function menuApi() { //获取表格左侧菜单 getMenu().then((res: any) => { - if (res.code === 200) { + if (res.code === 200 && res.data.length != 0) { menuDeptKey.value = routerType.value === '1' ? deptId.value @@ -71,13 +71,17 @@ function menuApi() { sessionStorageIns.setUseStorage('deptId', menuDeptKey.value); mitt.emit('menuKey', menuDeptKey.value); emit('tableMenuData', res.data); + } else { + menuDeptKey.value = 0; + selectedKey.value = menuDeptKey.value; + sessionStorageIns.setUseStorage('deptId', menuDeptKey.value); } }); } function comMenuApi() { //获取组态左侧菜单 getMenuData().then((res: any) => { - if (res.code === 200) { + if (res.code === 200 && res.data.length != 0) { menuIdKey.value = routerType.value === '1' ? id.value @@ -91,6 +95,11 @@ function comMenuApi() { sessionStorageIns.setUseStorage('deptId', routerType.value === '1' ? deptId.value : parentId); mitt.emit('deviceMenuKey', menuIdKey.value); emit('tableMenuData', res.data); + } else { + menuIdKey.value = 0; + selectedKey.value = menuIdKey.value; + sessionStorageIns.setUseStorage('id', menuIdKey.value); + sessionStorageIns.setUseStorage('deptId', menuIdKey.value); } }); } diff --git a/src/views/monitoring/screenData/components/header.vue b/src/views/monitoring/screenData/components/header.vue index edbbab4..e3d0d1b 100644 --- a/src/views/monitoring/screenData/components/header.vue +++ b/src/views/monitoring/screenData/components/header.vue @@ -1,6 +1,6 @@