From 3268317dcf6060fcb76fbf12290e495bc930d68b Mon Sep 17 00:00:00 2001 From: buaixuexideshitongxue <2936013465@qq.com> Date: Tue, 12 May 2026 17:16:59 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E4=B8=8A=E4=BC=A0=E5=9B=BE=E7=89=87?= =?UTF-8?q?=E9=99=90=E5=88=B6=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/file/upload.vue | 22 ++++++++++++++++------ src/views/report/edit/controlPrice.vue | 2 -- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/src/components/file/upload.vue b/src/components/file/upload.vue index 7c911a2..d3aeae0 100644 --- a/src/components/file/upload.vue +++ b/src/components/file/upload.vue @@ -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; diff --git a/src/views/report/edit/controlPrice.vue b/src/views/report/edit/controlPrice.vue index a597627..1e80d30 100644 --- a/src/views/report/edit/controlPrice.vue +++ b/src/views/report/edit/controlPrice.vue @@ -1426,7 +1426,6 @@ function hasAuditAttachment() { -

说明:附件上传仅支持 上传 Word / PDF / Excel / ZJXM /DWG /DWL /DWL2 /PKS6 文件(.doc .docx .pdf .xls .xlsx .ZJXM .DWG .DWL .DWL2 .PKS6)