Commit 1a1c0355 authored by wangqinghua's avatar wangqinghua

update

parent 8ed14360
...@@ -20,14 +20,14 @@ ...@@ -20,14 +20,14 @@
</div> </div>
<div nz-row [nzGutter]="4" class="search-form"> <div nz-row [nzGutter]="4" class="search-form">
<div nz-col nzSpan="3"> <div nz-col nzSpan="3">
<nz-select style="width: 100%;" nzShowSearch nzAllowClear nzPlaceHolder="选择分组" [(ngModel)]="obj.groupid" (ngModelChange)="getList($event)"> <nz-select style="width: 100%;" nzPlaceHolder="选择分组" [(ngModel)]="obj.groupid" (ngModelChange)="getList()">
<ng-container *ngFor="let item of groupList"> <ng-container *ngFor="let item of groupList">
<nz-option nzLabel="{{item.name}}" nzValue="{{item.groupid}}"></nz-option> <nz-option nzLabel="{{item.name}}" nzValue="{{item.groupid}}"></nz-option>
</ng-container> </ng-container>
</nz-select> </nz-select>
</div> </div>
<div nz-col nzSpan="3"> <div nz-col nzSpan="3">
<nz-select style="width: 100%;" nzShowSearch nzAllowClear nzPlaceHolder="选择告资源" [(ngModel)]="obj.hostid" (ngModelChange)="getListIO()"> <nz-select style="width: 100%;" nzPlaceHolder="选择告资源" [(ngModel)]="obj.hostid" (ngModelChange)="getListIO()">
<ng-container *ngFor="let item of hostList;"> <ng-container *ngFor="let item of hostList;">
<nz-option nzLabel="{{item.name}}" nzValue="{{item.hostid}}"></nz-option> <nz-option nzLabel="{{item.name}}" nzValue="{{item.hostid}}"></nz-option>
</ng-container> </ng-container>
...@@ -57,7 +57,7 @@ ...@@ -57,7 +57,7 @@
></nz-date-picker> ></nz-date-picker>
</div> </div>
</div> </div>
<div echarts [options]="chartOption" style="height: 420px;width: 100%"></div> <div echarts [options]="chartOption" style="height: 400px;width: 100%"></div>
<nz-tabset [nzTabPosition]="'top'" [nzType]="'card'"> <nz-tabset [nzTabPosition]="'top'" [nzType]="'card'">
<nz-tab nzTitle="接收流量排行"> <nz-tab nzTitle="接收流量排行">
<nz-table #nzTable [nzData]="inList" [nzLoading]="inLoading" [nzFrontPagination]="false" [nzTotal]="inTotalNum" [nzPageIndex]="inPageNum" [nzPageSize]="inPageCount" (nzPageIndexChange)="inChnagePage($event)"> <nz-table #nzTable [nzData]="inList" [nzLoading]="inLoading" [nzFrontPagination]="false" [nzTotal]="inTotalNum" [nzPageIndex]="inPageNum" [nzPageSize]="inPageCount" (nzPageIndexChange)="inChnagePage($event)">
...@@ -71,7 +71,7 @@ ...@@ -71,7 +71,7 @@
</thead> </thead>
<tbody> <tbody>
<ng-container *ngFor="let item of inList"> <ng-container *ngFor="let item of inList">
<tr (click)="getEcharts(item)"> <tr (click)="getEcharts(item.itemid)">
<td>{{item.itemName}}</td> <td>{{item.itemName}}</td>
<td>{{item.max}}</td> <td>{{item.max}}</td>
<td>{{item.min}}</td> <td>{{item.min}}</td>
...@@ -93,12 +93,14 @@ ...@@ -93,12 +93,14 @@
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr *ngFor="let data of outList"> <ng-container *ngFor="let data of outList">
<tr (click)="getEcharts(data.itemid)">
<td>{{data.itemName}}</td> <td>{{data.itemName}}</td>
<td>{{data.max}}</td> <td>{{data.max}}</td>
<td>{{data.min}}</td> <td>{{data.min}}</td>
<td>{{data.avg}}</td> <td>{{data.avg}}</td>
</tr> </tr>
</ng-container>
</tbody> </tbody>
</nz-table> </nz-table>
</nz-tab> </nz-tab>
......
...@@ -48,7 +48,6 @@ export class FlowTrendComponent implements OnInit { ...@@ -48,7 +48,6 @@ export class FlowTrendComponent implements OnInit {
} }
ngOnInit() { ngOnInit() {
this.getGroup();
const today = new Date().getTime(); const today = new Date().getTime();
this.obj.startTime = this.datePipe.transform(today,"yyyy-MM-dd") + " 00:00:00"; this.obj.startTime = this.datePipe.transform(today,"yyyy-MM-dd") + " 00:00:00";
this.obj.endTime = this.datePipe.transform(today,"yyyy-MM-dd") + " 23:59:59"; this.obj.endTime = this.datePipe.transform(today,"yyyy-MM-dd") + " 23:59:59";
...@@ -66,9 +65,9 @@ export class FlowTrendComponent implements OnInit { ...@@ -66,9 +65,9 @@ export class FlowTrendComponent implements OnInit {
} }
//查询主机 //查询主机
onchange(e) { onchange() {
const data = { const data = {
'groupids': [e], 'groupids': [this.obj.groupid],
'hostExtend': { 'hostExtend': {
'superiorHostid': null 'superiorHostid': null
} }
...@@ -77,22 +76,32 @@ export class FlowTrendComponent implements OnInit { ...@@ -77,22 +76,32 @@ export class FlowTrendComponent implements OnInit {
(res) => { (res) => {
if (res.errCode == 10000) { if (res.errCode == 10000) {
this.hostList = res.data; this.hostList = res.data;
this.obj.hostid = this.hostList[0].hostList;
this.getEcharts(null);
} }
} }
); );
} }
//获取图标数据 //获取图标数据
getEcharts(item) { getEcharts(itemid) {
const data= { const data= {
itemid: item.itemid, itemid: itemid,
endTime: this.obj.endTime, endTime: this.obj.endTime,
startTime: this.obj.startTime startTime: this.obj.startTime,
hostid:this.obj.hostid,
groupid:this.obj.groupid,
type:'in',
}; };
this.topologySer.findTrendData(data).subscribe( this.topologySer.findTrendData(data).subscribe(
(res) => { (res) => {
if(res.errCode == 10000){ if(res.errCode == 10000){
data.type = "out";
this.topologySer.findTrendData(data).subscribe(
(res)=>{
this.setEacharts(); this.setEacharts();
}
)
}else{ }else{
this.message.warning(res.errMsg); this.message.warning(res.errMsg);
} }
...@@ -183,9 +192,9 @@ export class FlowTrendComponent implements OnInit { ...@@ -183,9 +192,9 @@ export class FlowTrendComponent implements OnInit {
} }
//获取流量 //获取流量
getList(e) { getList() {
this.obj.hostid = null; this.obj.hostid = null;
this.onchange(e); this.onchange();
this.getInList(); this.getInList();
this.getOutList(); this.getOutList();
} }
...@@ -304,6 +313,7 @@ export class FlowTrendComponent implements OnInit { ...@@ -304,6 +313,7 @@ export class FlowTrendComponent implements OnInit {
this.obj.startTime = this.datePipe.transform(this.timeBegin,'yyyy-MM-dd HH:mm:ss'); this.obj.startTime = this.datePipe.transform(this.timeBegin,'yyyy-MM-dd HH:mm:ss');
this.obj.endTime = this.datePipe.transform(this.timeEnd,'yyyy-MM-dd HH:mm:ss'); this.obj.endTime = this.datePipe.transform(this.timeEnd,'yyyy-MM-dd HH:mm:ss');
} }
this.getEcharts(null);
this.getInList(); this.getInList();
this.getOutList(); this.getOutList();
} }
......
...@@ -26,7 +26,6 @@ ...@@ -26,7 +26,6 @@
<nz-option [nzLabel]="item.name" [nzValue]="item.id"></nz-option> <nz-option [nzLabel]="item.name" [nzValue]="item.id"></nz-option>
</ng-container> </ng-container>
</nz-select> </nz-select>
<!--<span (click)="edit()">编辑</span>-->
</div> </div>
<div nz-col nzSpan="12" class="text-right"> <div nz-col nzSpan="12" class="text-right">
<button nz-button (click)="addTopo()" nzType="default"><i class="anticon anticon-plus"></i>添加</button> <button nz-button (click)="addTopo()" nzType="default"><i class="anticon anticon-plus"></i>添加</button>
...@@ -40,7 +39,7 @@ ...@@ -40,7 +39,7 @@
<div class="layui-header layui-bg-gray" style="line-height: 60px"> <div class="layui-header layui-bg-gray" style="line-height: 60px">
设备:<span (click)="addDevice()">添加</span> 设备:<span (click)="addDevice()">添加</span>
<span onClick="editor.utils.deleteSelectedNodes()">移除</span> <span onClick="editor.utils.deleteSelectedNodes()">移除</span>
监测点:<span (click)="addCheck()">添加</span> <span>移除</span> 监测点:<span (click)="addCheck()">添加</span>
<span (click)="showAddImg()">添加图片</span> <span (click)="showAddImg()">添加图片</span>
<!-- 顶部工具栏 --> <!-- 顶部工具栏 -->
<div class="layui-nav layui-layout-right" > <div class="layui-nav layui-layout-right" >
...@@ -72,8 +71,8 @@ ...@@ -72,8 +71,8 @@
您的浏览器不支持HTML5! 您的浏览器不支持HTML5!
</canvas> </canvas>
<div class="checkList"> <div class="checkList">
<p *ngFor="let item of checkJson"> <p *ngFor="let item of checkJson;let i = index;">
<span [style.fontSize]="item.fontSize +'px'">{{item.name}}</span> <span [style.fontSize]="item.fontSize +'px'">{{item.name}}</span><i (click)="deleteCheck(i)" class="minus anticon anticon-minus-circle-o"></i>
</p> </p>
</div> </div>
</div> </div>
...@@ -110,7 +109,7 @@ ...@@ -110,7 +109,7 @@
<div class="layui-inline"> <div class="layui-inline">
<label class="layui-form-label">线条颜色</label> <label class="layui-form-label">线条颜色</label>
<div class="layui-input-block"> <div class="layui-input-block">
<input type="color" name="lineColor" required autocomplete="off" class="layui-input"> <input style="width: 100px;" type="color" name="lineColor" required autocomplete="off" class="layui-input">
</div> </div>
</div> </div>
</div> </div>
......
...@@ -41,6 +41,16 @@ declare var layui: any; ...@@ -41,6 +41,16 @@ declare var layui: any;
color: #666666; color: #666666;
font-size: 20px; font-size: 20px;
} }
.layui-form-label{
width: 110px;
}
.minus{
vertical-align: middle;
color: red;
font-size: 15px;
margin-left: 12px;
cursor: pointer;
}
` `
] ]
}) })
...@@ -53,8 +63,10 @@ export class NeTopologyComponent implements OnInit, AfterViewInit { ...@@ -53,8 +63,10 @@ export class NeTopologyComponent implements OnInit, AfterViewInit {
dataSet; dataSet;
isVisible = false; isVisible = false;
image; image;
topoId; topoId;
name; name;
refreshRete;
checkJson = []; checkJson = [];
fileList: UploadFile[] = []; fileList: UploadFile[] = [];
...@@ -109,7 +121,6 @@ export class NeTopologyComponent implements OnInit, AfterViewInit { ...@@ -109,7 +121,6 @@ export class NeTopologyComponent implements OnInit, AfterViewInit {
//获取设备图片 //获取设备图片
setImg(e){ setImg(e){
console.log(e);
editor.utils.addNode(e[0].icon,'图片'); editor.utils.addNode(e[0].icon,'图片');
} }
...@@ -135,6 +146,8 @@ export class NeTopologyComponent implements OnInit, AfterViewInit { ...@@ -135,6 +146,8 @@ export class NeTopologyComponent implements OnInit, AfterViewInit {
let data = { let data = {
id: this.topoId, id: this.topoId,
json: JSON.stringify(json), json: JSON.stringify(json),
refreshRete:this.refreshRete,
name:this.name
}; };
this.topologySer.update(data).subscribe( this.topologySer.update(data).subscribe(
(res) => { (res) => {
...@@ -160,14 +173,28 @@ export class NeTopologyComponent implements OnInit, AfterViewInit { ...@@ -160,14 +173,28 @@ export class NeTopologyComponent implements OnInit, AfterViewInit {
this.checkJson = json.check; this.checkJson = json.check;
} }
this.name = res.data.name; this.name = res.data.name;
this.refreshRete = res.data.refreshRete;
this.topoId = res.data.id; this.topoId = res.data.id;
editor.utils.editTopology(); editor.utils.editTopology();
this.findItemStatus();
} }
} }
); );
} }
//查询监控点状态 //查询监控点状态
findItemStatus(){
const data = {
httpTestIds:this.checkJson.map(e=>{
return e.id;
})
};
this.topologySer.findElementStatus(data).subscribe(
(res)=>{
}
)
}
//删除拓扑图 //删除拓扑图
deleteTopo() { deleteTopo() {
...@@ -205,9 +232,13 @@ export class NeTopologyComponent implements OnInit, AfterViewInit { ...@@ -205,9 +232,13 @@ export class NeTopologyComponent implements OnInit, AfterViewInit {
this.checkJson.push(JSON.parse(event)); this.checkJson.push(JSON.parse(event));
} }
//删除监测点
deleteCheck(index){
this.checkJson.splice(index,1);
}
//load //load
loadCanvas() { loadCanvas() {
// 节点树中每个节点的拖放动作定义给拓扑图编辑器 // 节点树中每个节点的拖放动作定义给拓扑图编辑器
let nodes = $('[topo-div-type=\'topo-node\']'); let nodes = $('[topo-div-type=\'topo-node\']');
let nodeLength = nodes.length; let nodeLength = nodes.length;
......
...@@ -158,7 +158,7 @@ function TopologyEditor() { ...@@ -158,7 +158,7 @@ function TopologyEditor() {
linkShadow: false, // 是否显示连线阴影 linkShadow: false, // 是否显示连线阴影
linkShadowColor: 'rgba(0,0,0,0.5)', linkShadowColor: 'rgba(0,0,0,0.5)',
linkFont: '12px Consolas', // 节点字体 linkFont: '12px Consolas', // 节点字体
linkFontColor: 'black', // 连线文字颜色,如"255,255,0" linkFontColor: 'red', // 连线文字颜色,如"255,255,0"
linkArrowsRadius: 0, // 线条箭头半径 linkArrowsRadius: 0, // 线条箭头半径
linkDefaultWidth: 3, // 连线宽度 linkDefaultWidth: 3, // 连线宽度
linkOffsetGap: 40, // 折线拐角处的长度 linkOffsetGap: 40, // 折线拐角处的长度
...@@ -610,31 +610,30 @@ TopologyEditor.prototype.init = function (topologyGuid, backImg, topologyJson) { ...@@ -610,31 +610,30 @@ TopologyEditor.prototype.init = function (topologyGuid, backImg, topologyJson) {
// 只处理双击节点事件 // 只处理双击节点事件
if (event.target instanceof JTopo.Node && editor.stageMode === 'edit') { if (event.target instanceof JTopo.Node && editor.stageMode === 'edit') {
console.log(event.target) return false;
// alert('双击了节点') // alert('双击了节点')
// 查询单个节点的信息, 回填数据 // 查询单个节点的信息, 回填数据
layer.open({ // layer.open({
title: "编辑设备", // title: "编辑设备",
type: 1, // type: 1,
area: ['600px', '500px'], // area: ['600px', '500px'],
content: $("#node-dialog"), // content: $("#node-dialog"),
btn: ["应用", "删除", "取消"], // btn: ["应用", "删除", "取消"],
yes: function(index, layero){ // yes: function(index, layero){
var param = getParam("node-form"); // var param = getParam("node-form");
self.currentNode.text = param.text; // self.currentNode.text = param.text;
self.currentNode.textPosition = param.textPosition; // self.currentNode.textPosition = param.textPosition;
self.currentNode.setLocation(param.x, param.y); // self.currentNode.setLocation(param.x, param.y);
$("#node-dialog").css("display","none") // $("#node-dialog").css("display","none")
}, // },
btn2: function () { // btn2: function () {
editor.utils.deleteNode(self.currentNode); // editor.utils.deleteNode(self.currentNode);
}, // },
cancel:function () { // cancel:function () {
$("#node-dialog").css("display","none") // $("#node-dialog").css("display","none")
} // }
}); // });
} else if (event.target instanceof JTopo.Link && editor.stageMode === 'edit') { } else if (event.target instanceof JTopo.Link && editor.stageMode === 'edit') {
console.log("编辑线");
layer.open({ layer.open({
title: "编辑线", title: "编辑线",
type: 1, type: 1,
...@@ -643,9 +642,9 @@ TopologyEditor.prototype.init = function (topologyGuid, backImg, topologyJson) { ...@@ -643,9 +642,9 @@ TopologyEditor.prototype.init = function (topologyGuid, backImg, topologyJson) {
btn: ["应用", "删除", "取消"], btn: ["应用", "删除", "取消"],
yes: function(index, layero){ yes: function(index, layero){
var param = getParam("link-form"); var param = getParam("link-form");
console.log(param);
self.currentNode.text = param.lineName; self.currentNode.text = param.lineName;
self.currentNode.textPosition = param.textPosition; self.currentNode.fontColor = param.lineColor;
self.currentNode.setLocation(param.x, param.y);
$('#link-dialog').css('display', 'none') $('#link-dialog').css('display', 'none')
layer.close(index); layer.close(index);
}, },
......
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