|
@@ -372,7 +372,7 @@
|
|
|
class="upload-demo"
|
|
|
action="#"
|
|
|
:on-change="file => handleFileUpload(file, scope.row, scope.$index)"
|
|
|
- :before-upload="beforeUpload"
|
|
|
+
|
|
|
:show-file-list="false"
|
|
|
:auto-upload="false"
|
|
|
accept=".pdf, application/pdf"
|
|
@@ -833,9 +833,15 @@ import { getStore, setStore } from "@/util/store";
|
|
|
},
|
|
|
|
|
|
uploadImportData(file) {
|
|
|
- // 验证文件类型
|
|
|
|
|
|
-
|
|
|
+ // 检查文件类型
|
|
|
+ const isPDF = file.raw.type === 'application/pdf';
|
|
|
+ const isCorrectExtension = file.raw.name.endsWith('.pdf');
|
|
|
+
|
|
|
+ if (!isPDF || !isCorrectExtension) {
|
|
|
+ this.$message.error('只能上传PDF文件!');
|
|
|
+ return false; // 阻止后续处理
|
|
|
+ }
|
|
|
|
|
|
// 将文件对象存入 files 数组
|
|
|
if (!this.fileForm.files) {
|
|
@@ -1094,18 +1100,29 @@ import { getStore, setStore } from "@/util/store";
|
|
|
this.isUploadVisible = true;
|
|
|
},
|
|
|
handleFileUpload(file,row,index) {
|
|
|
-
|
|
|
+ const isPDF = file.raw.type === 'application/pdf';
|
|
|
+ const isCorrectExtension = file.raw.name.endsWith('.pdf');
|
|
|
+
|
|
|
+ if (!isPDF || !isCorrectExtension) {
|
|
|
+ this.$message.error('只能上传PDF文件!');
|
|
|
+ return false; // 阻止后续处理
|
|
|
+ }
|
|
|
|
|
|
if(!file) return
|
|
|
|
|
|
row.file=file.raw; // 获取原始文件对象
|
|
|
row.standardFile.fileName = file.name; // 设置文件名
|
|
|
row.filesCount = 1; // 设置文件大小
|
|
|
-
|
|
|
+ // 强制更新视图,确保文件上传按钮显示正确
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.manageData = [...this.manageData]; // 强制更新视图
|
|
|
+ });
|
|
|
|
|
|
|
|
|
// 在这里处理文件上传逻辑
|
|
|
},
|
|
|
+
|
|
|
+
|
|
|
delFile(row,id){
|
|
|
console.log(row,'row');
|
|
|
const {standardFile}=row;
|