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" :autoCropHeight="cropperOption.autoCropHeight"
:outputSize="1" :outputSize="1"
:maxImgSize="300" :maxImgSize="300"
:centerBox="true"
mode="contain" mode="contain"
:autoCrop="true" :autoCrop="true"
></vueCropper> ></vueCropper>

View File

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

View File

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

View File

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

View File

@ -2009,8 +2009,11 @@
:outputType="cropperOption.outputType" :outputType="cropperOption.outputType"
:autoCropWidth="cropperOption.autoCropWidth" :autoCropWidth="cropperOption.autoCropWidth"
:autoCropHeight="cropperOption.autoCropHeight" :autoCropHeight="cropperOption.autoCropHeight"
:outputSize="1"
:maxImgSize="300"
:centerBox="true"
mode="contain"
:autoCrop="true" :autoCrop="true"
:fixedBox="true"
></vueCropper> ></vueCropper>
<!-- </vue-scroll> --> <!-- </vue-scroll> -->
</div> </div>
@ -2190,6 +2193,7 @@ import {
importImgDataApi, importImgDataApi,
xmglXzHikvisionSyncGetNewestList, xmglXzHikvisionSyncGetNewestList,
xmglXzHikvisionSyncRetryAPI, xmglXzHikvisionSyncRetryAPI,
checkfaceHikvisionApi,
} from "@/assets/js/api/laborPerson"; } from "@/assets/js/api/laborPerson";
import { selectUserDevAuthorityByUserIdApi } from "@/assets/js/api/configManage"; import { selectUserDevAuthorityByUserIdApi } from "@/assets/js/api/configManage";
import { getProjectConfigListApi } from "@/assets/js/api/project.js"; import { getProjectConfigListApi } from "@/assets/js/api/project.js";
@ -2358,7 +2362,7 @@ export default {
enterpriseTypeId: "", enterpriseTypeId: "",
enterpriseTypeList: [], enterpriseTypeList: [],
cropperOption: { cropperOption: {
outputType: "png", outputType: "jpeg",
img: "", img: "",
autoCropWidth: 300, // autoCropWidth: 300, //
autoCropHeight: 360, // autoCropHeight: 360, //
@ -2501,14 +2505,32 @@ export default {
handleUpload(fileData, type) { handleUpload(fileData, type) {
const file = fileData.file; const file = fileData.file;
// //
lrz(file, { quality: 1 }).then((result) => { // lrz(file, { quality: 1 }).then((result) => {
const formData = new FormData(); 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) => { apiUploadImage(formData).then((res) => {
if (res.code == 200 || res.status == "SUCCESS") { if (res.code == 200 || res.status == "SUCCESS") {
const imgInfo = res.data[0]; 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) { switch (type) {
case "idCardAvatar": // case "idCardAvatar": //
this.personForm.idCardBigPhotoUrl = imgInfo.imageUrl; this.personForm.idCardBigPhotoUrl = imgInfo.imageUrl;
@ -2517,9 +2539,31 @@ export default {
]; ];
break; break;
case "livesFace": // 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.cropperOption.img =
this.$store.state.FILEURL + imgInfo.imageUrl; this.$store.state.FILEURL + imgInfo.imageUrl;
this.cropperDialog = true; this.cropperDialog = true;
}
// let imgStatus = result.file.size / 1024 < 500 // let imgStatus = result.file.size / 1024 < 500
// if (!imgStatus) { // if (!imgStatus) {
// this.cropperOption.img = // this.cropperOption.img =
@ -2536,7 +2580,7 @@ export default {
} }
} }
}); });
}); // });
}, },
changePeople(val) {}, changePeople(val) {},
issuePersonFn() { issuePersonFn() {
@ -3529,6 +3573,12 @@ export default {
this.$message.error(this.$t("message.laborMange.hint8")); //"jpgjpeg" this.$message.error(this.$t("message.laborMange.hint8")); //"jpgjpeg"
return false; 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]; let fileType = file.type.split("/")[0];
if (fileType == "image") { if (fileType == "image") {
@ -3641,9 +3691,30 @@ export default {
checkFace(url) { checkFace(url) {
checkFaceApi({ fileUrl: url }).then((res) => { checkFaceApi({ fileUrl: url }).then((res) => {
if (res.result.checkType == 1) { if (res.result.checkType == 1) {
this.personForm.fieldAcquisitionUrl = url; if(this.isIscDevice){
this.fieldAcquisitionFile = [{ name: "", url: url }]; const loading = this.$loading({
this.cropperDialog = false; 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 { } else {
this.$message.error(res.result.message); this.$message.error(res.result.message);
} }
@ -3669,6 +3740,12 @@ export default {
}) })
.then((res) => { .then((res) => {
console.log("aaaaa", 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 (res.data.status == "SUCCESS") {
if (this.isSzProject == 1) { if (this.isSzProject == 1) {
this.checkImgLibrary(res.data.data[0].imageUrl); this.checkImgLibrary(res.data.data[0].imageUrl);

View File

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

View File

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