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