处理文件导入数量问题
This commit is contained in:
parent
95e0186dd5
commit
7a3b10ee58
@ -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);
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user