diff --git a/src/views/projectFront/laborManage/personModule/administration.vue b/src/views/projectFront/laborManage/personModule/administration.vue index eb7c48c7..0c7d2015 100644 --- a/src/views/projectFront/laborManage/personModule/administration.vue +++ b/src/views/projectFront/laborManage/personModule/administration.vue @@ -1221,17 +1221,16 @@ {{ $t('message.laborMange.IdCardHead') }} { + const formData = new FormData() + formData.append('files', result.file) + // 图片上传 + apiUploadImage(formData).then((res) => { + if (res.code == 200 || res.status == 'SUCCESS') { + const imgInfo = res.data[0] + + switch (type) { + case 'idCardAvatar': // 身份证头像 + this.personForm.idCardBigPhotoUrl = imgInfo.imageUrl + this.idCardUpPhotoFile = this.idCardBigPhotoUrlFile = [ + { name: imgInfo.filename, url: imgInfo.imageUrl } + ] + break + case 'livesFace': // 现场采集人脸 + let imgStatus = result.file.size / 1024 < 500 + if (!imgStatus) { + this.cropperOption.img = + this.$store.state.FILEURL + imgInfo.imageUrl + this.cropperDialog = true + } else { + if (this.isSzProject == 1) { + this.checkImgLibrary(imgInfo.imageUrl) + } else { + this.checkFace(imgInfo.imageUrl) + } + } + break + } + } + }) + }) + }, changePeople(val) {}, issuePersonFn() { batchSendWorkerInfoApi({ @@ -2851,22 +2884,6 @@ export default { this.personForm.idCardDownPhotoUrl = file.data[0].imageUrl this.idCardDownPhotoUrlFile = [arr] this.discernId(file.data[0].imageUrl, 1) - } else if (type == 3) { - this.personForm.idCardBigPhotoUrl = file.data[0].imageUrl - this.idCardBigPhotoUrlFile = [arr] - } else if (type == 4) { - 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) { - this.checkImgLibrary(file.data[0].imageUrl) - } else { - this.checkFace(file.data[0].imageUrl) - } - } } else if (type == 5) { this.contractImageFile.push(arr) let arrJoin = [] diff --git a/src/views/projectFront/laborManage/personModule/laborComponent.vue b/src/views/projectFront/laborManage/personModule/laborComponent.vue index c645a12b..53fb0819 100644 --- a/src/views/projectFront/laborManage/personModule/laborComponent.vue +++ b/src/views/projectFront/laborManage/personModule/laborComponent.vue @@ -1524,6 +1524,7 @@ * {{ $t('message.laborMange.IdCardHead') }} + { - if (res.code == 200 || res.status == 'SUCCESS') { - const data = res.data - let obj = {} - for (let i in data) { - obj = { name: data[i].filename, url: data[i].imageUrl } + handleUpload(fileData, type) { + const file = fileData.file + // 压缩图片 + lrz(file, { quality: 1 }).then((result) => { + const formData = new FormData() + formData.append('files', result.file) + // 图片上传 + apiUploadImage(formData).then((res) => { + if (res.code == 200 || res.status == 'SUCCESS') { + const imgInfo = res.data[0] + + switch (type) { + case 'idCardAvatar': // 身份证头像 + this.personForm.idCardBigPhotoUrl = imgInfo.imageUrl + this.idCardUpPhotoFile = [ + { name: imgInfo.filename, url: imgInfo.imageUrl } + ] + break + case 'livesFace': // 现场采集人脸 + let imgStatus = result.file.size / 1024 < 500 + if (!imgStatus) { + this.cropperOption.img = + this.$store.state.FILEURL + imgInfo.imageUrl + this.cropperDialog = true + } else { + if (this.isSzProject == 1) { + this.checkImgLibrary(imgInfo.imageUrl) + } else { + this.checkFace(imgInfo.imageUrl) + } + } + break + } } - this.personForm.idCardBigPhotoUrl = obj.url - this.idCardUpPhotoFile = [obj] - } + }) }) }, checkImg() { @@ -3342,18 +3353,8 @@ export default { this.$message.error(this.$t('message.companyDiagram.hint8')) return false } - } else { - // if(type==7){ - // const isLt2M = file.size / 1024 < 500; - // if (!isLt2M) { - // this.$message.error('现场采集照图片大小不能超过 500kb!'); - // } - // return isLt2M; - // }else{ - // return true; - // } - return true } + return true }, //删除 身份证头像 或 现场采集照片 @@ -3497,21 +3498,6 @@ export default { arrJoin.push(data) } this.personForm.employmentCard = arrJoin.join(',') - } else if (type == 6) { - this.personForm.idCardBigPhotoUrl = obj.url - this.idCardUpPhotoFile = [obj] - } else if (type == 7) { - let imgStatus = file2.size / 1024 < 500 - if (!imgStatus) { - this.cropperOption.img = this.$store.state.FILEURL + obj.url - this.cropperDialog = true - } else { - if (this.isSzProject == 1) { - this.checkImgLibrary(file.data[0].imageUrl) - } else { - this.checkFace(file.data[0].imageUrl) - } - } } else if (type == 8) { console.log(file) let data = {