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

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

    timeFormat = 'yyyy-MM-dd';
    parentList;
    childrenList;
    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) { }

    ngOnInit() {
        this.getList();
    }

    getList(){
        this.workSer.findByParentType().subscribe(
            (res)=>{
                if(res.errCode == 10000){
                    this.parentList = res.data;
                }else{

                }
            }
        )
    }

    changeType(e){
        this.workSer.findByParentidCount(e).subscribe(
            (res)=>{
                this.childrenList = res.data;
            }
        )
    }

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

}
