pull/102/head
孙萌 2024-01-24 16:29:48 +08:00
parent e7d0ffc820
commit 1835b6e4c8
1 changed files with 30 additions and 1 deletions

View File

@ -92,6 +92,8 @@
<div class="table-title"> <div class="table-title">
<img src="../../assets/image/status.png" alt="" /> <img src="../../assets/image/status.png" alt="" />
设备运行状态 设备运行状态
<div class="title-text">日出:{{ sunrise }}</div>
<div class="title-text">日落:{{ sunset }}</div>
</div> </div>
<div class="flex-view border-none"> <div class="flex-view border-none">
<div class="status-view" v-for="item, index in statusList" :key="index"> <div class="status-view" v-for="item, index in statusList" :key="index">
@ -428,6 +430,8 @@ export default {
}, },
data() { data() {
return { return {
sunrise: "00:00",
sunset: "00:00",
statusList: [], statusList: [],
time: null,// time: null,//
@ -759,6 +763,25 @@ export default {
} }
return num return num
}, },
//16 16
convertToTimeMinutes(hexValue) {
// 16
let hexString = hexValue.toString(16);
// 416
while (hexString.length < 4) {
hexString = "0" + hexString;
}
return hexString;
},
insertColonEveryTwoDigits(inputString) {
// 使
const chunks = inputString.match(/.{1,2}/g);
return chunks.join(":");
// 使join
},
//countType //countType
//0 //0
//1-400 //1-400
@ -1175,6 +1198,12 @@ export default {
} }
this.api.getControlGetState(TargetValue).then(res => { this.api.getControlGetState(TargetValue).then(res => {
if (res.data.code == 200) { if (res.data.code == 200) {
this.sunrise = this.insertColonEveryTwoDigits(
this.convertToTimeMinutes(res.data.data["1119"])
);
this.sunset = this.insertColonEveryTwoDigits(
this.convertToTimeMinutes(res.data.data["1120"])
);
const statusList = [] const statusList = []
this.nowDevicestatus.forEach((el, index) => { this.nowDevicestatus.forEach((el, index) => {
if (el.id == 1) { if (el.id == 1) {
@ -1273,7 +1302,7 @@ export default {
statusList.push(statusData) statusList.push(statusData)
} else if (el.id == 26 || el.id == 27 || el.id == 28 || el.id == 29) { } else if (el.id == 26 || el.id == 27 || el.id == 28 || el.id == 29) {
// //
var statusData = { name: el.name, type: 15, id: el.id, open: res.data.data[(1102 + ((el.id - 26) * 2))], progress: res.data.data[(1104 + ((el.id - 26) * 2))], index: res.data.data[(1103 + ((el.id - 26) * 2))] } var statusData = { name: el.name, type: 15, id: el.id, open: res.data.data[(1102 + ((el.id - 26) * 3))], progress: res.data.data[(1104 + ((el.id - 26) * 3))], index: res.data.data[(1103 + ((el.id - 26) * 3))] }
statusList.push(statusData) statusList.push(statusData)
} }