Newer
Older
import {WorkService} from '../work.service';
import {pageSize} from '../../app.constants';
import {NzMessageService, NzModalService} from 'ng-zorro-antd';
import {PlanModalComponent} from '../modal/plan-modal/plan-modal.component';
import {LookPlanComponent} from '../modal/look-plan/look-plan.component';
selector: 'smart-inspect-plan',
templateUrl: './inspect-plan.component.html',
styles: []
@ViewChild('smartPlanMoadl') smartPlanMoadl: PlanModalComponent;
@ViewChild('smartLookPlan') smartLookPlan: LookPlanComponent;
pageNum: '',
pageCount: '',
searchStr: '',
typeId: null,
status: null,
constructor(private workSer: WorkService, private message: NzMessageService,
private modalSer: NzModalService) {
}
this.getPlanType();
}
//获取计划分类
getPlanType() {
const data = {
type: 1
};
this.workSer.findByType(data).subscribe(
(res) => {
if (res.errCode == 10000) {
this.planTypeList = res.data;
}
}
);
pageNum: this.pageNum,
pageCount: this.pageCount,
searchStr: this.obj.searchStr,
typeId: this.obj.typeId,
status: this.obj.status,
this.planList = res.data.data;
this.totalNum = res.data.totalNum;
//新增计划
addPlan() {
this.smartPlanMoadl.showAddModal();
}
//编辑计划
editPlan(id) {
this.smartPlanMoadl.showEditModal(id);
}
//查看计划
}
//删除计划
deletePlan(data) {
this.modalSer.confirm({
nzTitle: '删除',
nzContent: '<b style="color: red;">确认删除该计划吗?</b>',
nzOkText: '确定',
nzOkType: 'danger',
nzOnOk: () => {
const arr = {
ids: []
};
arr.ids.push(data.id);
this.workSer.deletePlan(arr).subscribe(
(res) => {
if (res.errCode == 10000) {
this.message.success('删除成功');
} else {
this.message.error(res.errMsg);
}
}
);
},
nzCancelText: '取消',
nzOnCancel: () => console.log('Cancel')
}
);
}