Commit 7c24ec95 authored by wangqinghua's avatar wangqinghua

党支部

parent 7e898f56
......@@ -69,7 +69,7 @@
上午
</div>
<div class="morning-room">
<span (click)="goApply(item3,'8:00:00')" *ngFor="let item3 of room?.morningNotUse">
<span (click)="goApply(item3)" *ngFor="let item3 of room?.morningNotUse">
{{item3.name}}(可预定)
</span>
</div>
......@@ -79,7 +79,7 @@
下午
</div>
<div class="morning-room">
<span (click)="goApply(item4,'12:00:00')" *ngFor="let item4 of room?.afternoonNotUse">
<span (click)="goApply(item4)" *ngFor="let item4 of room?.afternoonNotUse">
{{item4.name}}(可预定)
</span>
</div>
......
......@@ -160,7 +160,7 @@ export class MeetRoomPage {
}
//新增申请
goApply(item,time) {
goApply(item) {
if (this.role.includes(1) || this.role.includes(2) || this.role.includes(7)) {
let data;
if (item) {
......@@ -168,7 +168,7 @@ export class MeetRoomPage {
roomId: item.id,
roomName: item.name,
equipmervice: item.equipmervice,
startTime: this.date + ' ' +time,
startTime: this.date,
accommodation:item.accommodation
};
}
......
......@@ -36,10 +36,16 @@
</ion-label>
<ion-label *ngIf="check.orgId" class="check-tips">请选择申请处室</ion-label>
</ion-item>
<div class="item-box">
<div class="left">会议日期:</div>
<div class="right text-right">
{{nowDate | date:'yyyy-MM-dd'}}
</div>
</div>
<ion-item>
<ion-label class="item-left"><span class="color-red">*</span>开始时间:</ion-label>
<ion-datetime cancelText="取消" doneText="确认" displayFormat="YYYY-MM-DD HH:mm"
pickerFormat="YYYY MM DD HH mm" placeholder="请选择" [max]="obj.endTime" [min]="nowDate"
<ion-datetime cancelText="取消" doneText="确认" displayFormat="HH:mm"
pickerFormat="HH mm" placeholder="请选择" [max]="obj.endTime" [min]="nowDate"
[(ngModel)]="obj.startTime"></ion-datetime>
<ion-label class="right-arrow">
<ion-icon name="arrow-forward"></ion-icon>
......@@ -48,8 +54,8 @@
</ion-item>
<ion-item>
<ion-label class="item-left"><span class="color-red">*</span>结束时间:</ion-label>
<ion-datetime cancelText="取消" doneText="确认" displayFormat="YYYY-MM-DD HH:mm"
pickerFormat="YYYY MM DD HH mm" placeholder="请选择" [min]="obj.startTime"
<ion-datetime cancelText="取消" doneText="确认" displayFormat="HH:mm"
pickerFormat="HH mm" placeholder="请选择" [min]="obj.startTime"
[(ngModel)]="obj.endTime"></ion-datetime>
<ion-label class="right-arrow">
<ion-icon name="arrow-forward"></ion-icon>
......
......@@ -92,16 +92,20 @@ export class RoomApplyPage {
//时间和会议室初始化
initParams() {
this.obj.startTime = this.datePipe.transform(new Date(), 'yyyy-MM-ddTHH:mm');
this.nowDate = this.datePipe.transform(new Date(), 'yyyy-MM-ddTHH:mm');
this.obj.startTime = this.datePipe.transform(new Date().toISOString(), 'yyyy-MM-ddTHH:mm');
this.obj.endTime = this.datePipe.transform(new Date().toISOString(), 'yyyy-MM-ddTHH:mm');
const data = this.navParams.get('data');
if (data) {
console.log(data);
this.nowDate = data.startTime;
this.obj.roomId = data.roomId;
this.obj.roomText = data.roomName;
this.roomMax = `该会议室可容纳${data.accommodation}人`;
this.obj.equipmervice = data.equipmervice.split(',');
this.getEquipmervice(this.obj.equipmervice);
}else{
}
}
......@@ -281,7 +285,7 @@ export class RoomApplyPage {
modal.onDidDismiss(data => {
if (data) {
const arr = this.personList.concat(data);
this.personList = this.commonSer.uniArr(arr,'id');
this.personList = this.commonSer.uniArr(arr, 'id');
}
});
modal.present();
......@@ -292,25 +296,39 @@ export class RoomApplyPage {
this.personList.splice(index, 1);
}
submit() {
if (new Date(this.obj.startTime).getTime() > new Date(this.obj.endTime).getTime() || new Date(this.obj.startTime).getTime() == new Date(this.obj.endTime).getTime()) {
this.commonSer.toast('会议室开始时间和结束时间选择有误');
return false;
}
//校验时间
checkPerson() {
const max = this.roomMax.replace(/[^0-9]/ig, "");
if (isNaN(this.obj.participantAmount)) {
console.log("max is Nan");
this.commonSer.toast(`会议室人数必须填数字`);
this.check.participantAmount = true;
return false;
}
if (~~this.obj.participantAmount > ~~max) {
console.log("人数太多");
this.commonSer.toast(`会议室最大人数${max}`);
this.check.participantAmount = true;
return false;
}
//校验
return true;
}
//校验时间
checkTime() {
const clock12 = new Date(this.datePipe.transform(new Date(), 'yyyy-MM-dd 12:00')).getTime();
const startTime = new Date(this.obj.startTime).getTime();
const endTime = new Date(this.obj.endTime).getTime();
console.log("clock12:" + clock12);
console.log("startTime:" + startTime);
console.log("endTime:" + endTime);
if (startTime < clock12 && clock12 < endTime) {
this.commonSer.toast('时间选择错误');
return
}
return true;
}
//校验必填
checkFull() {
let checkBool = false;
for (let i in this.check) {
if (!this.obj[i]) {
......@@ -321,7 +339,24 @@ export class RoomApplyPage {
}
}
if (checkBool) return false;
if (checkBool) return;
return true;
}
submit() {
if (!this.checkTime()) {
this.commonSer.toast("时间有误");
return;
}
if (!this.checkPerson()) {
return;
}
if (!this.checkFull()) {
this.commonSer.toast("缺少必填项");
return;
}
let orgName = this.orgList.filter(e => this.obj.orgId == e.id)[0].name;
const data = {
......@@ -329,8 +364,8 @@ export class RoomApplyPage {
roomId: this.obj.roomId,
orgId: this.obj.orgId,
orgName: orgName,
startTime: new Date(this.obj.startTime).getTime() - 8 * 60 * 60 * 1000,
endTime: new Date(this.obj.endTime).getTime() - 8 * 60 * 60 * 1000,
startTime: new Date(this.obj.startTime).getTime(),
endTime: new Date(this.obj.endTime).getTime(),
orgLeader: this.obj.orgLeader.join(','),
remark: this.obj.remark,
participant: this.personList.map(e => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment