优化导出数据

This commit is contained in:
hdm 2022-12-29 22:32:11 +08:00
parent 07558b9594
commit f572d888a6
3 changed files with 16 additions and 3 deletions

View File

@ -29,6 +29,7 @@
layui.pageTable = table.render({
elem: '#test'
,toolbar: '#toolbarDemo'
,defaultToolbar: false
,title:'合同类型列表'
,url: "/contract/cate/cate"
,page: false

View File

@ -38,8 +38,7 @@
var table = layui.table, tool = layui.tool ,form = layui.form;
layui.pageTable = table.render({
elem: '#test',
title: '合同列表',
toolbar: '#toolbarDemo',
title: '合同归档列表',
url: "/contract/index/archive", //数据接口
cellMinWidth: 320,
page: true, //开启分页

View File

@ -2,7 +2,7 @@
<!-- 主体 -->
{block name="body"}
<div class="p-3">
<form class="layui-form gg-form-bar border-x border-t">
<form class="layui-form gg-form-bar border-x border-t" lay-filter="barsearchform">
<div class="layui-input-inline" style="width:150px;">
<select name="cate_id">
<option value="">请选择合同类别</option>
@ -56,6 +56,7 @@
elem: '#test',
title: '合同列表',
toolbar: '#toolbarDemo',
defaultToolbar:['filter', {title:'导出EXCEL',layEvent: 'LAYTABLE_EXCEL',icon: 'layui-icon-export'}],
url: "/contract/index/index", //数据接口
cellMinWidth: 320,
page: true, //开启分页
@ -157,6 +158,18 @@
selectType();
return;
}
if(obj.event === 'LAYTABLE_EXCEL'){
var formSelect = form.val('barsearchform');
formSelect.limit=99999;
$.ajax({
url: '/contract/index/index',
data: formSelect,
success:function(res){
table.exportFile('test', res.data,'xls');
}
});
return;
}
});
//监听行工具事件
table.on('tool(test)', function(obj) {