From 34d9a8662da32afd2c4e6dc2c5514321ed6121ca Mon Sep 17 00:00:00 2001
From: liuyg <376836862@qq.com>
Date: Tue, 26 Oct 2021 15:47:35 +0800
Subject: [PATCH] +打印保安证
---
src/views/securityGuard/securityGuard.vue | 62 ++++++++++++++++++++++++++-----
1 files changed, 52 insertions(+), 10 deletions(-)
diff --git a/src/views/securityGuard/securityGuard.vue b/src/views/securityGuard/securityGuard.vue
index 43a6590..99397d1 100644
--- a/src/views/securityGuard/securityGuard.vue
+++ b/src/views/securityGuard/securityGuard.vue
@@ -337,21 +337,49 @@
// };
var date = new Date();
let year = date.getFullYear(),
- oldyear;
+ mouth = date.getMonth() + 1,
+ day = date.getDate(),
+ oldy,
+ oldm,
+ oldd,
+ ok = false;
const validatePassCardid = (rule, value, callback) => {
+ // console.log(oldy, oldm, oldd, year - oldy, mouth, day);
var test =
/^[1-9]\d{7}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}$|^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}([0-9]|X)$/;
if (!test.test(value)) {
callback(new Error("请输入正确身份证号码"));
} else {
//加入校验18岁到60岁的
- oldyear = +value.slice(6, 10);
- if (year - oldyear < 18 || year - oldyear > 60) {
+ oldy = +value.slice(6, 10);
+ oldm = +value.slice(10, 12);
+ oldd = +value.slice(12, 14);
+ ok =
+ year - oldy < 18 || year - oldy > 60
+ ? false
+ : year - oldy == 18
+ ? mouth < oldm
+ ? false
+ : mouth > oldm
+ ? true
+ : day < oldd
+ ? false
+ : true
+ : year - oldy == 60
+ ? mouth < oldm
+ ? true
+ : mouth > oldm
+ ? false
+ : day <= oldd
+ ? false
+ : true
+ : true;
+ if (ok) {
+ callback();
+ } else {
// callback(new Error("根据国家要求,需在18岁至60岁"));
callback(new Error("年龄不符"));
- } else {
- callback();
}
}
};
@@ -694,6 +722,14 @@
label: "保安员证编号",
prop: "securitynumber",
hide: true,
+ },
+ {
+ label: "发证日期",
+ prop: "paperTime",
+ hide: true,
+ type: "date",
+ format: "yyyy-MM-dd",
+ valueFormat: "yyyy-MM-dd",
},
{
label: "电子邮箱",
@@ -1106,15 +1142,21 @@
sex: row.sex,
},
};
+
securitySave(userMap).then(
() => {
this.initFlag = false;
- this.onLoad(this.page);
- this.$message({
- type: "success",
- message: "操作成功!",
+ this.$alert("账号为身份证号码,密码为身份证后六位", "温馨提示", {
+ confirmButtonText: "确定",
+ callback: (action) => {
+ this.$message({
+ type: "success",
+ message: `操作成功`,
+ });
+ this.onLoad(this.page);
+ done();
+ },
});
- done();
},
(error) => {
window.console.log(error);
--
Gitblit v1.9.3