From 2f0fa3545b539e8b6f952ea82a1ca2350c64a0e8 Mon Sep 17 00:00:00 2001 From: web <candymxq888@outlook.com> Date: 星期二, 22 四月 2025 17:28:48 +0800 Subject: [PATCH] fix:修改报警,添加参数 --- src/screen/flow.vue | 27 ++++++++++++++++++++++----- 1 files changed, 22 insertions(+), 5 deletions(-) diff --git a/src/screen/flow.vue b/src/screen/flow.vue index 03c0a0c..e37bbb9 100644 --- a/src/screen/flow.vue +++ b/src/screen/flow.vue @@ -29,11 +29,10 @@ </template> <script setup> import{ useRouter,useRoute } from 'vue-router' -import useUserStore from '@/store/modules/user.js' -import {onMounted, ref, watch} from "vue"; +import {onMounted, ref, watch, onUnmounted} from "vue"; import { getUserType } from '@/utils/auth' +import { warnHistory } from '@/api/screen/warning/index.js' -const userStore = useUserStore() const router = useRouter() const route = ref(useRoute()) @@ -48,7 +47,7 @@ const userType = ref(getUserType()) const openWarn = ref(false) -const text = ref('新扎沟口流量监测点水位到达下限值, 金川水电站生态流量监测点水位到达下限值,流量监测点水位到达下限值') +const text = ref('') let timer = null; watch(openWarn, (newVal) => { @@ -71,12 +70,30 @@ router.push(item.url) } +// 获取报警内容 +const getWarnList = () => { + let str = '' + warnHistory({limit: 10, page: 1, monitorType: 2}).then(res => { + res.data.list?.forEach((item)=>{ + str += item.description + ',' + }) + text.value = str + }) +} + onMounted(() => { - if(userStore.userType == 1) { + getWarnList() + if(userType.value == 1) { btnList.value.push({name:'系统管理',url:'/user'}) } }) +onUnmounted(() => { + if(timer){ + clearInterval(timer) + } +}) + </script> <style lang="scss" scoped> -- Gitblit v1.9.3