import { Component, OnInit } from '@angular/core';
import {WorkService} from '../work.service';
import {pageSize} from '../../app.constants';
import {NzMessageService} from 'ng-zorro-antd';

@Component({
  selector: 'smart-inspect-plan',
  templateUrl: './inspect-plan.component.html',
  styles: []
})
export class InspectPlanComponent implements OnInit {

    timeFormat = 'yyyy-MM-dd';
    planList;
    timeBegin;
    timeEnd;
    pageCount = pageSize;
    pageNum = 1;
    totalNum;

    obj = {
        pageNum:'',
        pageCount:'',
        searchStr:"",
        typeId:null,
        status:null,
    };
    constructor(private workSer:WorkService,private message:NzMessageService) { }

    ngOnInit() {
        this.getList();
    }

    getList(){
        const obj = {
            pageNum:this.pageNum,
            pageCount:this.pageCount,
            searchStr:this.obj.searchStr,
            typeId:this.obj.typeId,
            status:this.obj.status,
        };
        this.workSer.findPlanList(obj).subscribe(
            (res)=>{
                if(res.errCode == 10000){
                    this.planList = res.data.data;
                    this.totalNum = res.data.totalNum;
                }else{
                    this.message.error(res.errMsg);
                }
            }
        )
    }

    change(e){
        this.pageNum = e;
        this.getList();
    }

}
