|
|
@@ -18,7 +18,7 @@
|
|
|
<p class="upload-title"><span class="required">*</span>文件</p>
|
|
|
<el-upload
|
|
|
class="upload-box"
|
|
|
- action="/api/fusion/scene/uploadSceneFile"
|
|
|
+ action="/fusion/scene/uploadSceneFile"
|
|
|
:data="{sourceType}"
|
|
|
limit="1"
|
|
|
:headers="{Token: user.token}"
|
|
|
@@ -55,10 +55,6 @@ const props = defineProps({
|
|
|
type: Boolean,
|
|
|
default: false
|
|
|
},
|
|
|
- groupList: {
|
|
|
- type: Array,
|
|
|
- default: () => []
|
|
|
- }
|
|
|
});
|
|
|
|
|
|
const selectedGroup = ref('');
|
|
|
@@ -82,10 +78,18 @@ const changeGroup = (value) => {
|
|
|
fileList.value = [];
|
|
|
};
|
|
|
// 处理文件变化
|
|
|
-const handleChange = (file, files) => {
|
|
|
+const handleChange = async (file, files) => {
|
|
|
+ console.log(file, files);
|
|
|
if(file.data){
|
|
|
// 检查文件类型和大小
|
|
|
- filePath.value = file.data?.url;
|
|
|
+ if (file.data.code != 0 && await confirm(file.data.data ||'确定要上传该文件吗?')) {
|
|
|
+ filePath.value = file.data?.url;
|
|
|
+ }else{
|
|
|
+ files.status = 'fail'
|
|
|
+ fileList.value = [];
|
|
|
+ filePath.value = null;
|
|
|
+ }
|
|
|
+
|
|
|
} else {
|
|
|
ElMessage.error(file.message || `不支持的文件类型`);
|
|
|
files.status = 'fail'
|
|
|
@@ -129,9 +133,9 @@ const validateFile = (file) => {
|
|
|
}
|
|
|
|
|
|
// 检查文件大小,不能超过 5MB
|
|
|
- const maxSize = 5 * 1024 * 1024; // 5MB
|
|
|
+ const maxSize = 5 * 1024 * 1024 * 1024; // 5MB
|
|
|
if (fileSize > maxSize) {
|
|
|
- ElMessage.error(`上传文件不能超过 5MB`);
|
|
|
+ ElMessage.error(`上传文件不能超过 5 GB`);
|
|
|
return false;
|
|
|
}
|
|
|
return true;
|
|
|
@@ -172,6 +176,8 @@ const handleUpload = async () => {
|
|
|
emit('refresh');
|
|
|
} catch (error) {
|
|
|
console.error('上传失败:', error);
|
|
|
+ fileList.value = [];
|
|
|
+ filePath.value = null;
|
|
|
}
|
|
|
};
|
|
|
</script>
|