duy 1 месяц назад
Родитель
Сommit
f4ea3e03a6
1 измененных файлов с 6 добавлено и 3 удалено
  1. 6 3
      src/views/codeRule/ruleManage.vue

+ 6 - 3
src/views/codeRule/ruleManage.vue

@@ -426,6 +426,7 @@
               action="#"
               :file-list="fileForm.standardFileUrl"
               :on-change="uploadImportData"
+           
                accept=".pdf, application/pdf"
              :on-exceed="handleExceed"
              :on-remove="handleFileRemove"
@@ -831,8 +832,8 @@ import { getStore, setStore } from "@/util/store";
          //新增规范文件
          this.addFileDialogVisible = true;
          },
-         
-     uploadImportData(file) {
+      
+     uploadImportData(file,fileList) {
        
         // 检查文件类型
         const isPDF = file.raw.type === 'application/pdf';
@@ -840,7 +841,9 @@ import { getStore, setStore } from "@/util/store";
         
         if (!isPDF || !isCorrectExtension) {
           this.$message.error('只能上传PDF文件!');
-          return false; // 阻止后续处理
+          const filteredList = fileList.filter((f) => f.raw.type === "application/pdf" && f.name.endsWith(".pdf"));
+          this.fileForm.standardFileUrl = filteredList;
+           return false;  ; // 阻止后续处理
         }
 
           // 将文件对象存入 files 数组