import {Component} from '@angular/core';
import {IonicPage, NavController, NavParams} from 'ionic-angular';
import {ContactDetailPage} from "../contact-detail/contact-detail";
import * as Mock from "mockjs";
import {HomeService} from "../home.service";

@Component({
    selector: 'page-contact-list',
    templateUrl: 'contact-list.html',
})
export class ContactListPage {

    personList = [];
    org;

    constructor(public navCtrl: NavController, public navParams: NavParams,
                private homeSer: HomeService) {
        this.org = this.navParams.get('org');
    }

    ionViewDidLoad() {
        this.getPersonList();
    }

    //人员列表
    getPersonList() {
        const data = {
            page: 1,
            limit: 1000
        }
        this.homeSer.getPersonList(data).subscribe(
            (res) => {
                this.personList = res.data;
            }
        )
    }

    //人员详情
    goToInfo(person) {
        this.navCtrl.push(ContactDetailPage, {person: person});
    }

}
