绘制电脑治理信息页面
This commit is contained in:
@@ -5,18 +5,10 @@
|
||||
<view class="detail-header">
|
||||
<Cn-htmlToImg domId="header" @renderFinish="renderFinish">
|
||||
<view class="header" id="header" ref="header" @click="previewImg">
|
||||
<img
|
||||
:src="topoImg"
|
||||
style="width: 375px; display: block"
|
||||
mode="widthFix"
|
||||
@load="domLoading = false"
|
||||
/>
|
||||
<view
|
||||
class="point"
|
||||
:style="{ left: item.lat + 'px', top: item.lng + 'px' }"
|
||||
v-for="(item, index) in topolodyData"
|
||||
:key="index"
|
||||
>
|
||||
<img :src="topoImg" style="width: 375px; display: block" mode="widthFix"
|
||||
@load="domLoading = false" />
|
||||
<view class="point" :style="{ left: item.lat + 'px', top: item.lng + 'px' }"
|
||||
v-for="(item, index) in topolodyData" :key="index">
|
||||
<view class="grid-card mt10" style="width: fit-content">
|
||||
<view class="grid-card-content-1">
|
||||
<view class="item">{{ item.label }}</view>
|
||||
@@ -51,13 +43,9 @@
|
||||
<text class="ml10">设备状态</text>
|
||||
</view> -->
|
||||
<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)"
|
||||
>{{ item.text }}
|
||||
<view class="nav-menu" :class="{ 'nav-menu-active': navMenuActive == index }"
|
||||
v-for="(item, index) in navMenuList" :key="index" @click="navMenuClick(index)">{{ item.text
|
||||
}}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -107,22 +95,10 @@
|
||||
</uni-popup> -->
|
||||
<!-- 输入框示例 -->
|
||||
<uni-popup ref="inputDialog" type="dialog">
|
||||
<uni-popup-dialog
|
||||
ref="inputClose"
|
||||
type="info"
|
||||
mode="input"
|
||||
:title="dialogType"
|
||||
value="对话框预置提示内容!"
|
||||
placeholder="请输入内容"
|
||||
@confirm="dialogInputConfirm"
|
||||
>
|
||||
<uni-easyinput
|
||||
type="textarea"
|
||||
:maxlength="250"
|
||||
autoHeight
|
||||
v-model="remarkContent"
|
||||
placeholder="请输入备注"
|
||||
></uni-easyinput>
|
||||
<uni-popup-dialog ref="inputClose" type="info" mode="input" :title="dialogType" value="对话框预置提示内容!"
|
||||
placeholder="请输入内容" @confirm="dialogInputConfirm">
|
||||
<uni-easyinput type="textarea" :maxlength="250" autoHeight v-model="remarkContent"
|
||||
placeholder="请输入备注"></uni-easyinput>
|
||||
</uni-popup-dialog>
|
||||
</uni-popup>
|
||||
</view>
|
||||
@@ -140,6 +116,7 @@ import { manualAccess } from '@/common/api/accessBoot'
|
||||
import { MQTT_IP, MQTT_OPTIONS } from '@/common/js/mqtt.js'
|
||||
import mqtt from 'mqtt/dist/mqtt.js'
|
||||
import { base64ToPath, pathToBase64 } from 'image-tools'
|
||||
import { queryByCode, queryStatistical } from '@/common/api/dictionary'
|
||||
import hoverMenu from '@/hover-menu/components/hover-menu/hover-menu.vue'
|
||||
export default {
|
||||
components: {
|
||||
@@ -164,6 +141,7 @@ export default {
|
||||
navHeight: 0,
|
||||
img: '',
|
||||
topoImg: '',
|
||||
targetLists: [],
|
||||
navMenuList: [
|
||||
{
|
||||
text: '基本',
|
||||
@@ -177,9 +155,6 @@ export default {
|
||||
text: '功率',
|
||||
id: 'a16aceae7d1565bf9f94dd7410cf9bce',
|
||||
},
|
||||
// {
|
||||
// text: '波形',
|
||||
// },
|
||||
{
|
||||
text: '其他',
|
||||
},
|
||||
@@ -358,11 +333,21 @@ export default {
|
||||
},
|
||||
})
|
||||
},
|
||||
init() {
|
||||
|
||||
getTarget() {
|
||||
return queryByCode('app_harmonic_code').then((res) => {
|
||||
return queryStatistical({ id: res.data.id }).then((resp) => {
|
||||
this.targetLists = resp.data.selectedList
|
||||
})
|
||||
})
|
||||
},
|
||||
|
||||
async init() {
|
||||
console.log('init')
|
||||
this.loading = true
|
||||
this.domLoading = true
|
||||
queryTopologyDiagram(this.devId).then((res) => {
|
||||
|
||||
await queryTopologyDiagram(this.devId).then((res) => {
|
||||
res.data.filePath = this.$config.static + res.data.filePath
|
||||
this.deviceInfo = res.data
|
||||
this.downloadImg()
|
||||
@@ -371,6 +356,7 @@ export default {
|
||||
let index = this.deviceInfo.appsLineTopologyDiagramPO?.findIndex((element) => {
|
||||
element.label = element.name
|
||||
item.label = element.name
|
||||
item.target = element.target
|
||||
return element.linePostion === item.linePostion
|
||||
})
|
||||
if (index > -1) {
|
||||
@@ -384,10 +370,14 @@ export default {
|
||||
})
|
||||
console.log(this.topolodyData)
|
||||
if (this.client) {
|
||||
this.client.publish(`/zl/askDevData/${this.devId}/${this.navMenuList[0].id}`)
|
||||
this.loading = false
|
||||
} else {
|
||||
this.initMqtt(this.navMenuList[0].id)
|
||||
}
|
||||
console.log("🚀 ~ this.client:", this.client)
|
||||
|
||||
|
||||
})
|
||||
},
|
||||
renderFinish(e) {
|
||||
@@ -460,22 +450,28 @@ export default {
|
||||
console.log('连接断开')
|
||||
})
|
||||
.on('message', (topic, message) => {
|
||||
console.log('接收推送信息:', JSON.parse(message.toString()), topic)
|
||||
console.log('🚀 ~ .on ~ topic:', topic)
|
||||
// console.log('接收推送信息:', JSON.parse(message.toString()), topic)
|
||||
// console.log('🚀 ~ .on ~ topic:', topic)
|
||||
|
||||
if (topic === `/zl/devData/${this.devId}/${id}`) {
|
||||
|
||||
const data = JSON.parse(message.toString())
|
||||
if (Array.isArray(data) && !data.length) return
|
||||
|
||||
if ((!message.toString() || message.toString().length < 10) && this.loading) {
|
||||
this.$util.toast('该设备暂无数据')
|
||||
}
|
||||
this.loading = false
|
||||
this.handlerData(JSON.parse(message.toString()))
|
||||
this.handlerData(data)
|
||||
} else if (topic === `/zl/TemperData/${this.devId}`) {
|
||||
const data = JSON.parse(message.toString())
|
||||
if (Array.isArray(data) && !data.length) return
|
||||
// this.basicData.forEach((item) => {
|
||||
// if (item.statisticalName === '温度' && item.phase === 'avg') {
|
||||
// item.statisticalData = message.toString()
|
||||
// }
|
||||
// })
|
||||
this.IOData = JSON.parse(message.toString())
|
||||
this.IOData = data
|
||||
// this.IOData = this.IOData.filter((item) => item.value !== 0)
|
||||
this.IOData.forEach((item) => {
|
||||
if (!item.value) {
|
||||
@@ -490,37 +486,60 @@ export default {
|
||||
})
|
||||
},
|
||||
|
||||
handlerData(data) {
|
||||
async handlerData(data) {
|
||||
this.basicData = data
|
||||
|
||||
this.topolodyData.forEach((element) => {
|
||||
let arr = []
|
||||
let list = this.targetLists.filter(key => key.dataType == element.target)
|
||||
|
||||
element.showKey.forEach((key) => {
|
||||
if (list.length > 0) {
|
||||
let id = list[0]?.eleEpdPqdVOS.filter(key => key.phase == 'A')[0]?.id || ''
|
||||
data.forEach((item) => {
|
||||
if (item.statisticalName === key && item.phase === 'avg') {
|
||||
if (key === 'Apf_RmsI_TolOut(A)') {
|
||||
arr.push({
|
||||
label: '总输出电流:',
|
||||
value: Math.round(item.statisticalData) + 'A',
|
||||
})
|
||||
} else {
|
||||
arr.push({
|
||||
label: '电流畸变率:',
|
||||
value: Math.round(item.statisticalData) + '%',
|
||||
})
|
||||
// arr.push('电流畸变率:' + item.statisticalData + '%')
|
||||
}
|
||||
if (item.statisticalIndex === id && item.phase === 'avg') {
|
||||
|
||||
arr.push({
|
||||
label: list[0].dataTypeName.split('-')[1] + ':',
|
||||
value: (item.statisticalData) + `${item.unit || ''}`,
|
||||
})
|
||||
|
||||
}
|
||||
if (item.time) {
|
||||
this.dataTime = item.time.seconds
|
||||
this.time = this.$util.parseTime(this.dataTime - 8 * 60 * 60)
|
||||
// console.log(11111111,this.dataTime);
|
||||
}
|
||||
|
||||
})
|
||||
})
|
||||
}
|
||||
else {
|
||||
element.showKey.forEach((key) => {
|
||||
data.forEach((item) => {
|
||||
if (item.statisticalName === key && item.phase === 'avg') {
|
||||
if (key === 'Apf_RmsI_TolOut(A)') {
|
||||
arr.push({
|
||||
label: '总输出电流:',
|
||||
value: (item.statisticalData) + 'A',
|
||||
})
|
||||
} else {
|
||||
arr.push({
|
||||
label: '电流畸变率:',
|
||||
value: (item.statisticalData) + '%',
|
||||
})
|
||||
}
|
||||
}
|
||||
if (item.time) {
|
||||
this.dataTime = item.time.seconds
|
||||
this.time = this.$util.parseTime(this.dataTime - 8 * 60 * 60)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
element.value = arr
|
||||
})
|
||||
console.log("🚀 ~ this.topolodyData:", this.topolodyData)
|
||||
|
||||
console.log(this.topolodyData)
|
||||
this.$forceUpdate()
|
||||
},
|
||||
@@ -539,13 +558,16 @@ export default {
|
||||
}, 1000)
|
||||
},
|
||||
|
||||
onLoad(options) {
|
||||
async onLoad(options) {
|
||||
await this.getTarget()
|
||||
|
||||
this.pageOptions = options
|
||||
this.device = JSON.parse(options.device)
|
||||
console.log('🚀 ~ options:', options)
|
||||
|
||||
this.userInfo = uni.getStorageSync(this.$cacheKey.userInfo)
|
||||
this.devId = options.id
|
||||
this.isPrimaryUser = options.isPrimaryUser
|
||||
|
||||
if (this.pageOptions.process == 2 || this.pageOptions.process == 3) {
|
||||
this.content.splice(
|
||||
0,
|
||||
@@ -626,9 +648,11 @@ export default {
|
||||
lng: '',
|
||||
showKey: item.showKey, //要展示的指标key
|
||||
value: [],
|
||||
target: item.target
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
this.init()
|
||||
},
|
||||
}
|
||||
@@ -636,6 +660,7 @@ export default {
|
||||
|
||||
<style lang="scss">
|
||||
.detail {
|
||||
|
||||
// background: $uni-theme-white;
|
||||
.header-bg {
|
||||
position: absolute;
|
||||
@@ -666,7 +691,7 @@ export default {
|
||||
z-index: 2;
|
||||
text-align: center;
|
||||
color: #111;
|
||||
width: 110rpx;
|
||||
width: 150rpx;
|
||||
font-size: 16rpx;
|
||||
opacity: 0.8;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user