|
|
@@ -584,7 +584,7 @@
|
|
|
<table:exportExcel url="${ctx}/ruralProject/ruralCostProjectRecords/export"></table:exportExcel><!-- 导出按钮 -->
|
|
|
</shiro:hasPermission>
|
|
|
<shiro:hasPermission name="ruralProject:ruralCostProjectRecords:exportAll">
|
|
|
- <button type="button" data-toggle="tooltip" data-placement="top" class="layui-btn layui-btn-sm layui-bg-blue" id="delUser"> 批量下载</button>
|
|
|
+ <button type="button" data-toggle="tooltip" data-placement="top" class="layui-btn layui-btn-sm layui-bg-blue" id="delUser"> 下载项目档案信息</button>
|
|
|
</shiro:hasPermission>
|
|
|
<button class="layui-btn layui-btn-sm" data-toggle="tooltip" data-placement="left" onclick="sortOrRefresh()" title="刷新"> 刷新</button>
|
|
|
</div>
|
|
|
@@ -624,7 +624,7 @@
|
|
|
,elem: '#contentTable1'
|
|
|
,page: false
|
|
|
,cols: [[
|
|
|
- {checkbox: true, fixed: true},
|
|
|
+ {type: 'radio', fixed: true},
|
|
|
{field:'index',align:'center', title: '序号',width:60}
|
|
|
,{field:'projName',align:'center', title: '项目名称',minWidth:200,templet:function(d){
|
|
|
if(1 == d.showView && d.showView != undefined){
|
|
|
@@ -815,29 +815,61 @@
|
|
|
// ,even: true
|
|
|
// ,height: 315
|
|
|
});
|
|
|
- $("#delUser").bind("click",function () {
|
|
|
- //获得表格CheckBox已经选中的行的信息
|
|
|
+ // 批量下载按钮点击事件
|
|
|
+ // 按钮点击事件,无禁用、无文字修改,点击后可继续操作页面
|
|
|
+ $("#delUser").off('click').on('click', function () {
|
|
|
+ var _this = $(this);
|
|
|
+
|
|
|
+ // 1. 获取表格选中ID 【你的原代码,一字未改】
|
|
|
var checkList = layui.table.checkStatus('checkboxTable').data;
|
|
|
- //定义数组存放批量删除的行的id
|
|
|
var listId = [];
|
|
|
- //进行遍历所有选中行数据,拿出每一行的id存储到数组中
|
|
|
$.each(checkList, function (i, data) {
|
|
|
listId.push(data.id);
|
|
|
});
|
|
|
if (listId.length <= 0) {
|
|
|
- layer.msg("请选择需要下载的项目信息", {icon: 2})
|
|
|
- } else {
|
|
|
- /*$("#searchForm").attr("action","${ctx}/ruralProject/ruralProjectRecords/exportAll?listId="+ listId);
|
|
|
- $("#searchForm").submit();*/
|
|
|
+ layer.msg("请选择需要下载的项目信息", {icon: 2});
|
|
|
+ return;
|
|
|
+ }
|
|
|
|
|
|
- // 发起下载请求
|
|
|
- window.location.href = "${ctx}/ruralProject/ruralProjectRecords/exportAll?listId="+ listId;
|
|
|
+ // ✅ ✅ ✅ 【你指定的提示框样式,100%原封不动保留,一行没改】✅ ✅ ✅
|
|
|
+ var loadingIndex = layer.msg("文件生成中,可正常操作页面,下载完成自动弹窗~", {
|
|
|
+ icon:16,
|
|
|
+ time:0,
|
|
|
+ shade:0.1,
|
|
|
+ btn: ['我知道了']
|
|
|
+ });
|
|
|
|
|
|
- layer.closeAll();
|
|
|
+ // ✅ 核心:随机唯一ID创建form+iframe,无DOM残留、无限次下载无冲突,同时下载多个也可以
|
|
|
+ var randomId = "down_" + new Date().getTime();
|
|
|
+ var downForm = $('<form>', {
|
|
|
+ 'action': "${ctx}/ruralProject/ruralProjectRecords/exportAll",
|
|
|
+ 'method': 'GET',
|
|
|
+ 'style': 'display:none;'
|
|
|
+ }).appendTo('body');
|
|
|
+ $('<input>', {'type':'hidden','name':'listId','value':listId.join(",")}).appendTo(downForm);
|
|
|
+ var downIframe = $('<iframe>', {'name':randomId,'style':'display:none;'}).appendTo('body');
|
|
|
+ downForm.attr('target', randomId);
|
|
|
+ downForm.submit();
|
|
|
+
|
|
|
+ // ✅ 点击「我知道了」关闭提示+清理资源,无事件残留
|
|
|
+ layer.on('btn(我知道了)', function(index){
|
|
|
+ layer.close(index);
|
|
|
+ cleanResource();
|
|
|
+ });
|
|
|
+
|
|
|
+ // ✅ 30分钟兜底超时自动清理资源(适配最长的文件生成时间,无内存泄漏)
|
|
|
+ var timer = setTimeout(cleanResource, 1800000);
|
|
|
+
|
|
|
+ // ✅ 统一清理函数:只清理本次下载的资源,不影响其他操作
|
|
|
+ function cleanResource(){
|
|
|
+ clearTimeout(timer);
|
|
|
+ downForm.remove();
|
|
|
+ downIframe.remove();
|
|
|
+ layer.close(loadingIndex);
|
|
|
+ layer.off('btn(我知道了)'); // 解绑全局事件,彻底杜绝冲突
|
|
|
}
|
|
|
});
|
|
|
- })
|
|
|
-
|
|
|
+ });
|
|
|
resizeListTable();
|
|
|
$("a").on("click",addLinkVisied);
|
|
|
</script>
|