You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
772 B
30 lines
772 B
/**
|
|
* 生成设备概览 数量数据
|
|
* @param {object} count
|
|
* @param {number} count.online 在线数量
|
|
* @param {number} count.offline 离线数量
|
|
* @param {number} count.fault 故障数量
|
|
* @param {number} count.warning 报警数量
|
|
* @returns {[{type: string, value: number},{type: string, value: number},{type: string, value: number},{type: string, value: number}]}
|
|
*/
|
|
// eslint-disable-next-line import/prefer-default-export
|
|
export function generateChartData(count) {
|
|
return [
|
|
{
|
|
type: '在线',
|
|
value: count.online || 0,
|
|
},
|
|
{
|
|
type: '故障',
|
|
value: count.fault || 0,
|
|
},
|
|
{
|
|
type: '离线',
|
|
value: count.offline || 0,
|
|
},
|
|
{
|
|
type: '报警',
|
|
value: count.warning || 0,
|
|
},
|
|
];
|
|
}
|
|
|