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
import {Component} from '@angular/core';
import {ActionSheetController, ModalController, NavController, NavParams} from 'ionic-angular';
import {ServeService} from "../../serve.service";
import {AppMainService} from "../../../../app/app.service";
import {CommonService} from "../../../../provide/common.service";
import {DatePipe} from "@angular/common";
import {PersonMulComponent} from "../../../../components/person-mul/person-mul";
@Component({
selector: 'page-vistor-apply',
templateUrl: 'vistor-apply.html',
})
export class VistorApplyPage {
obj =<any> {
visitorName: '',
visitorOrg: '',
carNumber: '',
visitTime: '',
remark: '',
};
check = {
visitorName: false,
visitTime: false,
};
applyId; //是否编辑
mineInfo; //申请人信息
constructor(public navCtrl: NavController, public navParams: NavParams, private actionSheetCtrl: ActionSheetController,
private serveSer: ServeService, public _modalCtrl: ModalController, private appMainSer: AppMainService,
private commonSer: CommonService, private datePipe: DatePipe) {
this.appMainSer.mineInfo.subscribe(value => {
this.mineInfo = value;
})
}
ionViewDidLoad() {
this.initParams();
this.applyId = this.navParams.get('id');
if (this.applyId) {
this.meetDetail();
}
}
//时间和会议室初始化
initParams() {
const data = this.navParams.get('data');
}
//会议详情
meetDetail() {
this.serveSer.editVisitorApply(this.applyId).subscribe(
(res) => {
if (res) {
}
}
)
}
submit() {
//校验
let checkBool = false;
for (let i in this.check) {
if (!this.obj[i]) {
checkBool = true;
this.check[i] = true;
} else {
this.check[i] = false;
}
}
if (checkBool) return false;
this.obj.visitTime = this.datePipe.transform(this.obj.visitTime,'yyyy-MM-dd HH:mm');
if(this.applyId) this.obj.id = this.applyId;
this.commonSer.alert('确定提交登记?', () => {
this.serveSer.saveVisitorApply(this.obj).subscribe(
(res) => {
if (res.errcode == 1000) {
this.navCtrl.pop()
this.commonSer.toast('访客登记成功');
} else {
this.commonSer.toast(res.errmsg);
}
}
)
});
}
}