14 changed files with 169 additions and 31 deletions
@ -0,0 +1,30 @@ |
|||||
|
/** |
||||
|
* 生成设备概览 数量数据 |
||||
|
* @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, |
||||
|
}, |
||||
|
]; |
||||
|
} |
Loading…
Reference in new issue