Commit bcfeb6fe authored by wangqinghua's avatar wangqinghua

update

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