From ccee5f79043769c13d304343a40c46a3de4e9d17 Mon Sep 17 00:00:00 2001
From: ZZJ <zzjdsg2300@163.com>
Date: 星期五, 28 一月 2022 15:19:30 +0800
Subject: [PATCH]  Merge branch 'bhomebus' of http://192.168.5.5:10010/r/web/vue-smart-ai into bhomebus

---
 src/api/utils.ts                                              |    2 
 src/scripts/validate.ts                                       |   25 ++++++++
 src/pages/library/index/App.vue                               |    4 
 src/pages/vindicate/views/updateSettings.vue                  |    2 
 src/pages/library/components/addBase.vue                      |    2 
 src/pages/library/components/personList.vue                   |   98 ++++++++++++++------------------
 src/pages/settings/views/generalSettings.vue                  |    6 +
 src/pages/shuohuangMonitorAnalyze/components/memberManage.vue |    7 --
 8 files changed, 81 insertions(+), 65 deletions(-)

diff --git a/src/api/utils.ts b/src/api/utils.ts
index 1088596..faa51d4 100644
--- a/src/api/utils.ts
+++ b/src/api/utils.ts
@@ -45,3 +45,5 @@
     ) || null
   );
 }
+
+
diff --git a/src/pages/library/components/addBase.vue b/src/pages/library/components/addBase.vue
index 66011eb..b3865f4 100644
--- a/src/pages/library/components/addBase.vue
+++ b/src/pages/library/components/addBase.vue
@@ -286,6 +286,7 @@
   },
   methods: {
     onSubmit(formName) {
+      debugger
       if (this.form.id) {
         // id涓嶄负绌猴紝淇敼搴曞簱
         this.$refs[formName].validate(async (valid) => {
@@ -314,6 +315,7 @@
                 type: "success",
               });
               this.$emit("refresh");
+              this.$emit("closeAdd");
             } else {
               this.$notify({
                 title: "澶辫触",
diff --git a/src/pages/library/components/personList.vue b/src/pages/library/components/personList.vue
index 09726bb..64e0936 100644
--- a/src/pages/library/components/personList.vue
+++ b/src/pages/library/components/personList.vue
@@ -202,7 +202,7 @@
                 <span
                   class="iconfont iconbianjixinxi-09"
                   style="font-size: 24px; cursor: pointer"
-                  @click="handleClick(scope.row)"
+                  @click="editRow(scope.row)"
                 ></span>
               </el-tooltip>
             </fTemplate>
@@ -424,7 +424,7 @@
     <el-drawer title="淇敼淇℃伅" :modal="false" :visible.sync="showInfoDrawer">
       <el-form
         ref="formForEdit"
-        :model="form"
+        :model="inputPersonForm"
         label-width="100px"
         :rules="rules"
       >
@@ -459,8 +459,8 @@
               </div>
             </div>
             <img
-              v-if="`httpImage/` + form.personPicUrl"
-              :src="`/httpImage/` + form.personPicUrl"
+              v-if="`httpImage/` + inputPersonForm.personPicUrl"
+              :src="`/httpImage/` + inputPersonForm.personPicUrl"
               style="
                 max-height: 100px;
                 width: 100px;
@@ -476,7 +476,7 @@
             <el-form-item label="ID" style="width: 100%; margin-bottom: 20px">
               <el-input
                 size="small"
-                v-model="form.id"
+                v-model="inputPersonForm.id"
                 disabled
                 placeholder="璇疯緭鍏�"
               ></el-input>
@@ -492,7 +492,7 @@
             >
               <el-input
                 size="small"
-                v-model="form.picDesc"
+                v-model="inputPersonForm.picDesc"
                 placeholder="璇疯緭鍏�"
               ></el-input>
             </el-form-item>
@@ -503,7 +503,7 @@
             <el-form-item label="濮撳悕" style="width: 100%; margin-bottom: 20px">
               <el-input
                 size="small"
-                v-model="form.personName"
+                v-model="inputPersonForm.personName"
                 placeholder="璇疯緭鍏�"
               ></el-input>
             </el-form-item>
@@ -516,7 +516,7 @@
               prop="sex"
               style="width: 100%; margin-bottom: 20px; text-align: left"
             >
-              <el-radio-group v-model="form.sex" class="mt10">
+              <el-radio-group v-model="inputPersonForm.sex" class="mt10">
                 <el-radio label="鐢�"></el-radio>
                 <el-radio label="濂�"></el-radio>
               </el-radio-group>
@@ -527,11 +527,12 @@
           <el-col :span="20">
             <el-form-item
               label="韬唤璇佸彿"
+              prop="idCard"
               style="width: 100%; margin-bottom: 20px"
             >
               <el-input
                 size="small"
-                v-model="form.idCard"
+                v-model="inputPersonForm.idCard"
                 placeholder="璇疯緭鍏�"
               ></el-input>
             </el-form-item>
@@ -541,11 +542,12 @@
           <el-col :span="20">
             <el-form-item
               label="鎵嬫満鍙�"
+              prop="phoneNum"
               style="width: 100%; margin-bottom: 20px"
             >
               <el-input
                 size="small"
-                v-model="form.phoneNum"
+                v-model="inputPersonForm.phoneNum"
                 placeholder="璇疯緭鍏�"
               ></el-input>
             </el-form-item>
@@ -560,7 +562,7 @@
             >
               <el-select
                 size="small"
-                v-model="form.monitorLevel"
+                v-model="inputPersonForm.monitorLevel"
                 placeholder="璇烽�夋嫨"
                 style="width: 100%"
               >
@@ -582,7 +584,7 @@
             >
               <el-input
                 size="small"
-                v-model="form.fromServerId"
+                v-model="inputPersonForm.fromServerId"
                 disabled
               ></el-input>
             </el-form-item>
@@ -596,7 +598,7 @@
             >
               <el-input
                 size="small"
-                v-model="form.createTime"
+                v-model="inputPersonForm.createTime"
                 disabled
               ></el-input>
             </el-form-item>
@@ -607,7 +609,7 @@
             <el-form-item label="鍏朵粬" style="width: 100%; margin-bottom: 20px">
               <el-input
                 size="small"
-                v-model="form.reserved"
+                v-model="inputPersonForm.reserved"
                 placeholder="璇疯緭鍏�"
               ></el-input>
             </el-form-item>
@@ -615,6 +617,7 @@
         </el-row>
       </el-form>
       <div class="dialog-footer">
+        <!-- {{BaseManageData.personList[1].idCard}} -->
         <el-button
           size="small"
           class="cancel-btn"
@@ -866,6 +869,9 @@
   updateDbTableStatus,
 } from "@/api/baseLibrary";
 import { getCameraFaceData } from "@/api/es";
+// import { checkIDCard } from "@/api/utils";
+import { isIDCard, isPhone } from "../../../scripts/validate";
+
 import axios from "axios";
 import UploadBtn from "./upload";
 import fTemplate from "@/components/fTemplate";
@@ -918,7 +924,6 @@
       },
       cameraDetailData: [],
       cameraDetailVisible: false,
-      dialogFormVisible: false,
       copyVisiabled: false,
       moveVisiabled: false,
       buttonAuthority: sessionStorage.getItem("buttonAuthoritys") || [],
@@ -933,24 +938,14 @@
       visible: false,
       showInfoDrawer: false,
       selectedRowKeys: [],
-      form: {
-        id: "",
-        sex: "鐢�",
-        personName: "鍛靛懙鍛�",
-        tableId: "",
-        picDesc: "",
-        idCard: "12312938102143253",
-        phoneNum: "18712766787",
-        monitorLevel: "one",
-        faceUrl: "group2/M00/0A/D7/wKgBnFyjH0-AUE5eAAC8hSMP2Yw110.jpg",
-        enable: 0,
-        reserved: "",
-      },
+      inputPersonForm: {},
       rules: {
         picDesc: [
           { required: true, message: "璇疯緭鍏ョ収鐗囨爣璇�", trigger: "change" },
         ],
         sex: [{ required: true, message: "璇峰嬀閫夋�у埆", trigger: "change" }],
+        idCard: [{ validator: isIDCard, trigger: "blur" }],
+        phoneNum: [{ validator: isPhone, trigger: "blur" }],
         monitorLevel: [
           { required: true, message: "璇烽�夋嫨浜哄憳绛夌骇", trigger: "change" },
         ],
@@ -1149,10 +1144,10 @@
     async getPersonList() {
       this.$nextTick(() => {
         if (this.baseObject.id && this.baseObject.id !== undefined) {
-        this.BaseManageData.tableId = this.baseObject.id;
-        this.setLoadSearch(this.BaseManageData.queryPersonList());
-      }
-      })
+          this.BaseManageData.tableId = this.baseObject.id;
+          this.setLoadSearch(this.BaseManageData.queryPersonList());
+        }
+      });
     },
     changeDialog(data) {
       data.erFileList.map((item, index) => {
@@ -1177,41 +1172,36 @@
       this.BaseManageData.size = val;
       this.getPersonList();
     },
-    handleClick(row) {
-      this.form = row;
+    editRow(row) {
+      debugger;
+      this.inputPersonForm = { ...row };
       this.showInfoDrawer = true;
     },
     async submit() {
       this.$refs["formForEdit"].validate(async (valid) => {
         if (valid) {
-          let { ...json } = this.form;
+          let { ...json } = this.inputPersonForm;
           delete json["compareScore"];
           let res = await updateBasePerson(json);
           if (res.success) {
-            this.$notify({
-              type: "success",
-              message: "浜哄憳淇敼鎴愬姛锛�",
-            });
+            this.$notify.success("浜哄憳淇敼鎴愬姛锛�");
             this.showInfoDrawer = false;
           } else {
-            this.$notify({
-              type: "error",
-              message: "浜哄憳淇敼澶辫触锛岃閲嶈瘯锛侊紒",
-            });
+            this.$notify.error("浜哄憳淇敼澶辫触锛岃閲嶈瘯锛�");
           }
         } else {
           return false;
         }
       });
     },
-    confirm() {
-      this.$confirm({
-        title: "Confirm",
-        content: "Bla bla ...",
-        okText: "纭",
-        cancelText: "鍙栨秷",
-      });
-    },
+    // confirm() {
+    //   this.$confirm({
+    //     title: "Confirm",
+    //     content: "Bla bla ...",
+    //     okText: "纭",
+    //     cancelText: "鍙栨秷",
+    //   });
+    // },
     async enable(item) {
       let res = await updateBasePerson({
         id: item.id,
@@ -1278,7 +1268,7 @@
     async updateFace(param) {
       const fd = new FormData();
       fd.append("file", param.file);
-      fd.append("id", this.form.id);
+      fd.append("id", this.inputPersonForm.id);
       let res = await axios({
         method: "post",
         url: `/data/api-v/dbperson/updateFace`,
@@ -1290,8 +1280,8 @@
         data: fd,
       });
       if (res.data.success) {
-        this.form.persoasyncnPicUrl = res.data.data.personPicUrl;
-        this.form.faceFeature = res.data.data.faceFeature;
+        this.inputPersonForm.persoasyncnPicUrl = res.data.data.personPicUrl;
+        this.inputPersonForm.faceFeature = res.data.data.faceFeature;
       }
     },
     uploadSuccess() {},
diff --git a/src/pages/library/index/App.vue b/src/pages/library/index/App.vue
index 2622da2..4eeaa41 100644
--- a/src/pages/library/index/App.vue
+++ b/src/pages/library/index/App.vue
@@ -34,14 +34,14 @@
             v-show="showType == 'car'"
           ></car-list>
         </div>
-        <add-base
+        <addBase
           ref="addBase"
           :baseObject="baseForEdit"
           :type="syncType"
           v-if="!showList"
           @refresh="findBaseSync"
           @closeAdd="closeAdd"
-        ></add-base>
+        ></addBase>
       </div>
     </div>
   </div>
diff --git a/src/pages/settings/views/generalSettings.vue b/src/pages/settings/views/generalSettings.vue
index 4b6f2a1..c84b4c1 100644
--- a/src/pages/settings/views/generalSettings.vue
+++ b/src/pages/settings/views/generalSettings.vue
@@ -381,8 +381,10 @@
     });
     const url = this.curUser.backgroundpic;
     this.activeIcons = this.curUser.useIconType-1
+    this.universalColor = this.colorList.findIndex((x) => {
+      return x.color == localStorage.getItem("--colorCard")
+    })
     if (url) {
-      // const arr = url.split("/");
       this.activeBg = this.tableBGList.findIndex((x) => {
         return x.url == url;
       });
@@ -425,6 +427,7 @@
       }).then((res) => {
         if (res.success) {
           sessionStorage.setItem("userInfo", JSON.stringify(res.data))
+          debugger
           this.$message.success(res.msg);
         }
       });
@@ -510,6 +513,7 @@
         if (res.success) {
           window.parent.postMessage({ msg: "AppUpdate" }, "*");
           sessionStorage.setItem("userInfo", JSON.stringify(res.data))
+          debugger
           this.$message.success(res.msg);
         }
       });
diff --git a/src/pages/shuohuangMonitorAnalyze/components/memberManage.vue b/src/pages/shuohuangMonitorAnalyze/components/memberManage.vue
index cf6d449..6435d24 100644
--- a/src/pages/shuohuangMonitorAnalyze/components/memberManage.vue
+++ b/src/pages/shuohuangMonitorAnalyze/components/memberManage.vue
@@ -373,13 +373,6 @@
         }
         return callback(new Error("杈撳叆鐨勬墜鏈哄彿閿欒"));
       }
-      // if (value.trim()) {
-      //   var pattern = /^1[345789]\d{9}$/
-      //   if (pattern.test(value)) {
-      //     return callback()
-      //   }
-      //   return callback(new Error('杈撳叆鐨勬墜鏈哄彿閿欒'))
-      // }
     },
     nodeContextMenu(e, data, node, comp) {
       this.showMenu = true;
diff --git a/src/pages/vindicate/views/updateSettings.vue b/src/pages/vindicate/views/updateSettings.vue
index 4ec1f9b..dec75d5 100644
--- a/src/pages/vindicate/views/updateSettings.vue
+++ b/src/pages/vindicate/views/updateSettings.vue
@@ -374,7 +374,7 @@
         value: item.val,
       }).then((res) => {
         if (res.code == 200) {
-          this.$notify.success("鏇存柊鎴愬姛");
+          this.$notify.success("閰嶇疆鎴愬姛");
         }
       });
     },
diff --git a/src/scripts/validate.ts b/src/scripts/validate.ts
index 6db86d7..bd50caa 100644
--- a/src/scripts/validate.ts
+++ b/src/scripts/validate.ts
@@ -57,6 +57,31 @@
   return callback(new Error('杈撳叆鐨勬墜鏈哄彿閿欒'))
 }
 
+export function isIDCard(rule, idcode, callback) {
+  var weight_factor = [7,9,10,5,8,4,2,1,6,3,7,9,10,5,8,4,2];
+  var check_code = ['1', '0', 'X' , '9', '8', '7', '6', '5', '4', '3', '2'];
+
+  var code = idcode + "";
+  var last = idcode[17];//鏈�鍚庝竴浣�
+
+  var seventeen = code.substring(0,17);
+
+  var arr = seventeen.split("");
+  var len = arr.length;
+  var num = 0;
+  for(var i = 0; i < len; i++){
+      num = num + +arr[i] * weight_factor[i];
+  }
+  
+  var resisue = num%11;
+  var last_no = check_code[resisue];
+
+  var idcard_patter = /^[1-9][0-9]{5}([1][9][0-9]{2}|[2][0][0|1][0-9])([0][1-9]|[1][0|1|2])([0][1-9]|[1|2][0-9]|[3][0|1])[0-9]{3}([0-9]|[X])$/;
+
+  var format = idcard_patter.test(idcode);
+  return last === last_no && format ? callback() : callback(new Error('韬唤璇佸彿鏍煎紡閿欒'));
+}
+
 export function isIPv4(rule, value, callback) {
   if (!value) {
     return callback(new Error('杈撳叆涓嶅彲浠ヤ负绌�'));

--
Gitblit v1.8.0