大屏展示绑定设备相关数据

This commit is contained in:
kerwincui
2022-08-17 22:21:58 +08:00
parent e9f0175286
commit bdbfb187ab
2 changed files with 207 additions and 183 deletions

View File

@@ -10,7 +10,7 @@
<div class="guang"></div>
<div class="d-flex jc-center">
<div class="title">
<span class="title-text">物美智能系统</span>
<span class="title-text">物美智能物联网平台</span>
</div>
</div>
<div class="timers ">

View File

@@ -32,13 +32,24 @@
</template>
<script>
import { currentGET } from '@/api/bigScreen/modules'
let style = {
import {
getDeviceStatistic,
} from "@/api/iot/device";
import {
listAllDeviceShort,
} from "@/api/iot/device";
let style = {
fontSize: 24
}
export default {
}
export default {
data() {
return {
// 设备列表
deviceList: [],
// 设备统计信息
deviceStatistic: {},
// 设备总数
deviceCount: 0,
options: {},
userOverview: {
alarmNum: 0,
@@ -49,7 +60,7 @@ export default {
pageflag: true,
timer: null,
config: {
number: [100],
number: [],
content: '{nt}',
style: {
...style,
@@ -95,8 +106,7 @@ export default {
created() {
this.getData()
},
mounted() {
},
mounted() {},
beforeDestroy() {
this.clearData()
@@ -110,28 +120,19 @@ export default {
},
getData() {
this.pageflag = true;
currentGET("big2").then((res) => {
getDeviceStatistic().then(res => {
// this.deviceStatistic = response.data;
if (!this.timer) {
console.log("设备总览", res);
}
if (res.success) {
if (res.code == 200) {
this.userOverview = res.data;
this.onlineconfig = {
...this.onlineconfig,
number: [res.data.onlineNum]
}
this.config = {
...this.config,
number: [res.data.totalNum]
}
this.offlineconfig = {
...this.offlineconfig,
number: [res.data.offlineNum]
}
this.laramnumconfig = {
...this.laramnumconfig,
number: [res.data.alarmNum]
number: [res.data.alertCount]
}
this.getAllDevice();
// 轮询
this.switper()
} else {
this.pageflag = false;
@@ -145,15 +146,37 @@ export default {
return
}
let looper = (a) => {
this.getData()
// this.getData()
};
this.timer = setInterval(looper, this.$store.state.settings.echartsAutoTime);
},
/**查询所有设备 */
getAllDevice() {
listAllDeviceShort(this.queryParams).then(response => {
this.deviceList = response.rows;
this.deviceCount = response.total;
let online = this.deviceList.filter(x => x.status == 3).length;
let offline = this.deviceList.length - online;
this.config = {
...this.config,
number: [this.deviceCount]
}
this.onlineconfig = {
...this.onlineconfig,
number: [online]
}
this.offlineconfig = {
...this.offlineconfig,
number: [offline]
}
})
},
};
},
};
</script>
<style lang='scss' scoped>
.user_Overview {
.user_Overview {
li {
flex: 1;
@@ -218,5 +241,6 @@ export default {
}
}
}
}
}
</style>