人脸图片修改

This commit is contained in:
zzyuan 2024-08-09 10:27:39 +08:00
parent eb0cc94ce8
commit 182501d068
1 changed files with 35 additions and 20 deletions

View File

@ -405,9 +405,16 @@
mjCode: [
{ required: true, message: "马甲编号不能为空", trigger: "blur" }
],
// fileName: [
// { required: true, message: "", trigger: "change" }
// ],
fileName: [
{ required: true, message: "人脸图片不能为空", trigger: "blur" }
]
{
required: true,
validator: this.fileMustUpload,
trigger: "change",
},
],
}
};
},
@ -421,6 +428,14 @@
this.getList();
},
methods: {
//
fileMustUpload(rule, value, callback) {
if (this.form.fileName == '') {
//
callback("请上传人脸图片");
}
callback();//callback
},
/** 查询人员列表 */
getList() {
this.loading = true;
@ -466,46 +481,45 @@
},
//
handleChange(file, fileList) {
console.log(file)
// this.$refs["form"].clearValidate()
// console.log(file)
this.form.fileName = file.name;
this.$refs["form"].clearValidate()
this.fileList = fileList;
},
handleChangeHighImgList(file, fileList) {
console.log(file)
// this.$refs["form"].clearValidate()
this.form.fileName = file.name;
// this.certificateForm.fileName = file.name;
this.highImgList = fileList;
},
handleChangeElectricianImgList(file, fileList) {
console.log(file)
// this.$refs["form"].clearValidate()
this.form.electricianImgList = file.name;
// this.certificateForm.electricianImgList = file.name;
this.electricianImgList = fileList;
},
handleChangeElseImgList(file, fileList) {
console.log(file)
// this.$refs["form"].clearValidate()
this.form.elseImgList = file.name;
// this.certificateForm.elseImgList = file.name;
this.elseImgList = fileList;
},
//
handleRemove(file, fileList) {
let sum = 0
console.log(111111)
console.log(this.fileList)
this.fileList.forEach((item, index) => {
if (item.uid == file.uid) {
sum = index
if(!item?.hasOwnProperty('raw')) {
this.form.delFiles = this.form.filePath;
}
sum = index;
}
})
this.fileList.splice(sum, 1)
this.form.fileName = '';
},
handleRemoveHighImgList(file, fileList) {
let sum = 0
console.log(111111)
console.log(this.highImgList)
this.highImgList.forEach((item, index) => {
if (item.uid == file.uid) {
sum = index
@ -539,7 +553,7 @@
},
//-
picturePreview(file) {
console.log(file)
// console.log(file)
this.dialogImageUrl = file.url
this.dialogVisible = true
},
@ -559,10 +573,10 @@
this.$set(this.form,'sex',response.data.sex+'')
this.fileList.push({
name: response.data.fileId,
url: response.data.base64Url
url: response.data.base64Url,
})
// this.form.fileName = response.data.fileId;
//
this.form.fileName = response.data.fileId;
setTimeout(()=>{
this.open = true;
this.title = "修改人员";
@ -575,7 +589,8 @@
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id != undefined) {
console.log(this.form)
//base64
this.form.base64Url = '';
const reqData = new FormData()
reqData.append('params', JSON.stringify(this.form))
const { file } = this.getFileData()
@ -589,7 +604,7 @@
this.getList();
});
} else {
console.log(this.form)
const reqData = new FormData()
reqData.append('params', JSON.stringify(this.form))
const { file } = this.getFileData()