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();
......
...@@ -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