From 80db5f7ce1d0bd929c78c7e8dd1a3ff7240a095a Mon Sep 17 00:00:00 2001
From: 董国庆 <364620639@qq.com>
Date: 星期四, 22 一月 2026 09:48:53 +0800
Subject: [PATCH] Merge branch 'main' of http://120.76.84.145:10101/gitblit/r/H5/leshan-laboratory
---
culture/src/views/strainReportLibrary/reportLibraryOne/add.vue | 28 +++++++++++++++++++++++++++-
1 files changed, 27 insertions(+), 1 deletions(-)
diff --git a/culture/src/views/strainReportLibrary/reportLibraryOne/add.vue b/culture/src/views/strainReportLibrary/reportLibraryOne/add.vue
index 772bb67..c654293 100644
--- a/culture/src/views/strainReportLibrary/reportLibraryOne/add.vue
+++ b/culture/src/views/strainReportLibrary/reportLibraryOne/add.vue
@@ -61,7 +61,7 @@
<el-upload action="#" :file-list="fileList" :http-request="handleUpload"
:before-upload="beforeUpload" :on-preview="handlePreview" :on-remove="handleRemove">
<el-button size="small" type="primary">点击上传</el-button>
- <div slot="tip" class="el-upload__tip">支持任意格式文件上传</div>
+ <div slot="tip" class="el-upload__tip">支持 Word、Excel 和所有图片格式,禁止 PPT、PDF、CAJ</div>
</el-upload>
</el-form-item>
<div class="header-title" style="width: 100%;">
@@ -307,6 +307,32 @@
},
// 上传前校验
beforeUpload(file) {
+ // 获取文件扩展名
+ const fileName = file.name || '';
+ const fileExtension = fileName.substring(fileName.lastIndexOf('.') + 1).toLowerCase();
+
+ // 禁止的文件类型
+ const forbiddenExtensions = ['ppt', 'pptx', 'pdf', 'caj'];
+ if (forbiddenExtensions.includes(fileExtension)) {
+ this.$message.error(`不支持上传 ${fileExtension.toUpperCase()} 格式文件`);
+ return false;
+ }
+
+ // 允许的文件类型
+ // Word 格式
+ const wordExtensions = ['doc', 'docx'];
+ // Excel 格式
+ const excelExtensions = ['xls', 'xlsx'];
+ // 图片格式
+ const imageExtensions = ['jpg', 'jpeg', 'png', 'gif', 'bmp', 'webp', 'svg', 'ico', 'tiff', 'tif', 'heic', 'heif'];
+
+ const allowedExtensions = [...wordExtensions, ...excelExtensions, ...imageExtensions];
+
+ if (!allowedExtensions.includes(fileExtension)) {
+ this.$message.error(`不支持上传 ${fileExtension.toUpperCase()} 格式文件,仅支持 Word、Excel 和图片格式`);
+ return false;
+ }
+
return true;
},
// 自定义上传处理
--
Gitblit v1.7.1