Newer
Older
import {Component} from '@angular/core';
import {IonicPage, NavController, NavParams} from 'ionic-angular';
import {HomeService} from "../../home.service";
import {DatePipe} from "@angular/common";
reason = ''; //申请原因
old = {
date: null,
type: null,
id: ''
};
change = {
date: null,
personName: ''
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
constructor(public navCtrl: NavController, public navParams: NavParams, private datePipe: DatePipe,
public appService: AppService, private homeSer: HomeService) {
}
ionViewDidLoad() {
this.old.id = this.navParams.get('id');
this.old.date = this.navParams.get('date');
this.old.type = this.navParams.get('type');
this.change.date = this.datePipe.transform(this.old.date, "yyyy-MM-dd");
console.log(this.change.date)
}
//查询值班
getScheduleInfo() {
const data = {
date: this.datePipe.transform(this.change.date, "yyyy/MM/dd"),
type: this.old.type //0 白班 1 夜班
};
this.homeSer.getScheduleInfo(data).subscribe(
(res) => {
this.change.personName = res.name;
}
)
}
submit() {
const reason = this.reason + "备注:换班人--" + this.change.personName;
const data = {
scheduleId: this.old.id,
reason: reason
};
this.appService.alert('确定提交该申请?', res => {
this.appService.ObserverHttpPost('/wisdomgroup/changeApply/app/apply', data)
.subscribe((res) => {
this.appService.popToastView('提交该申请成功!', 'middle', 1000);
this.navCtrl.pop();
})
});
}