Commit b688c5bd authored by wangqinghua's avatar wangqinghua

update

parent bf62e4dc
...@@ -100,7 +100,9 @@ export class LineComponent implements OnInit { ...@@ -100,7 +100,9 @@ export class LineComponent implements OnInit {
showModal(linkObj) { showModal(linkObj) {
this.hostIds = linkObj.hostIds; //线条上的主机id; this.hostIds = linkObj.hostIds; //线条上的主机id;
if(linkObj.itemId.length > 0){
this.itemId = linkObj.itemId.split(','); //线条上的监测点id; this.itemId = linkObj.itemId.split(','); //线条上的监测点id;
}
this.isLine = true; this.isLine = true;
this.getInList(); this.getInList();
this.getOutList(); this.getOutList();
......
...@@ -7,26 +7,25 @@ ...@@ -7,26 +7,25 @@
<input nz-input type="text" [(ngModel)]="name"> <input nz-input type="text" [(ngModel)]="name">
</nz-form-control> </nz-form-control>
</nz-form-item> </nz-form-item>
<nz-form-item> <!--<nz-form-item>-->
<nz-form-label [nzSpan]="7" nzFor="host1">选择设备</nz-form-label> <!--<nz-form-label [nzSpan]="7" nzFor="host1">选择设备</nz-form-label>-->
<nz-form-control [nzSpan]="12"> <!--<nz-form-control [nzSpan]="12">-->
<div class="tree-div" style="height: 300px"> <!--<div class="tree-div" style="height: 300px">-->
<nz-tree #nzTree <!--<nz-tree #nzTree-->
[(ngModel)]="nodes" <!--[(ngModel)]="nodes"-->
[nzAsyncData]="true" <!--[nzAsyncData]="true"-->
[nzCheckStrictly]="true" <!--[nzCheckStrictly]="true"-->
(nzClick)="mouseAction('expand',$event)" <!--(nzClick)="mouseAction('expand',$event)"-->
(nzExpandChange)="mouseAction('expand',$event)" > <!--(nzExpandChange)="mouseAction('expand',$event)" >-->
<ng-template #nzTreeTemplate let-node> <!--<ng-template #nzTreeTemplate let-node>-->
<span class="custom-node" draggable="true" aria-grabbed="true" [class.active]="node.isSelected"> <!--<span class="custom-node" draggable="true" aria-grabbed="true" [class.active]="node.isSelected">-->
<label *ngIf="node.level == 0"> {{node.title}}</label> <!--<label *ngIf="node.level == 0"> {{node.title}}</label>-->
<label [(ngModel)]="node.isChecked" [nzDisabled]="node.origin.disabled" (click)="selectItem($event,node)" *ngIf="node.level == 1" nz-checkbox> {{node.title}}</label> <!--<label [(ngModel)]="node.isChecked" [nzDisabled]="node.origin.disabled" (click)="selectItem($event,node)" *ngIf="node.level == 1" nz-checkbox> {{node.title}}</label>-->
</span> <!--</span>-->
</ng-template> <!--</ng-template>-->
<!--</nz-tree>-->
</nz-tree> <!--</div>-->
</div> <!--</nz-form-control>-->
</nz-form-control> <!--</nz-form-item>-->
</nz-form-item>
</div> </div>
</nz-modal> </nz-modal>
\ No newline at end of file
...@@ -4,6 +4,7 @@ import {LocalStorageService} from 'ngx-webstorage'; ...@@ -4,6 +4,7 @@ import {LocalStorageService} from 'ngx-webstorage';
import {NzFormatEmitEvent, NzMessageService, NzTreeNode} from 'ng-zorro-antd'; import {NzFormatEmitEvent, NzMessageService, NzTreeNode} from 'ng-zorro-antd';
declare let editor: any; declare let editor: any;
@Component({ @Component({
selector: 'smart-node', selector: 'smart-node',
templateUrl: './node.component.html', templateUrl: './node.component.html',
...@@ -13,6 +14,7 @@ export class NodeComponent implements OnInit { ...@@ -13,6 +14,7 @@ export class NodeComponent implements OnInit {
isNode = false; isNode = false;
name; name;
hostId;
nodes; nodes;
nodeList; nodeList;
...@@ -21,9 +23,12 @@ export class NodeComponent implements OnInit { ...@@ -21,9 +23,12 @@ export class NodeComponent implements OnInit {
constructor(private topologySer: TopologyService, private message: NzMessageService, private localStorage: LocalStorageService,) { constructor(private topologySer: TopologyService, private message: NzMessageService, private localStorage: LocalStorageService,) {
} }
ngOnInit() {} ngOnInit() {
}
showModal() { showModal(nodeObj) {
this.hostId = nodeObj.hostIds; //主机id;
this.name = nodeObj.name; //主机名称;
this.isNode = true; this.isNode = true;
this.findTree(); this.findTree();
} }
...@@ -66,7 +71,7 @@ export class NodeComponent implements OnInit { ...@@ -66,7 +71,7 @@ export class NodeComponent implements OnInit {
if (event.node.level == 0) { if (event.node.level == 0) {
type = 'host'; //主机 type = 'host'; //主机
} }
if(event.node.level == 1){ if (event.node.level == 1) {
return false; return false;
} }
const index = <any>event.node.key - 1; const index = <any>event.node.key - 1;
...@@ -108,25 +113,34 @@ export class NodeComponent implements OnInit { ...@@ -108,25 +113,34 @@ export class NodeComponent implements OnInit {
handleNodeCancel() { handleNodeCancel() {
this.isNode = false; this.isNode = false;
this.selectList = []; this.selectList = [];
localStorage.setItem("node",'false'); localStorage.setItem('node', 'false');
} }
handleNodeOk() { handleNodeOk() {
const data = { if (this.name) {
hostIds:this.selectList
}
this.topologySer.findByHostIdOrWeb(data).subscribe(
(res)=>{
this.selectList = [];
const item = { const item = {
name:this.name, name: this.name,
img:res.data[0].url
}; };
this.isNode = false; this.isNode = false;
editor.utils.setNode(item); editor.utils.setNode(item);
localStorage.setItem("node",'false');
} }
) this.isNode = false;
localStorage.setItem("node",'false');
// const data = {
// hostIds:this.selectList
// };
// this.topologySer.findByHostIdOrWeb(data).subscribe(
// (res)=>{
// this.selectList = [];
// const item = {
// name:this.name,
// img:res.data[0].url
// };
// this.isNode = false;
// editor.utils.setNode(item);
// localStorage.setItem("node",'false');
// }
// )
} }
......
...@@ -145,10 +145,11 @@ export class NeTopologyComponent implements OnInit, DoCheck, AfterViewInit, OnDe ...@@ -145,10 +145,11 @@ export class NeTopologyComponent implements OnInit, DoCheck, AfterViewInit, OnDe
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 linkObj = localStorage.getItem('linkObj'); const linkObj = localStorage.getItem('linkObj');
this.smartLine.showModal(JSON.parse(linkObj)); this.smartLine.showModal( JSON.parse(linkObj) );
} }
if (changesNode && changesNode['_appendAfter'].currentValue == "true") { if (changesNode && changesNode['_appendAfter'].currentValue == "true") {
this.smartNode.showModal(); const nodeObj = localStorage.getItem('nodeObj');
this.smartNode.showModal( JSON.parse(nodeObj) );
} }
} }
......
...@@ -647,16 +647,21 @@ TopologyEditor.prototype.init = function (topologyGuid, backImg, topologyJson) { ...@@ -647,16 +647,21 @@ 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') {
const nodeObj = {
name:event.target.text,
hostId:event.target.hostId
}
localStorage.setItem("node",'true'); localStorage.setItem("node",'true');
localStorage.setItem("nodeObj",JSON.stringify(nodeObj));
} else if (event.target instanceof JTopo.Link && editor.stageMode === 'edit') { } else if (event.target instanceof JTopo.Link && editor.stageMode === 'edit') {
const obj = { const lineObj = {
hostIds:[], hostIds:[],
itemId:event.target.itemId itemId:event.target.itemId
} }
obj.hostIds.push(event.target.nodeA.hostId); lineObj.hostIds.push(event.target.nodeA.hostId);
obj.hostIds.push(event.target.nodeZ.hostId); lineObj.hostIds.push(event.target.nodeZ.hostId);
localStorage.setItem("line",'true'); localStorage.setItem("line",'true');
localStorage.setItem("linkObj",JSON.stringify(obj)); localStorage.setItem("linkObj",JSON.stringify(lineObj));
} }
}); });
...@@ -1193,8 +1198,8 @@ editor.utils = { ...@@ -1193,8 +1198,8 @@ editor.utils = {
var self = this; var self = this;
var node = editor.scene.selectedElements; var node = editor.scene.selectedElements;
node[0].text = item.name; node[0].text = item.name;
node[0].setImage(topoImgPath + item.img); // node[0].setImage(topoImgPath + item.img);
node[0].nodeImage = item.img; // node[0].nodeImage = item.img;
editor.stage.paint(); editor.stage.paint();
}, },
// 放大 // 放大
......
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