消息列表优化

This commit is contained in:
仲么了
2023-11-03 16:33:16 +08:00
parent f01f764fcf
commit bb95331392
32 changed files with 402 additions and 949 deletions

223
pages/message/message.vue Normal file
View File

@@ -0,0 +1,223 @@
<template>
<Cn-page :loading="loading">
<view class="content" slot="body">
<view class="content-item" v-for="(item, index) in store.data" :key="index" @click="jump(item)">
<view class="content-item-header">
<uni-badge
class="uni-badge-left-margin"
:is-dot="true"
:text="item.status == '1' ? 0 : 1"
absolute="rightTop"
size="small"
>
<view class="content-item-header-icon">
<image mode="aspectFill" :src="staticIcon" style="height: 60rpx; width: 60rpx"></image>
</view>
</uni-badge>
<view class="content-item-header-right">
<view class="content-item-header-right-title">{{ item.equipmentName }}</view>
<!-- <view class="content-item-header-right-des">{{ item.engineeringName }} {{ item.projectName }}</view> -->
<view class="content-item-header-right-des">工程名称{{ item.engineeringName }}</view>
<view class="content-item-header-right-des">项目名称{{ item.projectName }}</view>
<!-- <view class="content-item-header-right-des">{{ item.subTitle }}</view> -->
</view>
<view class="ml10" v-if="type === '0' || item.status != '1'">🔍</view>
</view>
<view class="content-item-footer">{{ item.subTitle }}</view>
</view>
<!-- <uni-card
:title="item.equipmentName"
:extra="item.status == '1' ? '' : '未读'"
:sub-title="item.subTitle"
thumbnail="https://qiniu-web-assets.dcloud.net.cn/unidoc/zh/unicloudlogo.png"
@click="jump(item)"
v-for="(item, index) in store.data"
:key="index"
>
<view class="term-list-bottom">
<view class="term-list-bottom-item" v-for="(item2, textIndex) in item.dataSet" :key="textIndex">
{{ item2.showName + ':' + (item2.value == 3.1415926 ? '-' : item2.value) + (item2.unit || '') }}
</view>
</view>
</uni-card> -->
<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 {
mixins: [list],
data() {
return {
loading: true,
type: '',
staticIcon: '',
}
},
onLoad(o) {
this.type = o.type
switch (o.type) {
case '0':
uni.setNavigationBarTitle({ title: '暂态事件' })
this.staticIcon = '/static/zantai2.png'
break
case '1':
uni.setNavigationBarTitle({ title: '稳态事件' })
this.staticIcon = '/static/steady2.png'
break
case '2':
uni.setNavigationBarTitle({ title: '运行事件' })
this.staticIcon = '/static/run2.png'
break
case '3':
uni.setNavigationBarTitle({ title: '设备告警' })
this.staticIcon = '/static/device_bad2.png'
break
}
},
onShow() {
this.loading = true
this.init()
},
onNavigationBarButtonTap(e) {
uni.showModal({
title: '提示',
content: '确定要全部标记为已读吗?',
success: (res) => {
if (res.confirm) {
updateStatus({
type: this.type,
eventIds: [],
}).then(() => {
this.loading = true
this.store.reload()
})
}
},
})
},
methods: {
async init() {
let dictData = await this.$util.getDictData('app_event')
console.log(dictData)
this.store = this.DataSource('/cs-harmonic-boot/eventUser/queryEventpage')
this.store.params.type = this.type
this.store.loadedCallback = () => {
this.store.data.forEach((item) => {
if (this.type !== '0') {
item.subTitle = `${item.startTime}发生${item.showName}`
} else {
item.subTitle =
`${item.startTime}发生${item.showName}` +
item.dataSet
.map((item2) => {
return (
item2.showName +
'' +
(item2.value == 3.1415926 ? '-' : item2.value) +
(item2.unit || '')
)
})
.join('')
}
})
this.loading = false
}
this.store.reload()
},
jump(item) {
if (this.type === '0') {
let str = JSON.stringify(item).replace(/%/g, '百分比')
uni.navigateTo({ url: '/pages/message/messageDetail?detail=' + encodeURIComponent(str) })
} else {
if (item.status != '1') {
item.status = '1'
updateStatus({
eventIds: [item.id],
})
}
}
},
},
}
</script>
<style lang="scss">
.content {
.content-item {
margin: 20rpx;
padding: 20rpx 20rpx;
box-shadow: rgba(0, 0, 0, 0.08) 0px 0px 6rpx 2rpx;
border-radius: 8rpx;
border: 1px solid #ebeef5;
background: #fff;
.content-item-header {
display: flex;
padding: 20rpx 0;
border-bottom: 1px solid #ebeef5;
.content-item-header-icon {
display: flex;
align-items: center;
justify-content: center;
width: 100rpx;
height: 100rpx;
border-radius: 8rpx;
background: $uni-theme-color;
}
.content-item-header-right {
flex: 1;
display: flex;
flex-direction: column;
justify-content: space-between;
height: 100rpx;
margin-left: 20rpx;
.content-item-header-right-title {
font-size: 28rpx;
font-weight: bold;
color: #111;
}
.content-item-header-right-des {
font-size: 24rpx;
color: #999;
}
}
}
.content-item-footer {
margin-top: 20rpx;
font-size: 24rpx;
color: #999;
}
}
// 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;
}
/deep/ .uni-card__header-extra-text {
color: #dd524d !important;
font-size: 20rpx;
}
</style>

View File

@@ -1,105 +0,0 @@
<template>
<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 {
mixins: [list],
data() {
return {
loading: true,
}
},
onShow() {
this.init()
},
onNavigationBarButtonTap(e) {
uni.showModal({
title: '提示',
content: '确定要全部标记为已读吗?',
success: (res) => {
if (res.confirm) {
updateStatus({
type: 3,
eventIds:[]
}).then(() => {
this.store.reload()
})
}
},
})
},
methods: {
async init() {
let dictData = await this.$util.getDictData('app_event')
console.log(dictData)
this.store = this.DataSource('/cs-harmonic-boot/eventUser/queryEventpage')
this.store.params.type = 3
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()
},
jump(item) {
let str = JSON.stringify(item).replace(/%/g, '百分比')
uni.navigateTo({ url: '/pages/message/reportDetail?detail=' + encodeURIComponent(str) })
},
},
}
</script>
<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;
}
/deep/ .uni-card__header-extra-text {
color: #dd524d !important;
font-size: 20rpx;
}
</style>

View File

@@ -1,61 +0,0 @@
<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.startTime }}</view>
</view>
<view class="detail-content">
<view class="detail-content-title mb20">基础信息</view>
<view class="mb5"> 设备名称{{ detail.equipmentName }}</view>
<view class="mb5"> 项目名称{{ detail.projectName }} </view>
<view class="mb5"> 工程名称{{ detail.engineeringName }} </view>
<view class="mb5"> 告警代码{{ detail.code }}</view>
<view class="mb5" v-for="(item, textIndex) in detail.dataSet" :key="textIndex">
{{ item.showName + ':' + (item.value == 3.1415926 ? '-' : item.value) + (item.unit || '') }}
</view>
</view>
</view>
</Cn-page>
</template>
<script>
import { updateStatus } from '@/common/api/message'
export default {
data() {
return {
loading: true,
detail: {},
}
},
onLoad(options) {
console.log(options.detail)
this.detail = JSON.parse(decodeURIComponent(options.detail).replace(/百分比/g, '%'))
this.loading = false
if (this.detail.status != 1) {
updateStatus({
eventIds: [this.detail.id],
})
}
},
methods: {},
}
</script>
<style lang="scss">
.detail {
padding: 20rpx 0;
.detail-content {
padding: 20rpx;
background: #fff;
margin-bottom: 20rpx;
font-size: 26rpx;
.detail-content-title {
font-size: 32rpx;
color: #111;
font-weight: 700;
}
}
}
</style>

View File

@@ -1,113 +0,0 @@
<template>
<view class="content">
<uni-card title="灿能园区NPQS_682发生设备状态异常一次" sub-title="2023-02-27 15:13:29" @click="jump">
<view class="term-list-bottom">
<view class="term-list-bottom-item">
<view>设备告警</view>
<view>0</view>
</view>
<view class="term-list-bottom-item">
<view>通讯设备</view>
<view>1</view>
</view>
<view class="term-list-bottom-item">
<view>设备流量</view>
<view>0</view>
</view>
</view>
</uni-card>
<uni-card title="灿能园区NPQS_681发生设备状态异常一次" sub-title="2023-02-27 13:13:29" @click="jump">
<view class="term-list-bottom">
<view class="term-list-bottom-item">
<view>设备告警</view>
<view>0</view>
</view>
<view class="term-list-bottom-item">
<view>通讯设备</view>
<view>1</view>
</view>
<view class="term-list-bottom-item">
<view>设备流量</view>
<view>0</view>
</view>
</view>
</uni-card>
<uni-card title="灿能园区NPQS_682发生设备状态异常一次" sub-title="2023-02-27 11:13:29" @click="jump">
<view class="term-list-bottom">
<view class="term-list-bottom-item">
<view>设备告警</view>
<view>0</view>
</view>
<view class="term-list-bottom-item">
<view>通讯设备</view>
<view>1</view>
</view>
<view class="term-list-bottom-item">
<view>设备流量</view>
<view>0</view>
</view>
</view>
</uni-card>
<uni-card title="灿能园区NPQS_682发生设备状态异常一次" sub-title="2023-02-27 09:13:29" @click="jump">
<view class="term-list-bottom">
<view class="term-list-bottom-item">
<view>设备告警</view>
<view>0</view>
</view>
<view class="term-list-bottom-item">
<view>通讯设备</view>
<view>1</view>
</view>
<view class="term-list-bottom-item">
<view>设备流量</view>
<view>0</view>
</view>
</view>
</uni-card>
<uni-load-more status="nomore"></uni-load-more>
</view>
</template>
<script>
export default {
data () {
return {
title: '灿能'
}
},
onLoad () {
},
methods: {
jump () {
console.log(123);
uni.navigateTo({ url: '/pages/message/termDetail' })
}
}
}
</script>
<style lang="scss">
.content {
// padding-top: 20rpx;
}
.term-list-bottom {
.term-list-bottom-item{
font-size: 28rpx;
margin-bottom: 20rpx;
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>

View File

@@ -1,82 +0,0 @@
<template>
<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.showName"
: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 {
mixins: [list],
data() {
return {
loading: true,
}
},
onShow() {
this.init()
},
onNavigationBarButtonTap(e) {
uni.showModal({
title: '提示',
content: '确定要全部标记为已读吗?',
success: (res) => {
if (res.confirm) {
updateStatus({
type: 2,
eventIds:[]
}).then(() => {
this.store.reload()
})
}
},
})
},
methods: {
async init() {
let dictData = await this.$util.getDictData('app_event')
console.log(dictData)
this.store = this.DataSource('/cs-harmonic-boot/eventUser/queryEventpage')
this.store.params.type = 2
this.store.firstCallBack = (res) => {
this.loading = false
}
this.store.reload()
},
jump(item) {
let str = JSON.stringify(item).replace(/%/g, '百分比')
uni.navigateTo({ url: '/pages/message/runDetail?detail=' + encodeURIComponent(str) })
},
},
}
</script>
<style lang="scss">
.content {
padding-top: 20rpx;
}
/deep/ .uni-list-item {
background-color: $uni-theme-white !important;
}
/deep/ .uni-badge {
background-color: unset !important;
color: #dd524d !important;
font-size: 28rpx !important;
}
</style>

View File

@@ -1,61 +0,0 @@
<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.startTime }}</view>
</view>
<view class="detail-content">
<view class="detail-content-title mb20">基础信息</view>
<view class="mb5"> 设备名称{{ detail.equipmentName }}</view>
<view class="mb5"> 项目名称{{ detail.projectName }} </view>
<view class="mb5"> 工程名称{{ detail.engineeringName }} </view>
<view class="mb5"> 事件名称{{ detail.showName }}</view>
<view class="mb5" v-for="(item, textIndex) in detail.dataSet" :key="textIndex">
{{ item.showName + ':' + (item.value == 3.1415926 ? '-' : item.value) + (item.unit || '') }}
</view>
</view>
</view>
</Cn-page>
</template>
<script>
import { updateStatus } from '@/common/api/message'
export default {
data() {
return {
loading: true,
detail: {},
}
},
onLoad(options) {
console.log(options.detail)
this.detail = JSON.parse(decodeURIComponent(options.detail).replace(/百分比/g, '%'))
this.loading = false
if (this.detail.status != 1) {
updateStatus({
eventIds: [this.detail.id],
})
}
},
methods: {},
}
</script>
<style lang="scss">
.detail {
padding: 20rpx 0;
.detail-content {
padding: 20rpx;
background: #fff;
margin-bottom: 20rpx;
font-size: 26rpx;
.detail-content-title {
font-size: 32rpx;
color: #111;
font-weight: 700;
}
}
}
</style>

View File

@@ -1,105 +0,0 @@
<template>
<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.showName"
: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 {
mixins: [list],
data() {
return {
loading: true,
}
},
onShow() {
this.init()
},
onNavigationBarButtonTap(e) {
uni.showModal({
title: '提示',
content: '确定要全部标记为已读吗?',
success: (res) => {
if (res.confirm) {
updateStatus({
type: 1,
eventIds:[]
}).then(() => {
this.store.reload()
})
}
},
})
},
methods: {
async init() {
let dictData = await this.$util.getDictData('app_event')
console.log(dictData)
this.store = this.DataSource('/cs-harmonic-boot/eventUser/queryEventpage')
this.store.params.type = 1
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()
},
jump(item) {
let str = JSON.stringify(item).replace(/%/g, '百分比')
uni.navigateTo({ url: '/pages/message/steadyDetail?detail=' + encodeURIComponent(str) })
},
},
}
</script>
<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;
}
/deep/ .uni-card__header-extra-text {
color: #dd524d !important;
font-size: 20rpx;
}
</style>

View File

@@ -1,61 +0,0 @@
<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.startTime }}</view>
</view>
<view class="detail-content">
<view class="detail-content-title mb20">基础信息</view>
<view class="mb5"> 设备名称{{ detail.equipmentName }}</view>
<view class="mb5"> 项目名称{{ detail.projectName }} </view>
<view class="mb5"> 工程名称{{ detail.engineeringName }} </view>
<view class="mb5"> 事件名称{{ detail.showName }}</view>
<view class="mb5" v-for="(item, textIndex) in detail.dataSet" :key="textIndex">
{{ item.showName + ':' + (item.value == 3.1415926 ? '-' : item.value) + (item.unit || '') }}
</view>
</view>
</view>
</Cn-page>
</template>
<script>
import { updateStatus } from '@/common/api/message'
export default {
data() {
return {
loading: true,
detail: {},
}
},
onLoad(options) {
console.log(options.detail)
this.detail = JSON.parse(decodeURIComponent(options.detail).replace(/百分比/g, '%'))
this.loading = false
if (this.detail.status != 1) {
updateStatus({
eventIds: [this.detail.id],
})
}
},
methods: {},
}
</script>
<style lang="scss">
.detail {
padding: 20rpx 0;
.detail-content {
padding: 20rpx;
background: #fff;
margin-bottom: 20rpx;
font-size: 26rpx;
.detail-content-title {
font-size: 32rpx;
color: #111;
font-weight: 700;
}
}
}
</style>

View File

@@ -1,54 +0,0 @@
<template>
<view class="content">
<view class="detail-content " style="font-size:32rpx">
<!-- <view class="detail-content-title mb20">发生时间</view> -->
<view>2023-02-14</view>
</view>
<uni-list :border="false">
<uni-list-item title="灿能园区CN_NPQS682发生稳态越线" note="电压谐波畸变率越限45分钟,5次电压谐波含有率越限5分钟" clickable @click="jump" />
<uni-list-item title="灿能园区CN_NPQS682发生稳态越线" note="电压谐波畸变率越限27分钟,5次电压谐波含有率越限3分钟" clickable @click="jump" />
<uni-list-item title="灿能园区CN_NPQS682发生稳态越线" note="电压谐波畸变率越限45分钟,5次电压谐波含有率越限5分钟" clickable @click="jump" />
<uni-list-item title="灿能园区CN_NPQS682发生稳态越线" note="电压谐波畸变率越限45分钟,5次电压谐波含有率越限5分钟" clickable @click="jump" />
<uni-list-item title="灿能园区CN_NPQS682发生稳态越线" note="电压谐波畸变率越限45分钟,5次电压谐波含有率越限5分钟" clickable @click="jump" />
</uni-list>
<uni-load-more status="nomore"></uni-load-more>
</view>
</template>
<script>
export default {
data () {
return {
title: '灿能'
}
},
onLoad () {
},
methods: {
jump () {
uni.navigateTo({ url: '/pages/message/steadyDetail' })
}
}
}
</script>
<style lang="scss">
.content {
.detail-content{
padding: 20rpx 30rpx;
background: #fff;
margin-bottom: 20rpx;
}
}
/deep/ .uni-list-item {
background-color: $uni-theme-white !important;
}
/deep/ .uni-badge {
background-color: unset !important;
color: #dd524d !important;
font-size: 28rpx !important;
}
</style>

View File

@@ -1,106 +0,0 @@
<template>
<Cn-page :loading="loading">
<view class="content" slot="body">
<uni-card
:title="item.showName"
:extra="item.status == '1' ? '' : '未读'"
:sub-title="item.startTime"
@click="jump(item)"
v-for="(item, index) in store.data"
:key="index"
>
<view class="term-list-bottom">
<view class="term-list-bottom-item" v-for="(item2, textIndex) in item.dataSet" :key="textIndex">
{{ item2.showName + ':' + (item2.value == 3.1415926 ? '-' : item2.value) + (item2.unit || '') }}
</view>
</view>
</uni-card>
<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 {
mixins: [list],
data() {
return {
loading: true,
}
},
onShow() {
this.init()
},
onNavigationBarButtonTap(e) {
uni.showModal({
title: '提示',
content: '确定要全部标记为已读吗?',
success: (res) => {
if (res.confirm) {
updateStatus({
type: 0,
eventIds:[]
}).then(() => {
this.store.reload()
})
}
},
})
},
methods: {
async init() {
let dictData = await this.$util.getDictData('app_event')
console.log(dictData)
this.store = this.DataSource('/cs-harmonic-boot/eventUser/queryEventpage')
this.store.params.type = 0
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()
},
jump(item) {
let str = JSON.stringify(item).replace(/%/g, '百分比')
uni.navigateTo({ url: '/pages/message/transientDetail?detail=' + encodeURIComponent(str) })
},
},
}
</script>
<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;
}
/deep/ .uni-card__header-extra-text {
color: #dd524d !important;
font-size: 20rpx;
}
</style>