Skip to content
reportDetail.ts 3.66 KiB
Newer Older
wangqinghua's avatar
wangqinghua committed
import {Component} from '@angular/core';
import {IonicPage, NavController, NavParams, AlertController, ToastController} from 'ionic-angular';
wangqinghua's avatar
wangqinghua committed

wangqinghua's avatar
wangqinghua committed
import {Http, Response} from '@angular/http';
import {Storage} from '@ionic/storage';
import {AppService} from '../../../service/appHttpService';
import {ReportSearchPage} from "../report-search/report-search";
wangqinghua's avatar
wangqinghua committed

@IonicPage()
@Component({
wangqinghua's avatar
wangqinghua committed
    selector: 'page-reportDetail',
    templateUrl: 'reportDetail.html',
wangqinghua's avatar
wangqinghua committed
})
export class ReportDetailPage {

wangqinghua's avatar
wangqinghua committed
    items: object[] = [];
    itemsOfNotReport: object[] = [];
    itemsOfLeave: object[] = [];
    itemsOfNotLeave: object[] = [];
    title: string;
    type: number;
    id;
wangqinghua's avatar
wangqinghua committed
    premanager; //报备信息
wangqinghua's avatar
wangqinghua committed

wangqinghua's avatar
wangqinghua committed
    constructor(public navCtrl: NavController,
                public navParams: NavParams,
                public alertCtrl: AlertController,
                public http: Http, public storage: Storage,
                public appService: AppService, public toast: ToastController) {


    }

    ionViewDidLoad() {
        this.premanager = this.navParams.get('item');
        this.title = this.navParams.get("title");
        this.id = this.navParams.get("id");
    }

    ionViewDidEnter() {
        this.getUserAboutLeave(this.id);
        this.getUserAboutNotLeave(this.id);
        this.getUserAboutNotReport(this.id);
    }

    //获取处室下所有未报备人员
    getUserAboutNotReport(id) {
        this.appService.ObserverHttpPost("/wisdomgroup/modules/premanager/getUserAboutNotReport", {id: id})
            .subscribe((res: Response) => {
                    let data = res.json();
                    this.itemsOfNotReport = data;
                    this.items = data;
                    this.type = 1;
                }, error => {
                    this.appService.alert('网络异常!');
                }
            );
    }

    //获取处室下所有离沪报备人员
    getUserAboutLeave(id) {
        this.appService.ObserverHttpPost("/wisdomgroup/modules/premanager/getUserAboutLeave", {id: id})
            .subscribe((res: Response) => {
                    let data = res.json();
                    console.log(data);
                    this.itemsOfLeave = data;
                }, error => {
                    this.appService.alert('网络异常!');
                }
            );
    }

    //获取处室下所有不离沪报备人员
    getUserAboutNotLeave(id) {
        this.appService.ObserverHttpPost("/wisdomgroup/modules/premanager/getUserAboutNotLeave", {id: id})
            .subscribe((res: Response) => {
                    let data = res.json();
                    console.log(data);
                    this.itemsOfNotLeave = data;
                }, error => {
                    this.appService.alert('网络异常!');
                }
            );
    }

    //切换
    change(type) {
        if (type == 1) {
            this.type = type;
            this.items = this.itemsOfNotReport;
        } else if (type == 2) {
            this.type = type;
            this.items = this.itemsOfLeave;
        } else if (type == 3) {
            this.type = type;
            this.items = this.itemsOfNotLeave;
        }
wangqinghua's avatar
wangqinghua committed
    }

wangqinghua's avatar
wangqinghua committed
    //协助报备
    goReport(item) {

        this.storage.remove("temp_userpre");
        this.storage.remove("managerId");
        this.storage.remove("city");
        this.storage.remove("cityList");
        this.storage.remove("person");

        this.storage.set('premanager', this.premanager);
        this.storage.set('person', item);
wangqinghua's avatar
wangqinghua committed
        this.navCtrl.push('OutGoingReportEditPage', {premanager: this.premanager});
wangqinghua's avatar
wangqinghua committed
    }

wangqinghua's avatar
wangqinghua committed

wangqinghua's avatar
wangqinghua committed
    search(){
        this.navCtrl.push('ReportSearchPage',{id:this.id,'premanager':this.premanager});
wangqinghua's avatar
wangqinghua committed
    }
wangqinghua's avatar
wangqinghua committed
}