1、添加发文编码信息,在上传文件时可输入

2、文件上传成功后清空文件列表
3、修改文件添加和移除功能
master
xiong_cl 7 months ago
parent 7c594216e4
commit 2350100a3e
  1. 11
      shandan-common/src/main/resources/static/js/common/layui/extend/uploader/uploader.js

@ -48,6 +48,7 @@ layui.extend({
<tr> <tr>
<th lay-data="{type:'numbers'}"></th> <th lay-data="{type:'numbers'}"></th>
<th lay-data="{field:'fileName'}">文件名称</th> <th lay-data="{field:'fileName'}">文件名称</th>
<th lay-data="{field:'fileNumber',templet:'#fileNumber'}">发文编号</th>
<th lay-data="{field:'progress', width:'35%',templet:'#processTemplate'}">进度</th> <th lay-data="{field:'progress', width:'35%',templet:'#processTemplate'}">进度</th>
<th lay-data="{field:'fileSize', width:120}">文件大小</th> <th lay-data="{field:'fileSize', width:120}">文件大小</th>
<th lay-data="{field:'oper', fixed: 'right', width: 130, align:'center', templet: '#rowTemplate'}">操作</th> <th lay-data="{field:'oper', fixed: 'right', width: 130, align:'center', templet: '#rowTemplate'}">操作</th>
@ -63,6 +64,11 @@ layui.extend({
<div style="margin-top: 5px;" class="layui-progress layui-progress-big" lay-filter="{{d.fileId}}" lay-showPercent="true"> <div style="margin-top: 5px;" class="layui-progress layui-progress-big" lay-filter="{{d.fileId}}" lay-showPercent="true">
<div class="layui-progress-bar layui-bg-blue" lay-percent="0%"></div> <div class="layui-progress-bar layui-bg-blue" lay-percent="0%"></div>
</div> </div>
</script>
<script type="text/html" id="fileNumber">
<input style="height: 25px;width: 100%;" type="text" autocomplete="off" name="fileNumber">
</script>` </script>`
let fileBoxE = options.fileBoxEle || fileBoxEle; let fileBoxE = options.fileBoxEle || fileBoxEle;
$(fileBoxE).html(fileBox); $(fileBoxE).html(fileBox);
@ -137,16 +143,19 @@ layui.extend({
progress: file.id, progress: file.id,
status: 0, status: 0,
}); });
option.fileQueued && option.fileQueued(file);
}); });
// 一批文件被添加 // 一批文件被添加
upload.on('filesQueued', function (files) { upload.on('filesQueued', function (files) {
that.reloadData(rowData); that.reloadData(rowData);
element.render('progress'); element.render('progress');
option.filesQueued && option.filesQueued(files);
}); });
//文件从队列移除触发 //文件从队列移除触发
upload.on('fileDequeued', function (file) { upload.on('fileDequeued', function (file) {
option.fileDequeued && option.fileDequeued(file);
}); });
// 文件上传之前触发 // 文件上传之前触发
@ -194,6 +203,8 @@ layui.extend({
rowData = []; rowData = [];
loading.closeAll(); loading.closeAll();
let {interruptNum, queueNum, uploadFailNum} = upload.getStats(); let {interruptNum, queueNum, uploadFailNum} = upload.getStats();
//上传成功后清楚上传文件列表
that.reloadData(rowData);
option.uploadFinished && option.uploadFinished(uploadFailNum === 0 && interruptNum === 0 && queueNum === 0); option.uploadFinished && option.uploadFinished(uploadFailNum === 0 && interruptNum === 0 && queueNum === 0);
}); });