From 7a3b10ee581fd8eccb4cc03e8b712a15083e7688 Mon Sep 17 00:00:00 2001 From: wenc000 <450292408@qq.com> Date: Sat, 25 Apr 2020 11:33:11 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=84=E7=90=86=E6=96=87=E4=BB=B6=E5=AF=BC?= =?UTF-8?q?=E5=85=A5=E6=95=B0=E9=87=8F=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../resources/templates/file/file-upload-v2.html | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/cloud-common-plugin/src/main/resources/templates/file/file-upload-v2.html b/cloud-common-plugin/src/main/resources/templates/file/file-upload-v2.html index b47c714..30a910f 100644 --- a/cloud-common-plugin/src/main/resources/templates/file/file-upload-v2.html +++ b/cloud-common-plugin/src/main/resources/templates/file/file-upload-v2.html @@ -42,25 +42,35 @@ if ('' == $('#uploadType').val() || '-1' == $('#uploadType').val()) { top.dialog.msg('文件上传类型错误'); } + var maxFileCount = top.dialog.maxFileCount == null ? $('#maxFileCount').val() : top.dialog.maxFileCount; $('#uploadFile').fileinput({ language: 'zh', // 中文 uploadUrl: $('#uploadUrl').val(), // 服务器地址 allowedFileExtensions: $('#allowFiles').val().split(','), // 文件后缀 - showUpload: true, // 显示上传按钮 - showRemove: true, // 显示删除按钮 + showUpload: false, // 显示上传按钮 + showRemove: false, // 显示删除按钮 showPreview: true, // 是否预览 showCaption: false, // 是否标题 showClose: false, // 右上角关闭 showCancel: true, // 取消上传 dropZoneEnabled: true, // 是否拖拽区域 minFileCount: 0, - maxFileCount: top.dialog.maxFileCount == null ? $('#maxFileCount').val() : top.dialog.maxFileCount, // 表示允许同时上传的最大文件个数 + maxFileCount: maxFileCount, // 表示允许同时上传的最大文件个数 enctype: 'multipart/form-data', previewFileType: 'any' // 预览文件格式 }).on('fileuploaded', function (event, data, previewId, index) { var id = data.response; uploadFileArray.push(id); top.dialog.dialogData.uploadFileArray = uploadFileArray; + if(uploadFileArray.length >= maxFileCount) { + $('.btn-file').hide(); + } + }).on('filesuccessremove', function(event, previewId, index) { + uploadFileArray.splice(index, 1); + if(uploadFileArray.length < maxFileCount) { + $('.btn-file').show(); + } + top.dialog.dialogData.uploadFileArray = uploadFileArray; }).on('fileerror', function(event, data, msg) { top.dialog.msg(data.response.msg); });