Skip to content
my-duty.ts 1.56 KiB
Newer Older
wangqinghua's avatar
wangqinghua committed
import { Component } from '@angular/core';
import { IonicPage, NavController, NavParams } from 'ionic-angular';
wangqinghua's avatar
wangqinghua committed
import {AppService} from "../../../service/appHttpService";
wangqinghua's avatar
wangqinghua committed


@IonicPage()
@Component({
  selector: 'page-my-duty',
  templateUrl: 'my-duty.html',
})
export class MyDutyPage {

wangqinghua's avatar
wangqinghua committed
    changeType = 1;
    nowDuty = [];
    historyDuty = [];
  constructor(public navCtrl: NavController, public navParams: NavParams,
              public appService: AppService) {
wangqinghua's avatar
wangqinghua committed
  }

  ionViewDidLoad() {
wangqinghua's avatar
wangqinghua committed
    this.getDuty();
wangqinghua's avatar
wangqinghua committed
  }

wangqinghua's avatar
wangqinghua committed
    change(type){
        this.changeType = type;
    }

    getDuty(){
        const data = {
            type:0
        };
        this.appService.ObserverHttpGetOption('/wisdomgroup/schedule/app/getMySchedule',data)
            .subscribe((res)=>{
                this.nowDuty = res.json();
            });

        const data1 = {
            type:1
        };
        this.appService.ObserverHttpGetOption('/wisdomgroup/schedule/app/getMySchedule',data1)
            .subscribe((res)=>{
                this.historyDuty = res.json();
            });
    }

    //提交申请
    dutyApply(item){
wangqinghua's avatar
wangqinghua committed
      let nowTime = new Date().getTime();
      if(nowTime > item.dutyDate){
          this.appService.popToastView('该条值班已过期','middle',1500);
          return false;
      }

wangqinghua's avatar
wangqinghua committed
        this.navCtrl.push('DutyApplyPage',{
            id:item.id,
            date:item.dutyDate
        })
    }

    //申请详情
    dutyDetail(item){
        this.navCtrl.push('DutyDetailPage',{
            "id":item.applyId,
            'time':item.dutyDate
        })
    }

wangqinghua's avatar
wangqinghua committed
}