fix:调整劳务管理模块中人员录入的vueCropper以及添加管理人员和临时人员的海康设备判断以及

This commit is contained in:
Vce 2024-06-18 15:28:05 +08:00
parent cea8ecc1e6
commit 33dc504ffb
7 changed files with 208 additions and 34 deletions

View File

@ -1046,6 +1046,7 @@
:autoCropHeight="cropperOption.autoCropHeight"
:outputSize="1"
:maxImgSize="300"
:centerBox="true"
mode="contain"
:autoCrop="true"
></vueCropper>

View File

@ -964,6 +964,7 @@
:autoCropHeight="cropperOption.autoCropHeight"
:outputSize="1"
:maxImgSize="300"
:centerBox="true"
mode="contain"
:autoCrop="true"
></vueCropper>

View File

@ -507,6 +507,7 @@
:autoCropHeight="cropperOption.autoCropHeight"
:outputSize="1"
:maxImgSize="300"
:centerBox="true"
mode="contain"
:autoCrop="true"
></vueCropper>

View File

@ -2318,6 +2318,7 @@
:autoCropHeight="cropperOption.autoCropHeight"
:outputSize="1"
:maxImgSize="300"
:centerBox="true"
mode="contain"
:autoCrop="true"
></vueCropper>

View File

@ -2009,8 +2009,11 @@
:outputType="cropperOption.outputType"
:autoCropWidth="cropperOption.autoCropWidth"
:autoCropHeight="cropperOption.autoCropHeight"
:outputSize="1"
:maxImgSize="300"
:centerBox="true"
mode="contain"
:autoCrop="true"
:fixedBox="true"
></vueCropper>
<!-- </vue-scroll> -->
</div>
@ -2190,6 +2193,7 @@ import {
importImgDataApi,
xmglXzHikvisionSyncGetNewestList,
xmglXzHikvisionSyncRetryAPI,
checkfaceHikvisionApi,
} from "@/assets/js/api/laborPerson";
import { selectUserDevAuthorityByUserIdApi } from "@/assets/js/api/configManage";
import { getProjectConfigListApi } from "@/assets/js/api/project.js";
@ -2358,7 +2362,7 @@ export default {
enterpriseTypeId: "",
enterpriseTypeList: [],
cropperOption: {
outputType: "png",
outputType: "jpeg",
img: "",
autoCropWidth: 300, //
autoCropHeight: 360, //
@ -2501,14 +2505,32 @@ export default {
handleUpload(fileData, type) {
const file = fileData.file;
//
lrz(file, { quality: 1 }).then((result) => {
// 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);
formData.append("files", 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格式图片")); //"jpgjpeg"
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;
@ -2517,9 +2539,31 @@ export default {
];
break;
case "livesFace": //
if(this.isIscDevice){
const loading = this.$loading({
lock: true,
text: '图片检测中',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.5)'
});
let data = {fileUrl: imgInfo.imageUrl}
checkfaceHikvisionApi(data).then((res) => {
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)
}
}).finally(() => {
loading.close();
})
}else{
this.cropperOption.img =
this.$store.state.FILEURL + imgInfo.imageUrl;
this.cropperDialog = true;
}
// let imgStatus = result.file.size / 1024 < 500
// if (!imgStatus) {
// this.cropperOption.img =
@ -2536,7 +2580,7 @@ export default {
}
}
});
});
// });
},
changePeople(val) {},
issuePersonFn() {
@ -3529,6 +3573,12 @@ export default {
this.$message.error(this.$t("message.laborMange.hint8")); //"jpgjpeg"
return false;
}
let imgSize = Number(file.size / 1024);
console.log(11111111, imgSize);
if (imgSize <= 10 || imgSize >= 200) {
this.$message.error("文件大小不能超过200kb小于10kb,请重新上传!");
return false;
}
}
let fileType = file.type.split("/")[0];
if (fileType == "image") {
@ -3641,9 +3691,30 @@ 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){
const loading = this.$loading({
lock: true,
text: '裁剪图片检测中',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.5)'
});
let data = {fileUrl: url}
checkfaceHikvisionApi(data).then((res) => {
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);
}
}).finally(() => {
loading.close();
})
}else{
this.personForm.fieldAcquisitionUrl = url;
this.fieldAcquisitionFile = [{ name: "", url: url }];
this.cropperDialog = false;
}
} else {
this.$message.error(res.result.message);
}
@ -3669,6 +3740,12 @@ export default {
})
.then((res) => {
console.log("aaaaa", res);
let imgSize = Number(res.data.data[0].fileInfo.size / 1024);
console.log('经过vueCropper裁剪后', imgSize);
if (imgSize <= 10 || imgSize >= 200) {
this.$message.error("图片裁剪后大小不能超过200kb小于10kb,请重新裁剪或重新上传图片!");
return false;
}
if (res.data.status == "SUCCESS") {
if (this.isSzProject == 1) {
this.checkImgLibrary(res.data.data[0].imageUrl);

View File

@ -2261,6 +2261,7 @@
:autoCropHeight="cropperOption.autoCropHeight"
:outputSize="1"
:maxImgSize="300"
:centerBox="true"
mode="contain"
:autoCrop="true"
></vueCropper>
@ -2651,7 +2652,6 @@ export default {
attendRulesList: [],
enterpriseTypeId: "",
cropperOption: {
// outputType: "png",
outputType: "jpeg",
img: "",
autoCropWidth: 300, //
@ -2786,11 +2786,10 @@ export default {
//
apiUploadImage(formData).then((res) => {
if (res.code == 200 || res.status == "SUCCESS") {
console.log("0000000000000000000000000000")
console.log(res)
console.log("0000000000000000000000000000")
console.log("图片上传后",res)
const imgInfo = res.data[0];
if (
imgInfo.fileInfo.contentType != "image/jpeg" &&
imgInfo.fileInfo.contentType != "image/jpg"
@ -4148,9 +4147,7 @@ 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')
console.log("判断大小以及格式之前的图片",file);
if (
file.type != "image/jpeg" &&
file.type != "image/jpg"
@ -4407,10 +4404,6 @@ export default {
loading.close();
})
}else{
// this.$message({
// message: "",
// type: "error",
// });
this.personForm.fieldAcquisitionUrl = url;
this.fieldAcquisitionFile = [{ name: "", url: url }];
this.cropperDialog = false;

View File

@ -587,9 +587,9 @@
size="medium"
style="padding: 9px 20px"
type="primary"
v-if="titleType != 'detail'"
>{{ $t("message.laborMange.clickOnTheUpload") }}</el-button
>
<!-- v-if="titleType != 'detail'" -->
</el-upload>
<el-upload
action="uploadUrl"
@ -607,9 +607,9 @@
size="medium"
style="padding: 9px 20px"
type="primary"
v-if="titleType != 'detail'"
>{{ $t("message.laborMange.clickOnTheUpload") }}</el-button
>
<!-- v-if="titleType != 'detail'" -->
</el-upload>
</div>
</el-col>
@ -679,8 +679,11 @@
:outputType="cropperOption.outputType"
:autoCropWidth="cropperOption.autoCropWidth"
:autoCropHeight="cropperOption.autoCropHeight"
:outputSize="1"
:maxImgSize="300"
:centerBox="true"
mode="contain"
:autoCrop="true"
:fixedBox="true"
></vueCropper>
<!-- </vue-scroll> -->
</div>
@ -710,6 +713,9 @@ import {
editWorkerInfo,
deleteWorkerInfo,
getWorkerInfoList,
checkfaceHikvisionApi,
getProjectUfaceConfigInfo,
checkFaceApi,
} from "@/assets/js/api/laborPerson";
import {
IdentityCodeValid
@ -725,11 +731,12 @@ export default {
},
data() {
return {
isIscDevice: false, //isc
//
fieldAcquisitionUrlFile: [],
idCardBigPhotoUrlFile: [],
cropperOption: {
outputType: "png",
outputType: "jpeg",
img: "",
autoCropWidth: 300, //
autoCropHeight: 360, //
@ -809,6 +816,7 @@ export default {
created() {
this.projectSn = this.$store.state.projectSn;
this.getInfoList();
this.getConfig();
},
methods: {
//
@ -842,14 +850,41 @@ 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.addForm.fieldAcquisitionUrl = url;
this.fieldAcquisitionFile = [{ name: "", url: url }];
this.cropperDialog = false;
if(this.isIscDevice){
const loading = this.$loading({
lock: true,
text: '裁剪图片检测中',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.5)'
});
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.addForm.fieldAcquisitionUrl = url;
this.fieldAcquisitionFile = [{ name: "", url: url }];
this.cropperDialog = false;
}
}else{
this.$message.error(res.result.message);
}
}).finally(() => {
loading.close();
})
}else{
if (this.temporaryDialog1 || this.temporaryDialog2) {
this.personForm.fieldAcquisitionUrl = url;
this.fieldAcquisitionFile = [{ name: "", url: url }];
this.cropperDialog = false;
} else {
this.addForm.fieldAcquisitionUrl = url;
this.fieldAcquisitionFile = [{ name: "", url: url }];
this.cropperDialog = false;
}
}
} else {
this.$message.error(res.result.message);
@ -876,6 +911,12 @@ export default {
})
.then((res) => {
console.log("aaaaa", res);
let imgSize = Number(res.data.data[0].fileInfo.size / 1024);
console.log('经过vueCropper裁剪后', imgSize);
if (imgSize <= 10 || imgSize >= 200) {
this.$message.error("图片裁剪后大小不能超过200kb小于10kb,请重新裁剪或重新上传图片!");
return false;
}
if (res.data.status == "SUCCESS") {
if (this.isSzProject == 1) {
this.checkImgLibrary(res.data.data[0].imageUrl);
@ -890,14 +931,33 @@ export default {
console.log(fileData, 111222);
const file = fileData.file;
//
lrz(file, { quality: 1 }).then((result) => {
// 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);
formData.append("files", 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格式图片")); //"jpgjpeg"
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.addForm.idCardBigPhotoUrl = imgInfo.imageUrl;
@ -906,9 +966,31 @@ export default {
];
break;
case "livesFace": //
if(this.isIscDevice){
const loading = this.$loading({
lock: true,
text: '图片检测中',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.5)'
});
let data = {fileUrl: imgInfo.imageUrl}
checkfaceHikvisionApi(data).then((res) => {
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)
}
}).finally(() => {
loading.close();
})
}else{
this.cropperOption.img =
this.$store.state.FILEURL + imgInfo.imageUrl;
this.cropperDialog = true;
}
// let imgStatus = result.file.size / 1024 < 500
// if (!imgStatus) {
// this.cropperOption.img =
@ -925,7 +1007,7 @@ export default {
}
}
});
});
// });
},
//
handleBeforeUpload(file, type) {
@ -946,6 +1028,12 @@ export default {
this.$message.error(this.$t("message.laborMange.hint8")); //"jpgjpeg"
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;
},
@ -1063,6 +1151,18 @@ export default {
"&codeState=" +
this.codeState;
},
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;
}
}
});
},
//
getInfoList() {
let data = {