From 152a4702ec03ceec5f57b207a8d7d9ea5ccdbfe7 Mon Sep 17 00:00:00 2001
From: Administrator <admin>
Date: Wed, 03 Nov 2021 10:05:22 +0800
Subject: [PATCH] 纸质证书样式修改

---
 src/views/securityGuard/securityGuard.vue |  514 ++++++++++++++++++++++++++++++++++++++------------------
 1 files changed, 348 insertions(+), 166 deletions(-)

diff --git a/src/views/securityGuard/securityGuard.vue b/src/views/securityGuard/securityGuard.vue
index e6f6f0f..56c52e5 100644
--- a/src/views/securityGuard/securityGuard.vue
+++ b/src/views/securityGuard/securityGuard.vue
@@ -1,5 +1,5 @@
 <template>
-  <el-row :class="{securityGuard : isSecurity}">
+  <el-row :class="{ securityGuard: isSecurity }">
     <el-col :span="0" style="display: none">
       <div class="box">
         <el-scrollbar>
@@ -46,7 +46,7 @@
               icon="el-icon-upload2"
               v-if="permission.securityGuard_import"
               @click="handleImport1"
-              >批量导入
+              >保安员批量导入
             </el-button>
             <el-button
               type="success"
@@ -130,9 +130,17 @@
               icon="el-icon-edit"
               :size="size"
               :type="type"
-              v-if="permission.securityGuard_delete"
-              @click.stop="rowDel(row)"
+              v-if="permission.securityGuard_delete && row.status != 2"
+              @click.stop="rowStatus(row)"
               >离职登记
+            </el-button>
+            <el-button
+              icon="el-icon-edit"
+              :size="size"
+              :type="type"
+              v-if="row.status == 2"
+              @click.stop="rowDellook(row)"
+              >离职查询
             </el-button>
             <el-button
               icon="el-icon-edit"
@@ -303,22 +311,88 @@
 
 export default {
   data() {
-    const validatePass = (rule, value, callback) => {
-      if (value === "") {
-        callback(new Error("请输入密码"));
+    // const validatePass = (rule, value, callback) => {
+    //   if (value === "") {
+    //     callback(new Error("请输入密码"));
+    //   } else {
+    //     callback();
+    //   }
+    // };
+    // const validatePass2 = (rule, value, callback) => {
+    //   if (value === "") {
+    //     callback(new Error("请再次输入密码"));
+    //   } else if (value !== this.form.password) {
+    //     callback(new Error("两次输入密码不一致!"));
+    //   } else {
+    //     callback();
+    //   }
+    // };
+    // const validatePassNumber = (rule, value, callback) => {
+    //   var test = /^[0-9]*$/gm;
+    //   if (!test.test(value)) {
+    //     callback(new Error("请输入数字"));
+    //   } else {
+    //     callback();
+    //   }
+    // };
+    var date = new Date();
+    let year = date.getFullYear(),
+      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岁的
+        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("年龄不符"));
+        }
+      }
+    };
+    const validatePassPhone = (rule, value, callback) => {
+      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 {
         callback();
       }
     };
-    const validatePass2 = (rule, value, callback) => {
-      if (value === "") {
-        callback(new Error("请再次输入密码"));
-      } else if (value !== this.form.password) {
-        callback(new Error("两次输入密码不一致!"));
-      } else {
-        callback();
-      }
-    };
+    console.log(this.userInfo, 123);
+
     return {
       securityid: "",
       excelBox1: false,
@@ -340,7 +414,7 @@
               res: "data",
             },
             tip: "请上传 .xls,.xlsx 标准格式文件",
-            action: "/api/blade-user/import-user",
+            action: "/api/blade-user/import-user?deptId=" + this.deptIds,
           },
           {
             label: "模板下载",
@@ -365,14 +439,12 @@
             propsHttp: {
               res: "data",
             },
-            tip: "请上传 zip 压缩文件",
+            tip: "请上传 zip 压缩文件,照片文件名以身份证号码命名",
             action: "/api/blade-resource/oss/endpoint/put-file-zip",
-          }
+          },
         ],
       },
-
-      form: {
-      },
+      form: {},
       search: {},
       roleBox: false,
       excelBox: false,
@@ -389,6 +461,7 @@
       },
       roleId: "1412226235153731586",
       deptId: "1413470343230877697",
+      deptIds: "",
       platformPage: {
         pageSize: 10,
         currentPage: 1,
@@ -442,12 +515,11 @@
         searchMenuSpan: 6,
         stripe: true,
         border: true,
-        delBtn: false,
-
+        delBtn: true,
         align: "center",
         index: true,
         delBtnText: "注销",
-        menuWidth: 271,
+        menuWidth: 327,
         selection: true,
         viewBtn: true,
         defaultExpandAll: true,
@@ -482,50 +554,6 @@
                 ],
               },
               {
-                label: "登录账号",
-                prop: "account",
-                editDisabled:true,
-                rules: [
-                  {
-                    required: true,
-                    message: "请输入登录账号",
-                    trigger: "blur",
-                  },
-                ],
-                // disabled: true,
-              },
-              {
-                label: "密码",
-                prop: "password",
-                type:'password',
-                hide: true,
-                editDisplay: false,
-                viewDisplay: false,
-                rules: [
-                  { required: true, validator: validatePass, trigger: "blur" },
-                ],
-              },
-              {
-                label: "确认密码",
-                prop: "password2",
-                type:'password',
-                hide: true,
-                editDisplay: false,
-                viewDisplay: false,
-                rules: [
-                  { required: true, validator: validatePass2, trigger: "blur" },
-                ],
-              },
-              
-            ],
-          },
-          {
-            label: "详细信息",
-            prop: "detailInfo",
-            labelWidth: "110",
-            icon: "el-icon-s-order",
-            column: [
-              {
                 label: "姓名",
                 prop: "realName",
                 rules: [
@@ -541,50 +569,49 @@
                   },
                 ],
               },
-              {
-                label: "昵称",
-                prop: "name",
-              },
-              {
-                label: "个人照片",
-                type: "upload",
-                listType: "picture-img",
-                propsHttp: {
-                  res: "data",
-                  url: "link",
-                },
-                canvasOption: {
-                  text: " ",
-                  ratio: 0.1,
-                },
-                action: "/api/blade-resource/oss/endpoint/put-file",
-                tip: "只能上传jpg/png个人头像,且不超过500kb",
-                span: 12,
-                row: true,
-                prop: "avatar",
-              },
-              {
-                label: "是否持证",
-                prop: "hold",
-                dicUrl: "/api/blade-system/dict-biz/dictionary?code=equipage",
-                props: {
-                  label: "dictValue",
-                  value: "dictKey",
-                },
-                type: "select",
-                rules: [
-                  {
-                    required: true,
-                    message: "请选择",
-                    trigger: "blur",
-                  },
-                ],
-              },
-              {
-                label: "保安员证编号",
-                prop: "securitynumber",
-                hide: true,
-              },
+              // {
+              //   label: "登录账号",
+              //   prop: "account",
+              //   editDisabled: true,
+              //   rules: [
+              //     {
+              //       required: true,
+              //       message: "请输入登录账号",
+              //       trigger: "blur",
+              //     },
+              //   ],
+              //   // disabled: true,
+              // },
+              // {
+              //   label: "密码",
+              //   prop: "password",
+              //   type: "password",
+              //   hide: true,
+              //   editDisplay: false,
+              //   viewDisplay: false,
+              //   rules: [
+              //     { required: true, validator: validatePass, trigger: "blur" },
+              //   ],
+              // },
+              // {
+              //   label: "确认密码",
+              //   prop: "password2",
+              //   type: "password",
+              //   hide: true,
+              //   editDisplay: false,
+              //   viewDisplay: false,
+              //   rules: [
+              //     { required: true, validator: validatePass2, trigger: "blur" },
+              //   ],
+              // },
+            ],
+          },
+          {
+            label: "详细信息",
+            prop: "detailInfo",
+            labelWidth: "110",
+            icon: "el-icon-s-order",
+            column: [
               {
                 label: "身份证号",
                 prop: "cardid",
@@ -594,6 +621,11 @@
                   {
                     required: true,
                     message: "请输入身份证号",
+                    trigger: "blur",
+                  },
+                  {
+                    required: true,
+                    validator: validatePassCardid,
                     trigger: "blur",
                   },
                 ],
@@ -608,8 +640,97 @@
                     message: "请输入手机号",
                     trigger: "blur",
                   },
+                  {
+                    required: true,
+                    validator: validatePassPhone,
+                    trigger: "blur",
+                  },
                 ],
               },
+              // {
+              //   label: "昵称",
+              //   prop: "name",
+              // },
+              {
+                label: "个人照片",
+                type: "upload",
+                listType: "picture-img",
+                propsHttp: {
+                  res: "data",
+                  url: "url",
+                },
+                canvasOption: {
+                  text: " ",
+                  ratio: 0.1,
+                },
+                action: "/api/blade-resource/oss/endpoint/put-files",
+                tip: "上传二代身份证一寸近期彩色正面免冠图象, (358像素(宽) × 441像素(高)、分辨率350dpi)且不超过500kb",
+                span: 12,
+                // row: true,
+                prop: "avatar",
+              },
+              {
+                label: "指纹信息",
+                type: "upload",
+                listType: "picture-img",
+                propsHttp: {
+                  res: "data",
+                  url: "url",
+                },
+                canvasOption: {
+                  text: " ",
+                  ratio: 0.1,
+                },
+                action: "/api/blade-resource/oss/endpoint/put-files",
+                tip: "只能上传jpg/png指纹信息,且不超过500kb",
+                span: 12,
+                // row: true,
+                prop: "fingerprint",
+              },
+              {
+                label: "是否持证",
+                prop: "hold",
+                // dicUrl: "/api/blade-system/dict-biz/dictionary?code=equipage",
+                // props: {
+                //   label: "dictValue",
+                //   value: "dictKey",
+                // },
+                type: "select",
+                dicData: [
+                  {
+                    label: "是",
+                    value: "1",
+                  },
+                  {
+                    label: "否",
+                    value: "2",
+                  },
+                  {
+                    label: "已吊销",
+                    value: "3",
+                  },
+                ],
+                rules: [
+                  {
+                    required: true,
+                    message: "请选择",
+                    trigger: "blur",
+                  },
+                ],
+              },
+              {
+                label: "保安员证编号",
+                prop: "securitynumber",
+                hide: true,
+              },
+              // {
+              //   label: "发证日期",
+              //   prop: "paperTime",
+              //   hide: true,
+              //   type: "date",
+              //   format: "yyyy-MM-dd",
+              //   valueFormat: "yyyy-MM-dd",
+              // },
               {
                 label: "电子邮箱",
                 prop: "email",
@@ -681,6 +802,13 @@
                 type: "date",
                 format: "yyyy-MM-dd",
                 valueFormat: "yyyy-MM-dd",
+                rules: [
+                  {
+                    required: true,
+                    message: "请输入入职时间",
+                    trigger: "click",
+                  },
+                ],
               },
               {
                 label: "性别",
@@ -700,6 +828,13 @@
                   //   label: "未知",
                   //   value: 3,
                   // },
+                ],
+                rules: [
+                  {
+                    required: true,
+                    message: "请选择性别",
+                    trigger: "blur",
+                  },
                 ],
               },
               // {
@@ -894,8 +1029,9 @@
     if (!website.tenantMode) {
       this.initData(website.tenantId);
     }
-    console.log(this.search,111);
-    this.search['status'] = 1;
+    console.log(this.search, 111);
+    this.search["status"] = 1;
+    this.deptIds = this.userInfo.dept_id;
   },
   methods: {
     handleImport1() {
@@ -976,35 +1112,65 @@
         row.postId = row.postId.join(",");
       }
 
-      const user = {
-        account: row.account,
-        address: row.address,
-        birthday: row.birthday,
-        cardid: row.cardid,
-        deptId: row.deptId,
-        education: row.education,
-        email: row.email,
-        height: row.height,
-        hold: row.hold,
-        jurisdiction: row.jurisdiction,
-        myPicture: row.myPicture,
-        name: row.name,
-        nation: row.nation,
-        nativeplace: row.nativeplace,
-        password: row.password,
-        password2: row.password2,
-        phone: row.phone,
-        politicaloutlook: row.politicaloutlook,
-        realName: row.realName,
-        registered: row.registered,
-        rtime: row.rtime,
-        securitynumber: row.securitynumber,
-        sex: row.sex,
-      };
       const userMap = {
-        user: user
+        user: {
+          account: row.account,
+          avatar: row.avatar,
+          fingerprint: row.fingerprint,
+          healstats: row.healstats,
+          address: row.address,
+          birthday: row.birthday,
+          cardid: row.cardid,
+          deptId: row.deptId,
+          education: row.education1,
+          email: row.email,
+          height: row.height,
+          hold: row.hold,
+          jurisdiction: row.jurisdiction,
+          myPicture: row.myPicture,
+          name: row.name,
+          nation: row.nation,
+          nativeplace: row.nativeplace,
+          password: row.password,
+          password2: row.password2,
+          phone: row.phone,
+          politicaloutlook: row.politicaloutlook,
+          realName: row.realName,
+          registered: row.registered,
+          rtime: row.rtime,
+          securitynumber: row.securitynumber,
+          sex: row.sex,
+        },
       };
+
       securitySave(userMap).then(
+        () => {
+          this.initFlag = false;
+          this.$alert("账号为身份证号码,密码为身份证后六位", "温馨提示", {
+            confirmButtonText: "确定",
+            callback: (action) => {
+              this.$message({
+                type: "success",
+                message: `操作成功`,
+              });
+              this.onLoad(this.page);
+              done();
+            },
+          });
+        },
+        (error) => {
+          window.console.log(error);
+          loading();
+        }
+      );
+    },
+    rowUpdate(row, index, done, loading) {
+      row.deptId = row.deptId;
+      row.roleId = row.roleId.join(",");
+      row.postId = row.postId.join(",");
+      //值替换,education 放在页面会卡死
+      row.education = row.education1;
+      update(row).then(
         () => {
           this.initFlag = false;
           this.onLoad(this.page);
@@ -1020,36 +1186,47 @@
         }
       );
     },
-    rowUpdate(row, index, done, loading) {
-      row.deptId = row.deptId;
-      row.roleId = row.roleId.join(",");
-      row.postId = row.postId.join(",");
-      //值替换,education 放在页面会卡死
-      row.education = row.education1;
-      update(row).then(() => {
-          this.initFlag = false;
-          this.onLoad(this.page);
-          this.$message({
-            type: "success",
-            message: "操作成功!",
-          });
-          done();
-        },
-        (error) => {
-          window.console.log(error);
-          loading();
+    rowDellook(row) {
+      // console.log(row.reasonForLeav);
+      this.$alert(
+        row.reasonForLeav == "" ? "未填写" : row.reasonForLeav,
+        "离职原因",
+        {
+          confirmButtonText: "确定",
+          callback: (action) => {},
         }
       );
     },
+    rowStatus(row) {
+      this.$prompt("离职原因", "提示", {
+        confirmButtonText: "确定离职",
+        cancelButtonText: "取消",
+        inputErrorMessage: "",
+      })
+        .then(({ value }) => {
+          console.log(value);
+          row.reasonForLeav = value;
+          row.status = "2";
+          // console.log(update);
+          // return;
+          update(row).then((res) => {
+            this.$message({
+              type: "success",
+              message: "操作成功",
+            });
+          });
+          this.refreshChange();
+        })
+        .catch(() => {});
+    },
     rowDel(row) {
-      this.$confirm("确定将选择保安登记离职?", {
+      this.$confirm("确定注销当前用户?", {
         confirmButtonText: "确定",
         cancelButtonText: "取消",
         type: "warning",
       })
         .then(() => {
-          row.status = "2";
-          return update(row);
+          return remove(row.id);
         })
         .then(() => {
           this.onLoad(this.page);
@@ -1243,10 +1420,7 @@
       roleIds.forEach((roleId) => {
         getRoleDetail(roleId).then((res) => {
           var roleAlias = res.data.data.roleAlias;
-          if (
-            roleAlias == "保安公司管理员" ||
-            roleAlias == "保安"
-          ) {
+          if (roleAlias == "保安公司管理员" || roleAlias == "保安") {
             //去除保安公司查询
             const column = that.findObject(that.option.column, "deptId");
             column.search = false;
@@ -1259,6 +1433,14 @@
             that.isSecurity = false;
             //如果是保安公司管理员
             params["deptId"] = that.userInfo.dept_id;
+
+            //导入action 修改
+            const importColumn = that.findObject(
+              that.excelOption1.column,
+              "excelFile"
+            );
+            importColumn.action =
+              "/api/blade-user/import-user?deptId=" + this.deptIds;
           } else if (roleAlias == "公安管理员") {
             params["jurisdiction"] = that.userInfo.jurisdiction;
             var columnDept = that.findObject(that.option.column, "deptId");

--
Gitblit v1.9.3