Files
app-govern/pages/message1/alarm.vue

196 lines
6.3 KiB
Vue
Raw Normal View History

2026-03-17 14:00:55 +08:00
<template>
<view style="position: relative">
<!-- 运行告警 -->
<!-- 卡片 -->
2026-06-01 11:32:25 +08:00
<scroll-view scroll-y="true" @scroll="onScroll" :scroll-top="scrollTop" scroll-with-animation
@refresherrefresh="refresherrefresh" @scrolltolower="scrolltolower"
2026-05-27 10:10:19 +08:00
:refresher-triggered="triggered" refresher-enabled="true" class="event-list"
:style="{ height: 'calc(100vh - ' + (navHeight + 10) + 'px)', overflow: 'auto' }">
2026-03-17 14:00:55 +08:00
<!-- 循环渲染事件项 -->
2026-05-27 10:10:19 +08:00
<uni-card class="event-item boxClick" :class="item.type" v-for="(item, index) in this.store.data"
:key="index" @click="jump(item)">
2026-03-17 14:00:55 +08:00
<!-- 头部图标 + 信息 + 操作 -->
<view class="event-header">
<view class="event-icon">
<!-- 动态图标根据类型切换 -->
2026-04-17 08:50:07 +08:00
<!-- <uni-icons
2026-03-17 14:00:55 +08:00
custom-prefix="iconfont"
type="icon-terminal-box-fill"
2026-03-30 08:43:13 +08:00
size="30"
2026-04-17 08:50:07 +08:00
color="#376cf3"
></uni-icons> -->
<Cn-icon-transient :name="`运行告警`" />
<view class="badge1" v-if="item.isRead == 0"></view>
2026-03-17 14:00:55 +08:00
</view>
<view class="event-info">
<view class="event-title">
2026-04-17 08:50:07 +08:00
<text class="event-id">{{ item.date }}</text>
</view>
<view class="event-desc">
<text>告警终端总数{{ item.warnNums }}</text>
2026-05-29 16:23:56 +08:00
<text v-if="item.onlineRateIsWarn">在线率偏低</text>
2026-05-27 10:10:19 +08:00
<text v-if="item.integrityIsWarn">完整性偏低</text>
<text v-if="item.warnCounts > 0">事件触发终端告警{{ item.warnCounts }}</text>
2026-03-17 14:00:55 +08:00
</view>
</view>
2026-04-17 08:50:07 +08:00
<view class="event-action">
<uni-icons type="search" size="25" color="#376cf3"></uni-icons>
2026-04-03 14:48:45 +08:00
</view>
2026-03-17 14:00:55 +08:00
</view>
2026-04-17 08:50:07 +08:00
<!-- <view class="event-detail">
<text> 告警终端总数{{ item.warnNums }} </text>
2026-04-17 08:50:07 +08:00
</view> -->
2026-03-17 14:00:55 +08:00
</uni-card>
2026-05-27 10:10:19 +08:00
<uni-load-more v-if="store.status == 'loading' || (store.data && store.data.length > 0)"
:status="store.status"></uni-load-more>
2026-03-17 14:00:55 +08:00
<Cn-empty v-else style="top: 20%"></Cn-empty>
2026-03-30 08:43:13 +08:00
</scroll-view>
2026-06-01 11:32:25 +08:00
<view class="back-top boxClick" v-show="showBackTop" @click="backToTop">
<uni-icons type="arrow-up" size="22" color="#fff"></uni-icons>
</view>
2026-03-17 14:00:55 +08:00
</view>
</template>
<script>
import list from '@/common/js/list'
2026-03-17 14:00:55 +08:00
export default {
components: {},
props: {
navHeight: {
type: Number,
default: 0,
},
selectValue: {
type: Object,
// default: () => {},
},
},
mixins: [list],
data() {
return {
2026-03-30 08:43:13 +08:00
triggered: true,
2026-03-17 14:00:55 +08:00
status: 'noMore', //more加载前 loading加载中 noMore加载后
2026-06-01 11:32:25 +08:00
scrollTop: 0,
oldScrollTop: 0,
showBackTop: false,
2026-03-17 14:00:55 +08:00
}
},
mounted() {
},
2026-03-17 14:00:55 +08:00
methods: {
init() {
this.store = this.DataSource('/cs-harmonic-boot/csAlarm/queryAlarmList')
2026-04-17 08:50:07 +08:00
// this.store.params.pageSize = 10000
2026-03-17 14:00:55 +08:00
this.store.params.engineerId = this.selectValue.engineeringId
this.store.params.projectId = this.selectValue.projectId
this.store.params.devId = this.selectValue.deviceId
this.store.params.lineId = this.selectValue.lineId
this.store.params.time = this.selectValue.date
this.store.loadedCallback = () => {
this.loading = false
}
2026-03-30 08:43:13 +08:00
2026-03-17 14:00:55 +08:00
this.store.reload()
},
jump(item) {
let str = JSON.stringify(item).replace(/%/g, '百分比')
uni.navigateTo({ url: '/pages/message1/comp/alarmDetails?detail=' + encodeURIComponent(str) })
2026-05-27 10:10:19 +08:00
item.isRead = 1
2026-05-29 16:23:56 +08:00
2026-03-17 14:00:55 +08:00
},
2026-03-30 08:43:13 +08:00
// 下拉
refresherrefresh() {
this.triggered = true
uni.startPullDownRefresh()
setTimeout(() => {
this.triggered = false
}, 500)
},
2026-04-17 08:50:07 +08:00
// 上拉
scrolltolower() {
if (this.store.status != 'noMore') {
this.store.next && this.store.next()
}
},
2026-06-01 11:32:25 +08:00
onScroll(e) {
this.oldScrollTop = e.detail.scrollTop
this.showBackTop = e.detail.scrollTop > 200
},
backToTop() {
this.scrollTop = this.oldScrollTop
this.$nextTick(() => {
this.scrollTop = 0
})
this.showBackTop = false
},
2026-03-17 14:00:55 +08:00
},
computed: {},
watch: {
selectValue: {
handler(val, oldVal) {
if (Object.keys(val).length === 0) return
this.init()
},
deep: true,
immediate: true,
},
},
}
</script>
<style lang="scss" scoped>
@import './index.scss';
2026-05-27 10:10:19 +08:00
2026-03-17 14:00:55 +08:00
/* 列表容器 */
.event-list {
margin-top: 20rpx;
/* 头部:图标 + 信息 + 操作 */
2026-04-17 08:50:07 +08:00
// .event-header {
// margin-bottom: 0rpx;
// }
// .event-title {
// margin-bottom: 0rpx;
// }
2026-03-17 14:00:55 +08:00
/* 图标区域(按类型区分背景色) */
.event-icon {
2026-04-17 08:50:07 +08:00
// width: 80rpx;
// height: 80rpx;
background-color: #376cf320;
2026-03-17 14:00:55 +08:00
}
/* 信息区域 */
.event-info {
flex: 1;
}
}
2026-03-30 08:43:13 +08:00
/deep/ .uni-scroll-view-refresher {
display: none;
}
2026-05-29 16:23:56 +08:00
.event-header {
margin-bottom: 0rpx !important;
}
2026-06-01 11:32:25 +08:00
.back-top {
position: fixed;
right: 30rpx;
bottom: 60rpx;
width: 80rpx;
height: 80rpx;
border-radius: 50%;
background: #376cf3;
display: flex;
align-items: center;
justify-content: center;
box-shadow: 0 4rpx 16rpx rgba(55, 108, 243, 0.35);
z-index: 99;
}
2026-03-17 14:00:55 +08:00
</style>