Newer
Older
import {Component} from '@angular/core';
import {IonicPage, NavController, NavParams} from 'ionic-angular';
import {CalendarComponentOptions} from "ion2-calendar";
import {monthCh, weekDay} from "../../../app/main";
import {RoomApplyPage} from "./room-apply/room-apply";
import {ServeService} from "../serve.service";
import {DatePipe} from "@angular/common";
import {AppGlobal} from "../../../service/http.service";
import {CommonService} from "../../../provide/common.service";
import {AppMainService} from "../../../app/app.service";
import {RoomDealPage} from "./room-deal/room-deal";
options: CalendarComponentOptions = {
from: new Date(2000, 0, 1),
monthFormat: 'YYYY 年 MM 月 ',
weekdays: weekDay,
monthPickerFormat: monthCh,
pickMode: 'single',
color: 'danger'
};
P_pageNumber: 1,
P_pageSize: AppGlobal.pageCount,
total: null,
isLoad: true,
constructor(public navCtrl: NavController, public navParams: NavParams,
private commonSer: CommonService, private appMainSer: AppMainService) {
//获取权限
this.appMainSer.role.subscribe(value => {
this.role = value;
}
);
//获取个人信息
this.appMainSer.mineInfo.subscribe(value => {
this.mineInfo = value;
})
this.room.morning = res.data.morningUse;
this.room.afternoon = res.data.afternoonUse;
if (this.page.total == this.applyList.length) {
console.log("没有更多了");
e.enable(false);
return false;
}
this.page.P_pageNumber++;
const data = {
P_pageNumber: this.page.P_pageNumber,
P_pageSize: this.page.P_pageSize,
};
this.serveSer.queryMyApply(data).subscribe(
(res) => {
this.page.total = res.total;
res.list.forEach(e => {
this.applyList.push(e);
});
timer(800).subscribe(() => e.complete());
}
)
P_pageNumber: this.page.P_pageNumber,
P_pageSize: this.page.P_pageSize,
}
)
}
//取消预定
removeItem(item) {
this.serveSer.cancelApply(item.id).subscribe(
(res) => {
if (res.errcode == 1000) {
this.commonSer.toast('取消预定成功');
this.myApply();
} else {
this.commonSer.toast(res.errmsg);
}
}
)
}
if (this.changeType == 1) this.getApply();
if (this.changeType == 2) this.myApply();
if ((this.role.includes(1) || this.role.includes(2)
&& item.orgName != this.mineInfo.orgName) || this.role.includes(7)) {
this.navCtrl.push(RoomApplyPage, {id: item.applyId, accommodation: item.accommodation});
if (this.role.includes(1) || this.role.includes(2) || this.role.includes(7)) {
let data;
if (item) {
data = {
roomId: item.id,
roomName: item.name,
startTime: this.date + ' ' + time,
accommodation: item.accommodation
}
;
}
chooseType(item, time) {
const nowDate = new Date().getTime();
const chooseDate = new Date(this.date +' 23:59:59').getTime();
this.goApplyEdit(item);
} else {
this.goApply(item, time);
}