Skip to content
change-apply-sure.ts 2.18 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({
wangqinghua's avatar
wangqinghua committed
    selector: 'page-change-apply-sure',
    templateUrl: 'change-apply-sure.html',
wangqinghua's avatar
wangqinghua committed
})
export class ChangeApplySurePage {

wangqinghua's avatar
wangqinghua committed
    item;     //替班人信息
    applyDetail;   //申请信息
wangqinghua's avatar
wangqinghua committed
    applyType;    //申请类型
wangqinghua's avatar
wangqinghua committed
    changeId;  // 换班Id
    personId;  //替班人id
    nowId;     //申请id
wangqinghua's avatar
wangqinghua committed
    applyId;
wangqinghua's avatar
wangqinghua committed
    constructor(public navCtrl: NavController, public navParams: NavParams,
                public appService: AppService) {
    }

    ionViewDidLoad() {
wangqinghua's avatar
wangqinghua committed
        this.item = this.navParams.get('item');
        this.applyId = this.navParams.get('applyId');
wangqinghua's avatar
wangqinghua committed
        this.personId = this.navParams.get('personId');
        this.nowId = this.navParams.get('nowId');
        this.changeId = this.navParams.get('changeId');
wangqinghua's avatar
wangqinghua committed
        console.log('applyId:' + this.applyId);
wangqinghua's avatar
wangqinghua committed
        console.log('personId:' + this.personId);
        console.log('nowId:' + this.nowId);
        console.log('changeId:' + this.changeId);
        if (this.personId) {
            this.applyType = 'replace';  //值班
        } else {
            this.applyType = 'change';   //替班
        }

wangqinghua's avatar
wangqinghua committed
        this.appService.ObserverHttpGetOption('/wisdomgroup/changeApply/app/apply',{'id': this.applyId})
            .subscribe((res)=>{
                this.applyDetail = res.json();
            })

wangqinghua's avatar
wangqinghua committed
    }

    //替班
    replace() {
        const data = {
            id: this.nowId,  //值班记录id
            personId: this.personId   //替班人id
        };
        console.log(data);
        this.appService.ObserverHttpGetOption('/wisdomgroup/schedule/replace', data)
            .subscribe((res) => {
                console.log(res.json());
            })
    }

    //换班
    change() {
        const data = {
            nowId: this.nowId,  //值班记录id
            changeId: this.changeId //互换的值班ID
        };
        console.log(data);
        this.appService.ObserverHttpGetOption('/wisdomgroup/schedule/change',data)
            .subscribe((res) => {
                console.log(res.json());
            })
    }
wangqinghua's avatar
wangqinghua committed

}