Newer
Older
import {Router} from '@angular/router';
import {TypeAsetsComponent} from '../modal/type-asets/type-asets.component';
import {UploadComponent} from '../modal/upload/upload.component';
import {CommonService} from '../../shared/common/common.service';
@Component({
selector: 'smart-asset-part',
templateUrl: './asset-part.component.html',
styles: []
})
export class AssetPartComponent implements OnInit {
constructor(private workSer:WorkService,private router:Router,private commonSer:CommonService,
private messge:NzMessageService,private systemSer:SystemService) { }
goToChild(data){
this.router.navigate(['app/main/assetChild'],
{
queryParams:{
}
})
}
showAddModal(){
this.smartTypeAsets.showAddModal("新增分类");
}
if(this.obj.type == "all"){
this.messge.warning("请选择需要编辑的分类");
if(this.obj.type == "all"){
this.messge.warning("请选择需要删除的分类");
return false;
}
if(this.childrenList.length > 0){
this.messge.warning("删除失败,请先清除该分类下的子分类!");
return false;
}
const data = {
inventoryTypeIds:[]
};
data.inventoryTypeIds.push(this.obj.type);
this.workSer.deleteType(data).subscribe(
(res)=>{
if(res.errCode == 10000){
this.messge.success("删除成功");
this.getList();
}else{
this.messge.error(res.errMsg);
}
}
)
})
}
//编辑子级分类
showCEditModal(id){
this.smartTypeAsets.showEditModal("编辑分类",id);
}
this.workSer.findInventory(item.id).subscribe(
(res) => {
if(res.data.length > 0 ){
this.messge.warning("删除失败,请先清除资产!");
}else{
const data = {
inventoryTypeIds:[]
};
data.inventoryTypeIds.push(item.id);
this.commonSer.confirmThing("删除","确定删除该子级分类",()=>{
this.workSer.deleteType(data).subscribe(
(res)=>{
if(res.errCode == 10000){
this.messge.success("删除成功");
this.changeType();
}else{
this.messge.error(res.errMsg);
}
}
)
})
}
}
);
this.smartUpload.showModal("上传资产文件");
}
//下载模版
downLoad(){
this.systemSer.downloadTemplate("inventory",SERVER_API_URL + "/api/template/download/").subscribe(