Commit 33ab7b9a authored by wangqinghua's avatar wangqinghua

template

parent 2da51acc
...@@ -50,7 +50,7 @@ export class DiscoveryComponent implements OnInit { ...@@ -50,7 +50,7 @@ export class DiscoveryComponent implements OnInit {
interfaceid: [null,], interfaceid: [null,],
delay: [null, [Validators.required]], delay: [null, [Validators.required]],
description: [null], description: [null],
lifetime: [null], lifetime: ['3600'],
status: [null], status: [null],
}); });
} }
...@@ -80,11 +80,6 @@ export class DiscoveryComponent implements OnInit { ...@@ -80,11 +80,6 @@ export class DiscoveryComponent implements OnInit {
data.type += ''; data.type += '';
data.interfaceid += ''; data.interfaceid += '';
data.value_type += ''; data.value_type += '';
if(data.applications){
data.applications = data.applications.map(e=>{
return e.applicationid;
});
}
this.validateForm.patchValue(data); this.validateForm.patchValue(data);
} }
); );
...@@ -107,7 +102,7 @@ export class DiscoveryComponent implements OnInit { ...@@ -107,7 +102,7 @@ export class DiscoveryComponent implements OnInit {
this.message.error('请输入必填信息'); this.message.error('请输入必填信息');
return false; return false;
} }
this.validateForm.value.applications = [this.validateForm.value.applications]; this.validateForm.value.status = this.validateForm.value.status ? 1:0;
this.validateForm.value.hostid = this.hostId; this.validateForm.value.hostid = this.hostId;
if (this.title == '添加自动发现') { if (this.title == '添加自动发现') {
this.create(); this.create();
......
import {Component, ElementRef, OnInit, ViewChild} from '@angular/core'; import {Component, ElementRef, OnDestroy, OnInit, ViewChild} from '@angular/core';
import {TopologyService} from '../topology.service'; import {TopologyService} from '../topology.service';
import {OverAllService} from '../../overAll/overAll.service'; import {OverAllService} from '../../overAll/overAll.service';
import {NzMessageService} from 'ng-zorro-antd'; import {NzMessageService} from 'ng-zorro-antd';
...@@ -12,12 +12,12 @@ declare var vis: any; ...@@ -12,12 +12,12 @@ declare var vis: any;
templateUrl: './flow-trend.component.html', templateUrl: './flow-trend.component.html',
styles: [] styles: []
}) })
export class FlowTrendComponent implements OnInit { export class FlowTrendComponent implements OnInit, OnDestroy {
groupList; groupList;
hostList; hostList;
isLoading; isLoading;
obj = { obj = {
groupid:null, groupid: null,
hostid: null, hostid: null,
startTime: '', startTime: '',
endTime: '' endTime: ''
...@@ -37,7 +37,7 @@ export class FlowTrendComponent implements OnInit { ...@@ -37,7 +37,7 @@ export class FlowTrendComponent implements OnInit {
outTotalNum; outTotalNum;
outLoading; outLoading;
timeType = "1"; timeType = '1';
timeBegin; timeBegin;
timeEnd; timeEnd;
...@@ -46,14 +46,16 @@ export class FlowTrendComponent implements OnInit { ...@@ -46,14 +46,16 @@ export class FlowTrendComponent implements OnInit {
inEchartData; inEchartData;
outEchartData; outEchartData;
time_;
constructor(private topologySer: TopologyService, private overAllSer: OverAllService, constructor(private topologySer: TopologyService, private overAllSer: OverAllService,
private message: NzMessageService,private datePipe:DatePipe) { private message: NzMessageService, private datePipe: DatePipe) {
} }
ngOnInit() { ngOnInit() {
const today = new Date().getTime(); const today = new Date().getTime();
this.obj.startTime = this.datePipe.transform(today,"yyyy-MM-dd") + " 00:00:00"; this.obj.startTime = this.datePipe.transform(today, 'yyyy-MM-dd') + ' 00:00:00';
this.obj.endTime = this.datePipe.transform(today,"yyyy-MM-dd") + " 23:59:59"; this.obj.endTime = this.datePipe.transform(today, 'yyyy-MM-dd') + ' 23:59:59';
this.getGroup(); this.getGroup();
} }
...@@ -63,7 +65,7 @@ export class FlowTrendComponent implements OnInit { ...@@ -63,7 +65,7 @@ export class FlowTrendComponent implements OnInit {
(res) => { (res) => {
if (res.errCode == 10000) { if (res.errCode == 10000) {
this.groupList = res.data; this.groupList = res.data;
this.obj.groupid = this.groupList[0].groupid +""; this.obj.groupid = this.groupList[0].groupid + '';
this.onchange(); this.onchange();
} }
} }
...@@ -82,62 +84,84 @@ export class FlowTrendComponent implements OnInit { ...@@ -82,62 +84,84 @@ export class FlowTrendComponent implements OnInit {
(res) => { (res) => {
if (res.errCode == 10000) { if (res.errCode == 10000) {
this.hostList = res.data; this.hostList = res.data;
if(this.hostList){ if (this.hostList) {
this.obj.hostid = this.hostList[0].hostid +""; this.obj.hostid = this.hostList[0].hostid + '';
this.getEcharts(null); this.getEcharts(null);
}else{ this.time_ = setInterval(()=>{
this.message.warning("当前资源组无资源"); this.findByTime();
},10000);
} else {
this.message.warning('当前资源组无资源');
} }
} }
} }
); );
} }
//实时流量数据
findByTime(){
this.topologySer.findByTime(this.obj.hostid).subscribe(
(res)=>{
if(res.errCode == 10000){
console.log('有值');
}else{
this.message.warning(res.errMsg);
clearInterval(this.time_);
console.log("停止");
}
}
)
}
//页面离开
ngOnDestroy(){
//销毁定时任务
clearInterval(this.time_);
}
//获取图标数据 //获取图标数据
getEcharts(itemid) { getEcharts(itemid) {
this.isLoading = true; this.isLoading = true;
const data= { const data = {
itemid: itemid, itemid: itemid,
endTime: this.obj.endTime, endTime: this.obj.endTime,
startTime: this.obj.startTime, startTime: this.obj.startTime,
hostid:this.obj.hostid, hostid: this.obj.hostid,
groupid:this.obj.groupid, groupid: this.obj.groupid,
type:'in', type: 'in',
limit:'1000' limit: '1000'
}; };
this.topologySer.findTrendData(data).subscribe( this.topologySer.findTrendData(data).subscribe(
(res) => { (res) => {
if(res.errCode == 10000){ if (res.errCode == 10000) {
if(res.data.length > 0){ if (res.data.length > 0) {
this.inEchartData = res.data; this.inEchartData = res.data;
}else{ } else {
this.message.warning("图表暂无数据"); this.message.warning('图表暂无数据');
this.isLoading = false; this.isLoading = false;
} }
data.type = "out"; data.type = 'out';
this.topologySer.findTrendData(data).subscribe( this.topologySer.findTrendData(data).subscribe(
(res)=>{ (res) => {
if(res.data.length > 0){ if (res.data.length > 0) {
this.outEchartData = res.data; this.outEchartData = res.data;
this.setEacharts(); this.setEacharts();
}else{ } else {
this.message.warning("图表暂无数据"); this.message.warning('图表暂无数据');
this.isLoading = false; this.isLoading = false;
} }
} }
) );
}else{ } else {
this.message.warning(res.errMsg); this.message.warning(res.errMsg);
} }
} }
); );
} }
setEacharts(){ setEacharts() {
let itemStyle = { let itemStyle = {
normal: { normal: {},
},
emphasis: { emphasis: {
barBorderWidth: 1, barBorderWidth: 1,
shadowBlur: 10, shadowBlur: 10,
...@@ -155,27 +179,27 @@ export class FlowTrendComponent implements OnInit { ...@@ -155,27 +179,27 @@ export class FlowTrendComponent implements OnInit {
backgroundColor: '#eee', backgroundColor: '#eee',
tooltip: { tooltip: {
// trigger: 'axis', // trigger: 'axis',
formatter: (params)=> { formatter: (params) => {
let res = params.seriesName; let res = params.seriesName;
res += '<br/>时间:' + params.name; res += '<br/>时间:' + params.name;
let Mbps = 1000*1000; let Mbps = 1000 * 1000;
let kbps = 1000; let kbps = 1000;
let size = Math.abs(params.data); let size = Math.abs(params.data);
if(size/Mbps > 1){ if (size / Mbps > 1) {
res += '<br/>流量:' + (size/Mbps).toFixed(2) + 'Mbps'; res += '<br/>流量:' + (size / Mbps).toFixed(2) + 'Mbps';
}else if(size/kbps >1){ } else if (size / kbps > 1) {
res += '<br/>流量:' +(size/kbps).toFixed(2) + 'kbps'; res += '<br/>流量:' + (size / kbps).toFixed(2) + 'kbps';
}else{ } else {
res += '<br/>流量:' + (size)+ 'bbps'; res += '<br/>流量:' + (size) + 'bbps';
} }
return res; return res;
} }
}, },
xAxis: { xAxis: {
data: this.inEchartData.map(e=>{ data: this.inEchartData.map(e => {
let date = this.datePipe.transform(e.clock,"yyyy-MM-dd HH:mm"); let date = this.datePipe.transform(e.clock, 'yyyy-MM-dd HH:mm');
return date; return date;
}), }),
name: '时间', name: '时间',
...@@ -188,10 +212,10 @@ export class FlowTrendComponent implements OnInit { ...@@ -188,10 +212,10 @@ export class FlowTrendComponent implements OnInit {
yAxis: { yAxis: {
inverse: true, inverse: true,
splitArea: {show: false}, splitArea: {show: false},
type : 'value', type: 'value',
axisLabel:{ //Y轴数据 axisLabel: { //Y轴数据
formatter:function(value){ formatter: function(value) {
return Math.abs(value)/10000 +" kbps"; //负数取绝对值变正数 return Math.abs(value) / 10000 + ' kbps'; //负数取绝对值变正数
}, },
textStyle: { textStyle: {
color: '#666' color: '#666'
...@@ -207,7 +231,7 @@ export class FlowTrendComponent implements OnInit { ...@@ -207,7 +231,7 @@ export class FlowTrendComponent implements OnInit {
type: 'line', type: 'line',
stack: 'one', stack: 'one',
itemStyle: itemStyle, itemStyle: itemStyle,
data: this.inEchartData.map(e=>{ data: this.inEchartData.map(e => {
return e.avg; return e.avg;
}) })
}, },
...@@ -216,7 +240,7 @@ export class FlowTrendComponent implements OnInit { ...@@ -216,7 +240,7 @@ export class FlowTrendComponent implements OnInit {
type: 'line', type: 'line',
stack: 'one', stack: 'one',
itemStyle: itemStyle, itemStyle: itemStyle,
data: this.outEchartData.map(e=>{ data: this.outEchartData.map(e => {
return -e.avg; return -e.avg;
}) })
} }
...@@ -233,19 +257,19 @@ export class FlowTrendComponent implements OnInit { ...@@ -233,19 +257,19 @@ export class FlowTrendComponent implements OnInit {
this.getOutList(); this.getOutList();
} }
getListIO(){ getListIO() {
this.getInList(); this.getInList();
this.getOutList(); this.getOutList();
} }
//in改变页数 //in改变页数
inChnagePage(e){ inChnagePage(e) {
this.inPageNum = e; this.inPageNum = e;
this.getInList(); this.getInList();
} }
//out改变页数 //out改变页数
outChnagePage(e){ outChnagePage(e) {
this.outPageNum = e; this.outPageNum = e;
this.getOutList(); this.getOutList();
} }
...@@ -254,12 +278,12 @@ export class FlowTrendComponent implements OnInit { ...@@ -254,12 +278,12 @@ export class FlowTrendComponent implements OnInit {
getInList() { getInList() {
this.inLoading = true; this.inLoading = true;
const data = { const data = {
obj:{ obj: {
type: 'in', type: 'in',
hostid: this.obj.hostid, hostid: this.obj.hostid,
startTime: this.obj.startTime, startTime: this.obj.startTime,
endTime: this.obj.endTime, endTime: this.obj.endTime,
groupid:this.obj.groupid groupid: this.obj.groupid
}, },
pageNum: this.inPageNum, pageNum: this.inPageNum,
pageCount: this.inPageCount, pageCount: this.inPageCount,
...@@ -282,11 +306,11 @@ export class FlowTrendComponent implements OnInit { ...@@ -282,11 +306,11 @@ export class FlowTrendComponent implements OnInit {
this.outLoading = true; this.outLoading = true;
const data = { const data = {
obj: { obj: {
type:'out', type: 'out',
hostid: this.obj.hostid, hostid: this.obj.hostid,
startTime: this.obj.startTime, startTime: this.obj.startTime,
endTime: this.obj.endTime, endTime: this.obj.endTime,
groupid:this.obj.groupid groupid: this.obj.groupid
}, },
pageNum: this.outPageNum, pageNum: this.outPageNum,
pageCount: this.outPageCount, pageCount: this.outPageCount,
...@@ -306,46 +330,46 @@ export class FlowTrendComponent implements OnInit { ...@@ -306,46 +330,46 @@ export class FlowTrendComponent implements OnInit {
} }
//时间改变 //时间改变
changeType(){ changeType() {
const nowDate = new Date().getTime(); const nowDate = new Date().getTime();
let day1,day2; let day1, day2;
switch (this.timeType){ switch (this.timeType) {
case'1':{ case'1': {
this.obj.startTime = this.datePipe.transform(nowDate,'yyyy-MM-dd') +' 00:00:00'; this.obj.startTime = this.datePipe.transform(nowDate, 'yyyy-MM-dd') + ' 00:00:00';
this.obj.endTime = this.datePipe.transform(nowDate,'yyyy-MM-dd') +' 23:59:59'; this.obj.endTime = this.datePipe.transform(nowDate, 'yyyy-MM-dd') + ' 23:59:59';
break; break;
} }
case'2':{ case'2': {
day1 = nowDate - 1*24*60*60*1000; day1 = nowDate - 1 * 24 * 60 * 60 * 1000;
this.obj.startTime = this.datePipe.transform(day1,'yyyy-MM-dd') + ' 00:00:00'; this.obj.startTime = this.datePipe.transform(day1, 'yyyy-MM-dd') + ' 00:00:00';
this.obj.endTime = this.datePipe.transform(day1,'yyyy-MM-dd') + ' 23:59:59'; this.obj.endTime = this.datePipe.transform(day1, 'yyyy-MM-dd') + ' 23:59:59';
break; break;
} }
case'3':{ case'3': {
day1 = nowDate - 3*24*60*60*1000; day1 = nowDate - 3 * 24 * 60 * 60 * 1000;
day2 = nowDate - 1*24*60*60*1000; day2 = nowDate - 1 * 24 * 60 * 60 * 1000;
this.obj.startTime = this.datePipe.transform(day1,'yyyy-MM-dd') + ' 00:00:00'; this.obj.startTime = this.datePipe.transform(day1, 'yyyy-MM-dd') + ' 00:00:00';
this.obj.endTime = this.datePipe.transform(day2,'yyyy-MM-dd') + ' 23:59:59'; this.obj.endTime = this.datePipe.transform(day2, 'yyyy-MM-dd') + ' 23:59:59';
break; break;
} }
case'4':{ case'4': {
day1 = nowDate - 7*24*60*60*1000; day1 = nowDate - 7 * 24 * 60 * 60 * 1000;
day2 = nowDate - 1*24*60*60*1000; day2 = nowDate - 1 * 24 * 60 * 60 * 1000;
this.obj.startTime = this.datePipe.transform(day1,'yyyy-MM-dd') + ' 00:00:00'; this.obj.startTime = this.datePipe.transform(day1, 'yyyy-MM-dd') + ' 00:00:00';
this.obj.endTime = this.datePipe.transform(day2,'yyyy-MM-dd') + ' 23:59:59'; this.obj.endTime = this.datePipe.transform(day2, 'yyyy-MM-dd') + ' 23:59:59';
break; break;
} }
case'5':{ case'5': {
break; break;
} }
} }
} }
//搜索 //搜索
search(){ search() {
if(this.timeType == '5'){ if (this.timeType == '5') {
this.obj.startTime = this.datePipe.transform(this.timeBegin,'yyyy-MM-dd HH:mm:ss'); this.obj.startTime = this.datePipe.transform(this.timeBegin, 'yyyy-MM-dd HH:mm:ss');
this.obj.endTime = this.datePipe.transform(this.timeEnd,'yyyy-MM-dd HH:mm:ss'); this.obj.endTime = this.datePipe.transform(this.timeEnd, 'yyyy-MM-dd HH:mm:ss');
} }
this.getEcharts(null); this.getEcharts(null);
this.getInList(); this.getInList();
......
...@@ -48,7 +48,8 @@ export class LineComponent implements OnInit { ...@@ -48,7 +48,8 @@ export class LineComponent implements OnInit {
} }
changePageIn(e){ changePageIn(e){
this.inPageNum = e;
this.getInList();
} }
//out //out
...@@ -70,7 +71,8 @@ export class LineComponent implements OnInit { ...@@ -70,7 +71,8 @@ export class LineComponent implements OnInit {
} }
changePageOut(e){ changePageOut(e){
this.outPageNum = e;
this.getOutList();
} }
ngOnInit() { ngOnInit() {
...@@ -78,7 +80,7 @@ export class LineComponent implements OnInit { ...@@ -78,7 +80,7 @@ export class LineComponent implements OnInit {
} }
showModal(hostIds) { showModal(hostIds) {
this.hostIds = hostIds; this.hostIds = hostIds.split(',');
this.isLine = true; this.isLine = true;
this.getOutList(); this.getOutList();
this.getInList(); this.getInList();
...@@ -86,7 +88,7 @@ export class LineComponent implements OnInit { ...@@ -86,7 +88,7 @@ export class LineComponent implements OnInit {
getInList(){ getInList(){
const data = { const data = {
hostIds:[this.hostIds], hostIds:this.hostIds,
search:"", search:"",
type:"in", type:"in",
pageNum:this.inPageNum, pageNum:this.inPageNum,
...@@ -103,7 +105,7 @@ export class LineComponent implements OnInit { ...@@ -103,7 +105,7 @@ export class LineComponent implements OnInit {
getOutList(){ getOutList(){
const data = { const data = {
hostIds:[this.hostIds], hostIds:this.hostIds,
search:"", search:"",
type:"out", type:"out",
pageNum:this.outPageNum, pageNum:this.outPageNum,
...@@ -130,8 +132,6 @@ export class LineComponent implements OnInit { ...@@ -130,8 +132,6 @@ export class LineComponent implements OnInit {
this.inList = []; this.inList = [];
this.outList = []; this.outList = [];
this.isLine = false; this.isLine = false;
console.log(this.inSelect);
console.log(this.outSelect);
editor.utils.setLink(this.inSelect,this.outSelect); editor.utils.setLink(this.inSelect,this.outSelect);
localStorage.setItem("line",'false'); localStorage.setItem("line",'false');
} }
......
...@@ -89,6 +89,11 @@ export class TopologyService { ...@@ -89,6 +89,11 @@ export class TopologyService {
return this.http.post(SERVER_API_URL + '/trend/findTrendData',data); return this.http.post(SERVER_API_URL + '/trend/findTrendData',data);
} }
//实时流量数据获取
findByTime(params): Observable<any> {
return this.http.get(SERVER_API_URL + '/trend/findByTime/' + params);
}
// 接受/发送流量列表 // 接受/发送流量列表
findTrend(data): Observable<any> { findTrend(data): Observable<any> {
return this.http.post(SERVER_API_URL + '/trend/findTrend',data); return this.http.post(SERVER_API_URL + '/trend/findTrend',data);
......
...@@ -344,17 +344,17 @@ export class OverAllService { ...@@ -344,17 +344,17 @@ export class OverAllService {
return this.http.post(SERVER_API_URL + '/lldrule/create',data); return this.http.post(SERVER_API_URL + '/lldrule/create',data);
} }
//添加主机自动发现 //修改主机自动发现
updateLldrule(data): Observable<any> { updateLldrule(data): Observable<any> {
return this.http.post(SERVER_API_URL + '/lldrule/update',data); return this.http.post(SERVER_API_URL + '/lldrule/update',data);
} }
//添加主机自动发现 //主机自动发现列表
findPageLldrule(data): Observable<any> { findPageLldrule(data): Observable<any> {
return this.http.post(SERVER_API_URL + '/lldrule/findPage',data); return this.http.post(SERVER_API_URL + '/lldrule/findPage',data);
} }
//添加主机自动发现 //删除主机自动发现
deleteLldrule(data): Observable<any> { deleteLldrule(data): Observable<any> {
return this.http.post(SERVER_API_URL + '/lldrule/delete',data); return this.http.post(SERVER_API_URL + '/lldrule/delete',data);
} }
......
...@@ -22,13 +22,13 @@ ...@@ -22,13 +22,13 @@
</div> </div>
<div nz-row [nzGutter]="4" class="search-form"> <div nz-row [nzGutter]="4" class="search-form">
<div nz-col nzSpan="3"> <div nz-col nzSpan="3">
<button (click)="showAddModal()" nz-button nzType="default"><i class="anticon anticon-plus-circle-o"></i>添加资产</button> <button (click)="showAddModal()" nz-button nzType="default"><i class="anticon anticon-plus-circle-o"></i>添加自动发现</button>
</div> </div>
<div nz-col nzSpan="18"></div> <div nz-col nzSpan="18"></div>
<div nz-col nzSpan="3"></div> <div nz-col nzSpan="3"></div>
</div> </div>
<nz-table #nzTable [nzData]="childrenList"> <nz-table #nzTable [nzData]="discoveryList">
<thead> <thead>
<tr> <tr>
<th nzShowCheckbox [nzIndeterminate]="indeterminate" [nzChecked]="allChecked" (nzCheckedChange)="checkAll($event)"></th> <th nzShowCheckbox [nzIndeterminate]="indeterminate" [nzChecked]="allChecked" (nzCheckedChange)="checkAll($event)"></th>
...@@ -42,11 +42,11 @@ ...@@ -42,11 +42,11 @@
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr *ngFor="let data of childrenList"> <tr *ngFor="let data of discoveryList">
<td nzShowCheckbox [(nzChecked)]="data.checked" (nzCheckedChange)="selectItem(data,$event)"></td> <td nzShowCheckbox [(nzChecked)]="data.checked" (nzCheckedChange)="selectItem(data,$event)"></td>
<td class="round-tag tag-form">{{data.inventoryNo}}</td> <td class="round-tag tag-form">{{data.name}}</td>
<td>{{data.name}}</td> <td>{{data.itemsCount}}</td>
<td>{{data.inventorycount}}</td> <td>{{data.triggersCount}}</td>
<td>{{data.stock}}</td> <td>{{data.stock}}</td>
<td>{{data.usedcount}}</td> <td>{{data.usedcount}}</td>
<td>{{data.lendcount}}</td> <td>{{data.lendcount}}</td>
......
...@@ -4,9 +4,10 @@ import {CommonService} from '../../../shared/common/common.service'; ...@@ -4,9 +4,10 @@ import {CommonService} from '../../../shared/common/common.service';
import {WorkService} from '../../../work/work.service'; import {WorkService} from '../../../work/work.service';
import {SystemService} from '../../../system/system.service'; import {SystemService} from '../../../system/system.service';
import {AssetsComponent} from '../../../work/modal/assets/assets.component'; import {AssetsComponent} from '../../../work/modal/assets/assets.component';
import {SERVER_API_URL} from '../../../app.constants'; import {pageSize, SERVER_API_URL} from '../../../app.constants';
import {UploadComponent} from '../../../work/modal/upload/upload.component'; import {UploadComponent} from '../../../work/modal/upload/upload.component';
import {NzMessageService} from 'ng-zorro-antd'; import {NzMessageService} from 'ng-zorro-antd';
import {OverAllService} from '../../overAll.service';
@Component({ @Component({
selector: 'smart-discovery-list', selector: 'smart-discovery-list',
...@@ -19,15 +20,19 @@ export class DiscoveryListComponent implements OnInit { ...@@ -19,15 +20,19 @@ export class DiscoveryListComponent implements OnInit {
@ViewChild('smartUpload') smartUpload:UploadComponent; @ViewChild('smartUpload') smartUpload:UploadComponent;
hostId; hostId;
childrenList; discoveryList;
tempName; tempName;
pageNum = 1;
pageCount = pageSize;
totalNum;
allChecked = false; allChecked = false;
selectList = []; selectList = [];
disabledButton = true; disabledButton = true;
indeterminate = false; indeterminate = false;
constructor(private workSer: WorkService, private routerInfo: ActivatedRoute,private router:Router, constructor(private overAllSer: OverAllService, private routerInfo: ActivatedRoute,private router:Router,
private message:NzMessageService,private systemSer:SystemService, private message:NzMessageService,private systemSer:SystemService,
private commonSer:CommonService) { private commonSer:CommonService) {
this.routerInfo.queryParams.subscribe( this.routerInfo.queryParams.subscribe(
...@@ -39,12 +44,12 @@ export class DiscoveryListComponent implements OnInit { ...@@ -39,12 +44,12 @@ export class DiscoveryListComponent implements OnInit {
} }
checkAll(value: boolean): void { checkAll(value: boolean): void {
this.childrenList.forEach(data => data.checked = value); this.discoveryList.forEach(data => data.checked = value);
this.refreshStatus(); this.refreshStatus();
} }
currentPageDataChange($event: Array<{ checked: boolean }>): void { currentPageDataChange($event: Array<{ checked: boolean }>): void {
this.childrenList = $event; this.discoveryList = $event;
} }
selectItem(item, e) { selectItem(item, e) {
...@@ -61,8 +66,8 @@ export class DiscoveryListComponent implements OnInit { ...@@ -61,8 +66,8 @@ export class DiscoveryListComponent implements OnInit {
} }
refreshStatus(): void { refreshStatus(): void {
const allChecked = this.childrenList.every(value => value.checked === true); const allChecked = this.discoveryList.every(value => value.checked === true);
const allUnChecked = this.childrenList.every(value => !value.checked); const allUnChecked = this.discoveryList.every(value => !value.checked);
this.allChecked = allChecked; this.allChecked = allChecked;
this.indeterminate = (!allChecked) && (!allUnChecked); this.indeterminate = (!allChecked) && (!allUnChecked);
} }
...@@ -72,9 +77,15 @@ export class DiscoveryListComponent implements OnInit { ...@@ -72,9 +77,15 @@ export class DiscoveryListComponent implements OnInit {
} }
getList() { getList() {
this.workSer.findInventory(this.hostId).subscribe( const data = {
pageNum:this.pageNum,
pageCount:this.pageCount,
hostIds:[this.hostId]
};
this.overAllSer.findPageLldrule(data).subscribe(
(res) => { (res) => {
this.childrenList = res.data; this.discoveryList = res.data.data;
this.totalNum = res.data.totalNum;
} }
); );
} }
...@@ -86,7 +97,7 @@ export class DiscoveryListComponent implements OnInit { ...@@ -86,7 +97,7 @@ export class DiscoveryListComponent implements OnInit {
}; };
data.inventoryIds.push(item.id); data.inventoryIds.push(item.id);
this.commonSer.confirmThing("删除","确定删除该资产?",()=>{ this.commonSer.confirmThing("删除","确定删除该资产?",()=>{
this.workSer.deleteInventory(data).subscribe( this.overAllSer.deleteLldrule(data).subscribe(
(res)=>{ (res)=>{
if(res.errCode == 10000){ if(res.errCode == 10000){
this.getList(); this.getList();
...@@ -111,7 +122,7 @@ export class DiscoveryListComponent implements OnInit { ...@@ -111,7 +122,7 @@ export class DiscoveryListComponent implements OnInit {
}) })
}; };
this.commonSer.confirmThing("批量删除","确定删除选择的资产?",()=>{ this.commonSer.confirmThing("批量删除","确定删除选择的资产?",()=>{
this.workSer.deleteInventory(data).subscribe( this.overAllSer.deleteLldrule(data).subscribe(
(res)=>{ (res)=>{
if(res.errCode == 10000){ if(res.errCode == 10000){
this.getList(); this.getList();
......
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