From 0e4d44c2f5a7511d2eee72deecb76b5ba67358cd Mon Sep 17 00:00:00 2001
From: Administrator <admin>
Date: Tue, 04 Jan 2022 17:39:41 +0800
Subject: [PATCH] 智能分析查询明细样式调整

---
 src/views/securityGuard/securityGuard.vue |   85 +++++++++++++++++++++++++++++++++---------
 1 files changed, 67 insertions(+), 18 deletions(-)

diff --git a/src/views/securityGuard/securityGuard.vue b/src/views/securityGuard/securityGuard.vue
index b0f645b..bdf06ee 100644
--- a/src/views/securityGuard/securityGuard.vue
+++ b/src/views/securityGuard/securityGuard.vue
@@ -438,6 +438,7 @@
   getUserPractitionersInfo,
   updatePaperTime,
   getzhiwen, //指纹
+  checkAccountByUser,
 } from "@/api/system/user";
 import { securityApply } from "@/api/accreditationRecords/accreditationRecords";
 import { getList } from "@/api/securityGuard/securityGuard";
@@ -534,6 +535,35 @@
     function trim(str) {
       return str.replace(/(^\s*)|(\s*$)/g, "");
     }
+    /**
+     * 身份证号码账号校验
+     */
+    let useBack = "";
+    function checkAccount(idCard, callback) {
+      var data = {
+        cardid: idCard,
+      };
+      if (window.deptIdss) {
+        data["deptId"] = window.deptIdss;
+      }
+      //调用接口校验
+      if (useBack != idCard) {
+        useBack = idCard;
+        checkAccountByUser(data)
+          .then((res) => {
+            useBack = "ok";
+            callback();
+          })
+          .catch((error) => {
+            callback("当前身份证号码已录入!");
+          });
+      } else if (useBack == "ok") {
+        callback();
+      } else {
+        console.log("cf");
+        callback(new Error("当前身份证号码已录入!"));
+      }
+    }
     const validatePassCardid = (rule, value, callback) => {
       let ok = false;
       if (value.length == 18) {
@@ -553,7 +583,8 @@
       }
 
       if (ok) {
-        callback();
+        //调用接口进行账户重复校验
+        checkAccount(value, callback);
       } else {
         callback(new Error("身份证错误"));
       }
@@ -758,6 +789,7 @@
         },
       },
       choiceList: [],
+      deptIdss: "",
       option: {
         searchIndex: 5, //收缩展示数量
         searchIcon: true, //搜索是否收缩
@@ -779,6 +811,7 @@
         },
         indexWidth: 55,
         searchMenuSpan: 6,
+
         stripe: true,
         border: true,
         delBtn: true,
@@ -1030,6 +1063,7 @@
                 prop: "email",
                 type: "upload",
                 listType: "picture-img",
+                display: true,
                 propsHttp: {
                   res: "data",
                   url: "url",
@@ -1359,12 +1393,21 @@
         this.initData(this.form.tenantId);
       }
     },
+    "form.deptId": {
+      handler(val) {
+        if (val) {
+          window.deptIdss = val;
+        }
+      },
+      immediate: true,
+    },
     "form.hold": {
       handler(val) {
         var securitynumbercolumn = this.findObject(
           this.option.group,
           "securitynumber"
         );
+        var emailcolumn = this.findObject(this.option.group, "email");
         // console.log(val,1234);
         if (val == 1) {
           securitynumbercolumn.display = true;
@@ -1375,6 +1418,7 @@
               trigger: "blur",
             },
           ];
+          emailcolumn.display = true;
         } else {
           securitynumbercolumn.display = false;
           securitynumbercolumn.rules = [
@@ -1384,6 +1428,7 @@
               trigger: "blur",
             },
           ];
+          emailcolumn.display = false;
         }
       },
       immediate: true,
@@ -2734,25 +2779,29 @@
     //照片上传拦截
     uploadBefore(file, done, loading, column) {
       //如果你想修改file文件,由于上传的file是只读文件,必须复制新的file才可以修改名字,完后赋值到done函数里,如果不修改的话直接写done()即可
-      if (file.type.indexOf("image/") == -1) {
-        MessageBox.alert(
-          "上传图片格式错误,请上传图片类型,如:JPG,PNG后缀的文件。"
-        );
-        loading();
-        return false;
-      }
-      let data = window.URL.createObjectURL(new Blob([file]));
-      this.filename = file;
-      this.option.img = data;
-      //判断文件大小
-      const isLt1M = file.size >= 30 * 1024 && file.size <= 500 * 1024;
-      if (!isLt1M) {
-        MessageBox.alert("上传图片大小必须大于30KB,且小于500KB!");
-        loading();
-        return false;
+      //判断角色
+      if (this.userInfo.role_name != "administrator") {
+        if (file.type.indexOf("image/") == -1) {
+          MessageBox.alert(
+            "上传图片格式错误,请上传图片类型,如:JPG,PNG后缀的文件。"
+          );
+          loading();
+          return false;
+        }
+        let data = window.URL.createObjectURL(new Blob([file]));
+        this.filename = file;
+        this.option.img = data;
+        //判断文件大小
+        const isLt1M = file.size >= 30 * 1024 && file.size <= 500 * 1024;
+        if (!isLt1M) {
+          MessageBox.alert("上传图片大小必须大于30KB,且小于500KB!");
+          loading();
+          return false;
+        }
+        done();
+        return isLt1M;
       }
       done();
-      return isLt1M;
     },
   },
 };

--
Gitblit v1.9.3