人脸图片修改
This commit is contained in:
parent
eb0cc94ce8
commit
182501d068
|
|
@ -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()
|
||||
|
|
|
|||
Loading…
Reference in New Issue