congming_huose-apk/pages/device/mcgydevice.vue

573 lines
19 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<view class="device-detail">
<!-- 自定义导航栏 -->
<view class="tabback">
<view class="rtjt" @click="btnback"></view>
<view class="name">{{ $i18n.t('deviceDetail') }}</view>
<view style="width: 36rpx;"></view>
</view>
<scroll-view style="height: 90vh;" scroll-y refresher-enabled @refresherrefresh="onRefresh" :refresher-triggered="isRefreshing" refresher-default-style="black">
<!-- 头像和扫码按钮悬浮 -->
<view class="avatar-box">
<image class="avatar" :src="xqobj.productPicture" mode="aspectFill"></image>
<view class="scan-btn" @click="btnrdit">
<image src="https://api.ccttiot.com/smartmeter/img/static/uZiAQwh3lTliRkGXV3R0" mode="aspectFill"></image>
</view>
</view>
<!-- 信息列表卡片 -->
<view class="info-card">
<!-- 门磁状况左边 -->
<view class="info-item">
<image class="iconfont info-icon" src="https://api.ccttiot.com/smartmeter/img/static/uyOgEFquTkqGVoJSNzKu" mode="aspectFill"></image>
<view class="info-content">
<view class="info-title">{{ $i18n.t('magneticContactStatusLeft') }}</view>
<view class="info-status-row">
<text class="info-status" :class="magneticContactStatusRightValueClass">{{xqobj.iotData.mcl.desc == undefined ? '--' : xqobj.iotData.mcl.desc}}</text>
</view>
</view>
<view class="divider"></view>
</view>
<!-- 门磁状况右边 -->
<view class="info-item">
<image class="iconfont info-icon" src="https://api.ccttiot.com/smartmeter/img/static/uyOgEFquTkqGVoJSNzKu" mode="aspectFill"></image>
<view class="info-content">
<view class="info-title">{{ $i18n.t('magneticContactStatusRight') }}</view>
<view class="info-status-row">
<text class="info-status" :class="magneticContactStatusRightValueClass">{{xqobj.iotData.mcr.desc == undefined ? '--' : xqobj.iotData.mcr.desc}}</text>
</view>
</view>
<view class="divider"></view>
</view>
<!-- 磁强计 -->
<view class="info-item">
<image class="iconfont info-icon" src="https://api.ccttiot.com/smartmeter/img/static/uLQQwSZMMJCRoyY9niZ2" mode="aspectFill"></image>
<view class="info-content">
<view class="info-title">{{ $i18n.t('magnetometer') }}</view>
<view class="info-status-row">
<text class="info-status" :class="magnetometerValueClass">{{ xqobj.iotData.cq.value == undefined ? '--' : xqobj.iotData.cq.value}}</text>
</view>
</view>
<view class="divider"></view>
</view>
<!-- 加速度器3-axis震动 -->
<view class="info-item">
<image class="iconfont info-icon" src="https://api.ccttiot.com/smartmeter/img/static/uoqYd103xEnqfHqQCV3m" mode="aspectFill"></image>
<view class="info-content">
<view class="info-title">{{ $i18n.t('accelerometer3AxisVibrationTitle') }}</view>
<view class="info-status-row">
<text class="info-status" :class="accelerometer3AxisVibrationValueClass">{{ xqobj.iotData.zd.value == undefined ? '--' : xqobj.iotData.zd.value}}</text>
</view>
</view>
<view class="divider"></view>
</view>
<!-- 加速度器3-axis角度 -->
<view class="info-item">
<image class="iconfont info-icon" src="https://api.ccttiot.com/smartmeter/img/static/unC82eDTsw5iBODBWQy0" mode="aspectFill"></image>
<view class="info-content">
<view class="info-title">{{ $i18n.t('accelerometer3AxisAngleTitle') }}</view>
<view class="info-status-row">
<text class="info-status" :class="accelerometer3AxisAngleValueClass">{{ xqobj.iotData.jd.value == undefined ? '--' : xqobj.iotData.jd.value}}</text>
</view>
</view>
<view class="divider"></view>
</view>
<!-- 湿度 -->
<view class="info-item">
<image class="iconfont info-icon" src="https://api.ccttiot.com/smartmeter/img/static/upMEA7YPuRFC2VClTsXv" mode="aspectFill"></image>
<view class="info-content">
<view class="info-title">湿度%</view>
<view class="info-status-row">
<text class="info-status" :class="temperatureCelsiusValueClass">{{ xqobj.iotData.sd.value == undefined ? '--' : xqobj.iotData.sd.value}}</text>
</view>
</view>
<view class="divider"></view>
</view>
<!-- 温度 -->
<view class="info-item">
<image class="iconfont info-icon" src="https://api.ccttiot.com/smartmeter/img/static/upMEA7YPuRFC2VClTsXv" mode="aspectFill"></image>
<view class="info-content">
<view class="info-title">{{ $i18n.t('temperatureCelsius') }}</view>
<view class="info-status-row">
<text class="info-status" :class="temperatureCelsiusValueClass">{{ xqobj.iotData.wd.value == undefined ? '--' : xqobj.iotData.wd.value}}</text>
</view>
</view>
<view class="divider"></view>
</view>
<!-- 电池电量 -->
<view class="info-item">
<image class="iconfont info-icon" src="https://api.ccttiot.com/smartmeter/img/static/uGzlwvxrcAsRPCW34eKp" mode="aspectFill"></image>
<view class="info-content">
<view class="info-title">{{ $i18n.t('batteryLevel') }}</view>
<view class="info-status-row">
<text class="info-status" :class="batteryLevelValueClass">{{ xqobj.iotData.bat.value == undefined ? '--' : xqobj.iotData.bat.value + '%'}}</text>
</view>
</view>
<view class="divider"></view>
</view>
<!-- 设备盖子 -->
<view class="info-item">
<image class="iconfont info-icon" src="https://api.ccttiot.com/smartmeter/img/static/ujnGeXUE8lSWKXg7bcFf" mode="aspectFill"></image>
<view class="info-content">
<view class="info-title">{{ $i18n.t('deviceCover') }}</view>
<view class="info-status-row">
<text class="info-status">{{ xqobj.iotData.fx.desc == undefined ? '--' : xqobj.iotData.fx.desc}}</text>
</view>
</view>
<view class="divider"></view>
</view>
<!-- 设备支架 -->
<view class="info-item">
<image class="iconfont info-icon" src="https://api.ccttiot.com/smartmeter/img/static/u9ElqXEKREKILzl3SLUG" mode="aspectFill"></image>
<view class="info-content">
<view class="info-title">{{ $i18n.t('deviceBracket') }}</view>
<view class="info-status-row">
<text class="info-status" :class="deviceBracketValueClass">{{ xqobj.iotData.zj.desc == undefined ? '--' : xqobj.iotData.zj.desc }}</text>
</view>
</view>
</view>
<!-- HUB接连 -->
<view class="info-item">
<image class="iconfont info-icon" src="https://api.ccttiot.com/smartmeter/img/static/uyO1e6LIeqzoybk2MeLt" mode="aspectFill"></image>
<view class="info-content">
<view class="info-title">{{ $i18n.t('hubConnection') }}</view>
<view class="info-status-row">
<text class="info-status" :class="hubConnectionValueClass">{{ hubConnectionValue }}</text>
</view>
</view>
<view class="divider"></view>
</view>
<!-- HUB信号强度 -->
<view class="info-item">
<image class="iconfont info-icon" src="https://api.ccttiot.com/smartmeter/img/static/u8LVyGR693oxNl6DaJLI" mode="aspectFill"></image>
<view class="info-content">
<view class="info-title">{{ $i18n.t('hubSignalStrength') }}</view>
<view class="info-status-row">
<view class="signal-bar">
<view v-for="n in 3" :key="n" class="signal-block" :class="{active: n <= hubSignalStrengthLevel}"></view>
<text class="info-status" :class="hubSignalStrengthValueClass">{{ hubSignalStrengthValue }}</text>
</view>
</view>
</view>
<view class="divider"></view>
</view>
<!-- 连接模式 -->
<view class="info-item">
<image class="iconfont info-icon" src="https://api.ccttiot.com/smartmeter/img/static/usrbHxshaZ3iuDlTHL4w" mode="aspectFill"></image>
<view class="info-content">
<view class="info-title">{{ $i18n.t('connectionMode') }}</view>
<view class="info-status-row">
<text class="info-status" :class="connectionModeValueClass">{{ connectionModeValue }}</text>
</view>
</view>
<view class="divider"></view>
</view>
<!-- LORA信号强度 -->
<view class="info-item">
<image class="iconfont info-icon" src="https://api.ccttiot.com/smartmeter/img/static/u8LVyGR693oxNl6DaJLI" mode="aspectFill"></image>
<view class="info-content">
<view class="info-title">{{ $i18n.t('loraSignalStrength') }}</view>
<view class="info-status-row">
<view class="signal-bar">
<view v-for="n in 3" :key="n" class="signal-block" :class="{active: n <= loraSignalStrengthLevel}"></view>
<text class="info-status" :class="loraSignalStrengthValueClass">{{ loraSignalStrengthValue }}</text>
</view>
</view>
</view>
<view class="divider"></view>
</view>
<!-- BLE信号强度 -->
<view class="info-item">
<image class="iconfont info-icon" src="https://api.ccttiot.com/smartmeter/img/static/u8LVyGR693oxNl6DaJLI" mode="aspectFill"></image>
<view class="info-content">
<view class="info-title">{{ $i18n.t('bleSignalStrength') }}</view>
<view class="info-status-row">
<view class="signal-bar">
<view v-for="n in 3" :key="n" class="signal-block" :class="{active: n <= bleSignalStrengthLevel}"></view>
<text class="info-status" :class="bleSignalStrengthValueClass">{{ bleSignalStrengthValue }}</text>
</view>
</view>
</view>
<view class="divider"></view>
</view>
<!-- LORA发射功率 -->
<view class="info-item">
<image class="iconfont info-icon" src="https://api.ccttiot.com/smartmeter/img/static/uMLNWkOVJRxP7rws6oHm" mode="aspectFill"></image>
<view class="info-content">
<view class="info-title">{{ $i18n.t('loraTransmitPower') }}</view>
<view class="info-status-row">
<view class="signal-bar">
<view v-for="n in 3" :key="n" class="signal-block" :class="{active: n <= loraTransmitPowerLevel}"></view>
<text class="info-status" :class="loraTransmitPowerValueClass">{{ loraTransmitPowerValue }}</text>
</view>
</view>
</view>
<view class="divider"></view>
</view>
<!-- BLE发射功率 -->
<view class="info-item">
<image class="iconfont info-icon" src="https://api.ccttiot.com/smartmeter/img/static/uMLNWkOVJRxP7rws6oHm" mode="aspectFill"></image>
<view class="info-content">
<view class="info-title">{{ $i18n.t('bleTransmitPower') }}</view>
<view class="info-status-row">
<view class="signal-bar">
<view v-for="n in 3" :key="n" class="signal-block" :class="{active: n <= bleTransmitPowerLevel}"></view>
<text class="info-status" :class="bleTransmitPowerValueClass">{{ bleTransmitPowerValue }}</text>
</view>
</view>
</view>
<view class="divider"></view>
</view>
<!-- 中继器 -->
<view class="info-item">
<image class="iconfont info-icon" src="https://api.ccttiot.com/smartmeter/img/static/uc1XzHKWwT9EzARbZIeR" mode="aspectFill"></image>
<view class="info-content">
<view class="info-title">{{ $i18n.t('repeater') }}</view>
<view class="info-status-row">
<text class="info-status" :class="repeaterValueClass">{{ repeaterValue }}</text>
</view>
</view>
<view class="divider"></view>
</view>
<!-- NC接口 -->
<view class="info-item">
<image class="iconfont info-icon" src="https://api.ccttiot.com/smartmeter/img/static/uRhz8EQZgniEsUdrWjzL" mode="aspectFill"></image>
<view class="info-content">
<view class="info-title">{{ $i18n.t('ncInterface') }}</view>
<view class="info-status-row">
<text class="info-status" :class="ncInterfaceValueClass">{{ ncInterfaceValue }}</text>
</view>
</view>
</view>
</view>
<!-- 底部摘要 -->
<view class="device-summary">
<view>{{xqobj.productName}}{{$i18n.t('deviceModel')}}</view>
<view>{{ $i18n.t('hardware') }}</view>
<view>{{ $i18n.t('firmware') }}</view>
<view>{{$i18n.t('deviceMac')}}{{xqobj.mac}}</view>
</view>
</scroll-view>
</view>
</template>
<script>
export default {
data() {
return {
// 门磁状况左边
magneticContactStatusLeftValue: this.$i18n.t('magneticContactStatusLeftValue'),
magneticContactStatusLeftValueClass: '',
// 门磁状况右边
magneticContactStatusRightValue: this.$i18n.t('magneticContactStatusRightValue'),
magneticContactStatusRightValueClass: '',
// 磁强计
magnetometerValue: this.$i18n.t('normal'),
magnetometerValueClass: '',
// 加速度器3-axis震动
accelerometer3AxisVibrationValue: '100%',
accelerometer3AxisVibrationValueClass: '',
// 加速度器3-axis角度
accelerometer3AxisAngleValue: '45°',
accelerometer3AxisAngleValueClass: '',
// 温度(℃)
temperatureCelsiusValue: this.$i18n.t('temperatureChange'),
temperatureCelsiusValueClass: '',
// 电池电量
batteryLevelValue: '100%',
batteryLevelValueClass: '',
// 设备盖子
deviceCoverValue: this.$i18n.t('open'),
deviceCoverValueClass: 'red',
// 设备支架
deviceBracketValue: this.$i18n.t('normal'),
deviceBracketValueClass: '',
// HUB接连
hubConnectionValue: this.$i18n.t('connected'),
hubConnectionValueClass: '',
// HUB信号强度
hubSignalStrengthLevel: 3,
hubSignalStrengthValue: '',
hubSignalStrengthValueClass: '',
// 连接模式
connectionModeValue: this.$i18n.t('wired'),
connectionModeValueClass: '',
// LORA信号强度
loraSignalStrengthLevel: 2,
loraSignalStrengthValue: '-95(dBm)',
loraSignalStrengthValueClass: '',
// BLE信号强度
bleSignalStrengthLevel: 1,
bleSignalStrengthValue: '-95(dBm)',
bleSignalStrengthValueClass: '',
// LORA发射功率
loraTransmitPowerLevel: 2,
loraTransmitPowerValue: '',
loraTransmitPowerValueClass: '',
// BLE发射功率
bleTransmitPowerLevel: 3,
bleTransmitPowerValue: '',
bleTransmitPowerValueClass: '',
// 中继器
repeaterValue: this.$i18n.t('none'),
repeaterValueClass: '',
// NC接口
ncInterfaceValue: this.$i18n.t('enabled'),
ncInterfaceValueClass: '',
id:'',
xqobj:{},
isRefreshing:false,
}
},
onLoad(option) {
this.id = option.id
this.getxq()
},
methods: {
// 下拉刷新
onRefresh() {
this.isRefreshing = true
setTimeout(()=>{
this.isRefreshing = false
this.getxq()
},1000)
},
// 点击进行设备修改
btnrdit(){
uni.navigateTo({
url:'/pages/device/mcygedit?id=' + this.id
})
},
// 进行设备详情请求
getxq(){
this.$http.get(`/bst/device/detail?id=${this.id}`).then(res => {
if(res.code == 200){
this.xqobj = res.data
}
})
},
// 点击返回上一级
btnback(){
uni.navigateBack()
},
}
}
</script>
<style scoped lang="less">
.tabback {
display: flex;
align-items: center;
justify-content: space-between;
width: 100%;
height: 160rpx;
padding: 0 20rpx;
padding-top: 80rpx;
box-sizing: border-box;
position: fixed;
top: 0;
left: 0;
z-index: 999 !important;
background-color: #fff;
.rtjt {
font-size: 36rpx;
}
}
.device-detail {
padding-top: 150rpx;
background-color: #F3F5F6;
}
.avatar-box {
position: relative;
display: flex;
justify-content: center;
margin-top: 60rpx;
padding-bottom: 74rpx;
border-bottom: 1rpx solid #f2f2f2;
.avatar {
width: 278rpx;
height: 278rpx;
background: #e0e0e0;
border-radius: 24rpx;
box-shadow: 0 2rpx 8rpx #eee;
}
.scan-btn {
image{
width: 48rpx;
height: 48rpx;
}
position: absolute;
right: 26rpx;
top: -36rpx;
width: 48rpx;
height: 48rpx;
background: #fff;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
font-size: 32rpx;
box-shadow: 0 2rpx 8rpx #eee;
border: 1rpx solid #eee;
}
}
.info-card .info-item:nth-child(9){
margin-bottom: 30rpx;
}
.info-card .info-item:nth-child(10){
border-bottom: 1px solid #f2f2f2;
}
.info-card {
.info-item {
display: flex;
align-items: flex-start;
padding: 0 24rpx 0 32rpx;
position: relative;
min-height: 80rpx;
background: #fff;
image{
width: 50rpx;
height: 50rpx;
margin-top: 30rpx;
}
.info-icon {
font-family: 'iconfont' !important;
font-size: 32rpx;
margin-right: 18rpx;
color: #222;
line-height: 80rpx;
}
.info-content {
flex: 1;
padding: 18rpx 0;
.info-title {
font-size: 28rpx;
color: #727272;
font-weight: 500;
}
.info-status-row {
display: flex;
align-items: center;
margin-top: 6rpx;
min-height: 32rpx;
.info-status {
font-size: 26rpx;
color: #3D3D3D;
&.red {
color: #e74c3c;
}
&.green {
color: #27ae60;
}
}
.signal-bar {
display: flex;
align-items: center;
.signal-block {
width: 62rpx;
height: 6rpx;
margin-right: 6rpx;
border-radius: 2rpx;
background: #e0e0e0;
&.active {
background: #4cd964;
}
}
}
}
}
.divider {
position: absolute;
left: 0;
right: 0;
bottom: 0;
height: 1rpx;
background: #f2f2f2;
}
}
}
.device-summary {
background: #f7f7f7;
text-align: center;
color: #888;
font-size: 24rpx;
line-height: 1.8;
border-radius: 0 0 20rpx 20rpx;
padding-top: 40rpx;
box-sizing: border-box;
padding-bottom: 30rpx;
}
/* WebSocket消息弹窗样式 */
.message-modal {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: rgba(0, 0, 0, 0.5);
display: flex;
align-items: center;
justify-content: center;
z-index: 9999;
.message-modal-content {
width: 80%;
max-width: 600rpx;
background-color: #fff;
border-radius: 20rpx;
overflow: hidden;
box-shadow: 0 4rpx 20rpx rgba(0, 0, 0, 0.2);
.message-modal-header {
display: flex;
align-items: center;
justify-content: space-between;
padding: 30rpx 30rpx 20rpx;
border-bottom: 1rpx solid #f0f0f0;
.message-modal-title {
font-size: 32rpx;
font-weight: 600;
color: #333;
}
.message-modal-close {
font-size: 48rpx;
color: #999;
line-height: 1;
cursor: pointer;
&:active {
color: #666;
}
}
}
.message-modal-body {
padding: 30rpx;
max-height: 60vh;
overflow-y: auto;
.message-text {
font-size: 28rpx;
color: #333;
line-height: 1.6;
word-break: break-all;
white-space: pre-wrap;
}
}
}
}
</style>