t
This commit is contained in:
@@ -1,64 +1,109 @@
|
||||
<template>
|
||||
<Cn-page :loading='loading'>
|
||||
<view slot='body'>
|
||||
<view class='record'>
|
||||
<uni-nav-bar dark :fixed="true" status-bar left-icon="left" rightText="关闭通知" background-color="#fff"
|
||||
color="#111" title="告警情况" @clickLeft="back" @clickRight="messageSet" />
|
||||
<div class="header">
|
||||
<uni-segmented-control :current="current" :values="items" :style-type="styleType"
|
||||
:active-color="activeColor" @clickItem="onClickItem" />
|
||||
</div>
|
||||
<uni-list :border="false">
|
||||
<uni-list-item title="输入电压异常" rightText="2023-02-01 15:10:29" v-for="item in 5" />
|
||||
</uni-list>
|
||||
<uni-load-more status="nomore"></uni-load-more>
|
||||
</view>
|
||||
<Cn-page :loading="loading">
|
||||
<view class="content" slot="body">
|
||||
<uni-list :border="false">
|
||||
<uni-list-item
|
||||
isDot
|
||||
show-badge
|
||||
badgeType="error"
|
||||
:badge-text="item.status == 1 ? '' : '未读'"
|
||||
:title="'告警代码:'+item.code"
|
||||
:note="item.startTime"
|
||||
@click="jump(item)"
|
||||
clickable
|
||||
v-for="(item, index) in store.data"
|
||||
/>
|
||||
</uni-list>
|
||||
<Cn-empty v-if="store.empty" style="padding-top: 400rpx"></Cn-empty>
|
||||
<uni-load-more v-if="store.data && store.data.length > 0" :status="store.status"></uni-load-more>
|
||||
</view>
|
||||
</Cn-page>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import list from '@/common/js/list'
|
||||
import { updateStatus } from '@/common/api/message'
|
||||
|
||||
export default {
|
||||
data () {
|
||||
mixins: [list],
|
||||
data() {
|
||||
return {
|
||||
loading: false,
|
||||
current: 0,
|
||||
items: ['当前告警', '历史告警'],
|
||||
styleType: 'text',
|
||||
activeColor: '#007aff',
|
||||
loading: true,
|
||||
deviceId:''
|
||||
}
|
||||
},
|
||||
onLoad(options) {
|
||||
this.deviceId = options.id
|
||||
},
|
||||
onShow() {
|
||||
this.init()
|
||||
},
|
||||
onNavigationBarButtonTap(e) {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '确定要全部标记为已读吗?',
|
||||
success: (res) => {
|
||||
if (res.confirm) {
|
||||
updateStatus({
|
||||
type: 3,
|
||||
eventIds:[]
|
||||
}).then(() => {
|
||||
this.store.reload()
|
||||
})
|
||||
}
|
||||
},
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
back(){
|
||||
uni.navigateBack()
|
||||
async init() {
|
||||
let dictData = await this.$util.getDictData('app_event')
|
||||
this.store = this.DataSource('/cs-harmonic-boot/eventUser/queryEventpage')
|
||||
this.store.params.type = 3
|
||||
this.store.params.deviceId = this.deviceId
|
||||
this.store.firstCallBack = (res) => {
|
||||
// this.store.data.forEach((item) => {
|
||||
// item.title = dictData.find((item2) => item2.code === item.tag)?.name
|
||||
// })
|
||||
// console.log(this.store.data)
|
||||
this.loading = false
|
||||
}
|
||||
this.store.reload()
|
||||
},
|
||||
messageSet(){
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '确定关闭该设备的告警通知吗?',
|
||||
showCancel: true,
|
||||
success: ({ confirm, cancel }) => {}
|
||||
})
|
||||
jump(item) {
|
||||
let str = JSON.stringify(item).replace(/%/g, '百分比')
|
||||
uni.navigateTo({ url: '/pages/message/reportDetail?detail=' + encodeURIComponent(str) })
|
||||
},
|
||||
onClickItem (e) {
|
||||
this.current = e.currentIndex
|
||||
},
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
<style lang='scss'>
|
||||
.record {
|
||||
.header {
|
||||
position: sticky;
|
||||
top: 0;
|
||||
left: 0;
|
||||
z-index: 10;
|
||||
background: $uni-theme-white;
|
||||
padding: 10rpx 20rpx 20rpx;
|
||||
box-shadow: 0 0 10rpx #eee;
|
||||
|
||||
<style lang="scss">
|
||||
.content {
|
||||
// padding-top: 20rpx;
|
||||
}
|
||||
|
||||
.term-list-bottom {
|
||||
.term-list-bottom-item {
|
||||
font-size: 28rpx;
|
||||
margin-bottom: 10rpx;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
// view:first-of-type{
|
||||
// color: #111;
|
||||
// }
|
||||
}
|
||||
|
||||
.term-list-bottom-item:last-of-type {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
}
|
||||
|
||||
/deep/ .uni-list-item {
|
||||
background-color: $uni-theme-white !important;
|
||||
}
|
||||
</style>
|
||||
|
||||
/deep/ .uni-card__header-extra-text {
|
||||
color: #dd524d !important;
|
||||
font-size: 20rpx;
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user