From 4a800a8fc83c6bd1f86a8e847b079a51a7532c09 Mon Sep 17 00:00:00 2001
From: zhangzengfei <zhangzengfei@smartai.com>
Date: 星期三, 20 七月 2022 15:05:58 +0800
Subject: [PATCH] 修复国标配置的bug

---
 src/pages/library/components/personList.vue |  256 +++++++++++++++++++++++---------------------------
 1 files changed, 118 insertions(+), 138 deletions(-)

diff --git a/src/pages/library/components/personList.vue b/src/pages/library/components/personList.vue
index 6511bbb..4048acb 100644
--- a/src/pages/library/components/personList.vue
+++ b/src/pages/library/components/personList.vue
@@ -20,6 +20,7 @@
         </div>
 
         <div class="right-btns">
+          <span style="margin-right: 2px">搴曞簱鐘舵�侊紙鐢熸晥/澶辨晥锛�</span>
           <el-switch
             :active-value="1"
             :width="52"
@@ -113,7 +114,6 @@
         tooltip-effect="dark"
         style="width: 100%; overflow: auto"
         :fit="true"
-        row-class-name="hover-row"
         cell-class-name="cell-classname"
         @row-click="pickRow"
         :default-sort="{ prop: 'createTime', order: 'descending' }"
@@ -625,11 +625,7 @@
           type="info"
           >鍙栨秷</el-button
         >
-        <el-button
-          size="small"
-          class="sure-btn"
-          type="primary"
-          @click="submit"
+        <el-button size="small" class="sure-btn" type="primary" @click="submit"
           >纭畾</el-button
         >
       </div>
@@ -690,6 +686,8 @@
         >
       </span>
     </el-dialog>
+
+    <!-- 纭鍒犻櫎瀵硅瘽妗� -->
     <el-dialog
       :visible.sync="askDeleteShow"
       :center="true"
@@ -706,9 +704,12 @@
       </div>
       <span slot="footer" class="dialog-footer">
         <el-button @click="askDeleteShow = false">鍙� 娑�</el-button>
-        <el-button type="primary" @click="handleDel">纭� 瀹�</el-button>
+        <el-button type="primary" @click="handleDel" :loading="delBtnLoading"
+          >纭� 瀹�</el-button
+        >
       </span>
     </el-dialog>
+
     <el-dialog
       title="澶嶅埗鍒�"
       :visible.sync="copyVisiabled"
@@ -867,9 +868,10 @@
   updateBasePerson,
   deleteBasePersons,
   updateDbTableStatus,
+  deleteDbPersonById,
+  deleteDBtablesById,
 } from "@/api/baseLibrary";
 import { getCameraFaceData } from "@/api/es";
-// import { checkIDCard } from "@/api/utils";
 import { isIDCard } from "../../../scripts/validate";
 
 import axios from "axios";
@@ -877,16 +879,16 @@
 import fTemplate from "@/components/fTemplate";
 import UploadIcon from "@/components/searching/UploadIcon.vue";
 function isPhone(rule, value, callback) {
-      if (!value) {
-        return callback();
-      } else if (value.trim()) {
-        var pattern = /^1[345789]\d{9}$/;
-        if (pattern.test(value)) {
-          return callback();
-        }
-        return callback(new Error("杈撳叆鐨勬墜鏈哄彿閿欒"));
-      }
+  if (!value) {
+    return callback();
+  } else if (value.trim()) {
+    var pattern = /^1[345789]\d{9}$/;
+    if (pattern.test(value)) {
+      return callback();
     }
+    return callback(new Error("杈撳叆鐨勬墜鏈哄彿閿欒"));
+  }
+}
 Date.prototype.Format = function (fmt) {
   var o = {
     "M+": this.getMonth() + 1, //鏈堜唤
@@ -912,6 +914,44 @@
 };
 
 export default {
+  components: {
+    UploadBtn,
+    fTemplate,
+    UploadIcon,
+  },
+  props: {
+    baseObject: {
+      default: () => {},
+      type: Object,
+    },
+    syncType: {
+      type: String,
+    },
+  },
+  computed: {
+    isAdmin() {
+      if (
+        sessionStorage.getItem("userInfo") &&
+        sessionStorage.getItem("userInfo") !== ""
+      ) {
+        let loginName = JSON.parse(sessionStorage.getItem("userInfo")).username;
+        return loginName === "superadmin" || loginName === "basic";
+      }
+      return false;
+    },
+    delText() {
+      switch (this.delType) {
+        case "base":
+          return ["鍒犻櫎搴曞簱", "纭畾鍒犻櫎璇ュ簳搴擄紵"];
+        case "single":
+          return ["鍒犻櫎浜哄憳", "纭畾鍒犻櫎璇ュ簳搴撲汉鍛橈紵"];
+        case "batch":
+          return ["鎵归噺鍒犻櫎", "纭畾鍒犻櫎璇ュ簳搴撻�変腑浜哄憳锛�"];
+        default:
+          return ["", ""];
+      }
+    },
+  },
   data() {
     return {
       timeRange: [
@@ -974,30 +1014,16 @@
         multiFaceList: [],
         noFaceList: [],
       },
+      delBtnLoading: false,
     };
   },
-  computed: {
-    isAdmin() {
-      if (
-        sessionStorage.getItem("userInfo") &&
-        sessionStorage.getItem("userInfo") !== ""
-      ) {
-        let loginName = JSON.parse(sessionStorage.getItem("userInfo")).username;
-        return loginName === "superadmin" || loginName === "basic";
-      }
-      return false;
+
+  watch: {
+    "BaseManageData.selectBlacks": function (value) {
+      this.blackAngWhite();
     },
-    delText() {
-      switch (this.delType) {
-        case "base":
-          return ["鍒犻櫎搴曞簱", "纭畾鍒犻櫎璇ュ簳搴擄紵"];
-        case "single":
-          return ["鍒犻櫎浜哄憳", "纭畾鍒犻櫎璇ュ簳搴撲汉鍛橈紵"];
-        case "batch":
-          return ["鎵归噺鍒犻櫎", "纭畾鍒犻櫎璇ュ簳搴撻�変腑浜哄憳锛�"];
-        default:
-          return ["", ""];
-      }
+    "BaseManageData.selectWhites": function (value) {
+      this.blackAngWhite();
     },
   },
   methods: {
@@ -1054,34 +1080,6 @@
       this.delType = typ;
       id && (this.toDeleteId = id);
     },
-    deleteThis() {
-      let token =
-        sessionStorage.getItem("loginedInfo") &&
-        JSON.parse(sessionStorage.getItem("loginedInfo")).access_token;
-
-      fetch(`/data/api-v/dbperson/deleteDbPersonById?id=${this.toDeleteId}`, {
-        method: "GET",
-        headers: {
-          "Content-Type": "application/json",
-          Authorization: token,
-        },
-      })
-        .then((res) => {
-          return res.json();
-        })
-        .then((data) => {
-          if (data.success) {
-            this.$notify({
-              type: "success",
-              message: "璇ヤ汉鍛樺垹闄ゆ垚鍔燂紒",
-            });
-            this.askDeleteShow = false;
-          }
-          this.getPersonList();
-        })
-        .catch((err) => {});
-    },
-    sayHello() {},
     getUploadResult(result) {
       this.uploadResult = result.data;
       this.dialogVisible = true;
@@ -1121,20 +1119,23 @@
     edit() {
       this.$emit("changeShow", this.baseObject, this.syncType);
     },
-    deleteBase() {
-      let token =
-        sessionStorage.getItem("loginedInfo") &&
-        JSON.parse(sessionStorage.getItem("loginedInfo")).access_token;
-      fetch(`/data/api-v/dbtable/deleteDBtablesById?id=${this.baseObject.id}`, {
-        method: "GET",
-        headers: {
-          "Content-Type": "application/json",
-          Authorization: token,
-        },
-      })
-        .then((res) => {
-          return res.json();
+
+    deleteThis() {
+      debugger;
+      deleteDbPersonById({ id: this.toDeleteId })
+        .then((data) => {
+          if (data.success) {
+            this.$notify({
+              type: "success",
+              message: "璇ヤ汉鍛樺垹闄ゆ垚鍔燂紒",
+            });
+          }
+          this.getPersonList();
         })
+        .catch((err) => {});
+    },
+    deleteBase() {
+      deleteDBtablesById({ id: this.baseObject.id })
         .then((res) => {
           if (res.success) {
             this.$notify({
@@ -1142,7 +1143,6 @@
               message: "搴曞簱鍒犻櫎鎴愬姛锛�",
             });
           }
-          this.askDeleteShow=false
 
           this.$emit("onDelete");
         })
@@ -1153,7 +1153,27 @@
           });
         });
     },
+    async deleteBatch() {
+      let ids = [];
+      this.selectedRowKeys.map((item, index) => {
+        ids.push(item.id);
+      });
+      let res = await deleteBasePersons({ ids: ids });
+      if (res.success) {
+        this.$notify({
+          type: "success",
+          message: "鍒犻櫎鎴愬姛锛�",
+        });
+        this.getPersonList();
+      } else {
+        this.$notify({
+          type: "error",
+          message: "鍒犻櫎澶辫触锛�",
+        });
+      }
+    },
     async getPersonList() {
+      console.log(this.baseObject);
       this.$nextTick(() => {
         if (this.baseObject.id && this.baseObject.id !== undefined) {
           this.BaseManageData.tableId = this.baseObject.id;
@@ -1166,6 +1186,7 @@
         this.$notify({
           type: "error",
           message: item.errorMsg.message,
+          customClass: "PersonListDialog",
         });
       });
     },
@@ -1195,7 +1216,7 @@
           delete json["compareScore"];
           let res = await updateBasePerson(json);
           if (res.success) {
-            this.getPersonList()
+            this.getPersonList();
             this.$notify.success("浜哄憳淇敼鎴愬姛锛�");
             this.showInfoDrawer = false;
           } else {
@@ -1234,14 +1255,18 @@
     handleSearch() {
       this.getPersonList();
     },
-    handleDel() {
+    async handleDel() {
+      this.delBtnLoading = true;
       if (this.delType == "single") {
-        this.deleteThis();
+        await this.deleteThis();
       } else if (this.delType == "base") {
-        this.deleteBase();
+        await this.deleteBase();
       } else if (this.delType == "batch") {
-        this.deleteBatch();
+        await this.deleteBatch();
       }
+
+      this.delBtnLoading = false;
+      this.askDeleteShow = false;
     },
     searchImg() {
       this.$refs.uploadDrag && this.$refs.uploadDrag.uploadStart();
@@ -1290,25 +1315,6 @@
     },
     uploadSuccess() {},
     uploadError() {},
-    async deleteBatch() {
-      let ids = [];
-      this.selectedRowKeys.map((item, index) => {
-        ids.push(item.id);
-      });
-      let res = await deleteBasePersons(ids);
-      if (res.success) {
-        this.$notify({
-          type: "success",
-          message: "鍒犻櫎鎴愬姛锛�",
-        });
-        this.getPersonList();
-      } else {
-        this.$notify({
-          type: "error",
-          message: "鍒犻櫎澶辫触锛�",
-        });
-      }
-    },
     async init() {
       await this.BaseManageData.querySyncTables();
       await this.BaseManageData.queryLocalTables();
@@ -1486,35 +1492,6 @@
   },
   beforeDestroy() {
     window.onresize = null;
-  },
-  watch: {
-    baseObject: {
-      handler(newVal, oldVal) {
-        this.BaseManageData.cleanData();
-        this.getPersonList();
-      },
-      deep: true,
-    },
-    "BaseManageData.selectBlacks": function (value) {
-      this.blackAngWhite();
-    },
-    "BaseManageData.selectWhites": function (value) {
-      this.blackAngWhite();
-    },
-  },
-  components: {
-    UploadBtn,
-    fTemplate,
-    UploadIcon,
-  },
-  props: {
-    baseObject: {
-      default: () => {},
-      type: Object,
-    },
-    syncType: {
-      type: String,
-    },
   },
 };
 </script>
@@ -1864,7 +1841,6 @@
       }
 
       .el-button--small:hover {
-        // background: "rgba(#{var(--colorCard-rgb)},10%) !important"  ;
         filter: brightness(92%);
       }
       .el-input__suffix {
@@ -1900,8 +1876,6 @@
         .el-input-number--mini {
           width: 72px;
         }
-      }
-      .upload-img-box {
       }
       .uploadIconBox .left-section1 .el-input__inner {
         height: 32px;
@@ -2170,7 +2144,7 @@
   }
 }
 .el-dialog.copy-dialog {
-  width: 516px;
+  width: 550px;
   border-radius: 24px;
   .el-dialog__header {
     text-align: center;
@@ -2189,6 +2163,7 @@
     color: #5f5f5f;
   }
   .dialog-footer {
+    // width: 315px;
     .el-button--info {
       color: #999999;
       background: #fff;
@@ -2225,7 +2200,7 @@
     .items {
       width: 100%;
       min-height: 150px;
-      margin-bottom: 20px;
+      margin-bottom: 10px;
       .lable {
         font-size: 16px;
         font-weight: bold;
@@ -2234,6 +2209,7 @@
       }
       .baseList {
         height: 100%;
+        overflow: auto;
         .base {
           width: 152px;
           padding: 5px 5px 5px 10px;
@@ -2426,4 +2402,8 @@
     }
   }
 }
+
+.PersonListDialog {
+  width: 360px !important;
+}
 </style>

--
Gitblit v1.8.0