Files
app-govern/pages/message1/comp/alarmDetails.vue

286 lines
9.0 KiB
Vue
Raw Normal View History

2026-03-17 14:00:55 +08:00
<template>
<Cn-page :loading="loading">
<view class="detail" slot="body">
<view class="detail-content" style="font-size: 32rpx">
<!-- <view class="detail-content-title mb20">发生时间</view> -->
<view>{{ detail.date }}</view>
</view>
2026-06-01 20:36:04 +08:00
<view class="detail-content" style="padding-top: 0px;padding-bottom: 0px">
2026-04-17 08:50:07 +08:00
<view class="detail-content-title pb20 pt20 pl20">终端告警列表</view>
</view>
2026-03-17 14:00:55 +08:00
2026-04-17 08:50:07 +08:00
<view class="event-list">
<uni-card class="event-item" :class="item.type" v-for="(item, index) in list" :key="index">
<!-- 头部图标 + 信息 + 操作 -->
<view class="event-header">
2026-05-27 10:10:19 +08:00
<view class="event-icon"
:class="item.devType == 'Direct_Connected_Device' ? 'zl-bgc' : 'jc-bgc'">
2026-06-01 20:36:04 +08:00
2026-05-27 10:10:19 +08:00
<Cn-icon-transient :name="item.devType == 'Direct_Connected_Device' ? '治理设备' : '监测设备'" />
2026-04-17 08:50:07 +08:00
<view class="badge1" v-if="item.status == 0"> </view>
2026-03-17 14:00:55 +08:00
</view>
2026-04-17 08:50:07 +08:00
<view class="event-info">
<view class="event-title">
<text class="event-id">{{ item.devName }}</text>
2026-05-27 10:10:19 +08:00
<text class="event-tag"
:class="item.devType == 'Direct_Connected_Device' ? 'zl-tag' : 'jc-tag'">{{
item.devType == 'Direct_Connected_Device' ? '治理设备' : '监测设备' }}</text>
2026-03-30 08:43:13 +08:00
</view>
2026-04-17 08:50:07 +08:00
<view class="event-desc">
2026-05-29 16:23:56 +08:00
<text>工程{{ item.engineeringName }}</text>
<text>项目{{ item.projectName }}</text>
2026-05-27 10:10:19 +08:00
<!-- <text v-if="item.dataDetails.onlineRate.isAbnormal">在线率{{
item.dataDetails.onlineRate.value }}% 限值{{ item.dataDetails.onlineRate.threshold
}}% </text> -->
2026-04-17 08:50:07 +08:00
<!-- <text>事件时间{{ item.startTime }}</text> -->
2026-03-30 08:43:13 +08:00
</view>
</view>
2026-04-17 08:50:07 +08:00
</view>
<!-- 详情区域 -->
<view class="event-detail">
2026-05-27 10:10:19 +08:00
<view v-if="item.dataDetails.onlineRate.isAbnormal">
<text>在线率
2026-06-01 20:36:04 +08:00
<text class="integrity-value">{{ item.dataDetails.onlineRate.value }}%</text> 
2026-05-27 10:10:19 +08:00
</text>
2026-04-17 08:50:07 +08:00
</view>
2026-05-27 10:10:19 +08:00
<view v-if="hasIntegrityAbnormal(item)" class="mt10">
数据完整性
2026-06-01 20:36:04 +08:00
<view class="integrity-grid">
<view
v-for="(rowItems, rowIdx) in chunkedPoints(getAbnormalPoints(item))"
:key="rowIdx"
class="grid-row">
<view
v-for="(point, pIdx) in rowItems"
:key="pIdx"
class="param-group">
<view class="param-title">
<text>{{ point.monitorName }}</text>
</view>
<view class="integrity-value-row">
<text class="integrity-value">{{ point.value }}%</text>
</view>
</view>
2026-05-27 10:10:19 +08:00
</view>
</view>
</view>
2026-06-01 20:36:04 +08:00
<view v-if="item.warnCounts" class="mt10 ">
2026-04-17 08:50:07 +08:00
终端告警 {{ item.warnCounts }} 详情如下
2026-06-01 20:36:04 +08:00
<view class="textBox mt10">
<view v-for="val in item.warnDetails" class="textBox mb5" style=" font-size: 26rpx;">
2026-04-17 08:50:07 +08:00
{{ val.warnEventTime + '发生' + val.warnEventDesc }}
2026-05-27 10:10:19 +08:00
</view>
</view>
2026-03-30 08:43:13 +08:00
</view>
2026-04-17 08:50:07 +08:00
</view>
</uni-card>
2026-03-17 14:00:55 +08:00
</view>
</view>
</Cn-page>
</template>
<script>
import { updateStatus, queryAlarmDetail } from '@/common/api/message'
export default {
data() {
return {
loading: true,
detail: {},
limit: '',
2026-03-30 08:43:13 +08:00
collapseValue: '0',
2026-03-17 14:00:55 +08:00
list: [],
}
},
onLoad(options) {
2026-03-30 08:43:13 +08:00
this.loading = true
2026-03-17 14:00:55 +08:00
this.detail = JSON.parse(decodeURIComponent(options.detail).replace(/百分比/g, '%'))
this.init()
if (this.detail.isRead != 1) {
updateStatus({
eventIds: [this.detail.eventId],
})
}
},
methods: {
2026-05-27 10:10:19 +08:00
hasIntegrityAbnormal(item) {
const points = item?.dataDetails?.integrity?.monitorPoints
if (!Array.isArray(points) || !points.length) return false
2026-06-01 20:36:04 +08:00
return points.some((p) => p.isAbnormal === true)
},
getAbnormalPoints(item) {
return item?.dataDetails?.integrity?.monitorPoints?.filter((p) => p.isAbnormal === true) || []
},
chunkedPoints(points) {
const result = []
for (let i = 0; i < points.length; i += 3) {
result.push(points.slice(i, i + 3))
}
return result
2026-05-27 10:10:19 +08:00
},
2026-03-17 14:00:55 +08:00
init() {
queryAlarmDetail({
devList: this.detail.devIds,
time: this.detail.date,
})
.then((res) => {
this.list = res.data
this.loading = false
})
.catch(() => {
this.loading = false
})
},
},
}
</script>
2026-03-30 08:43:13 +08:00
<style lang="scss" scoped>
@import '../index.scss';
2026-05-27 10:10:19 +08:00
2026-03-17 14:00:55 +08:00
.detail {
padding: 20rpx 0;
.detail-content {
2026-06-01 20:36:04 +08:00
2026-03-17 14:00:55 +08:00
padding: 20rpx;
background: #fff;
margin-bottom: 20rpx;
2026-04-25 15:22:50 +08:00
font-size: 28rpx;
2026-03-17 14:00:55 +08:00
.detail-content-title {
2026-06-01 20:36:04 +08:00
display: inline-flex;
align-items: center;
position: relative;
padding-left: 20rpx;
2026-03-30 08:43:13 +08:00
font-size: 30rpx;
2026-03-17 14:00:55 +08:00
color: #111;
font-weight: 700;
2026-06-01 20:36:04 +08:00
&::before {
content: '';
position: absolute;
left: 0;
top: 50%;
transform: translateY(-50%);
width: 8rpx;
height: 28rpx;
background: $uni-theme-color;
border-radius: 3rpx;
}
2026-03-17 14:00:55 +08:00
}
}
2026-05-27 10:10:19 +08:00
2026-03-17 14:00:55 +08:00
.collapseTop {
padding: 10rpx 0;
margin-left: 15px;
2026-05-27 10:10:19 +08:00
2026-03-17 14:00:55 +08:00
.name {
2026-03-30 08:43:13 +08:00
font-size: 28rpx;
2026-03-17 14:00:55 +08:00
font-weight: 700;
color: #333333;
}
}
2026-05-27 10:10:19 +08:00
2026-03-17 14:00:55 +08:00
.frequency {
display: flex;
2026-04-25 15:22:50 +08:00
font-size: 28rpx;
2026-03-17 14:00:55 +08:00
// color: #666666;
}
}
2026-05-27 10:10:19 +08:00
2026-03-17 14:00:55 +08:00
.textBox {
2026-04-17 08:50:07 +08:00
// border-bottom: 1px solid #eee;
2026-04-25 15:22:50 +08:00
font-size: 28rpx;
2026-03-30 08:43:13 +08:00
color: #666666;
2026-04-01 10:00:04 +08:00
text-indent: 2em;
2026-03-30 08:43:13 +08:00
}
2026-05-27 10:10:19 +08:00
2026-03-30 08:43:13 +08:00
.event-list {
2026-04-17 08:50:07 +08:00
// background: #fff;
2026-04-01 10:00:04 +08:00
padding-bottom: 10rpx;
2026-05-27 10:10:19 +08:00
2026-04-17 08:50:07 +08:00
// .event-icon {
// background-color: #376cf320;
// }
.zl-bgc {
background-color: #376cf320;
}
2026-05-27 10:10:19 +08:00
2026-04-17 08:50:07 +08:00
.jc-bgc {
background-color: #376cf320;
}
2026-05-27 10:10:19 +08:00
2026-04-17 08:50:07 +08:00
.zl-tag {
background-color: #007aff20;
color: #007aff;
}
2026-05-27 10:10:19 +08:00
2026-04-17 08:50:07 +08:00
.jc-tag {
2026-04-24 09:13:17 +08:00
background-color: #007aff20;
color: #007aff;
2026-03-30 08:43:13 +08:00
}
}
2026-05-27 10:10:19 +08:00
2026-03-30 08:43:13 +08:00
/deep/ .uni-collapse-item__title-box {
padding: 0 15px 0 0;
height: 56rpx;
line-height: 56rpx;
font-size: 26rpx !important;
color: #666666;
2026-05-27 10:10:19 +08:00
2026-03-30 08:43:13 +08:00
span {
font-size: 26rpx !important;
}
2026-03-17 14:00:55 +08:00
}
2026-05-27 10:10:19 +08:00
2026-04-17 08:50:07 +08:00
.textBox {
2026-06-01 20:36:04 +08:00
max-height: 150rpx;
2026-04-17 08:50:07 +08:00
overflow-y: auto;
}
2026-05-27 10:10:19 +08:00
2026-06-01 20:36:04 +08:00
.integrity-grid {
margin-top: 16rpx;
}
2026-05-27 10:10:19 +08:00
2026-06-01 20:36:04 +08:00
.grid-row {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 16rpx;
margin-bottom: 16rpx;
2026-05-27 10:10:19 +08:00
2026-06-01 20:36:04 +08:00
&:last-child {
margin-bottom: 0;
}
}
2026-05-27 10:10:19 +08:00
2026-06-01 20:36:04 +08:00
.param-group {
min-width: 0;
background: #f3f3f3;
border-radius: 16rpx;
padding: 16rpx 8rpx 12rpx;
text-align: center;
}
2026-05-27 10:10:19 +08:00
2026-06-01 20:36:04 +08:00
.param-title {
font-size: 24rpx;
color: #666666;
// margin-bottom: 8rpx;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
2026-05-27 10:10:19 +08:00
2026-06-01 20:36:04 +08:00
.integrity-value-row {
display: flex;
justify-content: center;
align-items: center;
padding: 2rpx;
}
2026-05-27 10:10:19 +08:00
2026-06-01 20:36:04 +08:00
.integrity-value {
font-size: 26rpx;
font-weight: 700;
color: #333333;
2026-05-27 10:10:19 +08:00
}
2026-06-01 20:36:04 +08:00
</style>