Commit bd3ee8f8 authored by wangqinghua's avatar wangqinghua

update

parent 8a4b8da1
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
<tr *ngFor="let data of basicTable.data"> <tr *ngFor="let data of basicTable.data">
<td nzShowCheckbox (nzCheckedChange)="refreshStatus()" [(nzChecked)]="data.checked"></td> <td nzShowCheckbox (nzCheckedChange)="refreshStatus()" [(nzChecked)]="data.checked"></td>
<td>{{data.name}}</td> <td>{{data.name}}</td>
<td>{{data.comments}}</td> <td>{{data.comment}}</td>
</tr> </tr>
</tbody> </tbody>
</nz-table> </nz-table>
......
...@@ -13,6 +13,7 @@ export class LineComponent implements OnInit { ...@@ -13,6 +13,7 @@ export class LineComponent implements OnInit {
isLine = false; isLine = false;
hostIds = []; hostIds = [];
itemId = []; //第一个进口流量,第二个出口流量
inPageNum = 1; inPageNum = 1;
outPageNum = 1; outPageNum = 1;
...@@ -22,23 +23,31 @@ export class LineComponent implements OnInit { ...@@ -22,23 +23,31 @@ export class LineComponent implements OnInit {
totalNum; totalNum;
inList; inList;
inSelect = []; inSelect;
inSearchName; inSearchName;
outList; outList;
outSelect = []; outSelect;
outSearchName; outSearchName;
constructor(private topologySer: TopologyService, private message: NzMessageService, private localStorage: LocalStorageService,) { constructor(private topologySer: TopologyService, private message: NzMessageService, private localStorage: LocalStorageService,) {
} }
//in //in
incurrentPageDataChange($event: Array<{ key1: string; key2: number; key3: string; key4: string; checked: boolean }>): void { incurrentPageDataChange($event: Array<{ kchecked: boolean }>): void {
this.inList = $event; this.inList = $event;
} }
inselectItem(item,e){ inselectItem(item,e){
if(e){ if(e){
const arr = this.inList.map(data=>{
return data.itemId;
});
const old = this.inSelect;
if(old){
const index = arr.indexOf(old.itemId);
this.inList[index].checked = false;
}
this.inSelect = item; this.inSelect = item;
}else{ }else{
this.inSelect = null; this.inSelect = null;
...@@ -62,6 +71,14 @@ export class LineComponent implements OnInit { ...@@ -62,6 +71,14 @@ export class LineComponent implements OnInit {
outselectItem(item,e){ outselectItem(item,e){
if(e){ if(e){
const arr = this.outList.map(data=>{
return data.itemId;
});
const old = this.outSelect;
if(old){
const index = arr.indexOf(old.itemId);
this.outList[index].checked = false;
}
this.outSelect = item; this.outSelect = item;
}else{ }else{
this.outSelect = null; this.outSelect = null;
...@@ -81,11 +98,12 @@ export class LineComponent implements OnInit { ...@@ -81,11 +98,12 @@ export class LineComponent implements OnInit {
} }
showModal(hostIds) { showModal(linkObj) {
this.hostIds = hostIds.split(','); this.hostIds = linkObj.hostIds; //线条上的主机id;
this.itemId = linkObj.itemId.split(','); //线条上的监测点id;
this.isLine = true; this.isLine = true;
this.getOutList();
this.getInList(); this.getInList();
this.getOutList();
} }
//查询进口流量 //查询进口流量
...@@ -101,6 +119,11 @@ export class LineComponent implements OnInit { ...@@ -101,6 +119,11 @@ export class LineComponent implements OnInit {
(res)=>{ (res)=>{
this.totalNum = res.data.totalNum; this.totalNum = res.data.totalNum;
this.inList = res.data.data; this.inList = res.data.data;
this.inList.forEach(e=>{ //进口流量回显
if(e.itemId = this.itemId[0]){
e.checked = true;
}
})
} }
) )
...@@ -119,6 +142,11 @@ export class LineComponent implements OnInit { ...@@ -119,6 +142,11 @@ export class LineComponent implements OnInit {
(res)=>{ (res)=>{
this.totalNum = res.data.totalNum; this.totalNum = res.data.totalNum;
this.outList = res.data.data; this.outList = res.data.data;
this.outList.forEach(e=>{
if(e.itemId = this.itemId[1]){ //出口流量回显
e.checked = true;
}
})
} }
) )
......
...@@ -52,8 +52,8 @@ ...@@ -52,8 +52,8 @@
<span aria-hidden="true" title="全屏查看" <span aria-hidden="true" title="全屏查看"
onClick="editor.utils.showInFullScreen(editor.stage.canvas,'RequestFullScreen')">全屏查看</span> onClick="editor.utils.showInFullScreen(editor.stage.canvas,'RequestFullScreen')">全屏查看</span>
<span aria-hidden="true" title="居中显示" onClick="editor.utils.showInCenter()">居中显示</span> <span aria-hidden="true" title="居中显示" onClick="editor.utils.showInCenter()">居中显示</span>
<span aria-hidden="true" title="编辑" onClick="editor.utils.editTopology()">编辑</span> <span aria-hidden="true" title="编辑" (click)="changeEdit('编辑')">编辑</span>
<span aria-hidden="true" title="只读" onClick="editor.utils.normalTopology()">只读</span> <span aria-hidden="true" title="只读" (click)="changeEdit('只读')">只读</span>
<span aria-hidden="true" title="保存" (click)="update()">保存</span> <span aria-hidden="true" title="保存" (click)="update()">保存</span>
<span aria-hidden="true" title="清空" onClick="editor.utils.clearTopology()">清空</span> <span aria-hidden="true" title="清空" onClick="editor.utils.clearTopology()">清空</span>
<span aria-hidden="true" title="放大" onClick="editor.utils.scalingBig()">放大</span> <span aria-hidden="true" title="放大" onClick="editor.utils.scalingBig()">放大</span>
...@@ -73,6 +73,9 @@ ...@@ -73,6 +73,9 @@
<canvas class="topology-context" id="topology-canvas" #topologyCanvas style="height: 580px;"> <canvas class="topology-context" id="topology-canvas" #topologyCanvas style="height: 580px;">
您的浏览器不支持HTML5! 您的浏览器不支持HTML5!
</canvas> </canvas>
<div class="lineList">
{{editType}}
</div>
<div class="checkList"> <div class="checkList">
<p *ngFor="let item of checkJson;let i = index;"> <p *ngFor="let item of checkJson;let i = index;">
<span [style.fontSize]="item.fontSize +'px'">{{item.name}}</span><i (click)="deleteCheck(i)" class="minus anticon anticon-minus-circle-o"></i> <span [style.fontSize]="item.fontSize +'px'">{{item.name}}</span><i (click)="deleteCheck(i)" class="minus anticon anticon-minus-circle-o"></i>
......
...@@ -93,6 +93,7 @@ export class NeTopologyComponent implements OnInit, DoCheck, AfterViewInit, OnDe ...@@ -93,6 +93,7 @@ export class NeTopologyComponent implements OnInit, DoCheck, AfterViewInit, OnDe
refreshRete; refreshRete;
options; options;
lineType = "1"; //线条类型 lineType = "1"; //线条类型
editType = "只读"; //拓扑图状态
checkJson = []; checkJson = [];
fileList: UploadFile[] = []; fileList: UploadFile[] = [];
...@@ -131,8 +132,8 @@ export class NeTopologyComponent implements OnInit, DoCheck, AfterViewInit, OnDe ...@@ -131,8 +132,8 @@ export class NeTopologyComponent implements OnInit, DoCheck, AfterViewInit, OnDe
const changesLine = this.customerDifferLink.diff(this.line); const changesLine = this.customerDifferLink.diff(this.line);
const changesNode = this.customerDifferNode.diff(this.node); const changesNode = this.customerDifferNode.diff(this.node);
if (changesLine && changesLine['_appendAfter'].currentValue == "true") { if (changesLine && changesLine['_appendAfter'].currentValue == "true") {
const arr = localStorage.getItem('linkHostIds'); const linkObj = localStorage.getItem('linkObj');
this.smartLine.showModal(arr); this.smartLine.showModal(JSON.parse(linkObj));
} }
if (changesNode && changesNode['_appendAfter'].currentValue == "true") { if (changesNode && changesNode['_appendAfter'].currentValue == "true") {
this.smartNode.showModal(); this.smartNode.showModal();
...@@ -174,6 +175,17 @@ export class NeTopologyComponent implements OnInit, DoCheck, AfterViewInit, OnDe ...@@ -174,6 +175,17 @@ export class NeTopologyComponent implements OnInit, DoCheck, AfterViewInit, OnDe
} }
} }
//
changeEdit(type){
if(type == '编辑'){
editor.utils.editTopology()
}
if(type == '只读'){
editor.utils.normalTopology()
}
this.editType = type;
}
//一级分类 //一级分类
getTypeList(){ getTypeList(){
this.topologySer.findTreeWithWeb().subscribe( this.topologySer.findTreeWithWeb().subscribe(
...@@ -324,6 +336,7 @@ export class NeTopologyComponent implements OnInit, DoCheck, AfterViewInit, OnDe ...@@ -324,6 +336,7 @@ export class NeTopologyComponent implements OnInit, DoCheck, AfterViewInit, OnDe
} }
}); });
//告警状态
if(hostIds.length > 0){ if(hostIds.length > 0){
const res = { const res = {
hostIds : hostIds hostIds : hostIds
...@@ -353,6 +366,7 @@ export class NeTopologyComponent implements OnInit, DoCheck, AfterViewInit, OnDe ...@@ -353,6 +366,7 @@ export class NeTopologyComponent implements OnInit, DoCheck, AfterViewInit, OnDe
) )
} }
//流量数据
if(list.length > 0){ //有流量监控-->查询流量监控 if(list.length > 0){ //有流量监控-->查询流量监控
const data = { const data = {
"list" : list "list" : list
...@@ -363,7 +377,7 @@ export class NeTopologyComponent implements OnInit, DoCheck, AfterViewInit, OnDe ...@@ -363,7 +377,7 @@ export class NeTopologyComponent implements OnInit, DoCheck, AfterViewInit, OnDe
response.forEach(e1=>{ response.forEach(e1=>{
arr.forEach(e2=>{ arr.forEach(e2=>{
if(e1.linkId == e2.id){ if(e1.linkId == e2.id){
e2.text = "进口流量:"+e1.valueIn+e1.units+" 出口流量:"+e1.valueOut+e1.units; e2.text = "进口流量:"+e1.fullValueIn+" 出口流量:"+e1.fullValueOut;
} }
}) })
}); });
......
...@@ -84,6 +84,7 @@ TopologyPanel.prototype.loadTopology = function (response, topologyGuid, backImg ...@@ -84,6 +84,7 @@ TopologyPanel.prototype.loadTopology = function (response, topologyGuid, backImg
TopologyPanel.prototype.loadTopologyByJson = function (topologyJson, backImg) { TopologyPanel.prototype.loadTopologyByJson = function (topologyJson, backImg) {
try { try {
JTopo.replaceStageWithJson(topologyJson) JTopo.replaceStageWithJson(topologyJson)
var timer = $interval(function(){},100,10);
if (editor.stage && editor.scene && editor.scene.childs && editor.scene.childs.length > 0) { if (editor.stage && editor.scene && editor.scene.childs && editor.scene.childs.length > 0) {
editor.stage.centerAndZoom() editor.stage.centerAndZoom()
console.log(editor.utils.getAllNodes()[0]); console.log(editor.utils.getAllNodes()[0]);
...@@ -619,11 +620,14 @@ TopologyEditor.prototype.init = function (topologyGuid, backImg, topologyJson) { ...@@ -619,11 +620,14 @@ 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') {
localStorage.setItem("node",'true'); localStorage.setItem("node",'true');
} else if (event.target instanceof JTopo.Link && editor.stageMode === 'edit') { } else if (event.target instanceof JTopo.Link && editor.stageMode === 'edit') {
var arr = []; const obj = {
arr.push(event.target.nodeA.hostId); hostIds:[],
arr.push(event.target.nodeZ.hostId); itemId:event.target.itemId
}
obj.hostIds.push(event.target.nodeA.hostId);
obj.hostIds.push(event.target.nodeZ.hostId);
localStorage.setItem("line",'true'); localStorage.setItem("line",'true');
localStorage.setItem("linkHostIds",arr); localStorage.setItem("linkObj",JSON.stringify(obj));
} }
}); });
...@@ -1146,8 +1150,14 @@ editor.utils = { ...@@ -1146,8 +1150,14 @@ editor.utils = {
}; };
var self = this; var self = this;
var link = editor.scene.selectedElements; var link = editor.scene.selectedElements;
link[0].text = "进口流量:"+inItem.name+" 出口流量:"+outItem.name; if(inItem){
link[0].itemId = (inItem.itemId) +"," +(outItem.itemId); link[0].text = "进口流量:"+inItem.name;
link[0].itemId = (inItem.itemId)
}
if(outItem){
link[0].text += " 出口流量:"+outItem.name;
link[0].itemId += "," +(outItem.itemId);
}
}, },
//设置节点属性 //设置节点属性
setNode: function (item) { setNode: function (item) {
......
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