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

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="guang"></div>
<div class="d-flex jc-center"> <div class="d-flex jc-center">
<div class="title"> <div class="title">
<span class="title-text">物美智能系统</span> <span class="title-text">物美智能物联网平台</span>
</div> </div>
</div> </div>
<div class="timers "> <div class="timers ">

View File

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