Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
import { Component } from '@angular/core';
import { IonicPage, NavController, NavParams } from 'ionic-angular';
import {CalendarComponentOptions} from "ion2-calendar";
import {DutyApplyPage} from "../duty-apply/duty-apply";
import {DutyDetailPage} from "../duty-detail/duty-detail";
import {DutySignUpPage} from "../duty-sign-up/duty-sign-up";
import { DayConfig } from "ion2-calendar";
import {AppService} from "../../../../service/http.service";
import {monthCh,weekDay} from "../../../../app/main";
declare var Swiper;
@IonicPage()
@Component({
selector: 'page-duty',
templateUrl: 'duty.html',
})
export class DutyPage {
menuList = [
{name:'值班安排'},
{name:'我的值班'},
];
swiperIndex;
changeType = 1;
dayObj = {
name:''
};
nightObj = {
name:''
};
nowDuty = [];
historyDuty;
options: CalendarComponentOptions = {
from: new Date(2000, 0, 1),
monthFormat: 'YYYY 年 MM 月 ',
weekdays: weekDay,
monthPickerFormat:monthCh,
pickMode: 'single',
color:'danger'
};
constructor(public navCtrl: NavController, public navParams: NavParams,
public appService: AppService) {
}
ionViewDidEnter() {
const date = new Date().toLocaleDateString();
this.getDuty(date);
this.myDuty();
this.selectPageMenu(0);
this.getSchedule()
}
selectPageMenu(index) {
this.swiperIndex = index;
//切换页面
// this.contentSlides.slideTo(index);
}
getSchedule(){
}
change(type){
this.changeType = type;
}
onChange(e){
const date = new Date(e).toLocaleDateString();
this.getDuty(date);
}
getDuty(date){
//0 白班 1 夜班
const data = {
date:date,
type:0
};
this.appService.ObserverHttpGetOption('/wisdomgroup/schedule/getScheduleInfo',data)
.subscribe((res)=>{
this.dayObj = res.json();
});
const data1 = {
date:date,
type:1
};
this.appService.ObserverHttpGetOption('/wisdomgroup/schedule/getScheduleInfo',data1)
.subscribe((res)=>{
this.nightObj = res.json();
});
}
//我的值班
myDuty(){
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;
});
}
//提交申请
dutyApply(item){
let nowTime = new Date().getTime();
if(nowTime > item.dutyDate){
this.appService.popToastView('该条值班已过期','middle',1500);
return false;
}
this.navCtrl.push('DutyApplyPage',{
id:item.id,
date:item.dutyDate
})
}
//申请详情
dutyDetail(item){
this.navCtrl.push('DutyDetailPage',{
"id":item.applyId,
'time':item.dutyDate
})
}
//值班签到
sigUp(){
this.navCtrl.push('DutySignUpPage');
}
}