2023-02-06 13:34:15 +08:00
|
|
|
<template>
|
2023-08-31 11:15:58 +08:00
|
|
|
<Cn-page :loading="loading" noPadding>
|
2023-07-24 08:47:20 +08:00
|
|
|
<view slot="body">
|
2023-08-23 16:22:08 +08:00
|
|
|
<view class="detail" :style="{ opacity: domLoading ? '0' : '1' }" style="overflow: hidden">
|
2023-02-22 08:43:52 +08:00
|
|
|
<view class="detail-header">
|
2023-03-14 09:09:05 +08:00
|
|
|
<Cn-htmlToImg domId="header" @renderFinish="renderFinish">
|
2023-08-17 09:24:59 +08:00
|
|
|
<view class="header" id="header" ref="header" @click="previewImg">
|
|
|
|
|
<img
|
2023-08-31 09:29:40 +08:00
|
|
|
:src="topoImg"
|
2023-08-17 09:24:59 +08:00
|
|
|
style="width: 375px; display: block"
|
|
|
|
|
mode="widthFix"
|
|
|
|
|
@load="domLoading = false"
|
|
|
|
|
/>
|
2023-07-24 08:47:20 +08:00
|
|
|
<view
|
|
|
|
|
class="point"
|
|
|
|
|
:style="{ left: item.lat + 'px', top: item.lng + 'px' }"
|
2023-08-18 14:41:53 +08:00
|
|
|
v-for="(item, index) in topolodyData"
|
2023-07-24 08:47:20 +08:00
|
|
|
:key="index"
|
|
|
|
|
>
|
|
|
|
|
<view class="grid-card mt10" style="width: fit-content">
|
|
|
|
|
<view class="grid-card-content-1">
|
|
|
|
|
<view class="item">{{ item.label }}</view>
|
|
|
|
|
<view class="item" v-for="(child, childIndex) in item.value" :key="childIndex">
|
2023-08-18 14:41:53 +08:00
|
|
|
{{ child }}
|
2023-03-08 13:45:57 +08:00
|
|
|
</view>
|
2023-02-23 08:44:46 +08:00
|
|
|
</view>
|
2023-03-14 09:09:05 +08:00
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
<view class="module">
|
|
|
|
|
<view class="grid-card">
|
|
|
|
|
<view class="grid-card-content-2">
|
2023-08-30 18:52:58 +08:00
|
|
|
<template v-for="(item,index) in IOData">
|
|
|
|
|
<view class="item">{{ item.clDid }}</view>
|
|
|
|
|
<view class="item">
|
2023-09-01 15:05:21 +08:00
|
|
|
<view style="width: 30rpx"> {{ item.value || '-' }}</view>
|
2023-08-31 14:13:28 +08:00
|
|
|
<view v-if="item.value"> °C</view>
|
2023-08-30 18:52:58 +08:00
|
|
|
</view>
|
|
|
|
|
</template>
|
|
|
|
|
|
2023-02-23 08:44:46 +08:00
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
2023-03-14 09:09:05 +08:00
|
|
|
</Cn-htmlToImg>
|
2023-02-22 08:43:52 +08:00
|
|
|
<!-- <view class="des">
|
|
|
|
|
<text>设备基础信息</text>
|
|
|
|
|
<text class="ml10">设备状态</text>
|
|
|
|
|
</view> -->
|
2023-07-24 08:47:20 +08:00
|
|
|
<view class="nav" style="margin-top: -10rpx">
|
|
|
|
|
<view
|
|
|
|
|
class="nav-menu"
|
|
|
|
|
:class="{ 'nav-menu-active': navMenuActive == index }"
|
|
|
|
|
v-for="(item, index) in navMenuList"
|
|
|
|
|
:key="index"
|
|
|
|
|
@click="navMenuClick(index)"
|
2023-08-17 15:37:19 +08:00
|
|
|
>{{ item.text }}
|
2023-02-22 08:43:52 +08:00
|
|
|
</view>
|
2023-02-06 13:34:15 +08:00
|
|
|
</view>
|
|
|
|
|
</view>
|
2023-08-30 10:03:07 +08:00
|
|
|
<view class="content" v-if="!loading">
|
2023-02-07 17:59:54 +08:00
|
|
|
<view v-if="navMenuActive == 0">
|
2023-08-18 14:41:53 +08:00
|
|
|
<basic :basicData="basicData"></basic>
|
2023-02-06 13:34:15 +08:00
|
|
|
</view>
|
2023-02-07 17:59:54 +08:00
|
|
|
<view v-else-if="navMenuActive == 1">
|
2023-08-18 14:41:53 +08:00
|
|
|
<xieBo :basicData="basicData"></xieBo>
|
2023-02-06 13:34:15 +08:00
|
|
|
</view>
|
2023-02-07 17:59:54 +08:00
|
|
|
<view v-else-if="navMenuActive == 2">
|
2023-08-18 14:41:53 +08:00
|
|
|
<power :basicData="basicData"></power>
|
2023-02-06 13:34:15 +08:00
|
|
|
</view>
|
2023-08-17 09:24:59 +08:00
|
|
|
<!-- <view v-else-if="navMenuActive == 3">
|
2023-02-07 17:59:54 +08:00
|
|
|
<oscillogram></oscillogram>
|
2023-08-17 09:24:59 +08:00
|
|
|
</view> -->
|
|
|
|
|
<view v-else-if="navMenuActive == 3">
|
2023-08-31 14:13:28 +08:00
|
|
|
<IO :IOData="IOData"></IO>
|
2023-02-06 13:34:15 +08:00
|
|
|
</view>
|
2023-07-24 08:47:20 +08:00
|
|
|
<view style="height: 20rpx"></view>
|
2023-02-06 13:34:15 +08:00
|
|
|
</view>
|
2023-07-24 08:47:20 +08:00
|
|
|
<uni-fab
|
|
|
|
|
ref="fab"
|
|
|
|
|
direction="vertical"
|
|
|
|
|
horizontal="right"
|
|
|
|
|
vertical="bottom"
|
|
|
|
|
:content="content"
|
|
|
|
|
@trigger="trigger"
|
|
|
|
|
/>
|
2023-07-31 09:00:30 +08:00
|
|
|
<uni-popup ref="share" type="share" :safe-area="false">
|
2023-08-02 09:10:45 +08:00
|
|
|
<uni-popup-share title="分享到"></uni-popup-share>
|
|
|
|
|
<view style="height: 40rpx; background: #fff"></view>
|
2023-07-31 09:00:30 +08:00
|
|
|
</uni-popup>
|
2023-02-06 13:34:15 +08:00
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
</Cn-page>
|
|
|
|
|
</template>
|
|
|
|
|
<script>
|
2023-07-24 08:47:20 +08:00
|
|
|
import basic from './comp/basic.vue'
|
|
|
|
|
import xieBo from './comp/xieBo.vue'
|
|
|
|
|
import power from './comp/power.vue'
|
|
|
|
|
import oscillogram from './comp/oscillogram.vue'
|
|
|
|
|
import IO from './comp/IO.vue'
|
2023-08-17 15:37:19 +08:00
|
|
|
import {queryTopologyDiagram, deleteDevice} from '@/common/api/device'
|
|
|
|
|
import {MQTT_IP, MQTT_OPTIONS} from '@/common/js/mqtt.js'
|
2023-07-24 08:47:20 +08:00
|
|
|
import mqtt from 'mqtt/dist/mqtt.js'
|
2023-08-17 15:37:19 +08:00
|
|
|
import {base64ToPath, pathToBase64} from 'image-tools'
|
|
|
|
|
|
2023-02-06 13:34:15 +08:00
|
|
|
export default {
|
|
|
|
|
components: {
|
|
|
|
|
basic,
|
2023-02-07 17:59:54 +08:00
|
|
|
xieBo,
|
|
|
|
|
power,
|
|
|
|
|
oscillogram,
|
2023-02-23 08:44:46 +08:00
|
|
|
IO,
|
2023-02-06 13:34:15 +08:00
|
|
|
},
|
2023-07-24 08:47:20 +08:00
|
|
|
data() {
|
2023-02-06 13:34:15 +08:00
|
|
|
return {
|
2023-08-17 09:24:59 +08:00
|
|
|
domLoading: true,
|
2023-07-24 08:47:20 +08:00
|
|
|
loading: true,
|
|
|
|
|
deviceInfo: {},
|
2023-02-06 13:34:15 +08:00
|
|
|
navMenuActive: 0,
|
|
|
|
|
navHeight: 0,
|
2023-03-14 09:09:05 +08:00
|
|
|
img: '',
|
2023-08-31 16:14:15 +08:00
|
|
|
topoImg: '',
|
2023-07-24 08:47:20 +08:00
|
|
|
navMenuList: [
|
|
|
|
|
{
|
|
|
|
|
text: '基本',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
text: '谐波',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
text: '功率',
|
|
|
|
|
},
|
2023-08-10 09:18:17 +08:00
|
|
|
// {
|
|
|
|
|
// text: '波形',
|
|
|
|
|
// },
|
2023-07-24 08:47:20 +08:00
|
|
|
{
|
2023-09-06 18:13:08 +08:00
|
|
|
text: '其他',
|
2023-07-24 08:47:20 +08:00
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
content: [
|
|
|
|
|
{
|
|
|
|
|
iconPath: '/static/report.png',
|
|
|
|
|
text: '告警',
|
|
|
|
|
},
|
2023-08-29 16:14:09 +08:00
|
|
|
// {
|
|
|
|
|
// iconPath: '/static/record.png',
|
|
|
|
|
// text: '记录',
|
|
|
|
|
// },
|
2023-07-24 08:47:20 +08:00
|
|
|
{
|
|
|
|
|
iconPath: '/static/about.png',
|
|
|
|
|
text: '关于',
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
client: null,
|
|
|
|
|
timer: null,
|
|
|
|
|
devId: '',
|
|
|
|
|
dictData: [],
|
2023-07-31 09:00:30 +08:00
|
|
|
isPrimaryUser: 0,
|
2023-07-24 15:00:19 +08:00
|
|
|
userInfo: {},
|
2023-08-18 14:41:53 +08:00
|
|
|
topolodyData: [
|
|
|
|
|
{
|
|
|
|
|
label: '电网侧',
|
|
|
|
|
linePostion: 'cb23b9ede3b652cd6da194fd7b318124',
|
|
|
|
|
lat: '',
|
|
|
|
|
lng: '',
|
|
|
|
|
showKey: ['Pq_ThdU(%)', 'Pq_ThdI(%)'], //要展示的指标key
|
|
|
|
|
value: [],// 展示的指标值
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
label: '负载侧',
|
|
|
|
|
linePostion: '32624d4bb3a86f2b9a01bab272e50125',
|
|
|
|
|
lat: '',
|
|
|
|
|
lng: '',
|
|
|
|
|
showKey: ['Pq_ThdU(%)', 'Pq_ThdI(%)'], //要展示的指标key
|
|
|
|
|
value: [],
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
label: '输出侧',
|
|
|
|
|
linePostion: '26eae70fb5ff1c090d2dc7c3a0743948',
|
|
|
|
|
lat: '',
|
|
|
|
|
lng: '',
|
|
|
|
|
showKey: ['Apf_ThdA_Load(%)', 'Apf_ThdA_Sys(%)'], //要展示的指标key
|
|
|
|
|
value: [],
|
|
|
|
|
},
|
|
|
|
|
],
|
2023-08-30 18:52:58 +08:00
|
|
|
basicData: [],
|
|
|
|
|
IOData: [],
|
2023-02-06 13:34:15 +08:00
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
2023-07-24 08:47:20 +08:00
|
|
|
trigger(e) {
|
|
|
|
|
console.log(e)
|
2023-02-09 16:37:53 +08:00
|
|
|
if (e.item.text === '分享') {
|
2023-08-29 16:14:09 +08:00
|
|
|
uni.navigateTo({url: '/pages/device/share?id=' + this.devId})
|
2023-02-09 16:37:53 +08:00
|
|
|
} else if (e.item.text === '删除') {
|
2023-02-07 17:59:54 +08:00
|
|
|
uni.showModal({
|
|
|
|
|
title: '提示',
|
|
|
|
|
content: '确定删除该设备吗?',
|
2023-07-31 09:00:30 +08:00
|
|
|
success: (res) => {
|
2023-02-07 17:59:54 +08:00
|
|
|
if (res.confirm) {
|
|
|
|
|
console.log('用户点击确定')
|
2023-07-31 09:00:30 +08:00
|
|
|
deleteDevice(this.devId).then((res) => {
|
|
|
|
|
uni.showToast({
|
|
|
|
|
title: '删除成功',
|
|
|
|
|
icon: 'none',
|
|
|
|
|
})
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
uni.navigateBack()
|
|
|
|
|
}, 1500)
|
|
|
|
|
})
|
2023-02-07 17:59:54 +08:00
|
|
|
} else if (res.cancel) {
|
|
|
|
|
console.log('用户点击取消')
|
|
|
|
|
}
|
2023-07-24 08:47:20 +08:00
|
|
|
},
|
|
|
|
|
})
|
2023-02-09 16:37:53 +08:00
|
|
|
} else if (e.item.text === '下载') {
|
2023-02-07 17:59:54 +08:00
|
|
|
this.$util.toast('下载成功')
|
2023-02-09 16:37:53 +08:00
|
|
|
} else if (e.item.text === '记录') {
|
2023-08-17 15:37:19 +08:00
|
|
|
uni.navigateTo({url: '/pages/device/APF/record'})
|
2023-02-09 16:37:53 +08:00
|
|
|
} else if (e.item.text === '告警') {
|
2023-08-17 15:37:19 +08:00
|
|
|
uni.navigateTo({url: '/pages/device/APF/report'})
|
2023-02-09 16:37:53 +08:00
|
|
|
} else if (e.item.text === '关于') {
|
2023-08-17 15:37:19 +08:00
|
|
|
uni.navigateTo({url: '/pages/device/APF/about?id=' + this.devId})
|
2023-02-09 16:37:53 +08:00
|
|
|
} else if (e.item.text === '移交') {
|
2023-08-17 15:37:19 +08:00
|
|
|
uni.navigateTo({url: '/pages/device/transfer?id=' + this.devId})
|
2023-02-09 16:37:53 +08:00
|
|
|
} else if (e.item.text === '反馈') {
|
2023-08-17 15:37:19 +08:00
|
|
|
uni.navigateTo({url: '/pages/device/feedback'})
|
2023-02-10 16:32:41 +08:00
|
|
|
} else if (e.item.text === '用户') {
|
2023-09-01 15:05:21 +08:00
|
|
|
uni.navigateTo({url: '/pages/device/user?id=' + this.devId + '&isPrimaryUser=' + this.isPrimaryUser})
|
2023-02-23 08:44:46 +08:00
|
|
|
} else if (e.item.text === '报表') {
|
|
|
|
|
this.$util.toast('效果是直接打开报表')
|
2023-02-28 14:03:38 +08:00
|
|
|
} else if (e.item.text === '版本') {
|
2023-02-27 14:56:08 +08:00
|
|
|
this.$util.toast('功能暂未开放')
|
2023-02-28 14:03:38 +08:00
|
|
|
} else if (e.item.text === '模版') {
|
2023-02-27 14:56:08 +08:00
|
|
|
this.$util.toast('效果是功能暂未开放直接打开报表')
|
2023-08-02 09:10:45 +08:00
|
|
|
} else if (e.item.text === '编辑') {
|
2023-08-17 15:37:19 +08:00
|
|
|
let data = JSON.parse(JSON.stringify(this.deviceInfo))
|
|
|
|
|
data.appsLineTopologyDiagramPO.forEach((item) => {
|
|
|
|
|
delete item.value
|
|
|
|
|
})
|
2023-08-02 09:10:45 +08:00
|
|
|
uni.navigateTo({
|
2023-08-17 15:37:19 +08:00
|
|
|
url: '/pages/device/edit?deviceInfo=' + encodeURIComponent(JSON.stringify(data)),
|
2023-08-02 09:10:45 +08:00
|
|
|
})
|
2023-02-07 17:59:54 +08:00
|
|
|
}
|
2023-02-09 16:37:53 +08:00
|
|
|
this.$refs.fab.close()
|
2023-02-07 17:59:54 +08:00
|
|
|
},
|
2023-07-24 08:47:20 +08:00
|
|
|
navMenuClick(idx) {
|
2023-02-06 13:34:15 +08:00
|
|
|
this.navMenuActive = idx
|
2023-08-17 15:37:19 +08:00
|
|
|
uni.pageScrollTo({scrollTop: 0, duration: 0})
|
2023-02-06 13:34:15 +08:00
|
|
|
},
|
2023-08-31 09:29:40 +08:00
|
|
|
downloadImg() {
|
|
|
|
|
uni.downloadFile({
|
|
|
|
|
url: this.deviceInfo.filePath,
|
|
|
|
|
success: (res) => {
|
|
|
|
|
pathToBase64(res.tempFilePath).then((res) => {
|
|
|
|
|
this.topoImg = res
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
},
|
2023-07-24 08:47:20 +08:00
|
|
|
init() {
|
2023-08-29 20:31:34 +08:00
|
|
|
console.log('init')
|
|
|
|
|
|
|
|
|
|
this.loading = true
|
|
|
|
|
this.domLoading = true
|
|
|
|
|
queryTopologyDiagram(this.devId).then((res) => {
|
2023-08-30 18:52:58 +08:00
|
|
|
res.data.filePath = this.$config.static + res.data.filePath
|
2023-08-29 20:31:34 +08:00
|
|
|
this.deviceInfo = res.data
|
2023-08-31 09:29:40 +08:00
|
|
|
this.downloadImg()
|
2023-08-29 20:31:34 +08:00
|
|
|
uni.setNavigationBarTitle({title: this.deviceInfo.devName || '设备详情'})
|
|
|
|
|
this.topolodyData.filter((item) => {
|
|
|
|
|
let index = this.deviceInfo.appsLineTopologyDiagramPO.findIndex((element) => {
|
|
|
|
|
element.label = element.name
|
|
|
|
|
item.label = element.name
|
|
|
|
|
return element.linePostion === item.linePostion
|
2023-08-10 09:18:17 +08:00
|
|
|
})
|
2023-08-29 20:31:34 +08:00
|
|
|
if (index > -1) {
|
|
|
|
|
item.lat = this.deviceInfo.appsLineTopologyDiagramPO[index].lat
|
|
|
|
|
item.lng = this.deviceInfo.appsLineTopologyDiagramPO[index].lng
|
|
|
|
|
return true
|
|
|
|
|
} else {
|
|
|
|
|
// 把多余的监测点过滤掉
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
if (this.client) {
|
|
|
|
|
this.loading = false
|
|
|
|
|
} else {
|
|
|
|
|
this.initMqtt()
|
2023-08-10 09:18:17 +08:00
|
|
|
}
|
2023-08-29 20:31:34 +08:00
|
|
|
})
|
2023-03-08 13:45:57 +08:00
|
|
|
},
|
2023-07-24 08:47:20 +08:00
|
|
|
renderFinish(e) {
|
2023-03-14 09:09:05 +08:00
|
|
|
this.img = e
|
|
|
|
|
},
|
2023-07-24 08:47:20 +08:00
|
|
|
previewImg() {
|
2023-03-14 14:03:33 +08:00
|
|
|
if (!this.img) {
|
|
|
|
|
uni.showLoading({
|
|
|
|
|
title: '图片生成中',
|
2023-07-24 08:47:20 +08:00
|
|
|
mask: false,
|
2023-03-14 14:03:33 +08:00
|
|
|
})
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
this.previewImg()
|
2023-07-24 08:47:20 +08:00
|
|
|
}, 500)
|
2023-03-14 14:03:33 +08:00
|
|
|
} else {
|
|
|
|
|
uni.hideLoading()
|
2023-07-31 09:00:30 +08:00
|
|
|
base64ToPath(this.img).then((res) => {
|
|
|
|
|
console.log(res)
|
|
|
|
|
uni.previewImage({
|
|
|
|
|
urls: [res],
|
|
|
|
|
})
|
2023-03-14 14:03:33 +08:00
|
|
|
})
|
|
|
|
|
}
|
2023-07-24 08:47:20 +08:00
|
|
|
},
|
|
|
|
|
initMqtt() {
|
|
|
|
|
MQTT_OPTIONS.clientId = uni.getStorageSync('devCode')
|
|
|
|
|
// #ifdef APP-PLUS
|
|
|
|
|
this.client = mqtt.connect('wx://' + MQTT_IP, MQTT_OPTIONS)
|
|
|
|
|
// #endif
|
|
|
|
|
// #ifdef H5
|
2023-08-31 15:26:59 +08:00
|
|
|
this.client = mqtt.connect('ws://' + MQTT_IP, MQTT_OPTIONS)
|
2023-07-24 08:47:20 +08:00
|
|
|
// #endif
|
|
|
|
|
this.client
|
|
|
|
|
.on('connect', () => {
|
|
|
|
|
console.log('连接成功')
|
2023-08-30 18:52:58 +08:00
|
|
|
this.client.subscribe(`/zl/TemperData/${this.devId}`, (err) => {
|
|
|
|
|
if (!err) {
|
|
|
|
|
console.log(`订阅成功:/zl/TemperData/${this.devId}`)
|
|
|
|
|
}
|
|
|
|
|
})
|
2023-07-24 08:47:20 +08:00
|
|
|
this.client.subscribe(`/zl/devData/${this.devId}`, (err) => {
|
|
|
|
|
if (!err) {
|
|
|
|
|
console.log(`订阅成功:/zl/devData/${this.devId}`)
|
2023-08-30 18:52:58 +08:00
|
|
|
|
|
|
|
|
// 默认推送
|
2023-07-24 08:47:20 +08:00
|
|
|
this.client.publish(`/zl/askDevData/${this.devId}`)
|
2023-08-30 18:52:58 +08:00
|
|
|
this.client.publish(`/zl/askTemperData/${this.devId}`)
|
2023-07-24 08:47:20 +08:00
|
|
|
this.timer = setInterval(() => {
|
2023-07-24 15:00:19 +08:00
|
|
|
console.log('askDevData')
|
2023-07-24 08:47:20 +08:00
|
|
|
this.client.publish(`/zl/askDevData/${this.devId}`)
|
2023-08-30 18:52:58 +08:00
|
|
|
this.client.publish(`/zl/askTemperData/${this.devId}`)
|
2023-08-23 16:22:08 +08:00
|
|
|
}, 1000 * 60)
|
2023-07-24 08:47:20 +08:00
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
.on('reconnect', function (error) {
|
|
|
|
|
console.log(error)
|
|
|
|
|
console.log('正在重连...', that.topic)
|
|
|
|
|
})
|
|
|
|
|
.on('error', function (error) {
|
|
|
|
|
console.log('连接失败...', error)
|
|
|
|
|
})
|
|
|
|
|
.on('end', function () {
|
|
|
|
|
console.log('连接断开')
|
|
|
|
|
})
|
|
|
|
|
.on('message', (topic, message) => {
|
2023-08-23 16:22:08 +08:00
|
|
|
console.log('接收推送信息:', message.toString(), topic)
|
2023-08-30 18:52:58 +08:00
|
|
|
if (topic === `/zl/devData/${this.devId}`) {
|
|
|
|
|
if ((!message.toString() || message.toString().length < 10) && this.loading) {
|
|
|
|
|
this.$util.toast('该设备暂无数据')
|
|
|
|
|
}
|
|
|
|
|
this.loading = false
|
|
|
|
|
this.handlerData(JSON.parse(message.toString()))
|
|
|
|
|
} else if (topic === `/zl/TemperData/${this.devId}`) {
|
|
|
|
|
// this.basicData.forEach((item) => {
|
|
|
|
|
// if (item.statisticalName === '温度' && item.phase === 'avg') {
|
|
|
|
|
// item.statisticalData = message.toString()
|
|
|
|
|
// }
|
|
|
|
|
// })
|
|
|
|
|
this.IOData = JSON.parse(message.toString())
|
2023-08-31 16:14:15 +08:00
|
|
|
this.IOData.forEach(item => {
|
|
|
|
|
if (item.value === 0) {
|
2023-08-31 15:26:59 +08:00
|
|
|
item.value = '0'
|
2023-08-31 16:14:15 +08:00
|
|
|
} else if (!item.value) {
|
2023-08-31 15:26:59 +08:00
|
|
|
item.value = ''
|
|
|
|
|
}
|
|
|
|
|
})
|
2023-07-24 15:00:19 +08:00
|
|
|
}
|
2023-07-24 08:47:20 +08:00
|
|
|
})
|
|
|
|
|
},
|
2023-08-18 14:41:53 +08:00
|
|
|
handlerData(data) {
|
|
|
|
|
this.topolodyData.forEach((element) => {
|
|
|
|
|
let arr = []
|
|
|
|
|
element.showKey.forEach((key) => {
|
|
|
|
|
data.forEach((item) => {
|
|
|
|
|
if (item.statisticalName === key && item.phase === 'avg' && element.linePostion === item.position) {
|
|
|
|
|
arr.push(key + ':' + item.statisticalData)
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
element.value = arr
|
|
|
|
|
})
|
|
|
|
|
this.basicData = data
|
|
|
|
|
this.$forceUpdate()
|
|
|
|
|
},
|
2023-07-24 08:47:20 +08:00
|
|
|
},
|
|
|
|
|
// 页面销毁
|
|
|
|
|
onUnload() {
|
|
|
|
|
clearInterval(this.timer)
|
|
|
|
|
this.client.end()
|
2023-02-06 13:34:15 +08:00
|
|
|
},
|
2023-07-24 08:47:20 +08:00
|
|
|
onLoad(options) {
|
2023-07-24 15:00:19 +08:00
|
|
|
this.userInfo = uni.getStorageSync(this.$cacheKey.userInfo)
|
2023-07-24 08:47:20 +08:00
|
|
|
this.devId = options.id
|
2023-07-31 09:00:30 +08:00
|
|
|
this.isPrimaryUser = options.isPrimaryUser
|
2023-08-29 20:31:34 +08:00
|
|
|
if (this.isPrimaryUser == 1) {
|
|
|
|
|
this.content.splice(
|
|
|
|
|
0,
|
|
|
|
|
0,
|
|
|
|
|
{
|
|
|
|
|
iconPath: '/static/transfer.png',
|
|
|
|
|
text: '移交',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
iconPath: '/static/feedback.png',
|
|
|
|
|
text: '编辑',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
iconPath: '/static/delate.png',
|
|
|
|
|
text: '删除',
|
|
|
|
|
},
|
|
|
|
|
)
|
|
|
|
|
if (this.userInfo.authorities === 'app_vip_user') {
|
|
|
|
|
this.content.splice(3, 0, {
|
|
|
|
|
iconPath: '/static/share.png',
|
|
|
|
|
text: '分享',
|
2023-08-18 14:41:53 +08:00
|
|
|
})
|
2023-08-29 20:31:34 +08:00
|
|
|
}
|
2023-09-01 15:05:21 +08:00
|
|
|
|
|
|
|
|
}
|
|
|
|
|
if (this.userInfo.authorities !== 'tourist') {
|
|
|
|
|
this.content.splice(0, 0, {
|
|
|
|
|
iconPath: '/static/subordinate.png',
|
|
|
|
|
text: '用户',
|
|
|
|
|
})
|
2023-08-29 20:31:34 +08:00
|
|
|
}
|
|
|
|
|
this.init()
|
2023-02-06 13:34:15 +08:00
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
</script>
|
2023-03-14 09:09:05 +08:00
|
|
|
|
2023-07-24 08:47:20 +08:00
|
|
|
<style lang="scss">
|
2023-02-06 13:34:15 +08:00
|
|
|
.detail {
|
2023-02-07 17:59:54 +08:00
|
|
|
// background: $uni-theme-white;
|
2023-07-24 08:47:20 +08:00
|
|
|
.header-bg {
|
|
|
|
|
position: absolute;
|
|
|
|
|
top: 0;
|
|
|
|
|
left: 0;
|
|
|
|
|
width: 100%;
|
|
|
|
|
height: 100%;
|
|
|
|
|
background-size: 100% 100%;
|
|
|
|
|
}
|
2023-08-17 15:37:19 +08:00
|
|
|
|
2023-02-23 08:44:46 +08:00
|
|
|
.header {
|
|
|
|
|
position: relative;
|
2023-07-24 08:47:20 +08:00
|
|
|
width: 375px;
|
|
|
|
|
margin: 0 auto;
|
2023-02-23 08:44:46 +08:00
|
|
|
|
2023-07-24 08:47:20 +08:00
|
|
|
image {
|
|
|
|
|
image-rendering: -moz-crisp-edges;
|
|
|
|
|
image-rendering: -o-crisp-edges;
|
|
|
|
|
image-rendering: -webkit-optimize-contrast;
|
|
|
|
|
image-rendering: crisp-edges;
|
|
|
|
|
-ms-interpolation-mode: nearest-neighbor;
|
|
|
|
|
}
|
2023-08-17 15:37:19 +08:00
|
|
|
|
2023-02-23 08:44:46 +08:00
|
|
|
.point {
|
|
|
|
|
position: absolute;
|
|
|
|
|
color: #111;
|
|
|
|
|
z-index: 2;
|
|
|
|
|
text-align: center;
|
|
|
|
|
color: #111;
|
2023-03-08 13:45:57 +08:00
|
|
|
width: 110rpx;
|
|
|
|
|
font-size: 16rpx;
|
2023-08-31 14:13:28 +08:00
|
|
|
opacity: 0.8;
|
2023-08-31 16:14:15 +08:00
|
|
|
|
2023-07-24 08:47:20 +08:00
|
|
|
.grid-card-content-2,
|
|
|
|
|
.grid-card-content-1 {
|
2023-03-08 13:45:57 +08:00
|
|
|
font-size: 16rpx;
|
|
|
|
|
|
|
|
|
|
.item {
|
|
|
|
|
min-height: unset;
|
2023-07-24 08:47:20 +08:00
|
|
|
white-space: nowrap;
|
2023-03-08 13:45:57 +08:00
|
|
|
}
|
|
|
|
|
}
|
2023-02-23 08:44:46 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.module {
|
|
|
|
|
position: absolute;
|
|
|
|
|
bottom: 0;
|
2023-08-17 09:24:59 +08:00
|
|
|
right: 10rpx;
|
2023-03-08 13:45:57 +08:00
|
|
|
width: 200rpx;
|
2023-08-31 14:13:28 +08:00
|
|
|
opacity: 0.8;
|
2023-08-31 16:14:15 +08:00
|
|
|
|
2023-07-24 08:47:20 +08:00
|
|
|
.grid-card-content-2,
|
|
|
|
|
.grid-card-content-1 {
|
2023-03-08 13:45:57 +08:00
|
|
|
font-size: 16rpx;
|
2023-02-23 08:44:46 +08:00
|
|
|
|
|
|
|
|
.item {
|
|
|
|
|
min-height: unset;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2023-02-06 13:34:15 +08:00
|
|
|
|
|
|
|
|
.des {
|
|
|
|
|
padding: 20rpx 20rpx 0;
|
|
|
|
|
font-size: 28rpx;
|
|
|
|
|
color: #999;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.content {
|
|
|
|
|
box-sizing: border-box;
|
|
|
|
|
padding: 0 20rpx;
|
|
|
|
|
}
|
2023-02-23 08:44:46 +08:00
|
|
|
|
|
|
|
|
.detail-header {
|
2023-02-22 08:43:52 +08:00
|
|
|
position: sticky;
|
|
|
|
|
top: 0;
|
|
|
|
|
left: 0;
|
|
|
|
|
z-index: 2;
|
|
|
|
|
background: #f3f4f5;
|
|
|
|
|
}
|
2023-02-06 13:34:15 +08:00
|
|
|
}
|
2023-07-24 08:47:20 +08:00
|
|
|
</style>
|