Newer
Older
import {pageSize} from '../../../app.constants';
import {NzMessageService} from 'ng-zorro-antd';
import {SelectGroupComponent} from '../../../modal/select-group/select-group.component';
import {CommonService} from '../../../shared/common/common.service';
import {Location} from '@angular/common';
import {AssetsComponent} from '../../modal/assets/assets.component';
@Component({
selector: 'smart-assets-detail',
templateUrl: './assets-detail.component.html',
styles: []
})
export class AssetsDetailComponent implements OnInit {
@ViewChild('smartSelectGroup') smartSelectGroup:SelectGroupComponent;
totalNum;
pageNum=1;
pageCount = pageSize;
loading = false;
thingList;
constructor(private routerInfo:ActivatedRoute,private workSer:WorkService,private commonSer:CommonService,
private message:NzMessageService,private router:Router,private localSer:Location) {
this.routerInfo.queryParams.subscribe(
(res)=>{
this.invertoryId = res.invertoryId;
}
)
}
getDetail(){
this.workSer.selectByPrimaryKey(this.invertoryId).subscribe(
(res)=>{
this.inventoryExtend = res.data;
}
)
}
//资产关联事件
getEventList(){
this.loading = true;
const data = {
"inventoryId":this.invertoryId
};
this.workSer.find(data).subscribe(
(res)=>{
this.thingList = res.data.data;
this.totalNum = res.data.totalNum;
this.loading = false;
}
)
}
//翻页
change(e){
this.pageNum = e;
this.getEventList();
}
//查看事件详情
lookEvent(item) {
this.router.navigate(['app/main/handleDetail'], {
queryParams: {
eventId: item.id
}
});
}
//删除
deleteModal(){
const data = {
inventoryIds: [this.invertoryId]
};
this.commonSer.confirmThing("删除","确定删除该资产?",()=>{
this.workSer.deleteInventory(data).subscribe(
(res)=>{
if(res.errCode == 10000){
this.localSer.back();
this.message.success("删除资产成功");
}else{
this.message.error(res.errMsg);
}
}
)
})
}
//编辑
showEditModal(){
this.smartAssets.showEditModal("编辑资产",this.invertoryId);
}
this.workSer.updateHostid(data).subscribe(
(res)=>{
if(res.errCode == 10000){
this.message.success("设置关联主机成功");
this.getDetail();
}else{
this.message.error(res.errMsg);
}
}
)
}
//查看资源
goToHost(hostid){
this.router.navigate(['app/main/basic-detail'], {
queryParams: {
hostId: hostid,
type: 0,
}
});
}