Newer
Older
import {Component, OnInit, ViewChild} from '@angular/core';
import {ActivatedRoute, Router} from '@angular/router';
import {CommonService} from '../../../shared/common/common.service';
import {SystemService} from '../../../system/system.service';
import {DiscoveryComponent} from '../../../modal/discovery/discovery.component';
selector: 'smart-discovery-list',
templateUrl: './discovery-list.component.html',
styles: []
allChecked = false;
selectList = [];
disabledButton = true;
indeterminate = false;
constructor(private overAllSer: OverAllService, private routerInfo: ActivatedRoute, private router: Router,
private message: NzMessageService, private systemSer: SystemService,
private commonSer: CommonService) {
this.refreshStatus();
}
currentPageDataChange($event: Array<{ checked: boolean }>): void {
}
selectItem(item, e) {
if (e) {
this.selectList.push(item);
} else {
this.selectList.forEach((value, index) => {
if (value.id == item.id) {
this.selectList.splice(index, 1);
}
});
}
this.refreshStatus();
}
refreshStatus(): void {
const allChecked = this.discoveryList.every(value => value.checked === true);
const allUnChecked = this.discoveryList.every(value => !value.checked);
this.allChecked = allChecked;
this.indeterminate = (!allChecked) && (!allUnChecked);
}
ngOnInit() {
this.getList();
}
//翻页
change(e) {
this.pageNum = e;
this.getList();
}
pageNum: this.pageNum,
pageCount: this.pageCount,
hostIds: [this.templateid]
this.discoveryList = res.data.data;
this.totalNum = res.data.totalNum;
showEditModal(data) {
this.smartDiscovery.showEditModal(this.templateid, data.itemid, '编辑自动发现');
goToCheck(data) {
this.router.navigate(['app/main/checkList'], {
queryParams: {
hostId: this.templateid,
discoveryids: data.itemid,
name: data.name,
tempName: this.tempName
goToTrigger(data) {
this.router.navigate(['app/main/triggerList'], {
queryParams: {
id: data.itemid,
name: data.name,
tempName: this.tempName
deleteDiscovery(item) {
this.commonSer.confirmThing('删除', '确定删除当前的自动发现', () => {
const data = {
ids: []
(res) => {
if (res.errCode == 10000) {
this.message.success('删除成功');
deleteBatchDiscovery() {
if (this.selectList.length == 0) {
this.message.warning('请选择需要删除的自动发现');
this.commonSer.confirmThing('删除', '确定删除选择的自动发现', () => {
const data = {
ids: this.selectList.map(e => {
(res) => {
if (res.errCode == 10000) {
this.message.success('删除成功');