From f7f2365989049f0155957863e0362f1f4a1c4cc9 Mon Sep 17 00:00:00 2001 From: Vce Date: Mon, 17 Jun 2024 11:21:29 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E5=9C=A8=E4=BA=BA=E5=91=98=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E6=A8=A1=E5=9D=97=E4=BA=BA=E5=91=98=E5=BD=95=E5=85=A5?= =?UTF-8?q?=E4=B8=AD=E6=B7=BB=E5=8A=A0=E6=98=AF=E5=90=A6=E4=B8=BA=E6=B5=B7?= =?UTF-8?q?=E5=BA=B7=E8=AE=BE=E5=A4=87=E7=9A=84=E5=88=A4=E6=96=AD=E4=BB=A5?= =?UTF-8?q?=E5=8F=8A=E4=BA=BA=E8=84=B8=E8=AF=84=E5=88=86=E6=A3=80=E6=B5=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/assets/js/api/laborPerson.js | 7 +- .../comboForm/dialogPage/adminDialog.vue | 87 +- .../comboForm/dialogPage/laborDialog.vue | 79 +- .../comboForm/dialogPage/temporaryDialog.vue | 6065 +++++++++-------- .../laborManage/personDetails.vue | 189 +- .../personModule/laborComponent.vue | 73 +- 6 files changed, 3434 insertions(+), 3066 deletions(-) diff --git a/src/assets/js/api/laborPerson.js b/src/assets/js/api/laborPerson.js index fcc96250..3a2a3ab2 100644 --- a/src/assets/js/api/laborPerson.js +++ b/src/assets/js/api/laborPerson.js @@ -266,4 +266,9 @@ export const getHikvisionPageApi = data => get('xmgl/xzHikvisionCompareData/page // 校验同步(批量) export const getHikvisionSyncApi = data => post('xmgl/xzHikvisionCompareData/sync', data); // 人员|车辆校验 -export const getHikvisionManualCompareApi = data => post('xmgl/xzHikvisionCompareData/manualCompareData', data); \ No newline at end of file +export const getHikvisionManualCompareApi = data => post('xmgl/xzHikvisionCompareData/manualCompareData', data); + + +//海康人脸评分接口 +// export const checkfaceHikvisionApi = (data,token) => post('xmgl/recognition/checkfaceHikvision', data, { headers: {Authorization: token}}); +export const checkfaceHikvisionApi = data => post('xmgl/recognition/checkfaceHikvision', data); \ No newline at end of file diff --git a/src/views/projectFront/laborManage/components/comboForm/dialogPage/adminDialog.vue b/src/views/projectFront/laborManage/components/comboForm/dialogPage/adminDialog.vue index 534ddbe3..ff0e243b 100644 --- a/src/views/projectFront/laborManage/components/comboForm/dialogPage/adminDialog.vue +++ b/src/views/projectFront/laborManage/components/comboForm/dialogPage/adminDialog.vue @@ -804,12 +804,13 @@ action="uploadUrl" :on-remove="(file) => handleRemove(file, 4)" :on-preview="(file) => handlePreview(file, 4)" - :beforeUpload="(file) => handleBeforeUpload(file, 4)" + :beforeUpload="(file) => handleBeforeUpload(file, 7)" list-type="picture" :show-file-list="false" - :file-list="fieldAcquisitionUrlFile" + :file-list="fieldAcquisitionFile" :http-request="(val) => handleUpload(val, 'livesFace')" > + @@ -1088,6 +1091,7 @@ import { sendBatchWokerApi, importImgDataApi, getDepartmentInfoList, + checkfaceHikvisionApi, } from "@/assets/js/api/laborPerson"; import { selectUserDevAuthorityByUserIdApi, @@ -1110,6 +1114,7 @@ export default { props: ["adminDialogVisible"], data() { return { + isIscDevice: false, // 判断是否为海康设备 visible: false, defaultImg: require("../../../../../../assets/images/profile_photo.png"), idCardBigPhotoUrlFile: [], @@ -1295,7 +1300,8 @@ export default { attendRulesList: [], enterpriseTypeId: "", cropperOption: { - outputType: "png", + // outputType: "png", + outputType: "jpeg", img: "", autoCropWidth: 300, // 默认生成截图框宽度 autoCropHeight: 360, // 默认生成截图框高度 @@ -1706,12 +1712,28 @@ export default { // 压缩图片 lrz(file, { quality: 1 }).then((result) => { const formData = new FormData(); - formData.append("files", result.file); + // formData.append("files", result.file); + formData.append("files", result.file, "image.jpg"); // 图片上传 apiUploadImage(formData).then((res) => { if (res.code == 200 || res.status == "SUCCESS") { const imgInfo = res.data[0]; + if ( + imgInfo.fileInfo.contentType != "image/jpeg" && + imgInfo.fileInfo.contentType != "image/jpg" + // file.type != "image/png" + ) { + this.$message.error(this.$t("请上传jpg格式图片")); //"请上传jpg、jpeg格式图片" + return false; + } + let imgSize = Number(imgInfo.fileInfo.size / 1024); + console.log(11111111, imgSize); + if (imgSize <= 10 || imgSize >= 200) { + this.$message.error("文件大小不能超过200kb小于10kb,请重新上传!"); + return false; + } + switch (type) { case "idCardAvatar": // 身份证头像 this.personForm.idCardBigPhotoUrl = imgInfo.imageUrl; @@ -1720,9 +1742,19 @@ export default { ]; break; case "livesFace": // 现场采集人脸 - this.cropperOption.img = - this.$store.state.FILEURL + imgInfo.imageUrl; - this.cropperDialog = true; + let data = {fileUrl: imgInfo.imageUrl} + checkfaceHikvisionApi(data).then((res) => { + console.log("333333333333333333333") + console.log(res) + console.log("333333333333333333333") + if(res.code == 200 && res.result.checkType == "1"){ + this.cropperOption.img = + this.$store.state.FILEURL + imgInfo.imageUrl; + this.cropperDialog = true; + }else{ + this.$message.error(res.result.message) + } + }) // let imgStatus = result.file.size / 1024 < 500 // if (!imgStatus) { // this.cropperOption.img = @@ -1989,6 +2021,7 @@ export default { if (result.success) { if (result.result) { this.isUploadToHouse = result.result.housing ? true : false; + this.isIscDevice = result.result.supplierType == 9 ? true : false; } } }); @@ -2631,6 +2664,12 @@ export default { this.$message.error(this.$t("message.laborMange.hint8")); //"请上传jpg、jpeg格式图片" return false; } + let imgSize = Number(file.size / 1024); + console.log(11111111, imgSize); + if (imgSize <= 10 || imgSize >= 200) { + this.$message.error("文件大小不能超过200kb小于10kb,请重新上传!"); + return false; + } } return true; }, @@ -2866,14 +2905,29 @@ export default { checkFace(url) { checkFaceApi({ fileUrl: url }).then((res) => { if (res.result.checkType == 1) { - if (this.temporaryDialog1 || this.temporaryDialog2) { - this.personForm.fieldAcquisitionUrl = url; - this.fieldAcquisitionFile = [{ name: "", url: url }]; - this.cropperDialog = false; - } else { - this.personForm.fieldAcquisitionUrl = url; - this.fieldAcquisitionFile = [{ name: "", url: url }]; - this.cropperDialog = false; + if(this.isIscDevice){ + let data = {fileUrl: url} + checkfaceHikvisionApi(data).then((res) => { + if(res.code == 200 && res.result.checkType == "1"){ + if (this.temporaryDialog1 || this.temporaryDialog2) { + this.personForm.fieldAcquisitionUrl = url; + this.fieldAcquisitionFile = [{ name: "", url: url }]; + this.cropperDialog = false; + } else { + this.personForm.fieldAcquisitionUrl = url; + this.fieldAcquisitionFile = [{ name: "", url: url }]; + this.cropperDialog = false; + } + }else{ + this.$message.error(res.result.message); + } + }) + + }else{ + this.$message({ + message: "非海康设备,请检查后重试!", + type: "error", + }); } } else { this.$message.error(res.result.message); @@ -2891,7 +2945,8 @@ export default { return; } var param = new FormData(); - param.append("files", data, "image.png"); + // param.append("files", data, "image.png"); + param.append("files", data, "image.jpg"); _this.$http .post("/upload/image", param, { headers: { diff --git a/src/views/projectFront/laborManage/components/comboForm/dialogPage/laborDialog.vue b/src/views/projectFront/laborManage/components/comboForm/dialogPage/laborDialog.vue index 7e3478bf..31c7058c 100644 --- a/src/views/projectFront/laborManage/components/comboForm/dialogPage/laborDialog.vue +++ b/src/views/projectFront/laborManage/components/comboForm/dialogPage/laborDialog.vue @@ -953,6 +953,8 @@ :autoCropHeight="cropperOption.autoCropHeight" :autoCrop="true" :fixedBox="true" + :outputSize="0.7" + :maxImgSize="300" > @@ -1007,6 +1009,7 @@ import { sendBatchWokerApi, importImgDataApi, getDepartmentInfoList, + checkfaceHikvisionApi, } from "@/assets/js/api/laborPerson"; import { selectUserDevAuthorityByUserIdApi, @@ -1029,6 +1032,7 @@ export default { props: ["laborDialogVisible"], data() { return { + isIscDevice: false, // 判断是否为海康设备 visible: false, defaultImg: require("../../../../../../assets/images/profile_photo.png"), idCardBigPhotoUrlFile: [], @@ -1215,7 +1219,8 @@ export default { attendRulesList: [], enterpriseTypeId: "", cropperOption: { - outputType: "png", + // outputType: "png", + outputType: "jpeg", img: "", autoCropWidth: 300, // 默认生成截图框宽度 autoCropHeight: 360, // 默认生成截图框高度 @@ -1574,12 +1579,28 @@ export default { // 压缩图片 lrz(file, { quality: 1 }).then((result) => { const formData = new FormData(); - formData.append("files", result.file); + // formData.append("files", result.file); + formData.append("files", result.file, "image.jpg"); // 图片上传 apiUploadImage(formData).then((res) => { if (res.code == 200 || res.status == "SUCCESS") { const imgInfo = res.data[0]; + if ( + imgInfo.fileInfo.contentType != "image/jpeg" && + imgInfo.fileInfo.contentType != "image/jpg" + // file.type != "image/png" + ) { + this.$message.error(this.$t("请上传jpg格式图片")); //"请上传jpg、jpeg格式图片" + return false; + } + let imgSize = Number(imgInfo.fileInfo.size / 1024); + console.log(11111111, imgSize); + if (imgSize <= 10 || imgSize >= 200) { + this.$message.error("文件大小不能超过200kb小于10kb,请重新上传!"); + return false; + } + switch (type) { case "idCardAvatar": // 身份证头像 this.personForm.idCardBigPhotoUrl = imgInfo.imageUrl; @@ -1588,9 +1609,19 @@ export default { ]; break; case "livesFace": // 现场采集人脸 - this.cropperOption.img = - this.$store.state.FILEURL + imgInfo.imageUrl; - this.cropperDialog = true; + let data = {fileUrl: imgInfo.imageUrl} + checkfaceHikvisionApi(data).then((res) => { + console.log("333333333333333333333") + console.log(res) + console.log("333333333333333333333") + if(res.code == 200 && res.result.checkType == "1"){ + this.cropperOption.img = + this.$store.state.FILEURL + imgInfo.imageUrl; + this.cropperDialog = true; + }else{ + this.$message.error(res.result.message) + } + }) // let imgStatus = result.file.size / 1024 < 500 // if (!imgStatus) { // this.cropperOption.img = @@ -1857,6 +1888,7 @@ export default { if (result.success) { if (result.result) { this.isUploadToHouse = result.result.housing ? true : false; + this.isIscDevice = result.result.supplierType == 9 ? true : false; } } }); @@ -2450,6 +2482,12 @@ export default { this.$message.error(this.$t("message.laborMange.hint8")); //"请上传jpg、jpeg格式图片" return false; } + let imgSize = Number(file.size / 1024); + console.log(11111111, imgSize); + if (imgSize <= 10 || imgSize >= 200) { + this.$message.error("文件大小不能超过200kb小于10kb,请重新上传!"); + return false; + } } return true; }, @@ -2673,13 +2711,27 @@ export default { checkFace(url) { checkFaceApi({ fileUrl: url }).then((res) => { if (res.result.checkType == 1) { - if (this.temporaryDialog1 || this.temporaryDialog2) { - this.personForm.fieldAcquisitionUrl = url; - this.fieldAcquisitionFile = [{ name: "", url: url }]; - this.cropperDialog = false; - } else { - this.fieldAcquisitionFile = [{ name: "", url: url }]; - this.cropperDialog = false; + if(this.isIscDevice){ + let data = {fileUrl: url} + checkfaceHikvisionApi(data).then((res) => { + if(res.code == 200 && res.result.checkType == "1"){ + if (this.temporaryDialog1 || this.temporaryDialog2) { + this.personForm.fieldAcquisitionUrl = url; + this.fieldAcquisitionFile = [{ name: "", url: url }]; + this.cropperDialog = false; + } else { + this.fieldAcquisitionFile = [{ name: "", url: url }]; + this.cropperDialog = false; + } + }else{ + this.$message.error(res.result.message); + } + }) + }else{ + this.$message({ + message: "非海康设备,请检查后重试!", + type: "error", + }); } } else { this.$message.error(res.result.message); @@ -2697,7 +2749,8 @@ export default { return; } var param = new FormData(); - param.append("files", data, "image.png"); + // param.append("files", data, "image.png"); + param.append("files", data, "image.jpg"); _this.$http .post("/upload/image", param, { headers: { diff --git a/src/views/projectFront/laborManage/components/comboForm/dialogPage/temporaryDialog.vue b/src/views/projectFront/laborManage/components/comboForm/dialogPage/temporaryDialog.vue index 88acd215..66dced37 100644 --- a/src/views/projectFront/laborManage/components/comboForm/dialogPage/temporaryDialog.vue +++ b/src/views/projectFront/laborManage/components/comboForm/dialogPage/temporaryDialog.vue @@ -1,184 +1,184 @@ + + + + +
+ + + +
+ +
+ + + }, +}; + +} + \ No newline at end of file diff --git a/src/views/projectFront/laborManage/personDetails.vue b/src/views/projectFront/laborManage/personDetails.vue index 64acaa89..e46cf075 100644 --- a/src/views/projectFront/laborManage/personDetails.vue +++ b/src/views/projectFront/laborManage/personDetails.vue @@ -55,10 +55,11 @@ class="upload-demo" :action="uploadUrl" :on-success="(res, file) => handleSuccess(res, 1, file)" - :beforeUpload="(file) => handleBeforeUpload(file, 1)" + :beforeUpload="(file) => handleBeforeUpload(file, 7)" :show-file-list="false" name="files" accept=".jpg, .jpeg" + :http-request="(val) => handleUpload(val, 'livesFace')" > {{ $t("message.laborMange.updateOnsitePhotos") @@ -2306,6 +2307,8 @@ :autoCropHeight="cropperOption.autoCropHeight" :autoCrop="true" :fixedBox="true" + :outputSize="0.7" + :maxImgSize="300" > @@ -2400,11 +2403,15 @@ import { checkImgLibraryApi, safeReduceDetailList, resetScoreApi, + checkfaceHikvisionApi, + getProjectUfaceConfigInfo, } from "@/assets/js/api/laborPerson.js"; import { getProjectConfigListApi } from "@/assets/js/api/project.js"; import { selectUserDevAuthorityByUserIdApi } from "@/assets/js/api/configManage"; import QRCode from "qrcodejs2"; import { VueCropper } from "vue-cropper"; +import { apiUploadImage } from "@/assets/js/api/common"; +import lrz from "lrz"; export default { components: { VueCropper, @@ -2461,7 +2468,8 @@ export default { autoCropHeight: 360, // 默认生成截图框高度 }, cropperOption: { - outputType: "png", + // outputType: "png", + outputType: "jpeg", img: "", autoCropWidth: 300, // 默认生成截图框宽度 autoCropHeight: 360, // 默认生成截图框高度 @@ -2486,6 +2494,7 @@ export default { }, ], }, + isIscDevice: false, //是否是海康门禁isc设备 }; }, @@ -2500,6 +2509,7 @@ export default { this.getSafeScoreDetail(); this.getAttendRuleList(); this.getProjectConfig(); + this.getConfig();//判断是否为海康设备 }, mounted() { new QRCode("workerQRcode", { @@ -3095,35 +3105,122 @@ export default { // 上传前 handleBeforeUpload(file, type) { console.log("上传前----", file); - if (type == 1) { + // >>>>>>>>>>>>>>>>>>>>>>>第一版<<<<<<<<<<<<<<<<<<<<<<<<< + // if (type == 1) { + // if ( + // file.type != "image/jpeg" && + // file.type != "image/jpg" && + // file.type != "image/png" + // // file.type != "image/png" + // ) { + // this.$message.error(this.$t("message.laborMange.hint8")); + // return false; + // } + // } + // >>>>>>>>>>>>>>>>>>>>>>>第一版<<<<<<<<<<<<<<<<<<<<<<<<< + if ( + file.type != "image/jpeg" && + file.type != "image/png" && + file.type != "image/jpg" && + file.type != "image/bmp" + ) { + this.$message.error(this.$t("message.companyDiagram.uploadMsg")); //只能上传图片 + return false; + } else if (type == 7) { + console.log('11111111111111111111') + console.log(file); + console.log('11111111111111111111') if ( file.type != "image/jpeg" && - file.type != "image/jpg" && - file.type != "image/png" + file.type != "image/jpg" // file.type != "image/png" ) { - this.$message.error(this.$t("message.laborMange.hint8")); + this.$message.error(this.$t("请上传jpg格式图片")); //"请上传jpg、jpeg格式图片" + return false; + } + let imgSize = Number(file.size / 1024); + console.log(11111111, imgSize); + if (imgSize <= 10 || imgSize >= 200) { + this.$message.error("文件大小不能超过200kb小于10kb,请重新上传!"); return false; } } + return true; + }, + handleUpload(fileData, type) { + const file = fileData.file; + // 压缩图片 + lrz(file, { quality: 1 }).then((result) => { + const formData = new FormData(); + // formData.append("files", result.file); + formData.append("files", result.file, "image.jpg"); + // 图片上传 + apiUploadImage(formData).then((res) => { + if (res.code == 200 || res.status == "SUCCESS") { + console.log("000000000000000000000000000") + console.log(res) + console.log("000000000000000000000000000") + + const imgInfo = res.data[0]; + if ( + imgInfo.fileInfo.contentType != "image/jpeg" && + imgInfo.fileInfo.contentType != "image/jpg" + // file.type != "image/png" + ) { + this.$message.error(this.$t("请上传jpg格式图片")); //"请上传jpg、jpeg格式图片" + return false; + } + let imgSize = Number(imgInfo.fileInfo.size / 1024); + console.log(11111111, imgSize); + if (imgSize <= 10 || imgSize >= 200) { + this.$message.error("文件大小不能超过200kb小于10kb,请重新上传!"); + return false; + } + + switch (type) { + // case "idCardAvatar": // 身份证头像 + // this.personForm.idCardBigPhotoUrl = imgInfo.imageUrl; + // this.idCardUpPhotoFile = [ + // { name: imgInfo.filename, url: imgInfo.imageUrl }, + // ]; + // break; + case "livesFace": // 现场采集人脸 + let data = {fileUrl: imgInfo.imageUrl} + checkfaceHikvisionApi(data).then((res) => { + console.log("333333333333333333333") + console.log(res) + console.log("333333333333333333333") + if(res.code == 200 && res.result.checkType == "1"){ + this.cropperOption.img = + this.$store.state.FILEURL + imgInfo.imageUrl; + this.cropperDialog = true; + }else{ + this.$message.error(res.result.message) + } + }) + break; + } + } + }); + }); }, //上传成功 handleSuccess(file, type, file2) { // type==1 现场采集照 2 身份证反面 3 身份证正面 4 合同 5 资格证书 6 身份证头像 if (type == 1) { - let imgStatus = file2.size / 1024 < 500; - if (imgStatus) { - this.cropperOption.img = - this.$store.state.FILEURL + file.data[0].imageUrl; - this.cropperDialog = true; - } else if (this.isSzProject == 1) { - console.log("6665"); - this.checkImgLibrary(file.data[0].imageUrl); - } else { - this.checkFace(file.data[0].imageUrl); - } - // this.cropperOption.img = this.$store.state.FILEURL + file.data[0].imageUrl; - // this.cropperDialog = true; + // let imgStatus = file2.size / 1024 < 500; + // if (imgStatus) { + // this.cropperOption.img = + // this.$store.state.FILEURL + file.data[0].imageUrl; + // this.cropperDialog = true; + // } else if (this.isSzProject == 1) { + // console.log("6665"); + // this.checkImgLibrary(file.data[0].imageUrl); + // } else { + // this.checkFace(file.data[0].imageUrl); + // } + // // this.cropperOption.img = this.$store.state.FILEURL + file.data[0].imageUrl; + // // this.cropperDialog = true; } else if (type == 2) { this.workerInfo.idCardUpPhotoUrl = file.data[0].imageUrl; this.discernId(file.data[0].imageUrl, 2); @@ -3195,6 +3292,19 @@ export default { } ); }, + //判断是不是海康的设备 + getConfig() { + getProjectUfaceConfigInfo({ + projectSn: this.$store.state.projectSn, + }).then((result) => { + if (result.success) { + if (result.result) { + // this.isUploadToHouse = result.result.housing ? true : false; + this.isIscDevice = result.result.supplierType == 9 ? true : false; + } + } + }); + }, //人脸监测、 checkFace(url) { console.log("url", url); @@ -3210,6 +3320,37 @@ export default { } }); }, + //人脸监测、第二版 + checkFace2(url) { + checkFaceApi({ fileUrl: url }).then((res) => { + if (res.result.checkType == 1) { + if(this.isIscDevice){ + let data = {fileUrl: url} + checkfaceHikvisionApi(data).then((res) => { + console.log("7777777777777777777777") + console.log(res) + console.log("7777777777777777777777") + if(res.code == 200 && res.result.checkType == "1"){ + // this.personForm.fieldAcquisitionUrl = url; + // this.fieldAcquisitionFile = [{ name: "", url: url }]; + // this.cropperDialog = false; + this.workerInfo.fieldAcquisitionUrl = url; + this.cropperDialog = false; + }else{ + this.$message.error(res.result.message); + } + }) + }else{ + this.$message({ + message: "非海康设备,请检查后重试!", + type: "error", + }); + } + } else { + this.$message.error(res.result.message); + } + }); + }, // 保存编辑截图 saveMapUrlEditFn() { this.$refs.cropperEdit.startCrop(); @@ -3260,7 +3401,8 @@ export default { return; } var param = new FormData(); - param.append("files", data, "image.png"); + // param.append("files", data, "image.png"); + param.append("files", data, "image.jpg"); _this.$http .post("/upload/image", param, { headers: { @@ -3278,7 +3420,12 @@ export default { // } // } if (res.data.status == "SUCCESS") { - this.checkImgLibrary(res.data.data[0].imageUrl); + // this.checkImgLibrary(res.data.data[0].imageUrl); + if (this.isSzProject == 1) { + this.checkImgLibrary(res.data.data[0].imageUrl); + } else { + this.checkFace2(res.data.data[0].imageUrl); + } } }); }); diff --git a/src/views/projectFront/laborManage/personModule/laborComponent.vue b/src/views/projectFront/laborManage/personModule/laborComponent.vue index 8230d199..b82c7bc4 100644 --- a/src/views/projectFront/laborManage/personModule/laborComponent.vue +++ b/src/views/projectFront/laborManage/personModule/laborComponent.vue @@ -2416,6 +2416,7 @@ import { importImgDataApi, xmglXzHikvisionSyncGetNewestList, xmglXzHikvisionSyncRetryAPI, + checkfaceHikvisionApi, } from "@/assets/js/api/laborPerson"; import { selectUserDevAuthorityByUserIdApi, @@ -2624,7 +2625,8 @@ export default { attendRulesList: [], enterpriseTypeId: "", cropperOption: { - outputType: "png", + // outputType: "png", + outputType: "jpeg", img: "", autoCropWidth: 300, // 默认生成截图框宽度 autoCropHeight: 360, // 默认生成截图框高度 @@ -2751,11 +2753,31 @@ export default { // 压缩图片 lrz(file, { quality: 1 }).then((result) => { const formData = new FormData(); - formData.append("files", result.file); + // formData.append("files", result.file); + formData.append("files", result.file, "image.jpg"); // 图片上传 apiUploadImage(formData).then((res) => { if (res.code == 200 || res.status == "SUCCESS") { + console.log("0000000000000000000000000000") + console.log(res) + console.log("0000000000000000000000000000") + const imgInfo = res.data[0]; + if ( + imgInfo.fileInfo.contentType != "image/jpeg" && + imgInfo.fileInfo.contentType != "image/jpg" + // file.type != "image/png" + ) { + this.$message.error(this.$t("请上传jpg格式图片")); //"请上传jpg、jpeg格式图片" + return false; + } + let imgSize = Number(imgInfo.fileInfo.size / 1024); + console.log(11111111, imgSize); + if (imgSize <= 10 || imgSize >= 200) { + this.$message.error("文件大小不能超过200kb小于10kb,请重新上传!"); + return false; + } + switch (type) { case "idCardAvatar": // 身份证头像 @@ -2765,9 +2787,22 @@ export default { ]; break; case "livesFace": // 现场采集人脸 - this.cropperOption.img = - this.$store.state.FILEURL + imgInfo.imageUrl; - this.cropperDialog = true; + let data = {fileUrl: imgInfo.imageUrl} + // let token = this.$store.state.userInfo.token + // checkfaceHikvisionApi(data,token).then((res) => { + checkfaceHikvisionApi(data).then((res) => { + console.log("333333333333333333333") + console.log(res) + console.log("333333333333333333333") + if(res.code == 200 && res.result.checkType == "1"){ + this.cropperOption.img = + this.$store.state.FILEURL + imgInfo.imageUrl; + this.cropperDialog = true; + }else{ + this.$message.error(res.result.message) + } + }) + // let imgStatus = result.file.size / 1024 < 500 // if (!imgStatus) { // this.cropperOption.img = @@ -4028,7 +4063,9 @@ export default { this.$message.error(this.$t("message.companyDiagram.uploadMsg")); //只能上传图片 return false; } else if (type == 7) { + console.log('11111111111111111111') console.log(file); + console.log('11111111111111111111') if ( file.type != "image/jpeg" && file.type != "image/jpg" @@ -4262,9 +4299,26 @@ export default { checkFace(url) { checkFaceApi({ fileUrl: url }).then((res) => { if (res.result.checkType == 1) { - this.personForm.fieldAcquisitionUrl = url; - this.fieldAcquisitionFile = [{ name: "", url: url }]; - this.cropperDialog = false; + if(this.isIscDevice){ + let data = {fileUrl: url} + checkfaceHikvisionApi(data).then((res) => { + console.log("7777777777777777777777") + console.log(res) + console.log("7777777777777777777777") + if(res.code == 200 && res.result.checkType == "1"){ + this.personForm.fieldAcquisitionUrl = url; + this.fieldAcquisitionFile = [{ name: "", url: url }]; + this.cropperDialog = false; + }else{ + this.$message.error(res.result.message); + } + }) + }else{ + this.$message({ + message: "非海康设备,请检查后重试!", + type: "error", + }); + } } else { this.$message.error(res.result.message); } @@ -4281,7 +4335,8 @@ export default { return; } var param = new FormData(); - param.append("files", data, "image.png"); + // param.append("files", data, "image.png"); + param.append("files", data, "image.jpg"); _this.$http .post("/upload/image", param, { headers: {