|
@@ -19,7 +19,7 @@ import {
|
|
|
|
|
|
|
|
import { getDictListApi } from '#/api/dict';
|
|
import { getDictListApi } from '#/api/dict';
|
|
|
import {
|
|
import {
|
|
|
- addAttachmentApi,
|
|
|
|
|
|
|
+ addImageApi,
|
|
|
deleteAttachmentApi,
|
|
deleteAttachmentApi,
|
|
|
getAttachmentListApi,
|
|
getAttachmentListApi,
|
|
|
} from '#/api/file';
|
|
} from '#/api/file';
|
|
@@ -256,8 +256,7 @@ const beforeUpload = (file: File) => {
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
// 处理文件上传
|
|
// 处理文件上传
|
|
|
-const handleFileUpload = async (options: any) => {
|
|
|
|
|
- const { file } = options;
|
|
|
|
|
|
|
+const handleFileUpload = async (file: any, _fileList: any[]) => {
|
|
|
uploadLoading.value = true;
|
|
uploadLoading.value = true;
|
|
|
|
|
|
|
|
try {
|
|
try {
|
|
@@ -304,35 +303,40 @@ const handleFileUpload = async (options: any) => {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
const formData = new FormData();
|
|
const formData = new FormData();
|
|
|
- formData.append('file', file);
|
|
|
|
|
|
|
+ formData.append('file', file.raw);
|
|
|
|
|
|
|
|
// 根据上传类型设置不同的参数
|
|
// 根据上传类型设置不同的参数
|
|
|
let attlsh = '';
|
|
let attlsh = '';
|
|
|
let attmodel = '';
|
|
let attmodel = '';
|
|
|
|
|
+ let attpath = '';
|
|
|
|
|
|
|
|
switch (currentUploadType.value) {
|
|
switch (currentUploadType.value) {
|
|
|
case 'buyer': {
|
|
case 'buyer': {
|
|
|
attlsh = coupon2sid.value;
|
|
attlsh = coupon2sid.value;
|
|
|
attmodel = 'coupon_buyer';
|
|
attmodel = 'coupon_buyer';
|
|
|
|
|
+ attpath = '/coupon_buyer/';
|
|
|
break;
|
|
break;
|
|
|
}
|
|
}
|
|
|
case 'certificate': {
|
|
case 'certificate': {
|
|
|
attlsh = coupon2sid.value;
|
|
attlsh = coupon2sid.value;
|
|
|
attmodel = 'coupon_identity';
|
|
attmodel = 'coupon_identity';
|
|
|
|
|
+ attpath = '/coupon_identity/';
|
|
|
break;
|
|
break;
|
|
|
}
|
|
}
|
|
|
case 'invoice': {
|
|
case 'invoice': {
|
|
|
attlsh = data.value.row.ordersid;
|
|
attlsh = data.value.row.ordersid;
|
|
|
attmodel = 'coupon_invoice';
|
|
attmodel = 'coupon_invoice';
|
|
|
|
|
+ attpath = '/coupon_invoice/';
|
|
|
break;
|
|
break;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
formData.append('attlsh', attlsh);
|
|
formData.append('attlsh', attlsh);
|
|
|
formData.append('attmodel', attmodel);
|
|
formData.append('attmodel', attmodel);
|
|
|
|
|
+ formData.append('attpath', attpath);
|
|
|
|
|
|
|
|
// 调用上传API
|
|
// 调用上传API
|
|
|
- await addAttachmentApi(formData);
|
|
|
|
|
|
|
+ await addImageApi(formData);
|
|
|
|
|
|
|
|
ElMessage.success('上传成功!');
|
|
ElMessage.success('上传成功!');
|
|
|
uploadDialogVisible.value = false;
|
|
uploadDialogVisible.value = false;
|