Commit 4bdc567f authored by wangqinghua's avatar wangqinghua

api update

parent 10134421
...@@ -87,7 +87,7 @@ export class RoomApplyPage { ...@@ -87,7 +87,7 @@ export class RoomApplyPage {
}); });
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-ddTHH: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;
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
<ion-content> <ion-content>
<div class="padding-6"> <div class="padding-6">
<ion-item> <ion-item>
<ion-label class="item-left">用车时间:</ion-label> <ion-label class="item-left"><span class="color-red">*</span>用车时间:</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>
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
</ion-label> </ion-label>
</ion-item> </ion-item>
<ion-item> <ion-item>
<ion-label class="item-left">还车时间:</ion-label> <ion-label class="item-left"><span class="color-red">*</span>还车时间:</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.endTime"></ion-datetime> [(ngModel)]="obj.endTime"></ion-datetime>
...@@ -28,12 +28,12 @@ ...@@ -28,12 +28,12 @@
</ion-label> </ion-label>
</ion-item> </ion-item>
<ion-item> <ion-item>
<ion-label class="item-left">用车人数:</ion-label> <ion-label class="item-left"><span class="color-red">*</span>用车人数:</ion-label>
<ion-input [(ngModel)]="obj.passengerCount" type="text" maxlength="20" <ion-input [(ngModel)]="obj.passengerCount" type="text" maxlength="20"
[placeholder]="'请输入'"></ion-input> [placeholder]="'请输入'"></ion-input>
</ion-item> </ion-item>
<div class="item-box"> <div class="item-box">
<div class="left">使用人: <div class="left"><span class="color-red">*</span>使用人:
</div> </div>
<div class="right"> <div class="right">
<button color="danger" ion-button small (click)="choose()">选择</button> <button color="danger" ion-button small (click)="choose()">选择</button>
...@@ -46,14 +46,14 @@ ...@@ -46,14 +46,14 @@
</div> </div>
</div> </div>
<ion-item> <ion-item>
<ion-label class="item-left">用车事由:</ion-label> <ion-label class="item-left"><span class="color-red">*</span>用车事由:</ion-label>
<ion-label class="choose" (click)="chooseReason()">{{obj.useText}}</ion-label> <ion-label class="choose" (click)="chooseReason()">{{obj.useText}}</ion-label>
<ion-label class="right-arrow"> <ion-label class="right-arrow">
<ion-icon name="arrow-forward"></ion-icon> <ion-icon name="arrow-forward"></ion-icon>
</ion-label> </ion-label>
</ion-item> </ion-item>
<div class="item-box"> <div class="item-box">
<div class="left">起讫地点:</div> <div class="left"><span class="color-red">*</span>起讫地点:</div>
<div class="right"> <div class="right">
<ion-textarea [(ngModel)]="obj.fromTo"></ion-textarea> <ion-textarea [(ngModel)]="obj.fromTo"></ion-textarea>
</div> </div>
...@@ -77,13 +77,13 @@ ...@@ -77,13 +77,13 @@
</div> </div>
<ng-container *ngIf="opObj.isOwner == 1"> <ng-container *ngIf="opObj.isOwner == 1">
<ion-item> <ion-item>
<ion-label class="item-left">司机:</ion-label> <ion-label class="item-left"><span class="color-red">*</span>司机:</ion-label>
<ion-select [(ngModel)]="opObj.driverName" cancelText="取消" okText="确定" placeholder="请选择"> <ion-select [(ngModel)]="opObj.driverName" cancelText="取消" okText="确定" placeholder="请选择">
<ion-option *ngFor="let item of driverList" [value]="item.name">{{item.name}}</ion-option> <ion-option *ngFor="let item of driverList" [value]="item.name">{{item.name}}</ion-option>
</ion-select> </ion-select>
</ion-item> </ion-item>
<ion-item> <ion-item>
<ion-label class="item-left">车牌号:</ion-label> <ion-label class="item-left"><span class="color-red">*</span>车牌号:</ion-label>
<ion-select [(ngModel)]="opObj.carNumber" cancelText="取消" okText="确定" placeholder="请选择"> <ion-select [(ngModel)]="opObj.carNumber" cancelText="取消" okText="确定" placeholder="请选择">
<ion-option *ngFor="let item of carList" [value]="item.carNumber">{{item.carNumber}}</ion-option> <ion-option *ngFor="let item of carList" [value]="item.carNumber">{{item.carNumber}}</ion-option>
</ion-select> </ion-select>
...@@ -113,8 +113,6 @@ ...@@ -113,8 +113,6 @@
<button class="submit-btn submit" (click)="submitOp(3)">退回</button> <button class="submit-btn submit" (click)="submitOp(3)">退回</button>
</ng-container> </ng-container>
<page-driver *ngIf="applyId" [applyId]="this.applyId"></page-driver>
<button *ngIf="!applyId" class="submit-btn submit" (click)="submit()">提交</button> <button *ngIf="!applyId" class="submit-btn submit" (click)="submit()">提交</button>
</ion-content> </ion-content>
...@@ -22,6 +22,16 @@ export class CarApplyPage { ...@@ -22,6 +22,16 @@ export class CarApplyPage {
fromTo: '' fromTo: ''
}; };
checkObj = {
startTime: false,
endTime: false,
carUser: false,
useReason: false,
passengerCount: false,
fromTo: false,
}
opObj = { opObj = {
isOwner: 1, //是否是内部车辆(1是,0否) isOwner: 1, //是否是内部车辆(1是,0否)
driverName: '', driverName: '',
...@@ -57,8 +67,9 @@ export class CarApplyPage { ...@@ -57,8 +67,9 @@ export class CarApplyPage {
this.obj.useReason = res.data.useReason; this.obj.useReason = res.data.useReason;
this.obj.passengerCount = res.data.passengerCount; this.obj.passengerCount = res.data.passengerCount;
this.obj.fromTo = res.data.fromTo; this.obj.fromTo = res.data.fromTo;
this.obj.startTime = this.datePipe.transform(res.data.startTime, "yyyy-MM-dd HH:mm"); this.obj.startTime = this.datePipe.transform(res.data.startTime, "yyyy-MM-ddTHH:mm");
this.obj.endTime = this.datePipe.transform(res.data.endTime, "yyyy-MM-dd HH:mm"); this.obj.endTime = this.datePipe.transform(res.data.endTime, "yyyy-MM-ddTHH:mm");
console.log(this.obj);
} }
} }
) )
...@@ -166,6 +177,20 @@ export class CarApplyPage { ...@@ -166,6 +177,20 @@ export class CarApplyPage {
//提交申请 //提交申请
submit() { submit() {
//校验
let checkBool = false;
for (let i in this.checkObj) {
if (!this.obj[i] || this.personList.length == 0) {
checkBool = true;
this.checkObj[i] = true;
} else {
this.checkObj[i] = false;
}
}
if (checkBool) return false;
let carUser = []; let carUser = [];
this.personList.forEach(e => { this.personList.forEach(e => {
carUser.push(e.id); carUser.push(e.id);
...@@ -177,18 +202,20 @@ export class CarApplyPage { ...@@ -177,18 +202,20 @@ export class CarApplyPage {
carUser: carUser.join(","), carUser: carUser.join(","),
useReason: this.obj.useReason, useReason: this.obj.useReason,
fromTo: this.obj.fromTo fromTo: this.obj.fromTo
} };
console.log(data); console.log(data);
this.serveSer.saveCarApply(data).subscribe( this.commonSer.alert('确认提交?',()=>{
(res) => { this.serveSer.saveCarApply(data).subscribe(
if (res.errcode == 1000) { (res) => {
this.commonSer.toast('提交申请成功'); if (res.errcode == 1000) {
this.navCtrl.pop(); this.commonSer.toast('提交申请成功');
} else { this.navCtrl.pop();
this.commonSer.toast(res.errmsg); } else {
this.commonSer.toast(res.errmsg);
}
} }
} )
) });
} }
//提交审核 //提交审核
...@@ -209,16 +236,18 @@ export class CarApplyPage { ...@@ -209,16 +236,18 @@ export class CarApplyPage {
status: status status: status
}; };
data = this.opObj.isOwner == 1 ? data_company : data_lease; data = this.opObj.isOwner == 1 ? data_company : data_lease;
this.serveSer.carOperate(data).subscribe( this.commonSer.alert('确认提交?',()=>{
(res) => { this.serveSer.carOperate(data).subscribe(
if (res.errcode == 1000) { (res) => {
this.commonSer.toast('审核成功'); if (res.errcode == 1000) {
this.navCtrl.pop(); this.commonSer.toast('审核成功');
} else { this.navCtrl.pop();
this.commonSer.toast(res.errmsg); } else {
this.commonSer.toast(res.errmsg);
}
} }
} )
) });
} }
} }
<ion-header> <ion-header>
<ion-navbar> <ion-navbar>
<ion-title>会议室申请</ion-title> <ion-title>用车审核</ion-title>
</ion-navbar> </ion-navbar>
<div class="duty"> <div class="duty">
<div class="dutyItem" (click)="change(1)"> <div class="dutyItem" (click)="change(1)">
......
page-driver {
.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-item {
position: relative;
}
ion-input input {
text-align: right;
font-size: 1.4rem;
}
.datetime-ios {
padding: 11px 15px 11px 16px;
}
.right-arrow {
position: absolute;
right: 2px;
top: 5px;
color: #999;
font-size: 1.6rem;
}
.choose{
text-align: right;
margin-right: 20px;
font-size: 1.5rem;
color: #999;
}
.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;
border-radius: 4px;
font-size: 1.2rem;
}
span.selectLead {
background-color: #fdf8f2;
border: 1px solid #e42417;
color: #e42417;
}
}
}
.segment-ios .segment-button{
border-color: #e12724;
color: #e12724;
height: 2.2rem;
line-height: 2rem;
}
.segment-ios .segment-button.segment-activated{
background-color: #e12724;
}
}
import {Component, Input} from '@angular/core';
import {IonicPage, NavController, NavParams} from 'ionic-angular';
import {ServeService} from "../../serve.service";
import {CommonService} from "../../../../provide/common.service";
@Component({
selector: 'page-driver',
templateUrl: 'driver.html',
})
export class DriverPage {
@Input() applyId;
obj = {
isOwner: 1, //是否是内部车辆(1是,0否)
driverName: '',
carNumber: '',
carOrg: '',
mobile: '',
};
driverList = [];
carList = [];
constructor(public navCtrl: NavController, public navParams: NavParams,
private serveSer: ServeService, private commonSer: CommonService) {
this.getList();
}
ionViewDidLoad() {
}
getList() {
this.serveSer.getDriverList().subscribe(
(res) => {
this.driverList = res.data;
}
)
this.serveSer.getCarList().subscribe(
(res) => {
this.carList = res.data;
}
)
}
}
...@@ -4,26 +4,22 @@ import {UseCarPage} from './use-car'; ...@@ -4,26 +4,22 @@ import {UseCarPage} from './use-car';
import {CarApplyPage} from "./car-apply/car-apply"; import {CarApplyPage} from "./car-apply/car-apply";
import {CalendarModule} from "ion2-calendar"; import {CalendarModule} from "ion2-calendar";
import {CarDealPage} from "./car-deal/car-deal"; import {CarDealPage} from "./car-deal/car-deal";
import {DriverPage} from "./driver/driver";
@NgModule({ @NgModule({
declarations: [ declarations: [
UseCarPage, UseCarPage,
CarApplyPage, CarApplyPage,
CarDealPage, CarDealPage,
DriverPage
], ],
imports: [ imports: [
CalendarModule, CalendarModule,
IonicPageModule.forChild(UseCarPage), IonicPageModule.forChild(UseCarPage),
], ],
exports: [ exports: [
DriverPage
], ],
entryComponents: [ entryComponents: [
CarApplyPage, CarApplyPage,
CarDealPage, CarDealPage,
DriverPage,
] ]
}) })
export class UseCarPageModule { export class UseCarPageModule {
......
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