You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
89 lines
2.3 KiB
89 lines
2.3 KiB
10 months ago
|
import { Component, OnInit } from '@angular/core';
|
||
|
import { NzMessageService } from 'ng-zorro-antd';
|
||
|
import { NoticeService } from '../../service/https/notice.service';
|
||
|
import { CacheService } from '../../service/cache/cache.service';
|
||
|
|
||
|
|
||
|
|
||
|
@Component({
|
||
|
selector: 'app-manage',
|
||
|
templateUrl: './manage.component.html',
|
||
|
styleUrls: ['./manage.component.styl']
|
||
|
})
|
||
|
export class ManageComponent implements OnInit {
|
||
|
dateFormat = 'yyyy/MM/dd HH:mm:ss'
|
||
|
dateRange = []
|
||
|
listOfData = []
|
||
|
iphead = []
|
||
|
dimension = '1'
|
||
|
isVisible = false
|
||
|
constructor(
|
||
|
private noticeService: NoticeService,
|
||
|
public message: NzMessageService,
|
||
|
public cache: CacheService
|
||
|
) { }
|
||
|
|
||
|
onSubmit(){
|
||
|
this.isVisible = true
|
||
|
console.log(123)
|
||
|
|
||
|
console.log(this.dimension)
|
||
|
console.log("Selected Date Range: ", this.dateRange);
|
||
|
if (this.dateRange.length === 2) {
|
||
|
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.');
|
||
|
}
|
||
|
|
||
|
this.noticeService.getQueryRange().subscribe(resp => {
|
||
|
if (resp.status === 200) {
|
||
|
console.log(resp.data);
|
||
|
} else {
|
||
|
this.message.error(resp.msg);
|
||
|
}
|
||
|
},
|
||
|
error => {
|
||
|
this.message.error('服务器错误');
|
||
|
})
|
||
|
}
|
||
|
ngOnInit() {
|
||
|
const now = new Date();
|
||
|
const oneWeekAgo = new Date();
|
||
|
oneWeekAgo.setDate(now.getDate() - 7);
|
||
|
|
||
|
this.dateRange = [oneWeekAgo, now];
|
||
|
}
|
||
|
getMenuItem(e) {
|
||
|
console.log(e.el.dataset.id);
|
||
|
// this.key = e.el.dataset.id;
|
||
|
}
|
||
|
selectValChange(){
|
||
|
console.log("xxxx"+this.dimension)
|
||
|
|
||
|
this.noticeService.getUebaResult(this.dimension).subscribe(resp => {
|
||
|
if (resp.status === 200) {
|
||
|
switch(this.dimension.toString()){
|
||
|
case "1":
|
||
|
this.listOfData = resp["summary"]["ip"];
|
||
|
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('服务器错误');
|
||
|
})
|
||
|
}
|
||
|
}
|