jsy-app/components/custom-index-adc/custom-index-adc.vue

267 lines
6.3 KiB
Vue
Raw Normal View History

2024-12-02 15:23:49 +08:00
<template>
2024-12-02 16:20:49 +08:00
<u-popup :show="open" mode="center" @close="close" closeable>
<view class="jz-info" style="width: 80vw;">
<view style="font-size: 16px;font-weight: 600;margin-bottom: 10px;">{{title}}</view>
2024-12-02 15:23:49 +08:00
<view v-for="item in items">
2025-01-14 17:30:53 +08:00
<text style="text-align: center;">{{ item.title }}</text>
<text style="text-align: center;">{{ item.value }}{{ item.unit }}</text>
2024-12-02 15:23:49 +08:00
</view>
</view>
</u-popup>
</template>
<script>
2024-12-20 10:39:10 +08:00
import {
timestampFormat
} from '@/utils/common.js'
2024-12-02 15:23:49 +08:00
export default {
name: "ADC",
components: {},
2024-12-02 16:20:49 +08:00
props: {},
2024-12-02 15:23:49 +08:00
data() {
return {
title: "设备ADC",
open: false,
items: [],
}
},
created() {},
mounted() {},
methods: {
/**
* 显示方法
* @param type 1基站 2阀门
* @param row
* @param data
*/
async show(type, row, data = {}) {
this.items = [];
if (type == 1) {
this.title = `基站ADC【${row.deviceCode}`;
this.items.push({
title: "软/硬件版本",
value: `${row?.softVer} / ${row?.deviceVersion}`,
unit: null
});
2025-02-08 17:26:11 +08:00
this.items.push({
title: "频段",
value: row.rolaRrequency,
unit: null
});
2024-12-02 15:23:49 +08:00
this.items.push({
title: "充电状态",
value: data?.adc?.charging ? '充电中' : '未充电',
unit: null
});
this.items.push({
title: "电池",
2025-01-14 17:30:53 +08:00
value: `${data?.b || ''}%(${data?.thingData?.adcProperty?.b || ''}V)`,
unit: null
2024-12-02 15:23:49 +08:00
});
this.items.push({
title: "433信号强度",
value: data?.thingData?.ls.value,
unit: null
});
this.items.push({
title: "4G信号强度",
value: data?.rssi,
unit: null
});
this.items.push({
2025-01-14 17:30:53 +08:00
title: "4G供电",
2024-12-02 15:23:49 +08:00
value: data?.thingData?.adcProperty?.g,
unit: "V"
});
this.items.push({
title: "MCU",
value: data?.thingData?.adcProperty?.mcu,
unit: "V"
});
this.items.push({
title: "充电电流ADC",
value: data?.thingData?.adcProperty?.cc,
unit: "mA"
});
this.items.push({
title: "充电电压ADC",
value: data?.thingData?.adcProperty?.ps,
unit: "V"
});
this.items.push({
title: "数据上报时间",
value: data?.date,
unit: null
});
}
if (type == 2) {
this.title = `阀门ADC【${row.showName}`;
this.items.push({
title: "阀门",
2025-01-15 15:48:58 +08:00
value: `${row.device.deviceTypeId == 3 ? "(4G)" : ""}${row.device?.deviceCode}`,
2024-12-02 15:23:49 +08:00
unit: null
});
this.items.push({
title: "软/硬件版本",
value: `${row.device?.softVer} / ${row.device?.deviceVersion}`,
unit: null
});
2025-02-08 17:26:11 +08:00
if (data?.comm?.frequency) {
this.items.push({
title: "频段",
value: data?.comm?.frequency,
unit: null
});
}
2024-12-02 15:23:49 +08:00
this.items.push({
title: "充电状态",
value: data?.adc?.charging ? '充电中' : '未充电',
unit: null
});
this.items.push({
title: "电池",
2025-01-14 17:30:53 +08:00
value: `${data?.adc?.b || ''}%(${data?.thingData?.adcProperty?.b || ''}V)`,
unit: null
2024-12-02 15:23:49 +08:00
});
this.items.push({
2025-01-14 17:30:53 +08:00
title: "舱内温度",
2024-12-02 15:23:49 +08:00
value: data?.adc?.t,
unit: "℃"
});
this.items.push({
2025-01-14 17:30:53 +08:00
title: "舱内湿度",
value: data?.adc?.h,
unit: "%"
2024-12-02 15:23:49 +08:00
});
2025-01-14 17:30:53 +08:00
let angel = "",
angelAdc = "";
2024-12-02 15:23:49 +08:00
switch (row.device.deviceTypeKey) {
case "butterflyValve":
break;
case "valve":
2025-01-14 17:30:53 +08:00
if (data.btnObj) {
if (data.btnObj.close.switchOn) {
angel = `全关(${data?.thingData?.va?.value})`;
} else if (data.btnObj.open.switchOn) {
angel = `全开(${data?.thingData?.va?.value})`;
} else if (data.btnObj.open1.switchOn) {
angel = `①开${data.btnObj.open1.openAngle}%`;
} else if (data.btnObj.open2.switchOn) {
angel = `②开${data.btnObj.open2.openAngle}%`;
} else {
angel = "-";
}
angelAdc = data?.thingData?.va?.value;
} else {
angel = "-";
angelAdc = "";
}
break;
2024-12-02 15:23:49 +08:00
case "fiveValve":
2025-01-14 17:30:53 +08:00
if (data.btnObj) {
let va = JSON.parse(data.thingData.va.value);
if (data.btnObj.open1.switchOn) {
angel = angel + `①开${data.btnObj.open1.openAngle}%`;
}
if (data.btnObj.open2.switchOn) {
angel = angel + `,②开${data.btnObj.open2.openAngle}%`;
}
if (data.btnObj.open3.switchOn) {
angel = angel + `,③开${data.btnObj.open3.openAngle}%`;
}
if (data.btnObj.open4.switchOn) {
angel = angel + `,④开${data.btnObj.open4.openAngle}%`;
}
angelAdc = va.toString();
} else {
angel = "-";
angelAdc = "";
}
2024-12-02 15:23:49 +08:00
break;
}
this.items.push({
title: "角度",
value: angel,
unit: null
});
2025-01-14 17:30:53 +08:00
this.items.push({
title: "原始角度",
value: angelAdc,
unit: null
});
this.items.push({
title: "压力",
value: data?.adc?.p.toString(),
unit: null
});
2024-12-02 15:23:49 +08:00
this.items.push({
title: "MCU",
value: data?.thingData?.adcProperty?.mcu,
2025-01-15 15:48:58 +08:00
unit: "V"
2024-12-02 15:23:49 +08:00
});
this.items.push({
2025-01-14 17:30:53 +08:00
title: "充电电流",
2024-12-02 15:23:49 +08:00
value: data?.thingData?.adcProperty?.cc,
unit: "mA"
});
this.items.push({
2025-01-14 17:30:53 +08:00
title: "充电电压",
2024-12-02 15:23:49 +08:00
value: data?.thingData?.adcProperty?.ps,
unit: "V"
});
2025-01-14 17:30:53 +08:00
if (row.device.deviceTypeKey == "valve") {
this.items.push({
title: "电机最大功率",
value: data?.thingData?.adcProperty?.ma,
2025-01-15 15:48:58 +08:00
unit: "W"
2025-01-14 17:30:53 +08:00
});
}
2024-12-02 15:23:49 +08:00
this.items.push({
title: "数据上报时间",
value: data?.date,
unit: null
});
}
this.open = true;
},
close() {
this.open = false;
2024-12-18 16:29:48 +08:00
this.$emit('close');
2024-12-02 15:23:49 +08:00
}
}
}
2024-12-02 15:53:37 +08:00
</script>
<style lang="scss" scoped>
2024-12-02 16:20:49 +08:00
.jz-info {
padding: 15px;
view {
display: flex;
uni-text {
line-height: 48rpx;
}
uni-text:nth-child(odd) {
width: 100px;
margin-right: 10px;
color: #666;
background: #f3f3f3;
}
uni-text:nth-child(even) {
2024-12-02 16:33:16 +08:00
width: calc(100% - 100px);
2024-12-02 16:20:49 +08:00
color: #000;
2024-12-02 16:33:16 +08:00
word-wrap: break-word;
/* 支持旧版浏览器 */
overflow-wrap: break-word;
/* 推荐 */
white-space: normal;
/* 可选:如果需要连字符 */
hyphens: auto;
2024-12-02 16:20:49 +08:00
}
}
2024-12-02 15:53:37 +08:00
}
</style>