import { Component } from '@angular/core';
import { IonicPage, NavController } from 'ionic-angular';
import { Response } from '@angular/http';
import { AppService } from '../../../service/appHttpService';
import { ReportDetailPage } from '../reportDetail/reportDetail';

@IonicPage()
@Component({
  selector: 'page-reportTrack',
  templateUrl: 'reportTrack.html',
})
export class ReportTrackPage {

  all: object[];
  constructor(public navCtrl: NavController, public appService: AppService) {
   
  }

  ionViewWillEnter() {
    //加载报备
    this.getAllReport();
  }

  //获取所有报备
  getAllReport() {
    this.appService.ObserverHttpPost("/wisdomgroup/modules/premanager/getReport", null)
      .subscribe((res: Response) => {
        let data = res.json();
        console.log(data);
        this.all = data;
      }, error => {
        this.appService.alert('网络异常！');
      }
      );
  }


  goDetail(id,title) {
    this.navCtrl.push("ReportDetailPage",{
      id:id,
      title:title
    });
  }

  goBack() {
    this.navCtrl.popToRoot();
  }

}
