From 43d76e599091dc6b79b51f89c79514b50e33ea35 Mon Sep 17 00:00:00 2001
From: fuzui <73400@163.com>
Date: 星期四, 16 十二月 2021 02:18:48 +0800
Subject: [PATCH] fix: cron组件中周回显bug

---
 ruoyi-ui/src/components/FileUpload/index.vue |   24 ++++++++++++++++++------
 1 files changed, 18 insertions(+), 6 deletions(-)

diff --git a/ruoyi-ui/src/components/FileUpload/index.vue b/ruoyi-ui/src/components/FileUpload/index.vue
index 649e077..bdbb069 100644
--- a/ruoyi-ui/src/components/FileUpload/index.vue
+++ b/ruoyi-ui/src/components/FileUpload/index.vue
@@ -4,7 +4,9 @@
       :action="uploadFileUrl"
       :before-upload="handleBeforeUpload"
       :file-list="fileList"
+      :limit="limit"
       :on-error="handleUploadError"
+      :on-exceed="handleExceed"
       :on-success="handleUploadSuccess"
       :show-file-list="false"
       :headers="headers"
@@ -44,6 +46,11 @@
   props: {
     // 鍊�
     value: [String, Object, Array],
+    // 鏁伴噺闄愬埗
+    limit: {
+      type: Number,
+      default: 5,
+    },
     // 澶у皬闄愬埗(MB)
     fileSize: {
       type: Number,
@@ -129,6 +136,10 @@
       }
       return true;
     },
+    // 鏂囦欢涓暟瓒呭嚭
+    handleExceed() {
+      this.$message.error(`涓婁紶鏂囦欢鏁伴噺涓嶈兘瓒呰繃 ${this.limit} 涓�!`);
+    },
     // 涓婁紶澶辫触
     handleUploadError(err) {
       this.$message.error("涓婁紶澶辫触, 璇烽噸璇�");
@@ -152,13 +163,14 @@
         return "";
       }
     },
-    // 瀵硅薄杞垚鍒嗛殧瀛楃涓�
-    listToString(list) {
-      let files = "";
-      for (let key in list) {
-        files += list[key].url + ",";
+    // 瀵硅薄杞垚鎸囧畾瀛楃涓插垎闅�
+    listToString(list, separator) {
+      let strs = "";
+      separator = separator || ",";
+      for (let i in list) {
+        strs += list[i].url + separator;
       }
-      return files.substr(0, files.length - 1);
+      return strs != '' ? strs.substr(0, strs.length - 1) : '';
     }
   }
 };

--
Gitblit v1.9.3