pull/36/head
孙萌 2023-11-16 11:09:07 +08:00
parent 8490006970
commit 94c0fa90b2
1 changed files with 60 additions and 44 deletions

View File

@ -107,24 +107,29 @@
</div>
<div class="status-fan">
<div class="btn" :class="fanStatus.status[0] == 1 ? 'blue' : 'off'">
<img class="fan-img" v-if="fanStatus.status[0] == 1" src="../../assets/img/fan-on.png" alt="">
<img class="fan-img" v-if="fanStatus.status[0] == 1" src="../../assets/img/fan-on.png"
alt="">
<img v-else src="../../assets/img/fan-off.png" alt="">
<span>1#风机</span>
</div>
<div class="btn" :class="fanStatus.status[1] == 1 ? 'blue' : 'off'">
<img class="fan-img" v-if="fanStatus.status[1] == 1" src="../../assets/img/fan-on.png" alt="">
<img class="fan-img" v-if="fanStatus.status[1] == 1" src="../../assets/img/fan-on.png"
alt="">
<img v-else src="../../assets/img/fan-off.png" alt=""> <span>2#风机</span>
</div>
<div class="btn" :class="fanStatus.status[2] == 1 ? 'blue' : 'off'">
<img class="fan-img" v-if="fanStatus.status[2] == 1" src="../../assets/img/fan-on.png" alt="">
<img class="fan-img" v-if="fanStatus.status[2] == 1" src="../../assets/img/fan-on.png"
alt="">
<img v-else src="../../assets/img/fan-off.png" alt=""> <span>3#风机</span>
</div>
<div class="btn" :class="fanStatus.status[3] == 1 ? 'blue' : 'off'">
<img class="fan-img" v-if="fanStatus.status[3] == 1" src="../../assets/img/fan-on.png" alt="">
<img class="fan-img" v-if="fanStatus.status[3] == 1" src="../../assets/img/fan-on.png"
alt="">
<img v-else src="../../assets/img/fan-off.png" alt=""> <span>4#风机</span>
</div>
<div class="btn" :class="fanStatus.status[4] == 1 ? 'blue' : 'off'">
<img class="fan-img" v-if="fanStatus.status[4] == 1" src="../../assets/img/fan-on.png" alt="">
<img class="fan-img" v-if="fanStatus.status[4] == 1" src="../../assets/img/fan-on.png"
alt="">
<img v-else src="../../assets/img/fan-off.png" alt=""> <span>5#风机</span>
</div>
</div>
@ -177,7 +182,7 @@
<div :id="'statusCharts' + index"></div>
</div>
<div class="status-true-text">
<div class="status-true-text-left">静止状态</div>
<div class="status-true-text-left">{{ getNumberStatus(item.index) }}</div>
<div class="status-true-text-right">{{ item.progress }}%</div>
</div>
</div>
@ -243,8 +248,8 @@ export default {
timer: null,
deviceName: 1,
controlList: [],
statusInterval:null,//statusInterval
statusTime:3,//status
statusInterval: null,//statusInterval
statusTime: 3,//status
}
},
watch: {
@ -253,7 +258,7 @@ export default {
const store = this.$store.state
this.indexs = this.$route.query.index ? this.$route.query.index : store.equipmentIndex;
this.deviceName = store.equipmentList[this.indexs - 1].deviceName
clearInterval(this.statusInterval)&&this.statusInterval
clearInterval(this.statusInterval) && this.statusInterval
setTimeout(() => {
if (this.player) {
@ -292,7 +297,7 @@ export default {
this.player.destroy()
this.player = null
}
clearInterval(this.statusInterval)&&this.statusInterval
clearInterval(this.statusInterval) && this.statusInterval
that.timer && clearInterval(that.timer)
this.$bus.$off('refreshTime')
},
@ -318,7 +323,19 @@ export default {
})
console.log(this.player);
},
getNumberStatus(index) {
if (index == 0) {
return '静止状态'
} else if (index == 1) {
return '正向打开中'
} else if (index == 2) {
return '反向关闭中'
} else {
return ''
}
},
createVideo() {
//
videojs.addLanguage('zh-CN', video_zhCN)
this.player = videojs(this.$refs.videoPlayer, {
@ -546,12 +563,12 @@ export default {
})
this.getStatus()
clearInterval(this.statusInterval)&&this.statusInterval
this.statusInterval = setInterval(() => {
if(this.deviceName==10){
clearInterval(this.statusInterval) && this.statusInterval
this.statusInterval = setInterval(() => {
if (this.deviceName == 10) {
this.getStatus()
}
}, this.statusTime*1000);
}, this.statusTime * 1000);
var data1 = store.equipmentList[this.indexs - 1].deviceId
this.api.getControlFsdata(data1).then(res => {
@ -585,40 +602,40 @@ export default {
}
},
getStatus(){
getStatus() {
var store = this.$store.state
var TargetValue = {
deviceId: store.equipmentList[this.indexs - 1].deviceId
}
this.api.getControlGetState(TargetValue).then(res => {
if (res.data.code == 200) {
this.fanStatus.open = res.data.data['1023']
this.fanStatus.status = []
var num = res.data.data['1024']
var num1 = this.padString(num.toString(2), 5)
var openListNew = []
openListNew = num1.split("")
this.fanStatus.status = openListNew.reverse()
this.statusList = []
for (var i = 0; i < 4; i++) {
var statusData = { name: `顶卷膜${i + 1}`, open: res.data.data[(1025 + (i * 3))], progress: res.data.data[(1027 + (i * 3))], index: res.data.data[(1026 + (i * 3))] }
this.statusList.push(statusData)
deviceId: store.equipmentList[this.indexs - 1].deviceId
}
this.api.getControlGetState(TargetValue).then(res => {
if (res.data.code == 200) {
this.fanStatus.open = res.data.data['1023']
this.fanStatus.status = []
var num = res.data.data['1024']
var num1 = this.padString(num.toString(2), 5)
var openListNew = []
openListNew = num1.split("")
this.fanStatus.status = openListNew.reverse()
this.statusList = []
for (var i = 0; i < 4; i++) {
var statusData = { name: `顶卷膜${i + 1}`, open: res.data.data[(1025 + (i * 3))], progress: res.data.data[(1027 + (i * 3))], index: res.data.data[(1026 + (i * 3))] }
this.statusList.push(statusData)
}
this.$forceUpdate();
setTimeout(() => {
this.statusList.forEach((el,index)=>{
if(el.open!=0){
statusCharts(`statusCharts${index}`,el.progress)
}
this.$forceUpdate();
setTimeout(() => {
this.statusList.forEach((el, index) => {
if (el.open != 0) {
statusCharts(`statusCharts${index}`, el.progress)
}
})
}, 10);
}, 10);
} else {
// this.$message.error(res.data.msg);
}
})
} else {
// this.$message.error(res.data.msg);
}
})
},
getTime() {
this.time = getnowtime()
@ -670,5 +687,4 @@ export default {
border: 1px solid #dcdfe6;
color: #606266;
font-size: 14px;
}
</style>
}</style>