pull/110/head
孙萌 2024-02-19 18:03:38 +08:00
parent fd10372039
commit e58028d02d
2 changed files with 62 additions and 54 deletions

View File

@ -371,6 +371,7 @@ export function realTimeLine(id, data,pageId) {
}
export function statusCharts(id, data) {
var chartDom = document.getElementById(id);
var myChart = echarts.init(chartDom);
var option;

View File

@ -93,7 +93,7 @@
<img src="../../assets/image/status.png" alt="" />
设备运行状态
<div class="title-text" v-if="sunrise"><img src="../../assets/img/sunrise.png" alt="">日出:{{ sunrise }}</div>
<div class="title-text" v-if="sunset"><img src="../../assets/img/sunset.png" alt="">日落:{{ sunset }}</div>
<div class="title-text" v-if="sunset"><img src="../../assets/img/sunset.png" alt="">日落:{{ sunset }}</div>
</div>
<div class="flex-view border-none">
<div class="status-view" v-for="item, index in statusList" :key="index">
@ -148,6 +148,7 @@
alt="">
<img v-else src="../../assets/img/fan-off.png" alt=""> <span>5#风机</span>
</div>
<div style="display: none;"></div>
</div>
</div>
<div v-else class="status-noTrue">
@ -219,6 +220,7 @@
<img v-else src="../../assets/img/fan-off.png" alt="">
<span>8#补光灯</span>
</div>
<div style="display: none;"></div>
</div>
</div>
<div v-else class="status-noTrue">
@ -250,18 +252,17 @@
</div>
<div class="status-true-text" v-if="item.type == 2 || item.type == 5 || item.type == 6 || item.type == 12
|| item.type == 13 || item.type == 14 || item.type == 15|| item.type == 16">
|| item.type == 13 || item.type == 14 || item.type == 15 || item.type == 16">
<div class="status-true-text-left">{{ getNumberStatus(item) }}</div>
<div class="status-true-text-right"
v-if="item.type == 6 || item.type == 5 || item.type == 2 || item.type == 15 || item.type == 14 || item.type == 13 || item.type == 12">
{{ item.progress }}%</div>
</div>
<div class="status-fan status-btn" v-else>
<div class="status-fan status-btn" v-else>
<div class="btn" :class="item.index == 1 ? 'blue' : 'off'">
<img class="light-img" :src="getIcon(item)"
alt="">
<img class="light-img" :src="getIcon(item)" alt="">
<!-- <img v-else src="../../assets/img/fan-off.png" alt=""> -->
<span>{{item.index==1?'开启':'关闭'}}</span>
<span>{{ item.index == 1 ? '开启' : '关闭' }}</span>
</div>
</div>
</div>
@ -439,7 +440,7 @@ export default {
data() {
return {
sunrise: "00:00",
sunset: "00:00",
sunset: "00:00",
statusList: [],
time: null,//
@ -667,9 +668,9 @@ export default {
height: divH, // 1080 px
})
},
getIcon(item){
getIcon(item) {
var index = item.index
if (item.type == 3) {
if (item.type == 3) {
//
if (index == 0) {
return require('../../assets/img/fan-off.png')
@ -678,8 +679,8 @@ export default {
} else {
return ''
}
} else if (item.type == 10) {
} else if (item.type == 10) {
//
if (index == 0) {
return require('../../assets/img/fan-off.png')
@ -688,7 +689,7 @@ export default {
} else {
return ''
}
}else if (item.type == 4) {
} else if (item.type == 4) {
//
if (index == 0) {
return require('../../assets/img/fan-off.png')
@ -697,7 +698,7 @@ export default {
} else {
return ''
}
}else if (item.type == 9) {
} else if (item.type == 9) {
//
if (index == 0) {
return require('../../assets/img/fan-off.png')
@ -717,7 +718,7 @@ export default {
return ''
}
}
else if (item.type == 7) {
else if (item.type == 7) {
//
if (index == 0) {
return require('../../assets/img/fan-off.png')
@ -727,12 +728,12 @@ export default {
return ''
}
}
},
getNumberStatus(item) {
var index = item.index
if (item.type == 2 || item.type == 5 || item.type == 6 || item.type == 12
|| item.type == 13 || item.type == 14 || item.type == 15|| item.type == 16) {
|| item.type == 13 || item.type == 14 || item.type == 15 || item.type == 16) {
//
if (index == 0) {
return '静止状态'
@ -744,7 +745,7 @@ export default {
return ''
}
}
// else if (item.type == 7) {
// else if (item.type == 7) {
// //
// if (index == 0) {
// return ''
@ -789,25 +790,25 @@ export default {
}
return num
},
//16 16
convertToTimeMinutes(hexValue) {
// 16
let hexString = hexValue.toString(16);
// 416
while (hexString.length < 4) {
hexString = "0" + hexString;
}
//16 16
convertToTimeMinutes(hexValue) {
// 16
let hexString = hexValue.toString(16);
return hexString;
},
insertColonEveryTwoDigits(inputString) {
// 使
const chunks = inputString.match(/.{1,2}/g);
return chunks.join(":");
// 使join
},
// 416
while (hexString.length < 4) {
hexString = "0" + hexString;
}
return hexString;
},
insertColonEveryTwoDigits(inputString) {
// 使
const chunks = inputString.match(/.{1,2}/g);
return chunks.join(":");
// 使join
},
//countType
//0
//1-400
@ -944,7 +945,7 @@ export default {
this.api.postFsdata(data1).then(res => {
if (res.data.code == 200) {
var chartsData = res.data.data
realTimeLine('realTime-line', chartsData,data1)
realTimeLine('realTime-line', chartsData, data1)
} else {
// this.$message.error(res.data.msg);
}
@ -1057,7 +1058,7 @@ export default {
this.api.getControlFsdata(data1).then(res => {
if (res.data.code == 200) {
var chartsData = res.data.data
realTimeLine('realTime-line', chartsData,data1)
realTimeLine('realTime-line', chartsData, data1)
} else {
// this.$message.error(res.data.msg);
}
@ -1120,7 +1121,7 @@ export default {
if (res.data.code == 200) {
res.data.data.forEach((el, index) => {
var chartsData = res.data.data
realTimeLine('realTime-line', chartsData,equipmentId)
realTimeLine('realTime-line', chartsData, equipmentId)
})
}
})
@ -1224,21 +1225,21 @@ export default {
}
this.api.getControlGetState(TargetValue).then(res => {
if (res.data.code == 200) {
if(res.data.data["1119"]){
if (res.data.data["1119"]) {
this.sunrise = this.insertColonEveryTwoDigits(
this.convertToTimeMinutes(res.data.data["1119"])
);
}else{
this.sunrise =''
this.convertToTimeMinutes(res.data.data["1119"])
);
} else {
this.sunrise = ''
}
if(res.data.data["1120"]){
this.sunset = this.insertColonEveryTwoDigits(
this.convertToTimeMinutes(res.data.data["1120"])
);
}else{
this.sunset =''
}
if (res.data.data["1120"]) {
this.sunset = this.insertColonEveryTwoDigits(
this.convertToTimeMinutes(res.data.data["1120"])
);
} else {
this.sunset = ''
}
const statusList = []
this.nowDevicestatus.forEach((el, index) => {
if (el.id == 1) {
@ -1249,7 +1250,7 @@ export default {
fandata.type = 1
fandata.name = el.name
fandata.status = []
var num = res.data.data['1024']?res.data.data['1024']:0
var num = res.data.data['1024'] ? res.data.data['1024'] : 0
var num1 = this.padString(num.toString(2), 5)
var openListNew = []
openListNew = num1.split("")
@ -1263,7 +1264,7 @@ export default {
fandata.type = 1
fandata.name = el.name
fandata.status = []
var num = res.data.data['1079']?res.data.data['1079']:0
var num = res.data.data['1079'] ? res.data.data['1079'] : 0
var num1 = this.padString(num.toString(2), 5)
var openListNew = []
openListNew = num1.split("")
@ -1277,7 +1278,7 @@ export default {
fandata.type = 8
fandata.name = el.name
fandata.status = []
var num = res.data.data['1069']?res.data.data['1069']:0
var num = res.data.data['1069'] ? res.data.data['1069'] : 0
var num1 = this.padString(num.toString(2), 8)
var openListNew = []
openListNew = num1.split("")
@ -1339,19 +1340,25 @@ export default {
//
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)
} else if (el.id == 30 || el.id == 31 ) {
} else if (el.id == 30 || el.id == 31) {
//
var statusData = { name: el.name, type: 16, id: el.id, open: res.data.data[(1182 + ((el.id - 30) * 3))], progress: res.data.data[(1184 + ((el.id - 30) * 3))], index: res.data.data[(1183 + ((el.id - 30) * 3))] }
statusList.push(statusData)
}
})
this.statusList = statusList
this.$forceUpdate();
setTimeout(() => {
this.statusList.forEach((el, index) => {
if (el.open != 0 && (el.type == 6 || el.type == 5 || el.type == 2 || el.type == 15 || el.type == 14 || el.type == 13 || el.type == 12)) {
setTimeout(() => {
statusCharts(`statusCharts${index}`, el.progress)
}, 0);
}
})
}, 10);