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 | 498 +++++++++++++++++++++++++++--------------------------- 1 files changed, 247 insertions(+), 251 deletions(-) diff --git a/src/pages/library/components/personList.vue b/src/pages/library/components/personList.vue index b47e9ca..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" @@ -108,15 +109,16 @@ <el-table id="multipleTable" ref="multipleTable" + class="tableBox" :data="BaseManageData.personList" 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' }" @selection-change="handleSelectionChange" + border :header-cell-style="{ background: '#fff', color: '#222222', @@ -200,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> @@ -422,7 +424,7 @@ <el-drawer title="淇敼淇℃伅" :modal="false" :visible.sync="showInfoDrawer"> <el-form ref="formForEdit" - :model="form" + :model="inputPersonForm" label-width="100px" :rules="rules" > @@ -457,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; @@ -474,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> @@ -490,7 +492,7 @@ > <el-input size="small" - v-model="form.picDesc" + v-model="inputPersonForm.picDesc" placeholder="璇疯緭鍏�" ></el-input> </el-form-item> @@ -501,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> @@ -514,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> @@ -525,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> @@ -539,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> @@ -558,7 +562,7 @@ > <el-select size="small" - v-model="form.monitorLevel" + v-model="inputPersonForm.monitorLevel" placeholder="璇烽�夋嫨" style="width: 100%" > @@ -580,9 +584,8 @@ > <el-input size="small" - v-model="form.fromServerId" + v-model="inputPersonForm.fromServerId" disabled - placeholder="璇疯緭鍏�" ></el-input> </el-form-item> </el-col> @@ -595,9 +598,8 @@ > <el-input size="small" - v-model="form.createTime" + v-model="inputPersonForm.createTime" disabled - placeholder="璇疯緭鍏�" ></el-input> </el-form-item> </el-col> @@ -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,19 +617,16 @@ </el-row> </el-form> <div class="dialog-footer"> + <!-- {{BaseManageData.personList[1].idCard}} --> <el-button size="small" class="cancel-btn" @click="handleClose" type="info" - >鍙� 娑�</el-button + >鍙栨秷</el-button > - <el-button - size="small" - class="sure-btn" - type="primary" - @click="submit()" - >纭� 瀹�</el-button + <el-button size="small" class="sure-btn" type="primary" @click="submit" + >纭畾</el-button > </div> </el-drawer> @@ -687,6 +686,8 @@ > </span> </el-dialog> + + <!-- 纭鍒犻櫎瀵硅瘽妗� --> <el-dialog :visible.sync="askDeleteShow" :center="true" @@ -703,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" @@ -864,13 +868,27 @@ updateBasePerson, deleteBasePersons, updateDbTableStatus, + deleteDbPersonById, + deleteDBtablesById, } from "@/api/baseLibrary"; import { getCameraFaceData } from "@/api/es"; +import { isIDCard } from "../../../scripts/validate"; + import axios from "axios"; import UploadBtn from "./upload"; 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("杈撳叆鐨勬墜鏈哄彿閿欒")); + } +} Date.prototype.Format = function (fmt) { var o = { "M+": this.getMonth() + 1, //鏈堜唤 @@ -896,80 +914,19 @@ }; export default { - data() { - return { - timeRange: [ - new Date(2020, 7, 25, 8), - new Date(new Date().setHours(23, 59, 59)), - ], - memberInfo: { - personName: "", - sex: "", - idCard: "", - reserved: "", - }, - askDeleteShow: false, - toDeleteId: "", - reqCameraParams: { - startTime: new Date(2020, 7, 25, 8).Format("yyyy-MM-dd HH:mm:ss"), - endTime: new Date().Format("yyyy-MM-dd HH:mm:ss"), - thresholdTime: 10, - faceId: [], - }, - cameraDetailData: [], - cameraDetailVisible: false, - dialogFormVisible: false, - copyVisiabled: false, - moveVisiabled: false, - buttonAuthority: sessionStorage.getItem("buttonAuthoritys") || [], - searchName: "", - current: 1, - compare: false, - pageSize: 10, - total: 0, - orderType: "desc", - orderName: "createTime", - contentValue: "", - 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: "", - }, - rules: { - picDesc: [ - { required: true, message: "璇疯緭鍏ョ収鐗囨爣璇�", trigger: "change" }, - ], - sex: [{ required: true, message: "璇峰嬀閫夋�у埆", trigger: "change" }], - monitorLevel: [ - { required: true, message: "璇烽�夋嫨浜哄憳绛夌骇", trigger: "change" }, - ], - }, - tableData: [], - oldWidth: "", - oldHeight: "", - delType: "", - faceDataCount: 0, - // 涓婁紶鍚庣殑寮规鏄剧ず - dialogVisible: false, - // 鎵归噺涓婁紶鍚庣殑杩斿洖缁撴灉 - uploadResult: { - failList: [], - successList: [], - multiFaceList: [], - noFaceList: [], - }, - }; + components: { + UploadBtn, + fTemplate, + UploadIcon, + }, + props: { + baseObject: { + default: () => {}, + type: Object, + }, + syncType: { + type: String, + }, }, computed: { isAdmin() { @@ -993,6 +950,80 @@ default: return ["", ""]; } + }, + }, + data() { + return { + timeRange: [ + new Date(2020, 7, 25, 8), + new Date(new Date().setHours(23, 59, 59)), + ], + memberInfo: { + personName: "", + sex: "", + idCard: "", + reserved: "", + }, + askDeleteShow: false, + toDeleteId: "", + reqCameraParams: { + startTime: new Date(2020, 7, 25, 8).Format("yyyy-MM-dd HH:mm:ss"), + endTime: new Date().Format("yyyy-MM-dd HH:mm:ss"), + thresholdTime: 10, + faceId: [], + }, + cameraDetailData: [], + cameraDetailVisible: false, + copyVisiabled: false, + moveVisiabled: false, + buttonAuthority: sessionStorage.getItem("buttonAuthoritys") || [], + searchName: "", + current: 1, + compare: false, + pageSize: 10, + total: 0, + orderType: "desc", + orderName: "createTime", + contentValue: "", + visible: false, + showInfoDrawer: false, + selectedRowKeys: [], + 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" }, + ], + }, + tableData: [], + oldWidth: "", + oldHeight: "", + delType: "", + faceDataCount: 0, + // 涓婁紶鍚庣殑寮规鏄剧ず + dialogVisible: false, + // 鎵归噺涓婁紶鍚庣殑杩斿洖缁撴灉 + uploadResult: { + failList: [], + successList: [], + multiFaceList: [], + noFaceList: [], + }, + delBtnLoading: false, + }; + }, + + watch: { + "BaseManageData.selectBlacks": function (value) { + this.blackAngWhite(); + }, + "BaseManageData.selectWhites": function (value) { + this.blackAngWhite(); }, }, methods: { @@ -1040,7 +1071,7 @@ this.$notify({ type: "warning", message: "璇烽�夋嫨瑕佸垹闄ょ殑浜哄憳", - duration:1000000, + duration: 1000000, }); return; } @@ -1049,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; @@ -1116,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({ @@ -1137,6 +1143,7 @@ message: "搴曞簱鍒犻櫎鎴愬姛锛�", }); } + this.$emit("onDelete"); }) .catch((err) => { @@ -1146,17 +1153,40 @@ }); }); }, - async getPersonList() { - if (this.baseObject.id && this.baseObject.id !== undefined) { - this.BaseManageData.tableId = this.baseObject.id; - this.setLoadSearch(this.BaseManageData.queryPersonList()); + 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; + this.setLoadSearch(this.BaseManageData.queryPersonList()); + } + }); }, changeDialog(data) { data.erFileList.map((item, index) => { this.$notify({ type: "error", message: item.errorMsg.message, + customClass: "PersonListDialog", }); }); }, @@ -1175,39 +1205,26 @@ this.BaseManageData.size = val; this.getPersonList(); }, - handleClick(row) { - this.form = row; + editRow(row) { + 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.getPersonList(); + 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: "鍙栨秷", }); }, async enable(item) { @@ -1238,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(); @@ -1276,7 +1297,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`, @@ -1288,31 +1309,12 @@ 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() {}, 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(); @@ -1491,35 +1493,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> <style lang="scss"> @@ -1580,25 +1553,25 @@ } .el-dialog__body { padding-top: 0; - .el-table::before { - visibility: hidden; - } - .el-checkbox__input.is-indeterminate .el-checkbox__inner { - background-color: var(--colorCard); - border-color: var(--colorCard); - } - .el-checkbox__input.is-checked .el-checkbox__inner { - background-color: var(--colorCard); - border-color: var(--colorCard); - } - .el-table th.el-table__cell > .cell { - background: #f7f8fa; - height: 38px; - line-height: 38px; - } - .el-table__body tr.hover-row > td.el-table__cell { - background-color: #ffffff !important; - } + .el-table::before { + visibility: hidden; + } + .el-checkbox__input.is-indeterminate .el-checkbox__inner { + background-color: var(--colorCard); + border-color: var(--colorCard); + } + .el-checkbox__input.is-checked .el-checkbox__inner { + background-color: var(--colorCard); + border-color: var(--colorCard); + } + .el-table th.el-table__cell > .cell { + background: #f7f8fa; + height: 38px; + line-height: 38px; + } + .el-table__body tr.hover-row > td.el-table__cell { + background-color: #ffffff !important; + } } .el-dialog__header { box-shadow: 0px 2px 4px rgb(0 0 0 / 8%); @@ -1745,12 +1718,12 @@ border-color: var(--colorCard); background: var(--colorCard); } -.el-form-item__label { - line-height: 32px; -} -.el-form-item__content { - line-height: 32px; -} + .el-form-item__label { + line-height: 32px; + } + .el-form-item__content { + line-height: 32px; + } .el-input--small { font-size: 14px; .el-input__inner { @@ -1764,7 +1737,7 @@ } .el-form-item__error { color: #fe6d68; - padding-top: 0px; + padding-top: 2px; left: 15px; } .el-form-item.is-required:not(.is-no-asterisk) @@ -1812,6 +1785,22 @@ padding: 10px; margin-top: 8px; box-shadow: 0px 0px 6px 1px rgb(143 159 191 / 15%); + .tableBox { + border: none; + &::before, + &::after { + display: none; + } + .el-table--border .el-table__cell, + .el-table__body-wrapper + .el-table--border.is-scrolling-left + ~ .el-table__fixed { + border-right: none; + } + td { + border: none; + } + } .cell-classname { background-color: #ffffff; } @@ -1823,6 +1812,10 @@ margin: 15px 10px 20px 10px; justify-content: space-between; align-items: center; + .desc { + min-width: fit-content; + margin-right: 20px; + } .right-group { display: flex; .el-input--small { @@ -1848,7 +1841,6 @@ } .el-button--small:hover { - // background: "rgba(#{var(--colorCard-rgb)},10%) !important" ; filter: brightness(92%); } .el-input__suffix { @@ -1884,8 +1876,6 @@ .el-input-number--mini { width: 72px; } - } - .upload-img-box { } .uploadIconBox .left-section1 .el-input__inner { height: 32px; @@ -2154,7 +2144,7 @@ } } .el-dialog.copy-dialog { - width: 516px; + width: 550px; border-radius: 24px; .el-dialog__header { text-align: center; @@ -2173,6 +2163,7 @@ color: #5f5f5f; } .dialog-footer { + // width: 315px; .el-button--info { color: #999999; background: #fff; @@ -2209,7 +2200,7 @@ .items { width: 100%; min-height: 150px; - margin-bottom: 20px; + margin-bottom: 10px; .lable { font-size: 16px; font-weight: bold; @@ -2218,6 +2209,7 @@ } .baseList { height: 100%; + overflow: auto; .base { width: 152px; padding: 5px 5px 5px 10px; @@ -2410,4 +2402,8 @@ } } } + +.PersonListDialog { + width: 360px !important; +} </style> -- Gitblit v1.8.0