人脸图片修改
This commit is contained in:
parent
eb0cc94ce8
commit
182501d068
|
|
@ -405,9 +405,16 @@
|
||||||
mjCode: [
|
mjCode: [
|
||||||
{ required: true, message: "马甲编号不能为空", trigger: "blur" }
|
{ required: true, message: "马甲编号不能为空", trigger: "blur" }
|
||||||
],
|
],
|
||||||
|
// fileName: [
|
||||||
|
// { required: true, message: "人脸图片不能为空", trigger: "change" }
|
||||||
|
// ],
|
||||||
fileName: [
|
fileName: [
|
||||||
{ required: true, message: "人脸图片不能为空", trigger: "blur" }
|
{
|
||||||
]
|
required: true,
|
||||||
|
validator: this.fileMustUpload,
|
||||||
|
trigger: "change",
|
||||||
|
},
|
||||||
|
],
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
@ -421,6 +428,14 @@
|
||||||
this.getList();
|
this.getList();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
//自定义人脸图片必填校验
|
||||||
|
fileMustUpload(rule, value, callback) {
|
||||||
|
if (this.form.fileName == '') {
|
||||||
|
// 未上传文件
|
||||||
|
callback("请上传人脸图片");
|
||||||
|
}
|
||||||
|
callback();//不要忘记写这个callback
|
||||||
|
},
|
||||||
/** 查询人员列表 */
|
/** 查询人员列表 */
|
||||||
getList() {
|
getList() {
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
|
|
@ -466,46 +481,45 @@
|
||||||
},
|
},
|
||||||
// 图片上传
|
// 图片上传
|
||||||
handleChange(file, fileList) {
|
handleChange(file, fileList) {
|
||||||
console.log(file)
|
// console.log(file)
|
||||||
// this.$refs["form"].clearValidate()
|
|
||||||
this.form.fileName = file.name;
|
this.form.fileName = file.name;
|
||||||
|
this.$refs["form"].clearValidate()
|
||||||
this.fileList = fileList;
|
this.fileList = fileList;
|
||||||
},
|
},
|
||||||
handleChangeHighImgList(file, fileList) {
|
handleChangeHighImgList(file, fileList) {
|
||||||
console.log(file)
|
console.log(file)
|
||||||
// this.$refs["form"].clearValidate()
|
// this.$refs["form"].clearValidate()
|
||||||
this.form.fileName = file.name;
|
// this.certificateForm.fileName = file.name;
|
||||||
this.highImgList = fileList;
|
this.highImgList = fileList;
|
||||||
},
|
},
|
||||||
handleChangeElectricianImgList(file, fileList) {
|
handleChangeElectricianImgList(file, fileList) {
|
||||||
console.log(file)
|
console.log(file)
|
||||||
// this.$refs["form"].clearValidate()
|
// this.$refs["form"].clearValidate()
|
||||||
this.form.electricianImgList = file.name;
|
// this.certificateForm.electricianImgList = file.name;
|
||||||
this.electricianImgList = fileList;
|
this.electricianImgList = fileList;
|
||||||
},
|
},
|
||||||
handleChangeElseImgList(file, fileList) {
|
handleChangeElseImgList(file, fileList) {
|
||||||
console.log(file)
|
console.log(file)
|
||||||
// this.$refs["form"].clearValidate()
|
// this.$refs["form"].clearValidate()
|
||||||
this.form.elseImgList = file.name;
|
// this.certificateForm.elseImgList = file.name;
|
||||||
this.elseImgList = fileList;
|
this.elseImgList = fileList;
|
||||||
},
|
},
|
||||||
|
//图片删除
|
||||||
handleRemove(file, fileList) {
|
handleRemove(file, fileList) {
|
||||||
let sum = 0
|
let sum = 0
|
||||||
console.log(111111)
|
|
||||||
console.log(this.fileList)
|
|
||||||
this.fileList.forEach((item, index) => {
|
this.fileList.forEach((item, index) => {
|
||||||
if (item.uid == file.uid) {
|
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.fileList.splice(sum, 1)
|
||||||
|
this.form.fileName = '';
|
||||||
},
|
},
|
||||||
handleRemoveHighImgList(file, fileList) {
|
handleRemoveHighImgList(file, fileList) {
|
||||||
let sum = 0
|
let sum = 0
|
||||||
console.log(111111)
|
|
||||||
console.log(this.highImgList)
|
|
||||||
this.highImgList.forEach((item, index) => {
|
this.highImgList.forEach((item, index) => {
|
||||||
if (item.uid == file.uid) {
|
if (item.uid == file.uid) {
|
||||||
sum = index
|
sum = index
|
||||||
|
|
@ -539,7 +553,7 @@
|
||||||
},
|
},
|
||||||
//上传组件-图片查看
|
//上传组件-图片查看
|
||||||
picturePreview(file) {
|
picturePreview(file) {
|
||||||
console.log(file)
|
// console.log(file)
|
||||||
this.dialogImageUrl = file.url
|
this.dialogImageUrl = file.url
|
||||||
this.dialogVisible = true
|
this.dialogVisible = true
|
||||||
},
|
},
|
||||||
|
|
@ -559,10 +573,10 @@
|
||||||
this.$set(this.form,'sex',response.data.sex+'')
|
this.$set(this.form,'sex',response.data.sex+'')
|
||||||
this.fileList.push({
|
this.fileList.push({
|
||||||
name: response.data.fileId,
|
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(()=>{
|
setTimeout(()=>{
|
||||||
this.open = true;
|
this.open = true;
|
||||||
this.title = "修改人员";
|
this.title = "修改人员";
|
||||||
|
|
@ -575,7 +589,8 @@
|
||||||
this.$refs["form"].validate(valid => {
|
this.$refs["form"].validate(valid => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
if (this.form.id != undefined) {
|
if (this.form.id != undefined) {
|
||||||
console.log(this.form)
|
//base64地址别传后台,过长
|
||||||
|
this.form.base64Url = '';
|
||||||
const reqData = new FormData()
|
const reqData = new FormData()
|
||||||
reqData.append('params', JSON.stringify(this.form))
|
reqData.append('params', JSON.stringify(this.form))
|
||||||
const { file } = this.getFileData()
|
const { file } = this.getFileData()
|
||||||
|
|
@ -589,7 +604,7 @@
|
||||||
this.getList();
|
this.getList();
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
console.log(this.form)
|
|
||||||
const reqData = new FormData()
|
const reqData = new FormData()
|
||||||
reqData.append('params', JSON.stringify(this.form))
|
reqData.append('params', JSON.stringify(this.form))
|
||||||
const { file } = this.getFileData()
|
const { file } = this.getFileData()
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue