Commit 4042b28d authored by wangqinghua's avatar wangqinghua

单位

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