Skip to content
select-relay-person.ts 1.62 KiB
Newer Older
wangqinghua's avatar
wangqinghua committed
import { Component } from '@angular/core';
import { IonicPage, NavController, NavParams } from 'ionic-angular';
import {ChangeApplySurePage} from "../change-apply-sure/change-apply-sure";
import { Storage } from "@ionic/storage";
import { DatePipe } from "@angular/common";
import {AppService} from "../../../../service/http.service";

@IonicPage()
@Component({
  selector: 'page-select-relay-person',
  templateUrl: 'select-relay-person.html',
})
export class SelectRelayPersonPage {

    gender;   //性别  1 男 0女
    scheduleId;
    date;
    list;
  constructor(public navCtrl: NavController, public navParams: NavParams,
              public appService: AppService,public storage: Storage,private datepipe: DatePipe) {
  }

  ionViewDidLoad() {
      this.scheduleId = this.navParams.get('scheduleId');
      this.date = this.datepipe.transform( this.navParams.get('date'),'yyyy/MM/dd');
      this.storage.get("user").then((res)=>{
          this.gender = res.userDetail.user.gender;
          this.getPerson();
      });
  }

  getPerson(){
      const data = {
          date:this.date,
          gender:this.gender,
          id:''
      };
      this.appService.ObserverHttpGetOption('/wisdomgroup/dutyPerson/getPersonListOutOfMine',data)
          .subscribe((res)=>{
              this.list = res.json();
          })
  }

  //替班
  selectPerson(item){

      this.navCtrl.push('ChangeApplySurePage',{
          'item':item,
          'applyId':this.navParams.get('applyId'),
          'personId':item.id,
          'nowId':this.scheduleId
      })
  }

    change(type){
        // this.changeType = type;
        this.getPerson();
    }

}