From c2f906eb3fc3fb9ef99b4ef698d8eab9ba366b95 Mon Sep 17 00:00:00 2001 From: fuguobin Date: Mon, 26 Feb 2024 14:41:16 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=9D=83=E9=99=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/dataVisual/index.ts | 2 +- src/mock/routes.json | 4 +-- src/store/modules/permission.ts | 8 ++--- src/types/auto-imports.d.ts | 4 +++ src/views/dashboard/index.vue | 52 ++++++++++++++++----------------- 5 files changed, 37 insertions(+), 33 deletions(-) diff --git a/src/api/dataVisual/index.ts b/src/api/dataVisual/index.ts index a13e62f..5a24449 100644 --- a/src/api/dataVisual/index.ts +++ b/src/api/dataVisual/index.ts @@ -27,7 +27,7 @@ export function getrealTime(queryParams: any) { */ export function getTempChart(queryParams: any) { return request({ - url: '/dc/heatSourceScreen/heatExchangeStation/temperature/history/Data', + url: '/dc/heatSourceScreen/heatExchangeStation/temperature/history/data', method: 'get', params: queryParams }); diff --git a/src/mock/routes.json b/src/mock/routes.json index 36cfd47..3d9cf66 100644 --- a/src/mock/routes.json +++ b/src/mock/routes.json @@ -8,7 +8,7 @@ "title": "监控系统", "icon": "multi_level", "hidden": false, - "roles": ["biadmin"], + "roles": ["biadmin", "1bigscreen"], "keepAlive": true }, "children": [ @@ -68,7 +68,7 @@ "title": "换热站监控", "icon": "document", "hidden": false, - "roles": ["biadmin"], + "roles": ["biadmin", "1bigscreen"], "keepAlive": true } } diff --git a/src/store/modules/permission.ts b/src/store/modules/permission.ts index 48b3c23..3c5aacd 100644 --- a/src/store/modules/permission.ts +++ b/src/store/modules/permission.ts @@ -89,10 +89,10 @@ export const usePermissionStore = defineStore('permission', () => { .then(({ data: asyncRoutes }) => { // 根据角色获取有访问权限的路由 // if (asyncRoutes.length === 0) { - const routesArr = routesData.data; - const accessedRoutes = filterAsyncRoutes(routesArr, roles); - setRoutes(accessedRoutes); - resolve(accessedRoutes); + const routesArr = routesData.data; + const accessedRoutes = filterAsyncRoutes(routesArr, roles); + setRoutes(accessedRoutes); + resolve(accessedRoutes); // } else { // const accessedRoutes = filterAsyncRoutes(asyncRoutes, roles); // setRoutes(accessedRoutes); diff --git a/src/types/auto-imports.d.ts b/src/types/auto-imports.d.ts index acba637..5742656 100644 --- a/src/types/auto-imports.d.ts +++ b/src/types/auto-imports.d.ts @@ -2,9 +2,11 @@ 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'] @@ -271,9 +273,11 @@ 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/dashboard/index.vue b/src/views/dashboard/index.vue index c8eef2c..a0b5ed5 100644 --- a/src/views/dashboard/index.vue +++ b/src/views/dashboard/index.vue @@ -98,7 +98,7 @@ const isCurrentRoute = ref(true); const userStore = useUserStore(); const duration = 5000; const userNumber = ref(2800); -// const notice = ref({}); +const notice = ref({}); // const vsitsNumber = transitionNum(720, 5000); const currentTime = useDateFormat(useNow(), 'YYYY-MM-DD HH:mm:ss'); const hoursNow = useNow().value.getHours(); @@ -177,32 +177,32 @@ const timePeriod = computed(() => { onMounted(() => { getWeatherData(); // socket.initialize(wsUrl); - // const webVersion = sessionStorage.getItem('webVersion'); - // if (webVersion != '' && webVersion != null) { - // const version = JSON.parse(webVersion); - // notice.value = ElNotification({ - // title: version.noticeTitle, - // dangerouslyUseHTMLString: true, - // customClass: 'notice', - // duration: 0, - // message: version.noticeContent.replace(/\n/g, '
'), - // onClose: () => { - // noticeCloce(version.noticeId); - // } - // }); - // } + const webVersion = sessionStorage.getItem('webVersion'); + if (webVersion != '' && webVersion != null) { + const version = JSON.parse(webVersion); + notice.value = ElNotification({ + title: version.noticeTitle, + dangerouslyUseHTMLString: true, + customClass: 'notice', + duration: 0, + message: version.noticeContent.replace(/\n/g, '
'), + onClose: () => { + noticeCloce(version.noticeId); + } + }); + } }); -// function noticeCloce(id: any) { -// //更新日志关闭事件 -// const params = { -// versionId: id -// }; -// userVersionRelation(params).then((res: any) => { -// if (res.code === 200) { -// console.log('更新日志关闭!'); -// } -// }); -// } +function noticeCloce(id: any) { + //更新日志关闭事件 + const params = { + versionId: id + }; + userVersionRelation(params).then((res: any) => { + if (res.code === 200) { + console.log('更新日志关闭!'); + } + }); +} function getWeatherData() { //获取天气 getWeather().then((res: any) => {