Commit fa58abb2 authored by wangqinghua's avatar wangqinghua

update

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