| | |
| | | }) |
| | | export class DashboardWorkplaceComponent implements OnInit, OnDestroy { |
| | | |
| | | totalDeviceCountList: any[] = []; |
| | | totalDeviceCountList = null; |
| | | totalDeviceCount = ''; |
| | | avgDeviceCount = ''; |
| | | deviceCountLoading = true; |
| | |
| | | radarData: any[] = []; |
| | | loading = true; |
| | | public alarmData: any = {}; |
| | | public alarmDatas = [ |
| | | { title: '所有', color: 'purple', data: [] }, |
| | | { title: '一级', color: 'yellow', data: [] }, |
| | | { title: '二级', color: 'orange', data: [] }, |
| | | { title: '三级', color: 'red', data: [] } |
| | | ]; |
| | | public alertData = [[], [], [], []]; |
| | | salesType = '0'; |
| | | salesTotal = 0; |
| | |
| | | |
| | | selectedIndexChange(index) { |
| | | this.rankingListData = []; |
| | | if (!this.alarmData['_' + index]) { |
| | | if (this.alarmDatas[index].data.length < 1) { |
| | | this.http2.get(environment.SERVER_BASH_URL + 'report/alarm-year', { params: { state: index > 0 ? index : null } }).subscribe((res: any) => { |
| | | const data = []; |
| | | for (let i = 0; i < res.data.length; i += 1) { |
| | | data.push({ x: `${i + 1}月`, y: !!res.data[i] ? res.data[i] : 0 }); |
| | | } |
| | | this.alarmData['_' + index] = data; |
| | | this.alarmDatas[index].data = data; |
| | | }); |
| | | } |
| | | if (this.alertData[index].length > 0) { |
| | |
| | | if (!!rWtihAvg.code && !!rWithToltal&&!!rWithList.code) { |
| | | this.avgDeviceCount = ToolsService.toThousands(rWtihAvg.data.toString()); |
| | | this.totalDeviceCount = ToolsService.toThousands(rWithToltal.data.toString()); |
| | | rWithList.data.forEach( item =>{ |
| | | this.totalDeviceCountList.push( |
| | | { |
| | | x:item.time, |
| | | y:item.count |
| | | } |
| | | ); |
| | | }); |
| | | this.totalDeviceCountList = rWithList.data.map(item => { |
| | | return {x:item.time,y:item.count}; |
| | | }) |
| | | this.operNormalPercent = Math.round(rWithNormal.data/rWithToltal.data*100); |
| | | this.deviceCountLoading = false; |
| | | this.operationLoading = false; |