diff --git a/pages/info/info.vue b/pages/info/info.vue index 3580802..f19ae45 100644 --- a/pages/info/info.vue +++ b/pages/info/info.vue @@ -14,32 +14,39 @@ {{info.staffCode}} + 申请者手机号 + {{info.staffPhone}} + + 申请者姓名 {{info.staffName}} - 访客姓名 + 访问姓名 {{info.visitorName}} - 访客身份证 + 访问身份证 {{info.visitorIdCard}} - 访客联系方式 + 访问联系方式 {{info.visitorPhone}} - 访客目的 + 访问目的 {{info.visitReason}} - 访客区域 + 访问区域 {{info.visitPosition}} - 访客时间 - {{info.inTime }} + 访问时间 + + {{info.inTime }} + {{info.outTime }} + 备注 diff --git a/pages/info/info.vue b/pages/info/info.vue index 3580802..f19ae45 100644 --- a/pages/info/info.vue +++ b/pages/info/info.vue @@ -14,32 +14,39 @@ {{info.staffCode}} + 申请者手机号 + {{info.staffPhone}} + + 申请者姓名 {{info.staffName}} - 访客姓名 + 访问姓名 {{info.visitorName}} - 访客身份证 + 访问身份证 {{info.visitorIdCard}} - 访客联系方式 + 访问联系方式 {{info.visitorPhone}} - 访客目的 + 访问目的 {{info.visitReason}} - 访客区域 + 访问区域 {{info.visitPosition}} - 访客时间 - {{info.inTime }} + 访问时间 + + {{info.inTime }} + {{info.outTime }} + 备注 diff --git a/pages/information/information.vue b/pages/information/information.vue index 513a75b..9cd54be 100644 --- a/pages/information/information.vue +++ b/pages/information/information.vue @@ -2,27 +2,27 @@ - - + + - - + + - - + + - - {{callerInfo.visitReason || '请选择访客目的'}} + + {{callerInfo.visitReason || '请选择访问目的'}} - + - {{callerInfo.visitPosition || '请选择访客楼栋'}} + {{callerInfo.visitPosition || '请选择访问楼栋'}} - + {{`开始时间:${callerInfo.inTime}`}} {{`结束时间:${callerInfo.outTime}`}} @@ -82,19 +82,42 @@ rules: { visitorName: [{ required: true, - message: '请填写访客姓名', + message: '请填写访问姓名', trigger: ['blur', 'change'], }], visitorIdCard: [{ required: true, - message: '请填写访客身份证', + message: '请填写访问身份证', trigger: ['blur', 'change'], - }], - visitorPhone: [{ - required: true, - message: '请填写访客联系方式', - trigger: ['blur', 'change'], - }], + }, + { + // 自定义验证函数,见上说明 + validator: (rule, value, callback) => { + return uni.$u.test.idCard(value); + }, + message: '身份证号不正确', + // 触发器可以同时用blur和change + trigger: ['change','blur'], + } + ], + visitorPhone: [ + { + required: true, + message: '请输入手机号', + trigger: ['change','blur'], + }, + { + // 自定义验证函数,见上说明 + validator: (rule, value, callback) => { + // 上面有说,返回true表示校验通过,返回false表示不通过 + // uni.$u.test.mobile()就是返回true或者false的 + return uni.$u.test.mobile(value); + }, + message: '手机号码不正确', + // 触发器可以同时用blur和change + trigger: ['change','blur'], + } + ], staffCode: [{ required: true, message: '请填写申请者工号', @@ -120,6 +143,10 @@ this.callerInfo.staffCode = userInfo.account this.callerInfo.staffName = userInfo.name }, + + mounted() { + this.$refs.form1.setRules(this.rules) + }, methods: { change(e) {}, //点击提交访客记录 diff --git a/pages/info/info.vue b/pages/info/info.vue index 3580802..f19ae45 100644 --- a/pages/info/info.vue +++ b/pages/info/info.vue @@ -14,32 +14,39 @@ {{info.staffCode}} + 申请者手机号 + {{info.staffPhone}} + + 申请者姓名 {{info.staffName}} - 访客姓名 + 访问姓名 {{info.visitorName}} - 访客身份证 + 访问身份证 {{info.visitorIdCard}} - 访客联系方式 + 访问联系方式 {{info.visitorPhone}} - 访客目的 + 访问目的 {{info.visitReason}} - 访客区域 + 访问区域 {{info.visitPosition}} - 访客时间 - {{info.inTime }} + 访问时间 + + {{info.inTime }} + {{info.outTime }} + 备注 diff --git a/pages/information/information.vue b/pages/information/information.vue index 513a75b..9cd54be 100644 --- a/pages/information/information.vue +++ b/pages/information/information.vue @@ -2,27 +2,27 @@ - - + + - - + + - - + + - - {{callerInfo.visitReason || '请选择访客目的'}} + + {{callerInfo.visitReason || '请选择访问目的'}} - + - {{callerInfo.visitPosition || '请选择访客楼栋'}} + {{callerInfo.visitPosition || '请选择访问楼栋'}} - + {{`开始时间:${callerInfo.inTime}`}} {{`结束时间:${callerInfo.outTime}`}} @@ -82,19 +82,42 @@ rules: { visitorName: [{ required: true, - message: '请填写访客姓名', + message: '请填写访问姓名', trigger: ['blur', 'change'], }], visitorIdCard: [{ required: true, - message: '请填写访客身份证', + message: '请填写访问身份证', trigger: ['blur', 'change'], - }], - visitorPhone: [{ - required: true, - message: '请填写访客联系方式', - trigger: ['blur', 'change'], - }], + }, + { + // 自定义验证函数,见上说明 + validator: (rule, value, callback) => { + return uni.$u.test.idCard(value); + }, + message: '身份证号不正确', + // 触发器可以同时用blur和change + trigger: ['change','blur'], + } + ], + visitorPhone: [ + { + required: true, + message: '请输入手机号', + trigger: ['change','blur'], + }, + { + // 自定义验证函数,见上说明 + validator: (rule, value, callback) => { + // 上面有说,返回true表示校验通过,返回false表示不通过 + // uni.$u.test.mobile()就是返回true或者false的 + return uni.$u.test.mobile(value); + }, + message: '手机号码不正确', + // 触发器可以同时用blur和change + trigger: ['change','blur'], + } + ], staffCode: [{ required: true, message: '请填写申请者工号', @@ -120,6 +143,10 @@ this.callerInfo.staffCode = userInfo.account this.callerInfo.staffName = userInfo.name }, + + mounted() { + this.$refs.form1.setRules(this.rules) + }, methods: { change(e) {}, //点击提交访客记录 diff --git a/pages/list/list.vue b/pages/list/list.vue index 24639b8..342ad9b 100644 --- a/pages/list/list.vue +++ b/pages/list/list.vue @@ -28,14 +28,15 @@ - + - + {{ item.visitorName }} {{ item.applyNo }} @@ -200,6 +201,7 @@ } const res = await getList(param); this.list = res.records.map((item) => { + item.value = false if (item.visitorApplyStatus == "1") { item.status = "申请已提交"; item.color = "blue"; @@ -239,6 +241,8 @@ methods: { //选中的数据 checkboxChange(item) { + console.log(item) + item.value = !item.value if (this.checkboxList.indexOf(item) == -1) { this.checkboxList.push(item); } else { @@ -344,10 +348,20 @@ this.ispassShow = true; }, async possQr() { - let ids = - this.checkboxList.length === 0 - ? this.list.map((item) => item.id).join() - : this.checkboxList.map((item) => item.id).join(); + const statusList = this.checkboxList.length === 0 ? this.list.filter((item) => item.visitorApplyStatus === '1') : this.checkboxList.filter((item) => item.visitorApplyStatus === '1') + console.log(statusList) + let ids = statusList.map((item) => item.id).join(); + console.log(ids) + if( ids === '') { + this.checkboxList = []; + this.ispassShow = false; + this.searchList(); + return uni.showToast({ + title: `暂无需要改动状态人员`, + icon: 'none', + duration: 2000, + }) + } let res = await solveStatus(this.leixin == "通过" ? "2" : "3", ids); this.searchList(); this.ispassShow = false;