add device data
This commit is contained in:
parent
48994438d8
commit
c897843f65
|
@ -250,55 +250,56 @@ export default {
|
|||
setInterval(this.animation, 3000)
|
||||
},
|
||||
methods: {
|
||||
getData() {
|
||||
getCount().then(res => {
|
||||
this.unprocessedAlarmNum = res.data
|
||||
})
|
||||
getAlarmLevelCount().then(res => {
|
||||
const level0Num = res.data.filter(item => item.alarm_level === 0)[0]?.count || 0
|
||||
const level1Num = res.data.filter(item => item.alarm_level === 1)[0]?.count || 0
|
||||
const level2Num = res.data.filter(item => item.alarm_level === 2)[0]?.count || 0
|
||||
const level3Num = res.data.filter(item => item.alarm_level === 3)[0]?.count || 0
|
||||
const alarmData = [{
|
||||
value: level0Num,
|
||||
name: '紧急'
|
||||
}, {
|
||||
value: level1Num,
|
||||
name: '重要'
|
||||
}, {
|
||||
value: level2Num,
|
||||
name: '次要'
|
||||
}, {
|
||||
value: level3Num,
|
||||
name: '提示'
|
||||
}]
|
||||
this.alarmTotalNum = res.data.reduce((pre, cur) => pre + cur.count, 0)
|
||||
this.options[1].series[0].data = alarmData
|
||||
})
|
||||
getRunStatusCount().then(res => {
|
||||
const status0Num = res.data.filter(item => item.runstatus === 0)[0]?.count || 0
|
||||
const status1Num = res.data.filter(item => item.runstatus === 1)[0]?.count || 0
|
||||
const status2Num = res.data.filter(item => item.runstatus === 2)[0]?.count || 0
|
||||
const runstatusData = [{
|
||||
value: status0Num,
|
||||
name: '运行'
|
||||
}, {
|
||||
value: status1Num,
|
||||
name: '待机'
|
||||
}, {
|
||||
value: status2Num,
|
||||
name: '警告'
|
||||
}]
|
||||
this.runningNum = status0Num
|
||||
this.options[2].series[0].data = runstatusData
|
||||
})
|
||||
getTypeCount().then(res => {
|
||||
const typeData = res.data.map(item => {
|
||||
return { name: item.type, value: item.count }
|
||||
})
|
||||
this.options[0].series[0].data = typeData
|
||||
this.terminalTotalNum = res.data.reduce((pre, cur) => pre + cur.count, 0)
|
||||
async getData() {
|
||||
const unprocessedAlarmData = await getCount()
|
||||
const alarmLevelData = await getAlarmLevelCount()
|
||||
const runStatusData = await getRunStatusCount()
|
||||
const typeCountData = await getTypeCount()
|
||||
|
||||
this.unprocessedAlarmNum = unprocessedAlarmData.data
|
||||
|
||||
const level0Num = alarmLevelData.data.filter(item => item.alarm_level === 0)[0]?.count || 0
|
||||
const level1Num = alarmLevelData.data.filter(item => item.alarm_level === 1)[0]?.count || 0
|
||||
const level2Num = alarmLevelData.data.filter(item => item.alarm_level === 2)[0]?.count || 0
|
||||
const level3Num = alarmLevelData.data.filter(item => item.alarm_level === 3)[0]?.count || 0
|
||||
const alarmData = [{
|
||||
value: level0Num,
|
||||
name: '紧急'
|
||||
}, {
|
||||
value: level1Num,
|
||||
name: '重要'
|
||||
}, {
|
||||
value: level2Num,
|
||||
name: '次要'
|
||||
}, {
|
||||
value: level3Num,
|
||||
name: '提示'
|
||||
}]
|
||||
this.alarmTotalNum = alarmLevelData.data.reduce((pre, cur) => pre + cur.count, 0)
|
||||
this.options[1].series[0].data = alarmData
|
||||
|
||||
const status0Num = runStatusData.data.filter(item => item.runstatus === 0)[0]?.count || 0
|
||||
const status1Num = runStatusData.data.filter(item => item.runstatus === 1)[0]?.count || 0
|
||||
const status2Num = runStatusData.data.filter(item => item.runstatus === 2)[0]?.count || 0
|
||||
const runstatusData = [{
|
||||
value: status0Num,
|
||||
name: '运行'
|
||||
}, {
|
||||
value: status1Num,
|
||||
name: '待机'
|
||||
}, {
|
||||
value: status2Num,
|
||||
name: '警告'
|
||||
}]
|
||||
this.runningNum = status1Num
|
||||
this.options[2].series[0].data = runstatusData
|
||||
|
||||
const typeData = typeCountData.data.map(item => {
|
||||
return { name: item.type, value: item.count }
|
||||
})
|
||||
this.options[0].series[0].data = typeData
|
||||
this.terminalTotalNum = typeCountData.data.reduce((pre, cur) => pre + cur.count, 0)
|
||||
|
||||
this.myCharts.forEach((chart, index) => {
|
||||
chart.setOption(this.options[index])
|
||||
})
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<div class="header">
|
||||
<h1 class="title">{{ abbrCorpName+'现有设备接入' }}</h1>
|
||||
<span class="date">{{ date }}</span>
|
||||
<span class="device_num">{{ '共'+activeList.length + '个设备' }}</span>
|
||||
<span class="device_num">{{ '共'+(activeList.length+disactiveList.length) + '个设备' }}</span>
|
||||
</div>
|
||||
<el-button type="primary" style="height: fit-content" @click="selectCompany">切换企业</el-button>
|
||||
</el-row>
|
||||
|
@ -220,8 +220,55 @@ export default {
|
|||
this.date = new Date().toLocaleDateString()
|
||||
this.getList(0)
|
||||
this.getList(1)
|
||||
// this.randomData()
|
||||
},
|
||||
methods: {
|
||||
// randomData() {
|
||||
// for (let i = 16; i < 17; i++) {
|
||||
// const productname = this.productList[0].name
|
||||
// const src = this.productList[0].src
|
||||
// const color = this.productList[0].color
|
||||
|
||||
// const randomDeviceNum = Math.round(Math.random() * 10) % 5
|
||||
// const type = this.deviceList[randomDeviceNum].name
|
||||
// const no = 'S' + String(i).padStart(2, '0')
|
||||
// const desc = ['激光切割机', '火焰切割机', '上料', 'H型钢组立', '进料缓存', '龙门式气保焊', '龙门式埋弧焊', '卧矫', '数控型钢钻孔', '型钢切割', '抛丸线', '门式切割']
|
||||
// const len = desc.length
|
||||
// const devicedesc = desc[i % len]
|
||||
|
||||
// const temp = {
|
||||
// src, productname, type, no, devicedesc, color
|
||||
// }
|
||||
|
||||
// const runstatus = Math.round(Math.random() * 10) % 2 + 1
|
||||
// const statusdesc = runstatus === 0 ? '待机' : runstatus === 1 ? '运行' : '警告'
|
||||
// const dataTemplate = {
|
||||
// runstatus,
|
||||
// statusdesc,
|
||||
// kernel: 'rt-thread kenel',
|
||||
// webversion: '1.0',
|
||||
// ipaddr: '192.168.131.29',
|
||||
// netmask: '255.255.254.0',
|
||||
// gateway: '192.168.130.1',
|
||||
// dnsserver0: '10.0.110.21',
|
||||
// dnsserver1: '10.0.110.20',
|
||||
// topic: '/broadcast/hf6mzwdVnJg/989898',
|
||||
// serveraddr: 'zwdVnJg.iot-as-mqtt.cn-shanghai.aliyuncs.com',
|
||||
// serverport: '1883',
|
||||
// username: 'test1&hf6mzwdVnJg',
|
||||
// clientid: '123|securemode=3,signmethod=hmacsha1|',
|
||||
// privateserveraddr: '192.168.131.30',
|
||||
// privateserverport: '9898',
|
||||
// privateserverusername: 'admin'
|
||||
// }
|
||||
// add({
|
||||
// productname, type, no, devicedesc, activestatus: 0, ...dataTemplate
|
||||
// }).then(res => {
|
||||
// }).catch(err => {
|
||||
// })
|
||||
// this.disactiveList.push(temp)
|
||||
// }
|
||||
// },
|
||||
selectCompany() {
|
||||
this.$message.warning('暂无权限')
|
||||
},
|
||||
|
|
|
@ -103,7 +103,7 @@
|
|||
<div class="temper">{{ current.temper }}<span class="unit">°C</span></div>
|
||||
<p>{{ '内存使用率:'+current.cpuRate+'%' }}</p>
|
||||
<p>{{ '线程数:'+current.threadNum }}</p>
|
||||
<p>{{ '耗电量:'+current.elec+'kW·h' }}</p>
|
||||
<p>{{ '功率:2W' }}</p>
|
||||
<p class="location">{{ current.location }}</p>
|
||||
</div>
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue