|
|
@ -71,7 +71,7 @@ export class ManageComponent implements OnInit { |
|
|
|
isVisible = false |
|
|
|
isVisible = false |
|
|
|
detail_data : any; |
|
|
|
detail_data : any; |
|
|
|
destroySubscriptions: Subscription[] = []; |
|
|
|
destroySubscriptions: Subscription[] = []; |
|
|
|
exportIsVisable = true; |
|
|
|
|
|
|
|
constructor( |
|
|
|
constructor( |
|
|
|
private noticeService: NoticeService, |
|
|
|
private noticeService: NoticeService, |
|
|
|
public message: NzMessageService, |
|
|
|
public message: NzMessageService, |
|
|
@ -91,83 +91,91 @@ export class ManageComponent implements OnInit { |
|
|
|
saveAs(data, fileName + '_export_' + new Date().getTime() + EXCEL_EXTENSION);
|
|
|
|
saveAs(data, fileName + '_export_' + new Date().getTime() + EXCEL_EXTENSION);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private getAnalysisResult(startDate,endDate,queryDates){ // 获取es的查询最大日期范围
|
|
|
|
onSubmit(){ |
|
|
|
this.noticeService.getQueryRange().subscribe(resp => { |
|
|
|
// 日期校验
|
|
|
|
console.log("resp.retcode"+resp.retcode); |
|
|
|
|
|
|
|
if (resp.retcode === 200) { |
|
|
|
|
|
|
|
console.log(resp.data.query_range); |
|
|
|
|
|
|
|
if (queryDates >resp.data.query_range ){ |
|
|
|
|
|
|
|
alert('查询范围不能超过'+resp.data.query_range+'天'); |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
}else{ |
|
|
|
|
|
|
|
this.submitLoading = true; |
|
|
|
this.submitLoading = true; |
|
|
|
this.noticeService.getUebaResult({"type":this.dimension,"startDate":startDate,"endDate":endDate}).subscribe(resp => { |
|
|
|
this.tableisShow = this.dimension; |
|
|
|
if (resp.code === 200) { |
|
|
|
if (this.dateRange.length === 2) { |
|
|
|
this.summary_detal_data = resp |
|
|
|
const startDate = this.dateRange[0]; |
|
|
|
|
|
|
|
const endDate = this.dateRange[1]; |
|
|
|
|
|
|
|
console.log(startDate); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//alert(`Selected Date Range: ${startDate.toLocaleDateString()} - ${endDate.toLocaleDateString()}`);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
alert('Please select a date range.'); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// 获取es的查询最大日期范围
|
|
|
|
|
|
|
|
// this.noticeService.getQueryRange().subscribe(resp => {
|
|
|
|
|
|
|
|
// if (resp.status === 200) {
|
|
|
|
|
|
|
|
// console.log(resp.data);
|
|
|
|
|
|
|
|
// } else {
|
|
|
|
|
|
|
|
// this.message.error(resp.msg);
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// },
|
|
|
|
|
|
|
|
// error => {
|
|
|
|
|
|
|
|
// this.message.error('服务器错误');
|
|
|
|
|
|
|
|
// })
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 获取es数据 暂时mock数据
|
|
|
|
|
|
|
|
this.summary_detal_data = this.mockData |
|
|
|
|
|
|
|
this.listOfData=[] |
|
|
|
|
|
|
|
if (this.summary_detal_data.code === 0) { |
|
|
|
switch(this.dimension.toString()){ |
|
|
|
switch(this.dimension.toString()){ |
|
|
|
case "1": |
|
|
|
case "1": |
|
|
|
this.listOfData = resp.data.summary.ip; |
|
|
|
this.listOfData = this.summary_detal_data.data.summary.ip; |
|
|
|
|
|
|
|
console.log("1"+this.dimension.toString()) |
|
|
|
break; |
|
|
|
break; |
|
|
|
case "2": |
|
|
|
case "2": |
|
|
|
this.listOfData = resp.data.summary.account; |
|
|
|
this.listOfData = this.summary_detal_data.data.summary.account; |
|
|
|
|
|
|
|
console.log("2"+this.dimension.toString()) |
|
|
|
break; |
|
|
|
break; |
|
|
|
case "3": |
|
|
|
case "3": |
|
|
|
this.listOfData = resp.data.summary.interface; |
|
|
|
this.listOfData = this.summary_detal_data.data.summary.interface; |
|
|
|
|
|
|
|
console.log("3"+this.dimension.toString()) |
|
|
|
break; |
|
|
|
break; |
|
|
|
case "4": |
|
|
|
case "4": |
|
|
|
this.listOfData = resp.data.summary.menu; |
|
|
|
this.listOfData = this.summary_detal_data.data.summary.menu; |
|
|
|
|
|
|
|
console.log("4"+this.dimension.toString()) |
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
this.tableisShow = this.dimension; |
|
|
|
|
|
|
|
this.submitLoading = false; |
|
|
|
|
|
|
|
if(this.tableisShow!=undefined){ |
|
|
|
|
|
|
|
this.exportIsVisable = false; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
error => { |
|
|
|
|
|
|
|
this.message.error('服务器错误'); |
|
|
|
|
|
|
|
this.submitLoading = false; |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
// this.tableisShow = this.dimension;
|
|
|
|
|
|
|
|
//this.submitLoading = false;
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}else{ |
|
|
|
|
|
|
|
return undefined; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
error => { |
|
|
|
|
|
|
|
this.message.error('服务器错误'); |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private querySubmit(){ |
|
|
|
|
|
|
|
var startDate :any; |
|
|
|
|
|
|
|
var endDate :any; |
|
|
|
|
|
|
|
if (this.dateRange.length === 2) { |
|
|
|
|
|
|
|
startDate = this.dateRange[0]; |
|
|
|
|
|
|
|
endDate = this.dateRange[1];
|
|
|
|
|
|
|
|
} else { |
|
|
|
} else { |
|
|
|
alert('请选择查询范围'); |
|
|
|
this.message.error("error"); |
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
let timeDiff = Math.abs(endDate.getTime() - startDate.getTime()); |
|
|
|
// this.listOfData = resp.data.summary.ip;
|
|
|
|
let diffDays = Math.ceil(timeDiff / (1000 * 3600 * 24)); |
|
|
|
// this.noticeService.getUebaResult({"type":eventVal}).subscribe(resp => {
|
|
|
|
|
|
|
|
// if (resp.code === 200) {
|
|
|
|
this.getAnalysisResult(startDate,endDate,diffDays) |
|
|
|
// switch(this.dimension.toString()){
|
|
|
|
} |
|
|
|
// case "1":
|
|
|
|
onSubmit(){ |
|
|
|
// this.listOfData = resp.summary.ip;
|
|
|
|
this.querySubmit(); |
|
|
|
// case "2":
|
|
|
|
|
|
|
|
// this.listOfData = resp.summary.account;
|
|
|
|
|
|
|
|
// case "3":
|
|
|
|
|
|
|
|
// this.listOfData = resp.summary.interface;
|
|
|
|
|
|
|
|
// case "4":
|
|
|
|
|
|
|
|
// this.listOfData = resp.summary.menu;
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// } else {
|
|
|
|
|
|
|
|
// this.message.error(resp.msg);
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// },
|
|
|
|
|
|
|
|
// error => {
|
|
|
|
|
|
|
|
// this.message.error('服务器错误');
|
|
|
|
|
|
|
|
// })
|
|
|
|
} |
|
|
|
} |
|
|
|
ngOnInit() { |
|
|
|
ngOnInit() { |
|
|
|
const now = new Date(); |
|
|
|
const now = new Date(); |
|
|
|
const oneWeekAgo = new Date(); |
|
|
|
const oneWeekAgo = new Date(); |
|
|
|
oneWeekAgo.setDate(now.getDate() - 7); |
|
|
|
oneWeekAgo.setDate(now.getDate() - 7); |
|
|
|
|
|
|
|
|
|
|
|
this.dateRange = [oneWeekAgo, now]; |
|
|
|
this.dateRange = [oneWeekAgo, now]; |
|
|
|
//this.onSubmit()
|
|
|
|
|
|
|
|
|
|
|
|
this.onSubmit() |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
getMenuItem(e) { |
|
|
|
|
|
|
|
console.log(e.el.dataset.id); |
|
|
|
|
|
|
|
// this.key = e.el.dataset.id;
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
exportExcel(){ |
|
|
|
exportExcel(){ |
|
|
@ -198,7 +206,6 @@ export class ManageComponent implements OnInit { |
|
|
|
|
|
|
|
|
|
|
|
showModel(data){ |
|
|
|
showModel(data){ |
|
|
|
var tmpdata :any; |
|
|
|
var tmpdata :any; |
|
|
|
if(this.summary_detal_data != undefined){ |
|
|
|
|
|
|
|
switch(data.type){ |
|
|
|
switch(data.type){ |
|
|
|
case 1: |
|
|
|
case 1: |
|
|
|
tmpdata=this.summary_detal_data.data.detail.ip[data.key]; |
|
|
|
tmpdata=this.summary_detal_data.data.detail.ip[data.key]; |
|
|
@ -215,8 +222,6 @@ export class ManageComponent implements OnInit { |
|
|
|
} |
|
|
|
} |
|
|
|
var diagData = { |
|
|
|
var diagData = { |
|
|
|
"type": data.type, |
|
|
|
"type": data.type, |
|
|
|
"startTime": Math.floor(this.dateRange[0].getTime() / 1000), |
|
|
|
|
|
|
|
"endTime": Math.floor(this.dateRange[1].getTime() / 1000), |
|
|
|
|
|
|
|
[data.key]: tmpdata |
|
|
|
[data.key]: tmpdata |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -224,7 +229,6 @@ export class ManageComponent implements OnInit { |
|
|
|
console.log(JSON.stringify(this.detail_data)); |
|
|
|
console.log(JSON.stringify(this.detail_data)); |
|
|
|
this.isVisible=true;
|
|
|
|
this.isVisible=true;
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
cancelSearch(): void { |
|
|
|
cancelSearch(): void { |
|
|
|
this.submitLoading = false; |
|
|
|
this.submitLoading = false; |
|
|
|
this.logLoading = false; |
|
|
|
this.logLoading = false; |
|
|
|