|
|
|
|
@ -73,17 +73,27 @@ watch(files, () => {
|
|
|
|
|
},{immediate:true}); |
|
|
|
|
|
|
|
|
|
function beforeUpload(file) { |
|
|
|
|
const allowExt = ['doc', 'docx', 'pdf', 'xls', 'xlsx', 'zjxm', 'dwg', 'dwl', 'dwl2', 'pks6'] |
|
|
|
|
const name = (file?.name || '').toLowerCase() |
|
|
|
|
const ext = name.includes('.') ? name.split('.').pop() : '' |
|
|
|
|
|
|
|
|
|
if (!allowExt.includes(ext)) { |
|
|
|
|
feedback.msgWarning( |
|
|
|
|
'只能上传 Word / PDF / Excel / ZJXM /DWG /DWL /DWL2 /PKS6 文件(.doc .docx .pdf .xls .xlsx .ZJXM .DWG .DWL .DWL2 .PKS6)' |
|
|
|
|
) |
|
|
|
|
// 定义图片扩展名 |
|
|
|
|
const imageExts = ['jpg', 'jpeg', 'png', 'gif', 'bmp', 'webp', 'svg', 'tiff', 'tif', 'ico', 'heic', 'heif'] |
|
|
|
|
// 定义压缩包扩展名 |
|
|
|
|
const archiveExts = ['zip', 'rar', '7z', 'tar', 'gz', 'bz2', 'xz', 'iso', 'dmg'] |
|
|
|
|
|
|
|
|
|
// 图片类型:提示转为 PDF |
|
|
|
|
if (imageExts.includes(ext)) { |
|
|
|
|
feedback.msgWarning('图片文件请转为 PDF 后再上传') |
|
|
|
|
return false |
|
|
|
|
} |
|
|
|
|
// 文件大小限制 1024 * 1024 * 100 (100MB) |
|
|
|
|
|
|
|
|
|
// 压缩包类型:禁止上传 |
|
|
|
|
if (archiveExts.includes(ext)) { |
|
|
|
|
feedback.msgWarning('暂不支持压缩包上传') |
|
|
|
|
return false |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 文件大小限制 100MB |
|
|
|
|
if (file.size >= 104857600) { |
|
|
|
|
feedback.msgError('文件大小不能超过100MB'); |
|
|
|
|
return false; |
|
|
|
|
|