Commit 9820996c authored by wangqinghua's avatar wangqinghua

校验

parent 9d4ae409
...@@ -67,7 +67,7 @@ ...@@ -67,7 +67,7 @@
</div> </div>
<div class="afternoon"> <div class="afternoon">
<div class="afternoon-text"> <div class="afternoon-text">
</div> </div>
<div class="morning-room"> <div class="morning-room">
<span (click)="goApply()" *ngFor="let item4 of room?.afternoonNotUse"> <span (click)="goApply()" *ngFor="let item4 of room?.afternoonNotUse">
......
...@@ -20,24 +20,27 @@ ...@@ -20,24 +20,27 @@
<ion-select [(ngModel)]="obj.roomId" cancelText="取消" okText="确定" placeholder="请选择"> <ion-select [(ngModel)]="obj.roomId" cancelText="取消" okText="确定" placeholder="请选择">
<ion-option *ngFor="let item of roomList" [value]="item.id" (ionSelect)="roomMax = '会议室可容纳'+ item.accommodation +'人' ">{{item.name}}</ion-option> <ion-option *ngFor="let item of roomList" [value]="item.id" (ionSelect)="roomMax = '会议室可容纳'+ item.accommodation +'人' ">{{item.name}}</ion-option>
</ion-select> </ion-select>
<ion-label *ngIf="check.roomId" class="check-tips">请选择会议室</ion-label>
</ion-item> </ion-item>
<ion-item> <ion-item>
<ion-label class="item-left">申请处室:</ion-label> <ion-label class="item-left">申请处室:</ion-label>
<ion-select [(ngModel)]="obj.orgId" cancelText="取消" okText="确定" placeholder="请选择"> <ion-select [(ngModel)]="obj.orgId" cancelText="取消" okText="确定" placeholder="请选择">
<ion-option *ngFor="let item of orgList" [value]="item.id">{{item.name}}</ion-option> <ion-option *ngFor="let item of orgList" [value]="item.id">{{item.name}}</ion-option>
</ion-select> </ion-select>
<ion-label *ngIf="check.orgId" class="check-tips">请选择申请处室</ion-label>
</ion-item> </ion-item>
<ion-item> <ion-item>
<ion-label class="item-left">开始时间:</ion-label> <ion-label class="item-left">开始时间:</ion-label>
<ion-datetime cancelText="取消" doneText="确认" displayFormat="YYYY-MM-DD HH:mm" <ion-datetime cancelText="取消" doneText="确认" displayFormat="YYYY-MM-DD HH:mm"
pickerFormat="YYYY MM DD HH mm" placeholder="请选择" pickerFormat="YYYY MM DD HH mm" placeholder="请选择"
[(ngModel)]="obj.startTime"></ion-datetime> [(ngModel)]="obj.startTime"></ion-datetime>
<ion-label *ngIf="check.startTime" class="check-tips">请选择开始时间</ion-label>
</ion-item> </ion-item>
<div class="item-box"> <div class="item-box">
<div class="left">部领导:</div> <div class="left">部领导:</div>
<div class="right"> <div class="right">
<span *ngFor="let item of leaderList;let index = i " class="tag" <span *ngFor="let item of leaderList;" class="tag"
(click)="chooseLeader(item,index)" (click)="chooseLeader(item)"
[ngClass]="obj.orgLeader.indexOf(item.id) > -1 ? 'selectLead':''"> [ngClass]="obj.orgLeader.indexOf(item.id) > -1 ? 'selectLead':''">
{{item.userName}} {{item.userName}}
</span> </span>
...@@ -47,6 +50,7 @@ ...@@ -47,6 +50,7 @@
<ion-label class="item-left">参会人数:</ion-label> <ion-label class="item-left">参会人数:</ion-label>
<ion-input [(ngModel)]="obj.participantAmount" type="text" maxlength="20" <ion-input [(ngModel)]="obj.participantAmount" type="text" maxlength="20"
[placeholder]="roomMax"></ion-input> [placeholder]="roomMax"></ion-input>
<ion-label *ngIf="check.participantAmount" class="check-tips">请输入参会人数</ion-label>
</ion-item> </ion-item>
<div class="item-box"> <div class="item-box">
<div class="left">参会人员: <div class="left">参会人员:
...@@ -60,12 +64,13 @@ ...@@ -60,12 +64,13 @@
</span> </span>
</div> </div>
</div> </div>
<ion-label *ngIf="check.personList" class="check-tips">请选择参会人员</ion-label>
</div> </div>
<div class="item-box"> <div class="item-box">
<div class="left">设备:</div> <div class="left">设备:</div>
<div class="right"> <div class="right">
<span *ngFor="let item of equipList;let index = i " class="tag" <span *ngFor="let item of equipList" class="tag"
(click)="chooseEquip(item,index)" (click)="chooseEquip(item)"
[ngClass]="obj.equipmervice.indexOf(item.id) > -1 ? 'selectLead':''"> [ngClass]="obj.equipmervice.indexOf(item.id) > -1 ? 'selectLead':''">
{{item.name}} {{item.name}}
</span> </span>
......
...@@ -76,9 +76,12 @@ page-room-apply { ...@@ -76,9 +76,12 @@ page-room-apply {
border: 1px solid #ccc; border: 1px solid #ccc;
margin: 0 5px 10px 0; margin: 0 5px 10px 0;
display: inline-block; display: inline-block;
padding: 4px 20px;
border-radius: 4px; border-radius: 4px;
font-size: 1.2rem; font-size: 1.2rem;
width: 60px;
height: 25px;
text-align: center;
line-height: 25px;
} }
span.selectLead { span.selectLead {
...@@ -88,4 +91,14 @@ page-room-apply { ...@@ -88,4 +91,14 @@ page-room-apply {
} }
} }
} }
ion-item,.item-box{
position: relative;
}
.check-tips{
position: absolute;
font-size: 1.2rem;
top: 24px;
color: red;
left: 10px;
}
} }
...@@ -19,12 +19,21 @@ export class RoomApplyPage { ...@@ -19,12 +19,21 @@ export class RoomApplyPage {
startTime: '', startTime: '',
endTime: '', endTime: '',
orgLeader: [], orgLeader: [],
personList: [],
remark: '', remark: '',
participant: '', participant: '',
participantAmount: '', participantAmount: '',
equipmervice: [] equipmervice: []
}; };
check = {
roomId: false,
startTime: false,
participantAmount: false,
personList: false,
orgId: false
};
meetTypeList = [ meetTypeList = [
{id: '1', name: '工作会议'}, {id: '1', name: '工作会议'},
...@@ -53,7 +62,7 @@ export class RoomApplyPage { ...@@ -53,7 +62,7 @@ export class RoomApplyPage {
constructor(public navCtrl: NavController, public navParams: NavParams, constructor(public navCtrl: NavController, public navParams: NavParams,
private serveSer: ServeService, public modalCtrl: ModalController, private serveSer: ServeService, public modalCtrl: ModalController,
private commonSer: CommonService,private datePipe:DatePipe) { private commonSer: CommonService, private datePipe: DatePipe) {
} }
ionViewDidLoad() { ionViewDidLoad() {
...@@ -69,16 +78,21 @@ export class RoomApplyPage { ...@@ -69,16 +78,21 @@ export class RoomApplyPage {
this.serveSer.meetDetail(this.applyId).subscribe( this.serveSer.meetDetail(this.applyId).subscribe(
(res) => { (res) => {
if (res) { if (res) {
this.personList = res.participants; this.personList = res.participants.map(e => {
const m = {
id: e.userId,
userName: e.userName
};
return m;
});
this.obj.orgLeader = res.leaders; this.obj.orgLeader = res.leaders;
this.obj.meetingType = res.meetingType; this.obj.meetingType = res.meetingType;
this.obj.startTime = this.datePipe.transform(res.startTime,'yyyy-MM-dd HH:mm'); this.obj.startTime = this.datePipe.transform(res.startTime, 'yyyy-MM-dd HH:mm');
this.obj.remark = res.remark; this.obj.remark = res.remark;
this.obj.equipmervice = res.equipmervice.split(','); this.obj.equipmervice = res.equipmervice.split(',');
this.obj.participantAmount = res.participantAmount; this.obj.participantAmount = res.participantAmount;
this.obj.orgId = res.orgId; this.obj.orgId = res.orgId;
this.obj.roomId = res.roomId; this.obj.roomId = res.roomId;
console.log(this.obj);
} }
} }
) )
...@@ -105,8 +119,9 @@ export class RoomApplyPage { ...@@ -105,8 +119,9 @@ export class RoomApplyPage {
} }
//选择部领导 //选择部领导
chooseLeader(item, index) { chooseLeader(item) {
if (this.obj.orgLeader.indexOf(item.id) > -1) { const index = this.obj.orgLeader.indexOf(item.id);
if (index > -1) {
this.obj.orgLeader.splice(index, 1); this.obj.orgLeader.splice(index, 1);
} else { } else {
this.obj.orgLeader.push(item.id); this.obj.orgLeader.push(item.id);
...@@ -114,8 +129,9 @@ export class RoomApplyPage { ...@@ -114,8 +129,9 @@ export class RoomApplyPage {
} }
//选择设备 //选择设备
chooseEquip(item, index) { chooseEquip(item) {
if (this.obj.equipmervice.indexOf(item.id) > -1) { const index = this.obj.equipmervice.indexOf(item.id);
if (index > -1) {
this.obj.equipmervice.splice(index, 1); this.obj.equipmervice.splice(index, 1);
} else { } else {
this.obj.equipmervice.push(item.id); this.obj.equipmervice.push(item.id);
...@@ -144,6 +160,20 @@ export class RoomApplyPage { ...@@ -144,6 +160,20 @@ export class RoomApplyPage {
} }
submit() { submit() {
//校验
let checkBool = false;
for (let i in this.check) {
if (!this.obj[i] || this.personList.length == 0) {
checkBool = true;
this.check[i] = true;
} else {
this.check[i] = false;
}
}
if (checkBool) return false;
let orgName; let orgName;
this.orgList.forEach(e => { this.orgList.forEach(e => {
if (this.obj.orgId == e.id) { if (this.obj.orgId == e.id) {
...@@ -165,7 +195,7 @@ export class RoomApplyPage { ...@@ -165,7 +195,7 @@ export class RoomApplyPage {
participantAmount: this.obj.participantAmount, participantAmount: this.obj.participantAmount,
equipmervice: this.obj.equipmervice.join(','), equipmervice: this.obj.equipmervice.join(','),
}; };
if(this.applyId) data['id'] = this.applyId; if (this.applyId) data['id'] = this.applyId;
console.log(data); console.log(data);
this.commonSer.alert('确定提交申请?', () => { this.commonSer.alert('确定提交申请?', () => {
this.serveSer.saveApply(data).subscribe( this.serveSer.saveApply(data).subscribe(
......
...@@ -10,7 +10,6 @@ ...@@ -10,7 +10,6 @@
<ion-content> <ion-content>
<div class="padding-6"> <div class="padding-6">
<ion-item> <ion-item>
<ion-item>
<ion-label class="item-left">用车时间:</ion-label> <ion-label class="item-left">用车时间:</ion-label>
<ion-datetime cancelText="取消" doneText="确认" displayFormat="YYYY-MM-DD HH:mm" <ion-datetime cancelText="取消" doneText="确认" displayFormat="YYYY-MM-DD HH:mm"
pickerFormat="YYYY MM DD HH mm" placeholder="请选择" pickerFormat="YYYY MM DD HH mm" placeholder="请选择"
...@@ -40,6 +39,7 @@ ...@@ -40,6 +39,7 @@
</div> </div>
</div> </div>
</div> </div>
<ion-item>
<ion-label class="item-left">用车事由:</ion-label> <ion-label class="item-left">用车事由:</ion-label>
<ion-select [(ngModel)]="obj.useReason" cancelText="取消" okText="确定" placeholder="请选择"> <ion-select [(ngModel)]="obj.useReason" cancelText="取消" okText="确定" placeholder="请选择">
<ion-option *ngFor="let type of meetTypeList" [value]="type.id">{{type.name}}</ion-option> <ion-option *ngFor="let type of meetTypeList" [value]="type.id">{{type.name}}</ion-option>
......
page-car-apply { page-car-apply {
.item-left {
text-align: right;
width: 20%;
font-weight: bold;
font-size: 1.4rem;
flex: none;
}
.item-ios.item-block .item-inner {
border-bottom: 0.55px solid #eeeeee;
}
ion-datetime, ion-select {
width: 80%;
max-width: 80%;
text-align: right;
font-size: 1.4rem;
}
ion-input input {
text-align: right;
font-size: 1.4rem;
}
.item-box {
display: flex;
border-bottom: 0.55px solid #eeeeee;
.left {
text-align: right;
width: 20%;
font-weight: bold;
font-size: 1.4rem;
margin: 11px 8px 11px 0;
}
.right {
width: 80%;
padding: 11px 8px 11px 16px;
.div-tag {
padding: 10px 0;
span {
display: inline-block;
margin-right: 10px;
white-space: initial;
border: 1px solid #eee;
padding: 2px 5px;
font-size: 1rem;
margin-bottom: 5px;
border-radius: 4px;
ion-icon {
margin-left: 3px;
color: #666666;
font-size: 1rem;
}
}
}
button {
margin: 0;
}
ion-textarea {
padding: 6px;
height: 100px;
border: 1px solid #ddd;
}
.tag {
border: 1px solid #ccc;
margin: 0 5px 10px 0;
display: inline-block;
padding: 4px 20px;
brder-radius: 4px;
font-size: 1.2rem;
}
span.selectLead {
background-color: #fdf8f2;
border: 1px solid #e42417;
color: #e42417;
}
}
}
} }
...@@ -20,6 +20,7 @@ export class CarApplyPage { ...@@ -20,6 +20,7 @@ export class CarApplyPage {
passengerCount:'', passengerCount:'',
driverName:'', driverName:'',
phone:'', phone:'',
fromTo:''
}; };
......
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