Commit 33ab7b9a authored by wangqinghua's avatar wangqinghua

template

parent 2da51acc
......@@ -50,7 +50,7 @@ export class DiscoveryComponent implements OnInit {
interfaceid: [null,],
delay: [null, [Validators.required]],
description: [null],
lifetime: [null],
lifetime: ['3600'],
status: [null],
});
}
......@@ -80,11 +80,6 @@ export class DiscoveryComponent implements OnInit {
data.type += '';
data.interfaceid += '';
data.value_type += '';
if(data.applications){
data.applications = data.applications.map(e=>{
return e.applicationid;
});
}
this.validateForm.patchValue(data);
}
);
......@@ -107,7 +102,7 @@ export class DiscoveryComponent implements OnInit {
this.message.error('请输入必填信息');
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;
if (this.title == '添加自动发现') {
this.create();
......
......@@ -48,7 +48,8 @@ export class LineComponent implements OnInit {
}
changePageIn(e){
this.inPageNum = e;
this.getInList();
}
//out
......@@ -70,7 +71,8 @@ export class LineComponent implements OnInit {
}
changePageOut(e){
this.outPageNum = e;
this.getOutList();
}
ngOnInit() {
......@@ -78,7 +80,7 @@ export class LineComponent implements OnInit {
}
showModal(hostIds) {
this.hostIds = hostIds;
this.hostIds = hostIds.split(',');
this.isLine = true;
this.getOutList();
this.getInList();
......@@ -86,7 +88,7 @@ export class LineComponent implements OnInit {
getInList(){
const data = {
hostIds:[this.hostIds],
hostIds:this.hostIds,
search:"",
type:"in",
pageNum:this.inPageNum,
......@@ -103,7 +105,7 @@ export class LineComponent implements OnInit {
getOutList(){
const data = {
hostIds:[this.hostIds],
hostIds:this.hostIds,
search:"",
type:"out",
pageNum:this.outPageNum,
......@@ -130,8 +132,6 @@ export class LineComponent implements OnInit {
this.inList = [];
this.outList = [];
this.isLine = false;
console.log(this.inSelect);
console.log(this.outSelect);
editor.utils.setLink(this.inSelect,this.outSelect);
localStorage.setItem("line",'false');
}
......
......@@ -89,6 +89,11 @@ export class TopologyService {
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> {
return this.http.post(SERVER_API_URL + '/trend/findTrend',data);
......
......@@ -344,17 +344,17 @@ export class OverAllService {
return this.http.post(SERVER_API_URL + '/lldrule/create',data);
}
//添加主机自动发现
//修改主机自动发现
updateLldrule(data): Observable<any> {
return this.http.post(SERVER_API_URL + '/lldrule/update',data);
}
//添加主机自动发现
//主机自动发现列表
findPageLldrule(data): Observable<any> {
return this.http.post(SERVER_API_URL + '/lldrule/findPage',data);
}
//添加主机自动发现
//删除主机自动发现
deleteLldrule(data): Observable<any> {
return this.http.post(SERVER_API_URL + '/lldrule/delete',data);
}
......
......@@ -22,13 +22,13 @@
</div>
<div nz-row [nzGutter]="4" class="search-form">
<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 nz-col nzSpan="18"></div>
<div nz-col nzSpan="3"></div>
</div>
<nz-table #nzTable [nzData]="childrenList">
<nz-table #nzTable [nzData]="discoveryList">
<thead>
<tr>
<th nzShowCheckbox [nzIndeterminate]="indeterminate" [nzChecked]="allChecked" (nzCheckedChange)="checkAll($event)"></th>
......@@ -42,11 +42,11 @@
</tr>
</thead>
<tbody>
<tr *ngFor="let data of childrenList">
<tr *ngFor="let data of discoveryList">
<td nzShowCheckbox [(nzChecked)]="data.checked" (nzCheckedChange)="selectItem(data,$event)"></td>
<td class="round-tag tag-form">{{data.inventoryNo}}</td>
<td>{{data.name}}</td>
<td>{{data.inventorycount}}</td>
<td class="round-tag tag-form">{{data.name}}</td>
<td>{{data.itemsCount}}</td>
<td>{{data.triggersCount}}</td>
<td>{{data.stock}}</td>
<td>{{data.usedcount}}</td>
<td>{{data.lendcount}}</td>
......
......@@ -4,9 +4,10 @@ import {CommonService} from '../../../shared/common/common.service';
import {WorkService} from '../../../work/work.service';
import {SystemService} from '../../../system/system.service';
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 {NzMessageService} from 'ng-zorro-antd';
import {OverAllService} from '../../overAll.service';
@Component({
selector: 'smart-discovery-list',
......@@ -19,15 +20,19 @@ export class DiscoveryListComponent implements OnInit {
@ViewChild('smartUpload') smartUpload:UploadComponent;
hostId;
childrenList;
discoveryList;
tempName;
pageNum = 1;
pageCount = pageSize;
totalNum;
allChecked = false;
selectList = [];
disabledButton = true;
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 commonSer:CommonService) {
this.routerInfo.queryParams.subscribe(
......@@ -39,12 +44,12 @@ export class DiscoveryListComponent implements OnInit {
}
checkAll(value: boolean): void {
this.childrenList.forEach(data => data.checked = value);
this.discoveryList.forEach(data => data.checked = value);
this.refreshStatus();
}
currentPageDataChange($event: Array<{ checked: boolean }>): void {
this.childrenList = $event;
this.discoveryList = $event;
}
selectItem(item, e) {
......@@ -61,8 +66,8 @@ export class DiscoveryListComponent implements OnInit {
}
refreshStatus(): void {
const allChecked = this.childrenList.every(value => value.checked === true);
const allUnChecked = this.childrenList.every(value => !value.checked);
const allChecked = this.discoveryList.every(value => value.checked === true);
const allUnChecked = this.discoveryList.every(value => !value.checked);
this.allChecked = allChecked;
this.indeterminate = (!allChecked) && (!allUnChecked);
}
......@@ -72,9 +77,15 @@ export class DiscoveryListComponent implements OnInit {
}
getList() {
this.workSer.findInventory(this.hostId).subscribe(
const data = {
pageNum:this.pageNum,
pageCount:this.pageCount,
hostIds:[this.hostId]
};
this.overAllSer.findPageLldrule(data).subscribe(
(res) => {
this.childrenList = res.data;
this.discoveryList = res.data.data;
this.totalNum = res.data.totalNum;
}
);
}
......@@ -86,7 +97,7 @@ export class DiscoveryListComponent implements OnInit {
};
data.inventoryIds.push(item.id);
this.commonSer.confirmThing("删除","确定删除该资产?",()=>{
this.workSer.deleteInventory(data).subscribe(
this.overAllSer.deleteLldrule(data).subscribe(
(res)=>{
if(res.errCode == 10000){
this.getList();
......@@ -111,7 +122,7 @@ export class DiscoveryListComponent implements OnInit {
})
};
this.commonSer.confirmThing("批量删除","确定删除选择的资产?",()=>{
this.workSer.deleteInventory(data).subscribe(
this.overAllSer.deleteLldrule(data).subscribe(
(res)=>{
if(res.errCode == 10000){
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