Skip to content
duty-apply-handle.ts 2.09 KiB
Newer Older
wangqinghua's avatar
wangqinghua committed
import { Component } from '@angular/core';
import { IonicPage, NavController, NavParams } from 'ionic-angular';
import {SelectChangePersonPage} from "../select-change-person/select-change-person";
import {SelectRelayPersonPage} from "../select-relay-person/select-relay-person";
import {AppService} from "../../../../service/http.service";

@IonicPage()
@Component({
  selector: 'page-duty-apply-handle',
  templateUrl: 'duty-apply-handle.html',
})
export class DutyApplyHandlePage {

    applyDetail = {
        id:'',
        scheduleId:'',
      reason:''
    };
    personDetail = {
        id:'',
        name:'',
        phoneNumber:'',
        dutyDate:''
    };
  constructor(public navCtrl: NavController, public navParams: NavParams,
              public appService: AppService) {
  }

  ionViewDidLoad() {

    this.personDetail = this.navParams.get('item');
      this.appService.ObserverHttpGetOption('/wisdomgroup/changeApply/app/apply',{'id': this.personDetail.id})
          .subscribe((res)=>{
             this.applyDetail = res.json();
          })
  }

    submit(type){
        switch (type){
          case '1':{  //换班
            this.navCtrl.push('SelectChangePersonPage',{
                scheduleId:this.applyDetail.scheduleId,
                applyId:this.applyDetail.id,
                date:this.personDetail.dutyDate
            });
            break;
          }
          case '2':{  //替班
              this.navCtrl.push('SelectRelayPersonPage',{
                  applyId:this.applyDetail.id,
                  scheduleId:this.applyDetail.scheduleId,
                  date:this.personDetail.dutyDate
              });
              break;
          }
          case '3':{
              const data= {
                  applyId: this.applyDetail.id
              };
                this.appService.ObserverHttpGetOption('/wisdomgroup/changeApply/app/ignore',data)
                    .subscribe((res)=>{
                        this.appService.popToastView('已忽略','middle',2000);
                        this.navCtrl.pop();
                    });
              break;
          }
      }
    }

}