From 68c4becede9016656735030b7372ff5b37bbb3cf Mon Sep 17 00:00:00 2001 From: fuguobin Date: Mon, 25 Mar 2024 13:54:41 +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 | 10 - .../screenData/components/header.vue | 546 ++++++++++++++++++ .../monitoring/screenData/components/main.vue | 15 +- .../monitoring/screenData/components/menu.vue | 4 +- src/views/monitoring/screenData/index.vue | 2 +- 5 files changed, 558 insertions(+), 19 deletions(-) create mode 100644 src/views/monitoring/screenData/components/header.vue diff --git a/src/types/auto-imports.d.ts b/src/types/auto-imports.d.ts index 5742656..6f8d200 100644 --- a/src/types/auto-imports.d.ts +++ b/src/types/auto-imports.d.ts @@ -2,11 +2,6 @@ export {} declare global { const EffectScope: typeof import('vue')['EffectScope'] - const ElForm: typeof import('element-plus/es')['ElForm'] - 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 NEllipsis: typeof import('naive-ui')['NEllipsis'] const asyncComputed: typeof import('@vueuse/core')['asyncComputed'] const autoResetRef: typeof import('@vueuse/core')['autoResetRef'] const computed: typeof import('vue')['computed'] @@ -273,11 +268,6 @@ import { UnwrapRef } from 'vue' declare module 'vue' { interface ComponentCustomProperties { readonly EffectScope: UnwrapRef - readonly ElForm: UnwrapRef - readonly ElMessage: UnwrapRef - readonly ElMessageBox: UnwrapRef - readonly ElNotification: UnwrapRef - readonly NEllipsis: UnwrapRef readonly asyncComputed: UnwrapRef readonly autoResetRef: UnwrapRef readonly computed: UnwrapRef diff --git a/src/views/monitoring/screenData/components/header.vue b/src/views/monitoring/screenData/components/header.vue new file mode 100644 index 0000000..edbbab4 --- /dev/null +++ b/src/views/monitoring/screenData/components/header.vue @@ -0,0 +1,546 @@ + + + + diff --git a/src/views/monitoring/screenData/components/main.vue b/src/views/monitoring/screenData/components/main.vue index cd77b5e..201f711 100644 --- a/src/views/monitoring/screenData/components/main.vue +++ b/src/views/monitoring/screenData/components/main.vue @@ -136,6 +136,7 @@ import mitt from '@/plugins/bus'; // import socket from '@/utils/socket'; import useStorage from '@/utils/useStorage'; import { useUserStoreHook } from '@/store/modules/user'; +import { randomColor, endTime, debounce } from '@/utils/index'; const sessionStorageIns = useStorage('sessionStorage'); const { perms } = useUserStoreHook(); @@ -274,13 +275,12 @@ onMounted(() => { // clearTimeout(timer.value); // } // }); - +onBeforeUnmount(() => { + clearTimeout(timer.value); +}); onBeforeRouteLeave((to, from) => { - //监听离开页面 //组件注销前清除setTimeout - if (timer.value !== null || timer.value !== undefined) { - clearTimeout(timer.value); - } + clearTimeout(timer.value); }); mitt.on('currentPageEmits', (res: any) => { @@ -439,10 +439,13 @@ function tableMockDatas() { tablePage.total = res.total; // gridOptions.data = res.data; loadingShow.value = false; - asyncTableDatas(); + tbleDataDebounce(); } }); } +const tbleDataDebounce = debounce(() => { + asyncTableDatas(); +}, 10000); function asyncTableDatas() { //获取表格数据 // const params = menuKey.value; diff --git a/src/views/monitoring/screenData/components/menu.vue b/src/views/monitoring/screenData/components/menu.vue index 1e79782..a371bcd 100644 --- a/src/views/monitoring/screenData/components/menu.vue +++ b/src/views/monitoring/screenData/components/menu.vue @@ -121,12 +121,12 @@ function menuUpdateValue(key: string, item: MenuOption) { sessionStorageIns.setUseStorage(props.menuType === '1' ? 'deptId' : 'id', key); sessionStorageIns.setUseStorage('currentPage', 1); if (props.menuType === '1') { - mitt.emit('currentPageEmits', 1); + mitt.emit('currentPageEmit', 1); } if (props.menuType === '2') { sessionStorageIns.setUseStorage('deptId', item.parentId); } - mitt.emit(props.menuType === '1' ? 'menuKey' : 'deviceMenuKey', key); + mitt.emit(props.menuType === '1' ? 'menuMockKeys' : 'deviceMenuKey', key); console.log(key, item); } diff --git a/src/views/monitoring/screenData/index.vue b/src/views/monitoring/screenData/index.vue index 3a03bf6..fe3688f 100644 --- a/src/views/monitoring/screenData/index.vue +++ b/src/views/monitoring/screenData/index.vue @@ -90,7 +90,7 @@ import { useRoute, useRouter, onBeforeRouteLeave } from 'vue-router'; // import { useDateFormat, useNow } from '@vueuse/core'; // import { Filter, Maximize, Settings, Power } from '@vicons/tabler'; -import Header from '../components/header.vue'; +import Header from './components/header.vue'; import Menu from './components/menu.vue'; import Main from './components/main.vue'; import InfoPanel from './components/infoPanel.vue';