Commit fa58abb2 authored by wangqinghua's avatar wangqinghua

update

parent 4a7979a5
...@@ -163,7 +163,7 @@ export class NeTopologyComponent implements OnInit, DoCheck, AfterViewInit, OnDe ...@@ -163,7 +163,7 @@ export class NeTopologyComponent implements OnInit, DoCheck, AfterViewInit, OnDe
myCanvas.width = myCanvas.width * ratio; myCanvas.width = myCanvas.width * ratio;
myCanvas.height = myCanvas.height * ratio; myCanvas.height = myCanvas.height * ratio;
context.scale(ratio, ratio); // context.scale(ratio, ratio);
editor.loadTopology('', '', 'img/backimg.png', canvasWidth, canvasHeight); editor.loadTopology('', '', 'img/backimg.png', canvasWidth, canvasHeight);
} }
......
...@@ -50,7 +50,6 @@ export class BasicComponent implements OnInit { ...@@ -50,7 +50,6 @@ export class BasicComponent implements OnInit {
//表格信息 //表格信息
loading = false; loading = false;
selectedValue;
isCheck = false; isCheck = false;
allChecked = false; allChecked = false;
interfaceList: any[]; interfaceList: any[];
...@@ -71,7 +70,6 @@ export class BasicComponent implements OnInit { ...@@ -71,7 +70,6 @@ export class BasicComponent implements OnInit {
gray; gray;
//搜索 //搜索
searchStatus = true;
searchName; searchName;
searchData; searchData;
status; status;
...@@ -80,6 +78,12 @@ export class BasicComponent implements OnInit { ...@@ -80,6 +78,12 @@ export class BasicComponent implements OnInit {
pageCount = pageSize; pageCount = pageSize;
totalNum; totalNum;
selectedValue = 'group';
groupList = []; //分组列表
groupid = null;
equipmentTypeid = null;
constructor(private fb: FormBuilder, private overAllSer: OverAllService, private router: Router, constructor(private fb: FormBuilder, private overAllSer: OverAllService, private router: Router,
private commonSer: CommonService, private commonSer: CommonService,
private modalService: NzModalService, private message: NzMessageService, private main: JhiMainComponent) { private modalService: NzModalService, private message: NzMessageService, private main: JhiMainComponent) {
...@@ -142,41 +146,50 @@ export class BasicComponent implements OnInit { ...@@ -142,41 +146,50 @@ export class BasicComponent implements OnInit {
}); });
} }
//获取下级list ngOnInit(): void {
getChildren(item) { this.findOpStatus();
if (item.list) { this.select('group');
if (item.expand) { }
item.expand = false;
select(e) {
this.groupid = null;
this.equipmentTypeid = null;
if (e == 'group') {
this.getGroup();
} else { } else {
item.expand = true; this.getType();
} }
return false;
} }
this.loading = true;
const data = { //获取资源分组
'groupids': [item.groupid], getGroup() {
}; this.overAllSer.findGroup().subscribe(
this.overAllSer.findHostNew(data).subscribe(
(res) => { (res) => {
if (res.data) { if (res.errCode == 10000) {
this.dataSet[item.host].list = res.data; this.groupList = res.data;
this.toTree(item.host); this.search();
} else {
this.message.info('该分组下无资源');
} }
this.loading = false;
} }
); );
} }
ngOnInit(): void { //获取设备类型
this.selectedValue = 'group'; getType() {
this.select(); this.overAllSer.findType().subscribe(
this.findOpStatus(); (res) => {
this.loading = false;
if (res.errCode == 10000) {
this.groupList = res.data;
this.search();
} else {
this.message.info(res.errMsg);
}
}
);
} }
changeStatus(status) { changeStatus(status) {
this.loading = true;
if (this.status == status) { if (this.status == status) {
this.status = null; this.status = null;
} else { } else {
...@@ -190,22 +203,43 @@ export class BasicComponent implements OnInit { ...@@ -190,22 +203,43 @@ export class BasicComponent implements OnInit {
//waringName:(值为:正常,禁用,告警,严重) //waringName:(值为:正常,禁用,告警,严重)
*/ */
search() { search() {
this.loading = true;
this.pageNum = 1; this.pageNum = 1;
this.searchRe(); this.searchRe();
} }
searchRe() { changeGroup(e) {
this.loading = true; this.loading = true;
this.searchStatus = true; this.pageNum = 1;
this.groupid = e;
this.equipmentTypeid = null;
this.searchRe();
}
changeEquiment(e){
this.loading = true;
this.pageNum = 1;
this.groupid = null;
this.equipmentTypeid = e;
this.searchRe();
}
searchRe() {
const data = { const data = {
pageNum: this.pageNum, pageNum: this.pageNum,
pageCount: this.pageCount, pageCount: this.pageCount,
obj: { obj: {
name: this.searchName, name: this.searchName,
waringName: this.status, waringName: this.status,
equipmentTypeid: this.equipmentTypeid,
groupids: [] groupids: []
} }
}; };
if(this.groupid){
data.obj.groupids.push(this.groupid)
}else{
data.obj.groupids = [];
}
this.overAllSer.findHostPageNew(data).subscribe( this.overAllSer.findHostPageNew(data).subscribe(
(res) => { (res) => {
if (res.errCode == 10000) { if (res.errCode == 10000) {
...@@ -219,17 +253,15 @@ export class BasicComponent implements OnInit { ...@@ -219,17 +253,15 @@ export class BasicComponent implements OnInit {
//翻页 //翻页
change(event) { change(event) {
if (event > 0) { this.loading = true;
this.pageNum = event; this.pageNum = event;
this.searchRe(); this.searchRe();
} console.log(this.groupid);
} }
//backList //backList
backList() { backList() {
this.select();
this.findOpStatus(); this.findOpStatus();
this.searchStatus = false;
} }
//查询设备状态 //查询设备状态
...@@ -279,53 +311,10 @@ export class BasicComponent implements OnInit { ...@@ -279,53 +311,10 @@ export class BasicComponent implements OnInit {
); );
} }
//选择分组
select() {
this.loading = true;
this.searchStatus = false;
this.findOpStatus();
if (this.selectedValue == 'group') {
this.overAllSer.getgroups({}).subscribe(
(res) => {
this.loading = false;
if (res.errCode == 10000) {
this.dataSet = res.data;
// this.dataSet = this.dataSet.filter(d => d.list); //过滤无list的
for (let i = 0; i < this.dataSet.length; i++) {
this.dataSet[i].host = i;
this.dataSet[i].checked = false;
}
this.toTree(null);
} else {
this.message.info(res.errMsg);
}
}
);
} else if (this.selectedValue == 'type') {
this.overAllSer.findType().subscribe(
(res) => {
this.loading = false;
if (res.errCode == 10000) {
this.dataSet = res.data;
// this.dataSet = this.dataSet.filter(d => d.list); //过滤无list的
for (let i = 0; i < this.dataSet.length; i++) {
this.dataSet[i].host = i;
this.dataSet[i].checked = false;
}
this.toTree(null);
} else {
this.message.info(res.errMsg);
}
}
);
} else if (this.selectedValue == 'all') {
this.findList();
}
}
//删除单个资源 //删除单个资源
showDeleteConfirm(item) { showDeleteConfirm(item) {
this.commonSer.confirmThing('删除', '确认删除该资源吗?', () => { this.commonSer.confirmThing('删除', '确认删除该资源吗?', () => {
this.loading = true;
const data = { const data = {
hostids: [] hostids: []
}; };
...@@ -334,7 +323,7 @@ export class BasicComponent implements OnInit { ...@@ -334,7 +323,7 @@ export class BasicComponent implements OnInit {
(res) => { (res) => {
if (res.errCode == 10000) { if (res.errCode == 10000) {
this.message.info('删除成功'); this.message.info('删除成功');
this.select(); this.searchRe();
} else { } else {
this.message.info(res.errMsg); this.message.info(res.errMsg);
} }
...@@ -351,6 +340,7 @@ export class BasicComponent implements OnInit { ...@@ -351,6 +340,7 @@ export class BasicComponent implements OnInit {
} }
this.commonSer.confirmThing('删除', '确认要删除所选设备吗?', () => { this.commonSer.confirmThing('删除', '确认要删除所选设备吗?', () => {
this.loading = true;
const data = { const data = {
hostids: this.batchDelList hostids: this.batchDelList
}; };
...@@ -359,7 +349,7 @@ export class BasicComponent implements OnInit { ...@@ -359,7 +349,7 @@ export class BasicComponent implements OnInit {
if (res.errCode == 10000) { if (res.errCode == 10000) {
this.message.info('删除成功'); this.message.info('删除成功');
this.batchDelList = []; this.batchDelList = [];
this.select(); this.searchRe();
} else { } else {
this.message.error(res.errMsg); this.message.error(res.errMsg);
} }
...@@ -386,13 +376,14 @@ export class BasicComponent implements OnInit { ...@@ -386,13 +376,14 @@ export class BasicComponent implements OnInit {
nzOkText: '确定', nzOkText: '确定',
nzOkType: 'danger', nzOkType: 'danger',
nzOnOk: () => { nzOnOk: () => {
this.loading = true;
const data = {groupid: []}; const data = {groupid: []};
data.groupid.push(item.groupid); data.groupid.push(item.groupid);
this.overAllSer.deleteGroup(data).subscribe( this.overAllSer.deleteGroup(data).subscribe(
(res) => { (res) => {
if (res.errCode == 10000) { if (res.errCode == 10000) {
this.message.info('删除成功'); this.message.info('删除成功');
this.select(); this.searchRe();
} else { } else {
this.message.info(res.errMsg); this.message.info(res.errMsg);
} }
...@@ -410,7 +401,8 @@ export class BasicComponent implements OnInit { ...@@ -410,7 +401,8 @@ export class BasicComponent implements OnInit {
} }
handleOk(e) { handleOk(e) {
this.select(); this.loading = true;
this.searchRe();
} }
//根据设备类型查询主机资源 //根据设备类型查询主机资源
...@@ -476,6 +468,7 @@ export class BasicComponent implements OnInit { ...@@ -476,6 +468,7 @@ export class BasicComponent implements OnInit {
nzOkText: '确定', nzOkText: '确定',
nzCancelText: '取消', nzCancelText: '取消',
nzOnOk: () => { nzOnOk: () => {
this.loading = true;
let params1 = 0; let params1 = 0;
if (item.status == 0) { if (item.status == 0) {
params1 = 1; params1 = 1;
...@@ -485,7 +478,7 @@ export class BasicComponent implements OnInit { ...@@ -485,7 +478,7 @@ export class BasicComponent implements OnInit {
(res) => { (res) => {
if (res.errCode == 10000) { if (res.errCode == 10000) {
this.message.info('修改成功'); this.message.info('修改成功');
this.select(); this.searchRe();
} else { } else {
this.message.info(res.errMsg); this.message.info(res.errMsg);
} }
...@@ -508,6 +501,7 @@ export class BasicComponent implements OnInit { ...@@ -508,6 +501,7 @@ export class BasicComponent implements OnInit {
nzOkText: '确定', nzOkText: '确定',
nzCancelText: '取消', nzCancelText: '取消',
nzOnOk: () => { nzOnOk: () => {
this.loading = true;
const data = { const data = {
status: status, status: status,
hostids: this.batchDelList hostids: this.batchDelList
...@@ -518,7 +512,7 @@ export class BasicComponent implements OnInit { ...@@ -518,7 +512,7 @@ export class BasicComponent implements OnInit {
this.message.info('修改成功'); this.message.info('修改成功');
this.batchDelList = []; this.batchDelList = [];
this.findOpStatus(); this.findOpStatus();
this.select(); this.searchRe();
} else { } else {
this.message.info(res.errMsg); this.message.info(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