duy 1 сар өмнө
parent
commit
86b36b943a

+ 18 - 0
src/views/codeRule/ruleManage.vue

@@ -426,6 +426,7 @@
               :on-change="uploadImportData"
                accept=".pdf, application/pdf"
              :on-exceed="handleExceed"
+             :on-remove="handleFileRemove"
              
              :limit="1"
               >
@@ -813,6 +814,7 @@ import { getStore, setStore } from "@/util/store";
           // 验证文件类型
        
 
+
           // 将文件对象存入 files 数组
           if (!this.fileForm.files) {
             this.fileForm.files = [];
@@ -824,6 +826,18 @@ import { getStore, setStore } from "@/util/store";
             name: file.name,
           }));
       },
+      handleFileRemove(file, fileList) {
+
+        
+        // return this.$confirm(`确定移除 ${file.name}?`);
+        const index = this.fileForm.standardFileUrl.findIndex(f => f.name === file.name);
+        console.log(index,'index');
+        
+        if (index !== -1) {
+          this.fileForm.standardFileUrl.splice(index, 1); // 从数组中移除文件
+          this.fileForm.files.splice(index, 1); // 从文件数组中移除文件
+        }
+      },
       handleExceed(files, fileList) {
         this.$message.warning(`当前限制只能上传一个文件,您已选择了 ${files.length + fileList.length} 个文件,请重新选择!`);
       },
@@ -1011,6 +1025,10 @@ import { getStore, setStore } from "@/util/store";
          this.manageData=JSON.parse(JSON.stringify(this.ruleItemOptionsDetail));
          this.manageData.forEach(item=>{
           item.filesCount=0;
+          if(item.standardFile===null){
+            item.standardFile=[];
+
+          }
          })
       }else{
          this.manageData=JSON.parse(JSON.stringify(this.ruleItemOptions));