Commit bcfeb6fe authored by wangqinghua's avatar wangqinghua

update

parent 4c1c40cd
...@@ -27,8 +27,7 @@ ...@@ -27,8 +27,7 @@
</nz-select> </nz-select>
</div> </div>
<div nz-col nzSpan="7"> <div nz-col nzSpan="7">
<nz-radio-group style="width: 100%;" [(ngModel)]="timeType" (ngModelChange)="changeType()" <nz-radio-group style="width: 100%;" [(ngModel)]="timeType" (ngModelChange)="changeType()">
[nzButtonStyle]="'solid'">
<label nz-radio-button nzValue="1">今天</label> <label nz-radio-button nzValue="1">今天</label>
<label nz-radio-button nzValue="2">昨天</label> <label nz-radio-button nzValue="2">昨天</label>
<label nz-radio-button nzValue="3">三天</label> <label nz-radio-button nzValue="3">三天</label>
......
...@@ -31,6 +31,7 @@ export class ResourceUsabilComponent implements OnInit { ...@@ -31,6 +31,7 @@ export class ResourceUsabilComponent implements OnInit {
lastList; lastList;
obj = { obj = {
timeType:this.timeType,
type: '', type: '',
groupid: '', groupid: '',
startTime: '', startTime: '',
......
import {AfterViewInit, Component, ElementRef, OnInit, Renderer2, ViewChild} from '@angular/core'; import {AfterViewInit, Component, ElementRef, OnInit, Renderer2, ViewChild} from '@angular/core';
import {JhiEventManager} from 'ng-jhipster'; import {JhiEventManager} from 'ng-jhipster';
import { Principal} from '../shared'; import {Principal} from '../shared';
import {OverAllService} from '../overAll/overAll.service'; import {OverAllService} from '../overAll/overAll.service';
import {color, pageSize} from '../app.constants'; import {color, pageSize} from '../app.constants';
import {AlarmService} from '../alarm/alarm.service'; import {AlarmService} from '../alarm/alarm.service';
...@@ -12,6 +12,7 @@ import {CommonService} from '../shared/common/common.service'; ...@@ -12,6 +12,7 @@ import {CommonService} from '../shared/common/common.service';
import {AnalysisService} from '../analysis/analysis.service'; import {AnalysisService} from '../analysis/analysis.service';
import {TopologyViewComponent} from '../component/topology-view/topology-view.component'; import {TopologyViewComponent} from '../component/topology-view/topology-view.component';
import {TopologyService} from '../netTopology/topology.service'; import {TopologyService} from '../netTopology/topology.service';
import {DatePipe} from '@angular/common';
@Component({ @Component({
selector: 'jhi-home', selector: 'jhi-home',
...@@ -31,7 +32,7 @@ export class HomeComponent implements OnInit, AfterViewInit { ...@@ -31,7 +32,7 @@ export class HomeComponent implements OnInit, AfterViewInit {
noData = false; noData = false;
groupList; //分组数组 groupList; //分组数组
timeList = [ timeList = [
{'label': '最近一小时', value: '0'}, {'label': '最近一小时', value: '1'},
{'label': '最近一天', value: '2'}, {'label': '最近一天', value: '2'},
{'label': '最近三天', value: '3'}, {'label': '最近三天', value: '3'},
{'label': '最近一周', value: '4'}, {'label': '最近一周', value: '4'},
...@@ -96,7 +97,7 @@ export class HomeComponent implements OnInit, AfterViewInit { ...@@ -96,7 +97,7 @@ export class HomeComponent implements OnInit, AfterViewInit {
constructor( constructor(
private overAllSer: OverAllService, private message: NzMessageService, private overAllSer: OverAllService, private message: NzMessageService,
private alarmSer: AlarmService, private renderer: Renderer2, private alarmSer: AlarmService, private renderer: Renderer2,
private layoutSer: LayoutService, private layoutSer: LayoutService,private datePipe:DatePipe,
private principal: Principal, private topologySer: TopologyService, private principal: Principal, private topologySer: TopologyService,
private eventManager: JhiEventManager, private analysisSer: AnalysisService, private eventManager: JhiEventManager, private analysisSer: AnalysisService,
private router: Router, private commonSer: CommonService, private router: Router, private commonSer: CommonService,
...@@ -130,7 +131,7 @@ export class HomeComponent implements OnInit, AfterViewInit { ...@@ -130,7 +131,7 @@ export class HomeComponent implements OnInit, AfterViewInit {
this.groupList = res.data; this.groupList = res.data;
this.obj.leftGroupId = this.groupList[0].groupid; this.obj.leftGroupId = this.groupList[0].groupid;
this.countGroupItem(); this.countGroupItem();
}else{ } else {
this.message.error(res.errMsg); this.message.error(res.errMsg);
} }
} }
...@@ -424,6 +425,7 @@ export class HomeComponent implements OnInit, AfterViewInit { ...@@ -424,6 +425,7 @@ export class HomeComponent implements OnInit, AfterViewInit {
//告警总数趋势 //告警总数趋势
getAlarmTrend() { getAlarmTrend() {
const data = { const data = {
timeType: this.timeTypeTrend,
startTime: this.trendObj.startTime, startTime: this.trendObj.startTime,
endTime: this.trendObj.endTime, endTime: this.trendObj.endTime,
}; };
...@@ -576,10 +578,41 @@ export class HomeComponent implements OnInit, AfterViewInit { ...@@ -576,10 +578,41 @@ export class HomeComponent implements OnInit, AfterViewInit {
} }
changeTrend(e) { changeTrend(e) {
this.timeTypeTrend = e;
this.isTrendLoading = true; this.isTrendLoading = true;
const timeObj = this.commonSer.getTimeByType(e); const nowDate = new Date().getTime();
this.trendObj.startTime = timeObj.startTime; let day1, day2;
this.trendObj.endTime = timeObj.endTime; switch (this.timeTypeTrend) {
case'1': {
day1 = nowDate - 1 * 60 * 60 * 1000;
this.trendObj.startTime = this.datePipe.transform(day1, 'yyyy-MM-dd') + ' 00:00:00';
this.trendObj.endTime = this.datePipe.transform(nowDate, 'yyyy-MM-dd') + ' 23:59:59';
break;
}
case'2': {
day1 = nowDate - 1 * 24 * 60 * 60 * 1000;
this.trendObj.startTime = this.datePipe.transform(day1, 'yyyy-MM-dd') + ' 00:00:00';
this.trendObj.endTime = this.datePipe.transform(day1, 'yyyy-MM-dd') + ' 23:59:59';
break;
}
case'3': {
day1 = nowDate - 3 * 24 * 60 * 60 * 1000;
day2 = nowDate;
this.trendObj.startTime = this.datePipe.transform(day1, 'yyyy-MM-dd') + ' 00:00:00';
this.trendObj.endTime = this.datePipe.transform(day2, 'yyyy-MM-dd') + ' 23:59:59';
break;
}
case'4': {
day1 = nowDate - 7 * 24 * 60 * 60 * 1000;
day2 = nowDate;
this.trendObj.startTime = this.datePipe.transform(day1, 'yyyy-MM-dd') + ' 00:00:00';
this.trendObj.endTime = this.datePipe.transform(day2, 'yyyy-MM-dd') + ' 23:59:59';
break;
}
case'5': {
break;
}
}
this.getAlarmTrend(); this.getAlarmTrend();
} }
......
...@@ -81,7 +81,7 @@ export class BasicComponent implements OnInit { ...@@ -81,7 +81,7 @@ export class BasicComponent implements OnInit {
totalNum; totalNum;
constructor(private fb: FormBuilder, private overAllSer: OverAllService, private router: Router, constructor(private fb: FormBuilder, private overAllSer: OverAllService, private router: Router,
private commonSer:CommonService, private commonSer: CommonService,
private modalService: NzModalService, private message: NzMessageService, private main: JhiMainComponent) { private modalService: NzModalService, private message: NzMessageService, private main: JhiMainComponent) {
} }
...@@ -176,10 +176,10 @@ export class BasicComponent implements OnInit { ...@@ -176,10 +176,10 @@ export class BasicComponent implements OnInit {
this.findOpStatus(); this.findOpStatus();
} }
changeStatus(status){ changeStatus(status) {
if(this.status == status){ if (this.status == status) {
this.status = null; this.status = null;
}else{ } else {
this.status = status; this.status = status;
} }
this.pageNum = 1; this.pageNum = 1;
...@@ -189,7 +189,7 @@ export class BasicComponent implements OnInit { ...@@ -189,7 +189,7 @@ export class BasicComponent implements OnInit {
/* /*
//waringName:(值为:正常,禁用,告警,严重) //waringName:(值为:正常,禁用,告警,严重)
*/ */
search(){ search() {
this.pageNum = 1; this.pageNum = 1;
this.searchRe(); this.searchRe();
} }
...@@ -198,28 +198,28 @@ export class BasicComponent implements OnInit { ...@@ -198,28 +198,28 @@ export class BasicComponent implements OnInit {
this.loading = true; this.loading = true;
this.searchStatus = true; this.searchStatus = true;
const data = { const data = {
pageNum:this.pageNum, pageNum: this.pageNum,
pageCount:this.pageCount, pageCount: this.pageCount,
obj:{ obj: {
name:this.searchName, name: this.searchName,
waringName:this.status, waringName: this.status,
groupids:[] groupids: []
} }
} };
this.overAllSer.findHostPageNew(data).subscribe( this.overAllSer.findHostPageNew(data).subscribe(
(res)=>{ (res) => {
if (res.errCode == 10000) { if (res.errCode == 10000) {
this.dataSet = res.data.data; this.dataSet = res.data.data;
this.totalNum = res.data.totalNum; this.totalNum = res.data.totalNum;
} }
this.loading = false; this.loading = false;
} }
) );
} }
//翻页 //翻页
change(event){ change(event) {
if(event > 0){ if (event > 0) {
this.pageNum = event; this.pageNum = event;
this.searchRe(); this.searchRe();
} }
...@@ -235,7 +235,7 @@ export class BasicComponent implements OnInit { ...@@ -235,7 +235,7 @@ export class BasicComponent implements OnInit {
//查询设备状态 //查询设备状态
findOpStatus() { findOpStatus() {
this.overAllSer.findHostCountByStatusByHost().subscribe( this.overAllSer.findHostCountByStatusByHost().subscribe(
(res)=>{ (res) => {
if (res.errCode == 10000) { if (res.errCode == 10000) {
this.green = res.data.normal; this.green = res.data.normal;
this.gray = res.data.disable; this.gray = res.data.disable;
...@@ -246,7 +246,7 @@ export class BasicComponent implements OnInit { ...@@ -246,7 +246,7 @@ export class BasicComponent implements OnInit {
this.message.info(res.Msg); this.message.info(res.Msg);
} }
} }
) );
} }
//添加资源 //添加资源
...@@ -261,7 +261,7 @@ export class BasicComponent implements OnInit { ...@@ -261,7 +261,7 @@ export class BasicComponent implements OnInit {
//添加监测点 //添加监测点
showBasicCheckModal(hostid, host) { showBasicCheckModal(hostid, host) {
this.smartCheck.showAddModal(hostid, host,'添加监测点'); this.smartCheck.showAddModal(hostid, host, '添加监测点');
} }
//列表 //列表
...@@ -325,7 +325,7 @@ export class BasicComponent implements OnInit { ...@@ -325,7 +325,7 @@ export class BasicComponent implements OnInit {
//删除单个资源 //删除单个资源
showDeleteConfirm(item) { showDeleteConfirm(item) {
this.commonSer.confirmThing("删除","确认删除该资源吗?",()=>{ this.commonSer.confirmThing('删除', '确认删除该资源吗?', () => {
const data = { const data = {
hostids: [] hostids: []
}; };
...@@ -340,7 +340,7 @@ export class BasicComponent implements OnInit { ...@@ -340,7 +340,7 @@ export class BasicComponent implements OnInit {
} }
} }
); );
}) });
} }
//批量删除资源 //批量删除资源
...@@ -350,7 +350,7 @@ export class BasicComponent implements OnInit { ...@@ -350,7 +350,7 @@ export class BasicComponent implements OnInit {
return false; return false;
} }
this.commonSer.confirmThing("删除","确认要删除所选设备吗?",()=>{ this.commonSer.confirmThing('删除', '确认要删除所选设备吗?', () => {
const data = { const data = {
hostids: this.batchDelList hostids: this.batchDelList
}; };
...@@ -406,7 +406,7 @@ export class BasicComponent implements OnInit { ...@@ -406,7 +406,7 @@ export class BasicComponent implements OnInit {
//添加告警 //添加告警
showAlarm() { showAlarm() {
this.smartAlarmModal.showAddModal('添加告警',null); this.smartAlarmModal.showAddModal('添加告警', null);
} }
handleOk(e) { handleOk(e) {
...@@ -539,19 +539,19 @@ export class BasicComponent implements OnInit { ...@@ -539,19 +539,19 @@ export class BasicComponent implements OnInit {
} }
//前往设备类型页面 //前往设备类型页面
goEquip(item){ goEquip(item) {
let type; let type;
if(item.equipmentType == "数据库"){ if (item.equipmentType == '数据库') {
type = "database"; type = 'database';
}else if(item.equipmentType == "交换机"){ } else if (item.equipmentType == '交换机') {
type = "switch" type = 'switch';
}else{ } else {
type = "server" type = 'server';
} }
this.router.navigate(['app/main/'+type], { this.router.navigate(['app/main/' + type], {
queryParams: { queryParams: {
hostId: item.hostid, hostId: item.hostid,
equipmentType:item.equipmentType equipmentType: item.equipmentType
} }
}); });
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment