Commit 4042b28d authored by wangqinghua's avatar wangqinghua

单位

parent daf938e5
...@@ -17,20 +17,20 @@ import {CommonService} from '../../../shared/common/common.service'; ...@@ -17,20 +17,20 @@ import {CommonService} from '../../../shared/common/common.service';
padding: 10px; padding: 10px;
} }
.chart-left{ .chart-left {
margin-left: 20px; margin-left: 20px;
} }
.chart-left p{ .chart-left p {
margin-left: 20px; margin-left: 20px;
} }
` `
] ]
}) })
export class NetworkDetailComponent implements OnInit, OnChanges { export class NetworkDetailComponent implements OnInit, OnChanges {
@ViewChild('chartSpeedLeft') chartSpeedLeft:ElementRef; @ViewChild('chartSpeedLeft') chartSpeedLeft: ElementRef;
@ViewChild('chartTimeLeft') chartTimeLeft:ElementRef; @ViewChild('chartTimeLeft') chartTimeLeft: ElementRef;
@ViewChild('smartWebsite') smartWebsite:WebsiteComponent; @ViewChild('smartWebsite') smartWebsite: WebsiteComponent;
httptestid; //网站ID httptestid; //网站ID
webName; //网站名称 webName; //网站名称
...@@ -55,8 +55,8 @@ export class NetworkDetailComponent implements OnInit, OnChanges { ...@@ -55,8 +55,8 @@ export class NetworkDetailComponent implements OnInit, OnChanges {
totalNum = 0; totalNum = 0;
constructor(private overAllSer: OverAllService, private routerInfo: ActivatedRoute,private router:Router, constructor(private overAllSer: OverAllService, private routerInfo: ActivatedRoute, private router: Router,
private message: NzMessageService, private datePipe: DatePipe,private commonSer:CommonService) { private message: NzMessageService, private datePipe: DatePipe, private commonSer: CommonService) {
} }
ngOnInit() { ngOnInit() {
...@@ -73,7 +73,7 @@ export class NetworkDetailComponent implements OnInit, OnChanges { ...@@ -73,7 +73,7 @@ export class NetworkDetailComponent implements OnInit, OnChanges {
this.getNowStatus(); this.getNowStatus();
} }
ngOnChanges(){ ngOnChanges() {
} }
//历史告警 //历史告警
...@@ -96,9 +96,9 @@ export class NetworkDetailComponent implements OnInit, OnChanges { ...@@ -96,9 +96,9 @@ export class NetworkDetailComponent implements OnInit, OnChanges {
(res) => { (res) => {
if (res.errCode == 10000) { if (res.errCode == 10000) {
this.nowStatus = res.data; this.nowStatus = res.data;
this.nowStatus.forEach(e=>{ this.nowStatus.forEach(e => {
this.totalNum += e.response; this.totalNum += e.response;
}) });
} }
} }
); );
...@@ -185,7 +185,27 @@ export class NetworkDetailComponent implements OnInit, OnChanges { ...@@ -185,7 +185,27 @@ export class NetworkDetailComponent implements OnInit, OnChanges {
left: '40%', left: '40%',
}, },
tooltip: { tooltip: {
trigger: 'axis' // trigger: 'axis',
formatter: (params) => {
if (params.data) {
let res = params.seriesName;
res += '<br/>时间:' + params.name;
let Gbps = 1000 * 1000 * 1000;
let Mbps = 1000 * 1000;
let kbps = 1000;
let size = Math.abs(params.data);
if (size / Gbps > 1) {
res += '<br/>流量:' + (size / Gbps).toFixed(2) + 'Gbps';
} else if (size / Mbps > 1) {
res += '<br/>流量:' + (size / Mbps).toFixed(2) + 'Mbps';
} else if (size / kbps > 1) {
res += '<br/>流量:' + (size / kbps).toFixed(2) + 'kbps';
} else {
res += '<br/>流量:' + (size) + 'bbps';
}
return res;
}
}
}, },
grid: { grid: {
left: '3%', left: '3%',
...@@ -205,12 +225,20 @@ export class NetworkDetailComponent implements OnInit, OnChanges { ...@@ -205,12 +225,20 @@ export class NetworkDetailComponent implements OnInit, OnChanges {
boundaryGap: false, boundaryGap: false,
data: speed[0].data.map(res => { data: speed[0].data.map(res => {
return res.date; return res.date;
}) }),
}, },
yAxis: { yAxis: {
type: 'value' type: 'value',
axisLabel: { //Y轴数据
formatter: function(value) {
return Math.abs(value) / 1000 + ' kbps';
}, },
series: speed.map((res1,index) => { textStyle: {
color: '#666'
}
},
},
series: speed.map((res1, index) => {
const number = res1.data.map(res2 => { const number = res1.data.map(res2 => {
return res2.val; return res2.val;
}); });
...@@ -218,10 +246,10 @@ export class NetworkDetailComponent implements OnInit, OnChanges { ...@@ -218,10 +246,10 @@ export class NetworkDetailComponent implements OnInit, OnChanges {
name: res1.name, name: res1.name,
type: 'line', type: 'line',
stack: '总量', stack: '总量',
itemStyle : { itemStyle: {
normal : { normal: {
lineStyle:{ lineStyle: {
color:this.colorArr[index] color: this.colorArr[index]
} }
} }
}, },
...@@ -237,7 +265,16 @@ export class NetworkDetailComponent implements OnInit, OnChanges { ...@@ -237,7 +265,16 @@ export class NetworkDetailComponent implements OnInit, OnChanges {
left: '40%', left: '40%',
}, },
tooltip: { tooltip: {
trigger: 'axis' // trigger: 'axis',
formatter: (params) => {
console.log(params);
if (params.data) {
let res = params.seriesName;
res += '<br/>时间:' + params.name;
res += '<br/>相应时间:' + params.data+'s';
return res;
}
}
}, },
grid: { grid: {
left: '3%', left: '3%',
...@@ -260,9 +297,17 @@ export class NetworkDetailComponent implements OnInit, OnChanges { ...@@ -260,9 +297,17 @@ export class NetworkDetailComponent implements OnInit, OnChanges {
}) })
}, },
yAxis: { yAxis: {
type: 'value' type: 'value',
axisLabel: { //Y轴数据
formatter: function(value) {
return value + ' s';
},
textStyle: {
color: '#666'
}
},
}, },
series: time.map((res1,index) => { series: time.map((res1, index) => {
const number = res1.data.map(res2 => { const number = res1.data.map(res2 => {
return res2.val; return res2.val;
}); });
...@@ -270,10 +315,10 @@ export class NetworkDetailComponent implements OnInit, OnChanges { ...@@ -270,10 +315,10 @@ export class NetworkDetailComponent implements OnInit, OnChanges {
name: res1.name, name: res1.name,
type: 'line', type: 'line',
stack: '总量', stack: '总量',
itemStyle : { itemStyle: {
normal : { normal: {
lineStyle:{ lineStyle: {
color:this.colorArr[index] color: this.colorArr[index]
} }
} }
}, },
...@@ -287,23 +332,23 @@ export class NetworkDetailComponent implements OnInit, OnChanges { ...@@ -287,23 +332,23 @@ export class NetworkDetailComponent implements OnInit, OnChanges {
} }
//编辑网站 //编辑网站
editBasicModal(){ editBasicModal() {
this.smartWebsite.showEditModal(this.httptestid); this.smartWebsite.showEditModal(this.httptestid);
} }
//单个删除 //单个删除
showDeleteConfirm(){ showDeleteConfirm() {
this.commonSer.confirmThing("删除","确认要删除该网站监测吗",()=>{ this.commonSer.confirmThing('删除', '确认要删除该网站监测吗', () => {
let arr = []; let arr = [];
arr.push(this.httptestid); arr.push(this.httptestid);
const data = { const data = {
ids:arr ids: arr
}; };
this.overAllSer.deleteBatch(data).subscribe( this.overAllSer.deleteBatch(data).subscribe(
(res) => { (res) => {
if (res.errCode == 10000) { if (res.errCode == 10000) {
this.message.success('删除成功'); this.message.success('删除成功');
this.router.navigate(['app/main/networkCheck']) this.router.navigate(['app/main/networkCheck']);
} else { } else {
this.message.error(res.errMsg); this.message.error(res.errMsg);
} }
......
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