|
|
@ -232,7 +232,7 @@ const submitForm = async () => { |
|
|
|
error.value = false |
|
|
|
return |
|
|
|
}else{ |
|
|
|
message.success(msg) |
|
|
|
message.success("导入成功!") |
|
|
|
error.value = false |
|
|
|
active.value = 2 // 设置为第三步 |
|
|
|
return |
|
|
@ -258,6 +258,17 @@ const submitForm = async () => { |
|
|
|
message.error('请上传文件') |
|
|
|
return |
|
|
|
} |
|
|
|
// 校验文件类型 |
|
|
|
const fileName = fileList.value[0].name |
|
|
|
const fileExtension = fileName.substring(fileName.lastIndexOf('.')).toLowerCase() |
|
|
|
const acceptedTypes = accept.value.split(',').map(type => type.toLowerCase()) |
|
|
|
|
|
|
|
// 检查文件扩展名是否在允许的类型列表中 |
|
|
|
if (!acceptedTypes.some(type => type === fileExtension || type === `.*${fileExtension}`)) { |
|
|
|
message.error(`只能上传 ${accept.value} 格式的文件`) |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
// 读取文件内容 |
|
|
|
const fileReader = new FileReader() |
|
|
|
const originalFile = fileList.value[0].raw |
|
|
|