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') }} {{ $t('message.laborMange.IdCardHead') }}
</div> </div>
<el-upload <el-upload
class="upload-demo" action="uploadUrl"
:action="uploadUrl"
:on-remove="(file) => handleRemove(file, 3)" :on-remove="(file) => handleRemove(file, 3)"
:on-success="(file) => handleSuccess(file, 3)"
:on-error="(file) => handleError(file, 3)"
:on-preview="(file) => handlePreview(file, 3)" :on-preview="(file) => handlePreview(file, 3)"
:beforeUpload="(file) => handleBeforeUpload(file, 3)" :beforeUpload="(file) => handleBeforeUpload(file, 3)"
name="files"
:show-file-list="false" :show-file-list="false"
:file-list="idCardBigPhotoUrlFile" :file-list="idCardBigPhotoUrlFile"
list-type="picture" list-type="picture"
:http-request="
(val) => handleUpload(val, 'idCardAvatar')
"
> >
<el-button <el-button
size="medium" size="medium"
@ -1283,19 +1282,14 @@
{{ $t('message.laborMange.spotFaceCollection') }} {{ $t('message.laborMange.spotFaceCollection') }}
</div> </div>
<el-upload <el-upload
class="upload-demo" action="uploadUrl"
:action="uploadUrl"
:on-remove="(file) => handleRemove(file, 4)" :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)" :on-preview="(file) => handlePreview(file, 4)"
:beforeUpload="(file) => handleBeforeUpload(file, 4)" :beforeUpload="(file) => handleBeforeUpload(file, 4)"
name="files"
list-type="picture" list-type="picture"
:show-file-list="false" :show-file-list="false"
:file-list="fieldAcquisitionUrlFile" :file-list="fieldAcquisitionUrlFile"
:http-request="(val) => handleUpload(val, 'livesFace')"
> >
<el-button <el-button
size="medium" size="medium"
@ -1770,6 +1764,8 @@ import {
} from '@/assets/js/util.js' } from '@/assets/js/util.js'
import { VueCropper } from 'vue-cropper' import { VueCropper } from 'vue-cropper'
import { apiUploadImage } from '@/assets/js/api/common'
import lrz from 'lrz'
export default { export default {
components: { components: {
VueCropper VueCropper
@ -1954,6 +1950,43 @@ export default {
} }
}, },
methods: { 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) {}, changePeople(val) {},
issuePersonFn() { issuePersonFn() {
batchSendWorkerInfoApi({ batchSendWorkerInfoApi({
@ -2851,22 +2884,6 @@ export default {
this.personForm.idCardDownPhotoUrl = file.data[0].imageUrl this.personForm.idCardDownPhotoUrl = file.data[0].imageUrl
this.idCardDownPhotoUrlFile = [arr] this.idCardDownPhotoUrlFile = [arr]
this.discernId(file.data[0].imageUrl, 1) 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) { } else if (type == 5) {
this.contractImageFile.push(arr) this.contractImageFile.push(arr)
let arrJoin = [] let arrJoin = []

View File

@ -1524,6 +1524,7 @@
<span style="color: #f76c6c">*</span> <span style="color: #f76c6c">*</span>
{{ $t('message.laborMange.IdCardHead') }} {{ $t('message.laborMange.IdCardHead') }}
</div> </div>
<!-- 身份证头像 -->
<el-upload <el-upload
class="upload-demo" class="upload-demo"
action="uploadUrl" action="uploadUrl"
@ -1533,7 +1534,9 @@
:show-file-list="false" :show-file-list="false"
:file-list="idCardUpPhotoFile" :file-list="idCardUpPhotoFile"
:disabled="titleType == 'detail'" :disabled="titleType == 'detail'"
:http-request="handleUpload" :http-request="
(val) => handleUpload(val, 'idCardAvatar')
"
> >
<el-button <el-button
size="medium" size="medium"
@ -1586,18 +1589,14 @@
</div> </div>
<el-upload <el-upload
class="upload-demo" class="upload-demo"
:action="uploadUrl" action="uploadUrl"
:on-remove="(file) => handleRemove(file, 7)" :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)" :on-preview="(file) => handlePreview(file, 7)"
:before-upload="(file) => handleBeforeUpload(file, 7)" :before-upload="(file) => handleBeforeUpload(file, 7)"
name="files"
:file-list="fieldAcquisitionFile" :file-list="fieldAcquisitionFile"
:disabled="titleType == 'detail'" :disabled="titleType == 'detail'"
:show-file-list="false" :show-file-list="false"
:http-request="(val) => handleUpload(val, 'livesFace')"
> >
<el-button <el-button
size="medium" size="medium"
@ -1997,7 +1996,6 @@ import {
updateByIdWorkerInfo, updateByIdWorkerInfo,
sendBatchWokerApi sendBatchWokerApi
} from '@/assets/js/api/laborPerson' } from '@/assets/js/api/laborPerson'
import axios from 'axios'
import { import {
selectUserDevAuthorityByUserIdApi, selectUserDevAuthorityByUserIdApi,
exporExcelWorkerTemplateApi exporExcelWorkerTemplateApi
@ -2011,6 +2009,7 @@ import { getProjectConfigListApi } from '@/assets/js/api/project.js'
import { VueCropper } from 'vue-cropper' import { VueCropper } from 'vue-cropper'
import { apiUploadImage } from '@/assets/js/api/common' import { apiUploadImage } from '@/assets/js/api/common'
import lrz from 'lrz'
export default { export default {
components: { components: {
VueCropper VueCropper
@ -2238,29 +2237,41 @@ export default {
} }
}, },
methods: { methods: {
handleUpload(params) { handleUpload(fileData, type) {
const file = params.file const file = fileData.file
if ( //
file.type != 'image/jpeg' && lrz(file, { quality: 1 }).then((result) => {
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() const formData = new FormData()
formData.append('files', file) formData.append('files', result.file)
//
apiUploadImage(formData).then((res) => { apiUploadImage(formData).then((res) => {
if (res.code == 200 || res.status == 'SUCCESS') { if (res.code == 200 || res.status == 'SUCCESS') {
const data = res.data const imgInfo = res.data[0]
let obj = {}
for (let i in data) { switch (type) {
obj = { name: data[i].filename, url: data[i].imageUrl } 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)
} }
this.personForm.idCardBigPhotoUrl = obj.url
this.idCardUpPhotoFile = [obj]
} }
break
}
}
})
}) })
}, },
checkImg() { checkImg() {
@ -3342,18 +3353,8 @@ export default {
this.$message.error(this.$t('message.companyDiagram.hint8')) this.$message.error(this.$t('message.companyDiagram.hint8'))
return false 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) arrJoin.push(data)
} }
this.personForm.employmentCard = arrJoin.join(',') 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) { } else if (type == 8) {
console.log(file) console.log(file)
let data = { let data = {