Merge branch 'dev-jack' into shenzhen-dev

This commit is contained in:
Jack 2022-07-29 09:47:41 +08:00
commit 707669712c
2 changed files with 87 additions and 84 deletions

View File

@ -1221,17 +1221,16 @@
{{ $t('message.laborMange.IdCardHead') }}
</div>
<el-upload
class="upload-demo"
:action="uploadUrl"
action="uploadUrl"
:on-remove="(file) => handleRemove(file, 3)"
:on-success="(file) => handleSuccess(file, 3)"
:on-error="(file) => handleError(file, 3)"
:on-preview="(file) => handlePreview(file, 3)"
:beforeUpload="(file) => handleBeforeUpload(file, 3)"
name="files"
:show-file-list="false"
:file-list="idCardBigPhotoUrlFile"
list-type="picture"
:http-request="
(val) => handleUpload(val, 'idCardAvatar')
"
>
<el-button
size="medium"
@ -1283,19 +1282,14 @@
{{ $t('message.laborMange.spotFaceCollection') }}
</div>
<el-upload
class="upload-demo"
:action="uploadUrl"
action="uploadUrl"
:on-remove="(file) => handleRemove(file, 4)"
:on-success="
(res, file, filelist) => handleSuccess(res, 4, file)
"
:on-error="(file) => handleError(file, 4)"
:on-preview="(file) => handlePreview(file, 4)"
:beforeUpload="(file) => handleBeforeUpload(file, 4)"
name="files"
list-type="picture"
:show-file-list="false"
:file-list="fieldAcquisitionUrlFile"
:http-request="(val) => handleUpload(val, 'livesFace')"
>
<el-button
size="medium"
@ -1770,6 +1764,8 @@ import {
} from '@/assets/js/util.js'
import { VueCropper } from 'vue-cropper'
import { apiUploadImage } from '@/assets/js/api/common'
import lrz from 'lrz'
export default {
components: {
VueCropper
@ -1954,6 +1950,43 @@ export default {
}
},
methods: {
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 = 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 = []

View File

@ -1524,6 +1524,7 @@
<span style="color: #f76c6c">*</span>
{{ $t('message.laborMange.IdCardHead') }}
</div>
<!-- 身份证头像 -->
<el-upload
class="upload-demo"
action="uploadUrl"
@ -1533,7 +1534,9 @@
:show-file-list="false"
:file-list="idCardUpPhotoFile"
:disabled="titleType == 'detail'"
:http-request="handleUpload"
:http-request="
(val) => handleUpload(val, 'idCardAvatar')
"
>
<el-button
size="medium"
@ -1586,18 +1589,14 @@
</div>
<el-upload
class="upload-demo"
:action="uploadUrl"
action="uploadUrl"
:on-remove="(file) => handleRemove(file, 7)"
:on-success="
(res, file, filelist) => handleSuccess(res, 7, file)
"
:on-error="(file) => handleError(file, 7)"
:on-preview="(file) => handlePreview(file, 7)"
:before-upload="(file) => handleBeforeUpload(file, 7)"
name="files"
:file-list="fieldAcquisitionFile"
:disabled="titleType == 'detail'"
:show-file-list="false"
:http-request="(val) => handleUpload(val, 'livesFace')"
>
<el-button
size="medium"
@ -1997,7 +1996,6 @@ import {
updateByIdWorkerInfo,
sendBatchWokerApi
} from '@/assets/js/api/laborPerson'
import axios from 'axios'
import {
selectUserDevAuthorityByUserIdApi,
exporExcelWorkerTemplateApi
@ -2011,6 +2009,7 @@ import { getProjectConfigListApi } from '@/assets/js/api/project.js'
import { VueCropper } from 'vue-cropper'
import { apiUploadImage } from '@/assets/js/api/common'
import lrz from 'lrz'
export default {
components: {
VueCropper
@ -2238,29 +2237,41 @@ export default {
}
},
methods: {
handleUpload(params) {
const file = params.file
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
}
const formData = new FormData()
formData.append('files', file)
apiUploadImage(formData).then((res) => {
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 = {