Newer
Older
import {WorkService} from '../work.service';
import {pageSize} from '../../app.constants';
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 {
timeBegin;
timeEnd;
pageCount = pageSize;
pageNum = 1;
totalNum;
obj = {
pageCount:null,
pageNum:null,
searchStr:'',
type:null,
status:null,
source:null,
startTime:'',
endTime:'',
};
constructor(private workSer:WorkService,private router:Router,private commonSer:CommonService,
getTypeList(){
this.getList();
this.changeType();
}
changeType(){
this.workSer.findByParentidCount(this.obj.type).subscribe(
goToChild(data){
this.router.navigate(['app/main/assetChild'],
{
queryParams:{
id:data.id
}
})
}
showAddModal(){
this.smartTypeAsets.showAddModal("新增分类");
}
if(!this.obj.type){
this.messge.error("请选择需要编辑的分类");
return false;
}
//删除父分类
deleteParentType(){
const data = {
inventoryTypeIds:[]
};
data.inventoryTypeIds.push(this.obj.type);
this.commonSer.deleteThing("确定删除该父级分类",()=>{
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);
}
//删除子级分类
deleteChildType(item){
const data = {
inventoryTypeIds:[]
};
data.inventoryTypeIds.push(item.id);
this.commonSer.deleteThing("确定删除该子级分类",()=>{
this.workSer.deleteType(data).subscribe(
(res)=>{
if(res.errCode == 10000){
this.messge.success("删除成功");
this.changeType();
}else{
this.messge.error(res.errMsg);
}
}
)
})
}
//导入资产
showUploadModal(){
this.smartUpload.showModal();
}