Newer
Older
import {Component, OnInit, ViewChild} from '@angular/core';
import {PlanModalComponent} from '../modal/plan-modal/plan-modal.component';
import {LookPlanComponent} from '../modal/look-plan/look-plan.component';
import {WorkService} from '../work.service';
import {NzMessageService, NzModalService} from 'ng-zorro-antd';
import {CommonService} from '../../shared/common/common.service';
import {SparePartsComponent} from '../modal/spare-parts/spare-parts.component';
import {UploadComponent} from '../modal/upload/upload.component';
import {SystemService} from '../../system/system.service';
selector: 'smart-spare-parts-management',
templateUrl: './spare-parts-management.component.html',
styles: []
@ViewChild('smartSpareParts') smartSpareParts: SparePartsComponent;
isLoading = false;
pageCount = pageSize;
pageNum = 1;
totalNum;
constructor(private workSer: WorkService, private message: NzMessageService,
private modalSer: NzModalService,
getList() {
this.isLoading = true;
const obj = {
pageNum: this.pageNum,
pageCount: this.pageCount,
obj: this.obj,
};
this.workSer.selectComponentsList(obj).subscribe(
(res) => {
if (res.errCode == 10000) {
this.dataSet = res.data.data;
this.totalNum = res.data.totalNum;
}
this.isLoading = false;
}
);
}
change(e) {
if (e > 0) {
this.pageNum = e;
this.getList();
//查看计划
lookPlan(id, name) {
this.smartLookPlan.showModal(id, name);
}
//删除
deleteData(data) {
this.commonSer.confirmThing('提示', `确定删除该备件`, () => {
const d = {
id:data.id
}
this.workSer.deleteComponents(d).subscribe(
if (res.errCode == 10000) {
this.message.success('删除成功');
this.search();
}
//下载模版
downLoad(){
this.systemSer.downloadTemplate("components",SERVER_API_URL + "/api/template/download/").subscribe(
(data)=>{
}
)
}
//上传文件
uploadFile(){
this.smartUpload.showModal('导入备件管理数据');
}