Procházet zdrojové kódy

组件ImageUpload支持多图同时选择上传

RuoYi před 4 roky
rodič
revize
c43565ef43

+ 1 - 4
ruoyi-modules/ruoyi-job/src/main/java/com/ruoyi/job/util/ScheduleUtils.java

@@ -125,10 +125,7 @@ public class ScheduleUtils
125
         int count = StringUtils.countMatches(packageName, ".");
125
         int count = StringUtils.countMatches(packageName, ".");
126
         if (count > 1)
126
         if (count > 1)
127
         {
127
         {
128
-            if (!StringUtils.containsAnyIgnoreCase(invokeTarget, Constants.JOB_WHITELIST_STR))
129
-            {
130
-                return false;
131
-            }
128
+            return StringUtils.containsAnyIgnoreCase(invokeTarget, Constants.JOB_WHITELIST_STR);
132
         }
129
         }
133
         return true;
130
         return true;
134
     }
131
     }

+ 12 - 3
ruoyi-ui/src/components/ImageUpload/index.vue

@@ -1,6 +1,7 @@
1
 <template>
1
 <template>
2
   <div class="component-upload-image">
2
   <div class="component-upload-image">
3
     <el-upload
3
     <el-upload
4
+      multiple
4
       :action="uploadImgUrl"
5
       :action="uploadImgUrl"
5
       list-type="picture-card"
6
       list-type="picture-card"
6
       :on-success="handleUploadSuccess"
7
       :on-success="handleUploadSuccess"
@@ -70,6 +71,8 @@ export default {
70
   },
71
   },
71
   data() {
72
   data() {
72
     return {
73
     return {
74
+      number: 0,
75
+      uploadList: [],
73
       dialogImageUrl: "",
76
       dialogImageUrl: "",
74
       dialogVisible: false,
77
       dialogVisible: false,
75
       hideUpload: false,
78
       hideUpload: false,
@@ -119,9 +122,14 @@ export default {
119
     },
122
     },
120
     // 上传成功回调
123
     // 上传成功回调
121
     handleUploadSuccess(res) {
124
     handleUploadSuccess(res) {
122
-      this.fileList.push({ name: res.data.url, url: res.data.url });
123
-      this.$emit("input", this.listToString(this.fileList));
124
-      this.loading.close();
125
+      this.uploadList.push({ name: res.data.url, url: res.data.url });
126
+      if (this.uploadList.length === this.number) {
127
+        this.fileList = this.fileList.concat(this.uploadList);
128
+        this.uploadList = [];
129
+        this.number = 0;
130
+        this.$emit("input", this.listToString(this.fileList));
131
+        this.loading.close();
132
+      }
125
     },
133
     },
126
     // 上传前loading加载
134
     // 上传前loading加载
127
     handleBeforeUpload(file) {
135
     handleBeforeUpload(file) {
@@ -158,6 +166,7 @@ export default {
158
         text: "上传中",
166
         text: "上传中",
159
         background: "rgba(0, 0, 0, 0.7)",
167
         background: "rgba(0, 0, 0, 0.7)",
160
       });
168
       });
169
+      this.number++;
161
     },
170
     },
162
     // 文件个数超出
171
     // 文件个数超出
163
     handleExceed() {
172
     handleExceed() {