消息修改

This commit is contained in:
仲么了
2023-09-22 13:39:19 +08:00
parent a17e785d3e
commit 525e7e6f04
11 changed files with 223 additions and 142 deletions

View File

@@ -144,6 +144,9 @@ export default {
},
getDevCount() {
if (!this.select.engineeringId) return
if (!uni.getStorageSync(this.$cacheKey.access_token)) {
clearInterval(this.timer)
}
getDevCount(this.select.engineeringId).then((res) => {
// Object.assign(this.devCount, res.data)
this.devCount = res.data
@@ -163,15 +166,28 @@ export default {
this.devCount.eventCount +
this.devCount.alarmCount +
this.devCount.harmonicCount
let minePage = this.devCount.harmonicCount
uni.setTabBarBadge({
index: 1,
text: messagePage ? messagePage + '' : '',
})
uni.setTabBarBadge({
index: 2,
text: minePage ? minePage + '' : '',
})
let minePage = this.devCount.feedBackCount
if (messagePage) {
uni.setTabBarBadge({
index: 1,
text: messagePage ? messagePage + '' : '',
})
} else {
uni.removeTabBarBadge({
index: 1,
})
}
if (minePage) {
uni.setTabBarBadge({
index: 2,
text: minePage + '',
})
} else {
uni.removeTabBarBadge({
index: 2,
})
}
})
},
},
@@ -181,6 +197,7 @@ export default {
url: '/pages/user/login',
})
}
this.timer = setInterval(this.getDevCount, 3000) // 定时请求
this.store = this.DataSource('/cs-device-boot/EquipmentDelivery/queryEquipmentByProject')
// #ifdef APP-PLUS
setTimeout(() => {
@@ -204,12 +221,8 @@ export default {
})
} else {
this.init()
this.timer = setInterval(this.getDevCount, 10000) // 定时请求
}
},
onHide() {
clearInterval(this.timer)
}
}
</script>
<style lang="scss">

View File

@@ -36,6 +36,7 @@ export default {
loading: false,
userInfo: {},
messageCount: {},
timer: null,
}
},
methods: {
@@ -72,15 +73,17 @@ export default {
}
},
},
onLoad(options) {
setInterval(() => {
this.messageCount = uni.getStorageSync(this.$cacheKey.messageCount) || {}
}, 10000) // 定时请求
},
onLoad(options) {},
onShow() {
this.init()
this.messageCount = uni.getStorageSync(this.$cacheKey.messageCount) || {}
this.timer = setInterval(() => {
this.messageCount = uni.getStorageSync(this.$cacheKey.messageCount) || {}
}, 3000) // 定时请求
},
onHide() {
clearInterval(this.timer)
}
}
</script>

View File

@@ -114,6 +114,7 @@ export default {
loading: true,
userInfo: {},
messageCount: {},
timer: null,
}
},
computed: {
@@ -143,7 +144,7 @@ export default {
this.init()
setInterval(() => {
this.messageCount = uni.getStorageSync(this.$cacheKey.messageCount) || {}
}, 10000) // 定时请求
}, 3000) // 定时请求
},
methods: {
init() {},
@@ -248,6 +249,12 @@ export default {
this.userInfo = uni.getStorageSync(this.$cacheKey.userInfo)
this.loading = false
this.messageCount = uni.getStorageSync(this.$cacheKey.messageCount) || {}
this.timer = setInterval(() => {
this.messageCount = uni.getStorageSync(this.$cacheKey.messageCount) || {}
}, 3000) // 定时请求
},
onHide() {
clearInterval(this.timer)
},
}
</script>

View File

@@ -1,19 +1,27 @@
<template>
<view class="content">
<uni-list :border="false">
<uni-list-item :show-badge="true" badgeType="error" isDot badge-text="未读" title="设备异常共4台"
note="2023-02-27 15:13:29" clickable @click="jump" />
<uni-list-item badgeType="error" isDot badge-text="未读" title="设备异常共1台" note="2023-02-14 15:10:29" clickable
@click="jump" />
<uni-list-item badgeType="error" isDot badge-text="未读" title="设备异常共4台" note="2023-02-10 15:10:29" clickable
@click="jump" />
</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.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 list from '@/common/js/list'
export default {
mixins: [list],
@@ -32,34 +40,49 @@ export default {
this.store = this.DataSource('/cs-harmonic-boot/event/queryEventList')
this.store.params.type = 3
this.store.firstCallBack = (res) => {
this.store.data.forEach(item => {
item.title = item.equipmentName + dictData.find(item2 => item2.code === item.tag)?.name
})
console.log(this.store.data)
// 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)})
let str = JSON.stringify(item).replace(/%/g, '百分比')
uni.navigateTo({ url: '/pages/message/steadyDetail?detail=' + encodeURIComponent(str) })
},
}
},
}
</script>
<style lang="scss">
.content {
padding-top: 20rpx;
// 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-badge {
background-color: unset !important;
/deep/ .uni-card__header-extra-text {
color: #dd524d !important;
font-size: 28rpx !important;
font-size: 20rpx;
}
</style>

View File

@@ -1,46 +1,45 @@
<template>
<Cn-page :loading='loading'>
<view slot='body'>
<view class='detail'>
<view class="detail-content " style="font-size:32rpx">
<!-- <view class="detail-content-title mb20">发生时间</view> -->
<view>2023-02-14</view>
<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="mb10" style="font-size: 28rpx">{{ detail.showName }}</view>
<view class="mb5" v-for="(item, textIndex) in detail.dataSet" :key="textIndex">
{{ item.showName + ':' + item.value + (item.unit || '') }}
</view>
<view class="detail-content ">
<view class="detail-content-title mb20">设备基础信息</view>
<view class="mb10">灿能园区NPQS_681</view>
<view>网络参数00-B7-8D-A8-00-D3</view>
</view>
<view class="detail-content ">
<view class="detail-content-title mb20">设备通讯信息</view>
<view class="mb10">NPQS_681通讯设备1次具体如下所示</view>
<view>2023-02-14 10:59:10至2023-02-14 10:59:57</view>
</view>
<view class="detail-content ">
<view class="detail-content-title mb20">设备告警信息</view>
<view class="mb10">暂无告警信息</view>
</view>
<view class="detail-content ">
<view class="detail-content-title mb20">设备流量信息</view>
<view class="mb10">NPQS_681的流量于2023-02-14 23:59:59占总流量的0.0%</view>
</view>
<view class="mb5"> 设备名称{{ detail.equipmentName }}</view>
<view class="mb5"> 项目名称{{ detail.projectName }} </view>
<view class="mb5"> 工程名称{{ detail.engineeringName }} </view>
</view>
</view>
</Cn-page>
</template>
<script>
import { updateStatus } from '@/common/api/message'
export default {
data () {
data() {
return {
loading: false
loading: true,
detail: {},
}
},
methods: {
}
onLoad(options) {
console.log(options.detail)
this.detail = JSON.parse(decodeURIComponent(options.detail).replace(/百分比/g, '%'))
this.loading = false
if (this.detail.status != 1) {
updateStatus([this.detail.id])
}
},
methods: {},
}
</script>
<style lang='scss'>
<style lang="scss">
.detail {
padding: 20rpx 0;
@@ -57,4 +56,4 @@ export default {
}
}
}
</style>
</style>

View File

@@ -39,10 +39,6 @@ export default {
this.store = this.DataSource('/cs-harmonic-boot/event/queryEventList')
this.store.params.type = 2
this.store.firstCallBack = (res) => {
this.store.data.forEach((item) => {
item.title = item.equipmentName
})
console.log(this.store.data)
this.loading = false
}
this.store.reload()

View File

@@ -7,13 +7,13 @@
</view>
<view class="detail-content">
<view class="detail-content-title mb20">基础信息</view>
<view class="mb10" style="font-size: 28rpx;"> {{ detail.showName }}</view>
<view class="mb5"> 设备名称{{ detail.title }}</view>
<view class="mb5"> 项目名称{{ detail.projectName }} </view>
<view class="mb5"> 工程名称{{ detail.engineeringName }} </view>
<view v-for="(item, textIndex) in detail.dataSet" :key="textIndex">
<view class="mb10" style="font-size: 28rpx">{{ detail.showName }}</view>
<view class="mb5" v-for="(item, textIndex) in detail.dataSet" :key="textIndex">
{{ item.showName + ':' + item.value + (item.unit || '') }}
</view>
<view class="mb5"> 设备名称{{ detail.equipmentName }}</view>
<view class="mb5"> 项目名称{{ detail.projectName }} </view>
<view class="mb5"> 工程名称{{ detail.engineeringName }} </view>
</view>
</view>
</Cn-page>

View File

@@ -1,28 +1,25 @@
<template>
<Cn-page :loading="loading">
<view class="content" slot="body">
<uni-card
:title="item.equipmentName"
: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">
{{ item.engineeringName +'&#12288;' + item.projectName }}
</view>
<view class="term-list-bottom-item" v-for="(item2, textIndex) in item.dataSet" :key="textIndex">
{{ item2.showName + ':' + item2.value + (item2.unit || '') }}
</view>
</view>
</uni-card>
<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'
@@ -43,17 +40,17 @@ export default {
this.store = this.DataSource('/cs-harmonic-boot/event/queryEventList')
this.store.params.type = 1
this.store.firstCallBack = (res) => {
this.store.data.forEach(item => {
item.title = item.equipmentName + dictData.find(item2 => item2.code === item.tag)?.name
})
console.log(this.store.data)
// 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) })
uni.navigateTo({ url: '/pages/message/steadyDetail?detail=' + encodeURIComponent(str) })
},
},
}
@@ -61,16 +58,31 @@ export default {
<style lang="scss">
.content {
padding-top: 20rpx;
// 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-badge {
background-color: unset !important;
/deep/ .uni-card__header-extra-text {
color: #dd524d !important;
font-size: 28rpx !important;
font-size: 20rpx;
}
</style>

View File

@@ -1,35 +1,45 @@
<template>
<Cn-page :loading='loading'>
<view slot='body'>
<view class='detail'>
<view class="detail-content " style="font-size:32rpx">
<!-- <view class="detail-content-title mb20">发生时间</view> -->
<view>2023-02-14</view>
</view>
<view class="detail-content ">
<view class="detail-content-title mb20">电压谐波畸变率越限4</view>
<image style="width:100%" src="/static/boxing3.jpeg" mode="widthFix" />
</view>
<view class="detail-content ">
<view class="detail-content-title mb20">5次电压谐波含有率越限</view>
<image style="width:100%" src="/static/boxing3.jpeg" mode="widthFix" />
<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="mb10" style="font-size: 28rpx">{{ detail.showName }}</view>
<view class="mb5" v-for="(item, textIndex) in detail.dataSet" :key="textIndex">
{{ item.showName + ':' + item.value + (item.unit || '') }}
</view>
<view class="mb5"> 设备名称{{ detail.equipmentName }}</view>
<view class="mb5"> 项目名称{{ detail.projectName }} </view>
<view class="mb5"> 工程名称{{ detail.engineeringName }} </view>
</view>
</view>
</Cn-page>
</template>
<script>
import { updateStatus } from '@/common/api/message'
export default {
data () {
data() {
return {
loading: false
loading: true,
detail: {},
}
},
methods: {
}
onLoad(options) {
console.log(options.detail)
this.detail = JSON.parse(decodeURIComponent(options.detail).replace(/百分比/g, '%'))
this.loading = false
if (this.detail.status != 1) {
updateStatus([this.detail.id])
}
},
methods: {},
}
</script>
<style lang='scss'>
<style lang="scss">
.detail {
padding: 20rpx 0;
@@ -46,4 +56,4 @@ export default {
}
}
}
</style>
</style>

View File

@@ -2,7 +2,7 @@
<Cn-page :loading="loading">
<view class="content" slot="body">
<uni-card
:title="item.title"
:title="item.showName"
:extra="item.status == '1' ? '' : '未读'"
:sub-title="item.startTime"
@click="jump(item)"
@@ -41,10 +41,10 @@ export default {
this.store = this.DataSource('/cs-harmonic-boot/event/queryEventList')
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.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()

View File

@@ -7,25 +7,35 @@
</view>
<view class="detail-content">
<view class="detail-content-title mb20">基础信息</view>
<view class="mb10" style="font-size: 28rpx">{{ detail.title }}</view>
<view class="mb10" style="font-size: 28rpx">{{ detail.showName }}</view>
<view class="mb5" v-for="(item, textIndex) in detail.dataSet" :key="textIndex">
{{ item.showName + ':' + item.value + (item.unit || '') }}
</view>
<view class="mb5"> 设备名称{{ detail.title }}</view>
<view class="mb5"> 设备名称{{ detail.equipmentName }}</view>
<view class="mb5"> 项目名称{{ detail.projectName }} </view>
<view class="mb5"> 工程名称{{ detail.engineeringName }} </view>
<!-- <view class="space-between">请您评价本次事件是否对设备造成影响
</view> -->
</view>
<view class="detail-content">
<view class="detail-content-title mb20">瞬时波形图</view>
<image style="width: 100%" src="/static/boxing1.jpeg" mode="widthFix" />
<image
style="width: 100%"
:src="detail.instantPics"
mode="widthFix"
v-if="detail.instantPics"
@click="previewImage(detail.instantPics)"
/>
<text v-else>暂无</text>
</view>
<view class="detail-content">
<view class="detail-content-title mb20">RMS波形图</view>
<image style="width: 100%" src="/static/boxing2.jpeg" mode="widthFix" />
<image
style="width: 100%"
:src="detail.rmsPics"
mode="widthFix"
v-if="detail.rmsPics"
@click="previewImage(detail.rmsPics)"
/>
<text v-else>暂无</text>
</view>
</view>
</Cn-page>
@@ -43,12 +53,20 @@ export default {
onLoad(options) {
console.log(options.detail)
this.detail = JSON.parse(decodeURIComponent(options.detail).replace(/百分比/g, '%'))
this.detail.rmsPics && (this.detail.rmsPics = this.$config.static + this.detail.rmsPics)
this.detail.instantPics && (this.detail.instantPics = this.$config.static + this.detail.instantPics)
this.loading = false
if (this.detail.status != 1) {
updateStatus([this.detail.id])
}
},
methods: {},
methods: {
previewImage(url) {
uni.previewImage({
urls: [url],
})
},
},
}
</script>
<style lang="scss">