Administrator
2021-11-03 152a4702ec03ceec5f57b207a8d7d9ea5ccdbfe7
src/views/securityGuard/securityGuard.vue
@@ -337,26 +337,54 @@
    // };
    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();
        }
      }
    };
    const validatePassPhone = (rule, value, callback) => {
      var test = /^(13[0-9]|14[0-9]|15[0-9]|17[0-9]|18[0-9])\d{8}$/g;
      var test = /^(13[0-9]|14[0-9]|15[0-9]|17[0-9]|18[0-9]|19[0-9])\d{8}$/g;
      if (!test.test(value)) {
        callback(new Error("请输入正确手机号码"));
      } else {
@@ -695,6 +723,14 @@
                prop: "securitynumber",
                hide: true,
              },
              // {
              //   label: "发证日期",
              //   prop: "paperTime",
              //   hide: true,
              //   type: "date",
              //   format: "yyyy-MM-dd",
              //   valueFormat: "yyyy-MM-dd",
              // },
              {
                label: "电子邮箱",
                prop: "email",
@@ -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);