消息修改

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

View File

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

View File

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

View File

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

View File

@@ -1,46 +1,45 @@
<template> <template>
<Cn-page :loading='loading'> <Cn-page :loading="loading">
<view slot='body'> <view class="detail" slot="body">
<view class='detail'>
<view class="detail-content" style="font-size: 32rpx"> <view class="detail-content" style="font-size: 32rpx">
<!-- <view class="detail-content-title mb20">发生时间</view> --> <!-- <view class="detail-content-title mb20">发生时间</view> -->
<view>2023-02-14</view> <view>{{ detail.startTime }}</view>
</view> </view>
<view class="detail-content"> <view class="detail-content">
<view class="detail-content-title mb20">设备基础信息</view> <view class="detail-content-title mb20">基础信息</view>
<view class="mb10">灿能园区NPQS_681</view> <view class="mb10" style="font-size: 28rpx">{{ detail.showName }}</view>
<view>网络参数00-B7-8D-A8-00-D3</view> <view class="mb5" v-for="(item, textIndex) in detail.dataSet" :key="textIndex">
{{ item.showName + ':' + item.value + (item.unit || '') }}
</view> </view>
<view class="detail-content "> <view class="mb5"> 设备名称{{ detail.equipmentName }}</view>
<view class="detail-content-title mb20">设备通讯信息</view> <view class="mb5"> 项目名称{{ detail.projectName }} </view>
<view class="mb10">NPQS_681通讯设备1次具体如下所示</view> <view class="mb5"> 工程名称{{ detail.engineeringName }} </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> </view>
</view> </view>
</Cn-page> </Cn-page>
</template> </template>
<script> <script>
import { updateStatus } from '@/common/api/message'
export default { export default {
data() { data() {
return { 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> </script>
<style lang='scss'> <style lang="scss">
.detail { .detail {
padding: 20rpx 0; padding: 20rpx 0;

View File

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

View File

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

View File

@@ -1,28 +1,25 @@
<template> <template>
<Cn-page :loading="loading"> <Cn-page :loading="loading">
<view class="content" slot="body"> <view class="content" slot="body">
<uni-card <uni-list :border="false">
:title="item.equipmentName" <uni-list-item
:extra="item.status === '1' ? '' : '未读'" isDot
:sub-title="item.startTime" show-badge
badgeType="error"
:badge-text="item.status == 1 ? '' : '未读'"
:title="item.showName"
:note="item.startTime"
@click="jump(item)" @click="jump(item)"
clickable
v-for="(item, index) in store.data" v-for="(item, index) in store.data"
:key="index" />
> </uni-list>
<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>
<Cn-empty v-if="store.empty" style="padding-top: 400rpx"></Cn-empty> <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> <uni-load-more v-if="store.data && store.data.length > 0" :status="store.status"></uni-load-more>
</view> </view>
</Cn-page> </Cn-page>
</template> </template>
<script> <script>
import list from '@/common/js/list' import list from '@/common/js/list'
@@ -43,17 +40,17 @@ export default {
this.store = this.DataSource('/cs-harmonic-boot/event/queryEventList') this.store = this.DataSource('/cs-harmonic-boot/event/queryEventList')
this.store.params.type = 1 this.store.params.type = 1
this.store.firstCallBack = (res) => { this.store.firstCallBack = (res) => {
this.store.data.forEach(item => { // this.store.data.forEach((item) => {
item.title = item.equipmentName + dictData.find(item2 => item2.code === item.tag)?.name // item.title = dictData.find((item2) => item2.code === item.tag)?.name
}) // })
console.log(this.store.data) // console.log(this.store.data)
this.loading = false this.loading = false
} }
this.store.reload() this.store.reload()
}, },
jump(item) { jump(item) {
let str = JSON.stringify(item).replace(/%/g, '百分比') 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"> <style lang="scss">
.content { .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 { /deep/ .uni-list-item {
background-color: $uni-theme-white !important; background-color: $uni-theme-white !important;
} }
/deep/ .uni-badge { /deep/ .uni-card__header-extra-text {
background-color: unset !important;
color: #dd524d !important; color: #dd524d !important;
font-size: 28rpx !important; font-size: 20rpx;
} }
</style> </style>

View File

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

View File

@@ -2,7 +2,7 @@
<Cn-page :loading="loading"> <Cn-page :loading="loading">
<view class="content" slot="body"> <view class="content" slot="body">
<uni-card <uni-card
:title="item.title" :title="item.showName"
:extra="item.status == '1' ? '' : '未读'" :extra="item.status == '1' ? '' : '未读'"
:sub-title="item.startTime" :sub-title="item.startTime"
@click="jump(item)" @click="jump(item)"
@@ -41,10 +41,10 @@ export default {
this.store = this.DataSource('/cs-harmonic-boot/event/queryEventList') this.store = this.DataSource('/cs-harmonic-boot/event/queryEventList')
this.store.params.type = 0 this.store.params.type = 0
this.store.firstCallBack = (res) => { this.store.firstCallBack = (res) => {
this.store.data.forEach((item) => { // this.store.data.forEach((item) => {
item.title = dictData.find((item2) => item2.code === item.tag)?.name // item.title = dictData.find((item2) => item2.code === item.tag)?.name
}) // })
console.log(this.store.data) // console.log(this.store.data)
this.loading = false this.loading = false
} }
this.store.reload() this.store.reload()

View File

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