Showing
2 changed files
with
26 additions
and
11 deletions
| ... | @@ -92,6 +92,8 @@ export function submitWaybill(data) { | ... | @@ -92,6 +92,8 @@ export function submitWaybill(data) { |
| 92 | data.fileUpload.forEach((item) => { | 92 | data.fileUpload.forEach((item) => { |
| 93 | formData.append("fileUpload", item); | 93 | formData.append("fileUpload", item); |
| 94 | }) | 94 | }) |
| 95 | + } else { | ||
| 96 | + formData.append("fileUpload", null); | ||
| 95 | } | 97 | } |
| 96 | return request({ | 98 | return request({ |
| 97 | url: "/biz-customer/consignment/submit", | 99 | url: "/biz-customer/consignment/submit", | ... | ... |
| ... | @@ -160,11 +160,13 @@ export default { | ... | @@ -160,11 +160,13 @@ export default { |
| 160 | fileList: [], | 160 | fileList: [], |
| 161 | uploadType: true, | 161 | uploadType: true, |
| 162 | viewHistoryType: false, | 162 | viewHistoryType: false, |
| 163 | + errorTip: "", | ||
| 163 | }; | 164 | }; |
| 164 | }, | 165 | }, |
| 165 | methods: { | 166 | methods: { |
| 166 | //上传 | 167 | //上传 |
| 167 | upload(type) { | 168 | upload(type) { |
| 169 | + this.errorTip = ""; | ||
| 168 | this.fileList = []; | 170 | this.fileList = []; |
| 169 | this.fileFormData.uploadType = type; | 171 | this.fileFormData.uploadType = type; |
| 170 | this.$refs.uploadBlock.$refs["upload-inner"].handleClick(); | 172 | this.$refs.uploadBlock.$refs["upload-inner"].handleClick(); |
| ... | @@ -173,6 +175,7 @@ export default { | ... | @@ -173,6 +175,7 @@ export default { |
| 173 | let fileSum = 0; | 175 | let fileSum = 0; |
| 174 | let fileSize = 0; | 176 | let fileSize = 0; |
| 175 | let fileNameArray = []; | 177 | let fileNameArray = []; |
| 178 | + let errorTip = ""; | ||
| 176 | this.fileData.forEach((item) => { | 179 | this.fileData.forEach((item) => { |
| 177 | fileSum = Number(fileSum) + Number(item.files.length); | 180 | fileSum = Number(fileSum) + Number(item.files.length); |
| 178 | item.files.forEach((file) => { | 181 | item.files.forEach((file) => { |
| ... | @@ -181,18 +184,28 @@ export default { | ... | @@ -181,18 +184,28 @@ export default { |
| 181 | }); | 184 | }); |
| 182 | }); | 185 | }); |
| 183 | if (fileSum + 1 > 100) { | 186 | if (fileSum + 1 > 100) { |
| 184 | - this.$message.warning("The maximum number of uploaded files is 100!"); | 187 | + if (this.errorTip == "") { |
| 185 | - return false; | 188 | + errorTip = "The maximum number of uploaded files is 100!"; |
| 186 | - } else if (Number(fileSize) + Number(val.fileSize) / 1024 / 1024 > 95) { | 189 | + this.$message.warning(this.errorTip); |
| 187 | - this.$message.warning( | 190 | + } |
| 188 | - "The maximum total size of uploaded files is 95M!" | 191 | + } else if ((Number(fileSize) + Number(val.size)) / 1024 / 1024 > 95) { |
| 189 | - ); | 192 | + if (this.errorTip == "") { |
| 190 | - return false; | 193 | + errorTip = "The maximum total size of uploaded files is 95M!"; |
| 191 | - } else if (fileNameArray.includes(val.fileName)) { | 194 | + } |
| 192 | - this.$message.warning("Duplicate file name uploaded!"); | 195 | + } else if (fileNameArray.includes(val.name)) { |
| 193 | - return false; | 196 | + if (this.errorTip == "") { |
| 194 | - } else { | 197 | + errorTip = "Duplicate file name uploaded!"; |
| 198 | + } | ||
| 199 | + } | ||
| 200 | + | ||
| 201 | + if (errorTip == "") { | ||
| 195 | return true; | 202 | return true; |
| 203 | + } else { | ||
| 204 | + if (errorTip != "" && this.errorTip == "") { | ||
| 205 | + this.errorTip = errorTip; | ||
| 206 | + this.$message.warning(errorTip); | ||
| 207 | + } | ||
| 208 | + return false; | ||
| 196 | } | 209 | } |
| 197 | }, | 210 | }, |
| 198 | uploadFile(val) { | 211 | uploadFile(val) { | ... | ... |
-
Please register or login to post a comment