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();
        this.all = data;
      }, error => {
        this.appService.alert('网络异常！');
      }
      );
  }


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

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

}
