From 8c6cf205affbbc8ada74f00a7ca25ebca867e9ed Mon Sep 17 00:00:00 2001
From: liuyg <376836862@qq.com>
Date: Mon, 27 Sep 2021 11:44:44 +0800
Subject: [PATCH] 图表颜色

---
 src/views/securityGuard/securityGuard.vue |  224 ++++++++++++++++++++++++++++++++++++++++++-------------
 1 files changed, 169 insertions(+), 55 deletions(-)

diff --git a/src/views/securityGuard/securityGuard.vue b/src/views/securityGuard/securityGuard.vue
index e6f6f0f..9ebf584 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>
@@ -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"
@@ -302,6 +310,7 @@
 import { mapState } from "vuex";
 
 export default {
+  
   data() {
     const validatePass = (rule, value, callback) => {
       if (value === "") {
@@ -319,6 +328,32 @@
         callback();
       }
     };
+    const validatePassNumber = (rule, value, callback) => {
+      var test = /^[0-9]*$/gm;
+      if (!test.test(value)) {
+        callback(new Error("请输入数字"));
+      } else {
+        callback();
+      }
+    };
+    const validatePassCardid = (rule, value, callback) => {
+      var test = /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/g;
+      if (!test.test(value) && value.length < 17) {
+        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;
+      if (!test.test(value)) {
+        callback(new Error("请输入正确手机号码"));
+      } else {
+        callback();
+      }
+    };
+    console.log(this.userInfo,123);
+    
     return {
       securityid: "",
       excelBox1: false,
@@ -340,7 +375,7 @@
               res: "data",
             },
             tip: "请上传 .xls,.xlsx 标准格式文件",
-            action: "/api/blade-user/import-user",
+            action: "/api/blade-user/import-user?deptId="+this.deptIds,
           },
           {
             label: "模板下载",
@@ -365,14 +400,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 +422,7 @@
       },
       roleId: "1412226235153731586",
       deptId: "1413470343230877697",
+      deptIds:"",
       platformPage: {
         pageSize: 10,
         currentPage: 1,
@@ -442,12 +476,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,
@@ -484,7 +517,7 @@
               {
                 label: "登录账号",
                 prop: "account",
-                editDisabled:true,
+                editDisabled: true,
                 rules: [
                   {
                     required: true,
@@ -497,7 +530,7 @@
               {
                 label: "密码",
                 prop: "password",
-                type:'password',
+                type: "password",
                 hide: true,
                 editDisplay: false,
                 viewDisplay: false,
@@ -508,7 +541,7 @@
               {
                 label: "确认密码",
                 prop: "password2",
-                type:'password',
+                type: "password",
                 hide: true,
                 editDisplay: false,
                 viewDisplay: false,
@@ -516,7 +549,6 @@
                   { required: true, validator: validatePass2, trigger: "blur" },
                 ],
               },
-              
             ],
           },
           {
@@ -551,17 +583,35 @@
                 listType: "picture-img",
                 propsHttp: {
                   res: "data",
-                  url: "link",
+                  url: "url",
                 },
                 canvasOption: {
                   text: " ",
                   ratio: 0.1,
                 },
-                action: "/api/blade-resource/oss/endpoint/put-file",
+                action: "/api/blade-resource/oss/endpoint/put-files",
                 tip: "只能上传jpg/png个人头像,且不超过500kb",
                 span: 12,
-                row: true,
+                // 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: "是否持证",
@@ -596,6 +646,11 @@
                     message: "请输入身份证号",
                     trigger: "blur",
                   },
+                  {
+                    required: true,
+                    validator: validatePassCardid,
+                    trigger: "blur",
+                  },
                 ],
               },
               {
@@ -606,6 +661,11 @@
                   {
                     required: true,
                     message: "请输入手机号",
+                    trigger: "blur",
+                  },
+                  {
+                    required: true,
+                    validator: validatePassPhone,
                     trigger: "blur",
                   },
                 ],
@@ -681,6 +741,13 @@
                 type: "date",
                 format: "yyyy-MM-dd",
                 valueFormat: "yyyy-MM-dd",
+                rules: [
+                  {
+                    required: true,
+                    message: "请输入入职时间",
+                    trigger: "click",
+                  },
+                ],
               },
               {
                 label: "性别",
@@ -700,6 +767,13 @@
                   //   label: "未知",
                   //   value: 3,
                   // },
+                ],
+                rules: [
+                  {
+                    required: true,
+                    message: "请选择性别",
+                    trigger: "blur",
+                  },
                 ],
               },
               // {
@@ -894,8 +968,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,33 +1051,35 @@
         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(
         () => {
@@ -1026,7 +1103,8 @@
       row.postId = row.postId.join(",");
       //值替换,education 放在页面会卡死
       row.education = row.education1;
-      update(row).then(() => {
+      update(row).then(
+        () => {
           this.initFlag = false;
           this.onLoad(this.page);
           this.$message({
@@ -1041,15 +1119,47 @@
         }
       );
     },
+    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 +1353,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 +1366,13 @@
             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