From d195776f9d23f7c79a049ccececdf674853eadb7 Mon Sep 17 00:00:00 2001
From: fei <791364011@qq.com>
Date: 星期五, 10 十月 2025 23:20:03 +0800
Subject: [PATCH] 修改了对应代码

---
 src/views/archiveManager/archiveMaterial/index.vue |   26 ++++++++++++++++++++++++--
 1 files changed, 24 insertions(+), 2 deletions(-)

diff --git a/src/views/archiveManager/archiveMaterial/index.vue b/src/views/archiveManager/archiveMaterial/index.vue
index 4ed97fc..5130c0f 100644
--- a/src/views/archiveManager/archiveMaterial/index.vue
+++ b/src/views/archiveManager/archiveMaterial/index.vue
@@ -239,12 +239,14 @@
       :on-preview="handlePreview"
       :on-remove="handleRemove"
       :file-list="fileList"
+        :on-change="handleFileChange"
       :auto-upload="false"
       multiple
       accept=".jpg,.png"
     >
       <el-button slot="trigger" size="small" type="primary">閫夋嫨鏂囦欢</el-button>
       <el-button style="margin-left: 10px;" size="small" type="success" @click="submitUpload">涓婁紶鍒版湇鍔″櫒</el-button>
+      <el-button style="margin-left: 10px;" size="small" type="danger" @click="clearFileList">娓呯┖鍒楄〃</el-button>
       <div slot="tip" class="el-upload__tip">鍙笂浼燡PG绛夋牸寮忔枃浠讹紝鍗曚釜鏂囦欢涓嶈秴杩�50MB</div>
     </el-upload>
   </el-dialog>
@@ -883,9 +885,29 @@
     handlePreview(file) {
       console.log(file)
     },
+     handleFileChange(file, fileList) {
+    console.log('褰撳墠鏂囦欢鍒楄〃:', fileList);
+    this.fileList = fileList;
+  },
     // 鎻愪氦涓婁紶
     submitUpload() {
+      // 鑾峰彇褰撳墠閫夋嫨鐨勬枃浠舵暟閲�
+      const fileCount = this.fileList.length
+      if (fileCount === 0) {
+        this.$modal.msgWarning('璇峰厛閫夋嫨鏂囦欢鍐嶄笂浼�')
+        return
+      }
+      if(fileCount!==this.total)
+      {
+        this.$modal.msgWarning('璇烽�夋嫨涓庤褰曟暟涓�鑷寸殑鏂囦欢')
+        return
+      }
+      // 鎵ц涓婁紶
       this.$refs.upload.submit()
+    },
+    clearFileList() {
+      this.fileList = [];
+      this.$modal.msgSuccess('宸叉竻绌轰笂浼犲垪琛�');
     },
           handleKeyDown(e) {
       // 鍦╧eydown浜嬩欢涓洿鏃╁湴闃绘榛樿琛屼负
@@ -1086,8 +1108,8 @@
   // }
   const formData = new FormData();
   formData.append('file', file);
-  formData.append('recordId', this.recordId)
-  alert(this.recordId)
+ // formData.append('recordId', this.recordId)
+  // alert(this.recordId)
   console.log(file)
 
   // 鏄剧ず鍔犺浇涓姸鎬�

--
Gitblit v1.9.1