优化导出数据

This commit is contained in:
hdm 2022-12-29 22:43:25 +08:00
parent f572d888a6
commit 6abb245f57
7 changed files with 39 additions and 4 deletions

View File

@ -2,7 +2,7 @@
<!-- 主体 --> <!-- 主体 -->
{block name="body"} {block name="body"}
<div class="p-3"> <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:300px;"> <div class="layui-input-inline" style="width:300px;">
<input type="text" name="keywords" placeholder="输入关键字" class="layui-input" autocomplete="off" /> <input type="text" name="keywords" placeholder="输入关键字" class="layui-input" autocomplete="off" />
</div> </div>
@ -22,6 +22,7 @@
layui.pageTable = table.render({ layui.pageTable = table.render({
elem: '#test' elem: '#test'
,toolbar: '#toolbarDemo' ,toolbar: '#toolbarDemo'
,defaultToolbar:['filter', {title:'导出EXCEL',layEvent: 'LAYTABLE_EXCEL',icon: 'layui-icon-export'}]
,title:'联系人列表' ,title:'联系人列表'
,url: "/customer/contact/index" ,url: "/customer/contact/index"
,cellMinWidth: 240 ,cellMinWidth: 240
@ -91,6 +92,22 @@
} }
}); });
//表头工具栏事件
table.on('toolbar(test)', function(obj){
if(obj.event === 'LAYTABLE_EXCEL'){
var formSelect = form.val('barsearchform');
formSelect.limit=99999;
$.ajax({
url: '/customer/contact/index',
data: formSelect,
success:function(res){
table.exportFile('test', res.data,'xls');
}
});
return;
}
})
//监听搜索提交 //监听搜索提交
form.on('submit(webform)', function(data) { form.on('submit(webform)', function(data) {
layui.pageTable.reload({ layui.pageTable.reload({

View File

@ -21,6 +21,7 @@
layui.pageTable = table.render({ layui.pageTable = table.render({
elem: '#test' elem: '#test'
,toolbar: '#toolbarDemo' ,toolbar: '#toolbarDemo'
,defaultToolbar: false
,title:'客户等级列表' ,title:'客户等级列表'
,url: "/customer/grade/index" ,url: "/customer/grade/index"
,page: false ,page: false

View File

@ -12,7 +12,7 @@
</ul> </ul>
</div> </div>
</div> </div>
<form class="layui-form gg-form-bar border-x"> <form class="layui-form gg-form-bar border-x" lay-filter="barsearchform">
<div class="layui-input-inline" style="width:150px;"> <div class="layui-input-inline" style="width:150px;">
<select name="grade_id"> <select name="grade_id">
<option value="">请选择客户等级</option> <option value="">请选择客户等级</option>
@ -75,6 +75,7 @@
elem: '#test', elem: '#test',
title: '客户列表', title: '客户列表',
toolbar: '#toolbarDemo', toolbar: '#toolbarDemo',
defaultToolbar:['filter', {title:'导出EXCEL',layEvent: 'LAYTABLE_EXCEL',icon: 'layui-icon-export'}],
url: "/customer/index/index", //数据接口 url: "/customer/index/index", //数据接口
cellMinWidth: 240, cellMinWidth: 240,
page: true, //开启分页 page: true, //开启分页
@ -176,6 +177,18 @@
tool.side("/customer/index/add"); tool.side("/customer/index/add");
return; return;
} }
if(obj.event === 'LAYTABLE_EXCEL'){
var formSelect = form.val('barsearchform');
formSelect.limit=99999;
$.ajax({
url: '/customer/index/index',
data: formSelect,
success:function(res){
table.exportFile('test', res.data,'xls');
}
});
return;
}
}); });
//监听行工具事件 //监听行工具事件
table.on('tool(test)', function(obj) { table.on('tool(test)', function(obj) {

View File

@ -33,6 +33,7 @@
elem: '#test', elem: '#test',
title: '抢客宝列表', title: '抢客宝列表',
toolbar: '#toolbarDemo', toolbar: '#toolbarDemo',
defaultToolbar: false,
url: "/customer/index/rush", //数据接口 url: "/customer/index/rush", //数据接口
cellMinWidth: 240, cellMinWidth: 240,
page: false, //开启分页 page: false, //开启分页

View File

@ -52,7 +52,8 @@
var table = layui.table, tool = layui.tool ,form = layui.form, employeepicker = layui.employeepicker,upload=layui.upload; var table = layui.table, tool = layui.tool ,form = layui.form, employeepicker = layui.employeepicker,upload=layui.upload;
layui.pageTable = table.render({ layui.pageTable = table.render({
elem: '#test', elem: '#test',
title: '客户列表', title: '公海客户列表',
defaultToolbar: false,
toolbar: '#toolbarDemo', toolbar: '#toolbarDemo',
url: "/customer/index/sea", //数据接口 url: "/customer/index/sea", //数据接口
cellMinWidth: 240, cellMinWidth: 240,

View File

@ -37,8 +37,9 @@
var table = layui.table, tool = layui.tool ,form = layui.form; var table = layui.table, tool = layui.tool ,form = layui.form;
layui.pageTable = table.render({ layui.pageTable = table.render({
elem: '#test', elem: '#test',
title: '客户列表', title: '废弃客户列表',
toolbar: '#toolbarDemo', toolbar: '#toolbarDemo',
defaultToolbar: false,
url: "/customer/index/trash", //数据接口 url: "/customer/index/trash", //数据接口
cellMinWidth: 240, cellMinWidth: 240,
page: true, //开启分页 page: true, //开启分页

View File

@ -21,6 +21,7 @@
layui.pageTable = table.render({ layui.pageTable = table.render({
elem: '#test' elem: '#test'
,toolbar: '#toolbarDemo' ,toolbar: '#toolbarDemo'
,defaultToolbar: false
,title:'客户渠道列表' ,title:'客户渠道列表'
,url: "/customer/source/index" ,url: "/customer/source/index"
,page: false ,page: false