From 94c0fa90b26a65048d0e0865d5690a6dff8cd686 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=AD=99=E8=90=8C?= <525441437@qq.com>
Date: Thu, 16 Nov 2023 11:09:07 +0800
Subject: [PATCH] 1
---
src/views/page/realTime.vue | 104 +++++++++++++++++++++---------------
1 file changed, 60 insertions(+), 44 deletions(-)
diff --git a/src/views/page/realTime.vue b/src/views/page/realTime.vue
index 9940843..e5663f2 100644
--- a/src/views/page/realTime.vue
+++ b/src/views/page/realTime.vue
@@ -107,24 +107,29 @@
-
静止状态
+
{{ getNumberStatus(item.index) }}
{{ item.progress }}%
@@ -243,8 +248,8 @@ export default {
timer: null,
deviceName: 1,
controlList: [],
- statusInterval:null,//status状态的Interval
- statusTime:3,//status状态的秒数
+ statusInterval: null,//status状态的Interval
+ 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;
-}
-
\ No newline at end of file
+}
\ No newline at end of file