fix:在人员管理模块人员录入中添加是否为海康设备的判断以及人脸评分检测

This commit is contained in:
Vce 2024-06-17 11:21:29 +08:00
parent 3f50794732
commit f7f2365989
6 changed files with 3434 additions and 3066 deletions

View File

@ -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);
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);

View File

@ -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')"
>
<!-- :file-list="fieldAcquisitionUrlFile" -->
<el-button
size="medium"
style="padding: 9px 20px"
@ -1034,6 +1035,8 @@
:autoCropHeight="cropperOption.autoCropHeight"
:autoCrop="true"
:fixedBox="true"
:outputSize="0.7"
:maxImgSize="300"
></vueCropper>
<!-- </vue-scroll> -->
</div>
@ -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格式图片")); //"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;
@ -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")); //"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;
},
@ -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: {

View File

@ -953,6 +953,8 @@
:autoCropHeight="cropperOption.autoCropHeight"
:autoCrop="true"
:fixedBox="true"
:outputSize="0.7"
:maxImgSize="300"
></vueCropper>
<!-- </vue-scroll> -->
</div>
@ -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格式图片")); //"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;
@ -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")); //"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;
},
@ -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: {

View File

@ -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')"
>
<el-button size="small" type="primary">{{
$t("message.laborMange.updateOnsitePhotos")
@ -2306,6 +2307,8 @@
:autoCropHeight="cropperOption.autoCropHeight"
:autoCrop="true"
:fixedBox="true"
:outputSize="0.7"
:maxImgSize="300"
></vueCropper>
<!-- </vue-scroll> -->
</div>
@ -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格式图片")); //"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;
},
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格式图片")); //"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;
// 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);
}
}
});
});

View File

@ -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格式图片")); //"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": //
@ -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: {