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

147 lines
4.4 KiB
Vue
Raw Normal View History

2026-03-17 14:00:55 +08:00
<template>
<view style="position: relative">
<!-- 运行告警 -->
<!-- 卡片 -->
2026-03-30 08:43:13 +08:00
<scroll-view
scroll-y="true"
@refresherrefresh="refresherrefresh"
: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
<!-- 循环渲染事件项 -->
<uni-card
class="event-item"
:class="item.type"
v-for="(item, index) in this.store.data"
:key="index"
@click="jump(item)"
>
<!-- 头部图标 + 信息 + 操作 -->
<view class="event-header">
<view class="event-icon">
<!-- 动态图标根据类型切换 -->
<uni-icons
custom-prefix="iconfont"
type="icon-terminal-box-fill"
2026-03-30 08:43:13 +08:00
size="30"
2026-03-17 14:00:55 +08:00
color="#FF0000"
></uni-icons>
<view class="badge1" v-if="item.isRead == 0"> </view>
</view>
<view class="event-info">
<view class="event-title">
<text class="event-id">{{ item.date }}发生告警终端{{ item.warnNums }}</text>
</view>
</view>
2026-03-30 08:43:13 +08:00
<view class="event-action"> <uni-icons type="search" size="25"></uni-icons> </view>
2026-03-17 14:00:55 +08:00
</view>
</uni-card>
<uni-load-more
v-if="store.status == 'loading' || (store.data && store.data.length > 0)"
:status="store.status"
></uni-load-more>
<Cn-empty v-else style="top: 20%"></Cn-empty>
2026-03-30 08:43:13 +08:00
</scroll-view>
2026-03-17 14:00:55 +08:00
</view>
</template>
<script>
import list from '@/common/js/list'
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加载后
}
},
mounted() {},
methods: {
init() {
this.store = this.DataSource('/cs-harmonic-boot/csAlarm/queryAlarmList')
this.store.params.pageSize = 10000
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, '百分比')
item.status = '1'
uni.navigateTo({ url: '/pages/message1/comp/alarmDetails?detail=' + encodeURIComponent(str) })
},
2026-03-30 08:43:13 +08:00
// 下拉
refresherrefresh() {
this.triggered = true
uni.startPullDownRefresh()
setTimeout(() => {
this.triggered = false
}, 500)
},
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';
/* 列表容器 */
.event-list {
margin-top: 20rpx;
/* 头部:图标 + 信息 + 操作 */
.event-header {
margin-bottom: 0rpx;
}
.event-title {
margin-bottom: 0rpx;
}
/* 图标区域(按类型区分背景色) */
.event-icon {
width: 70rpx;
height: 70rpx;
background-color: #ff000020;
}
/* 信息区域 */
.event-info {
flex: 1;
}
}
2026-03-30 08:43:13 +08:00
/deep/ .uni-scroll-view-refresher {
display: none;
}
2026-03-17 14:00:55 +08:00
</style>