优化导出数据

This commit is contained in:
hdm 2022-12-29 22:06:23 +08:00
parent fe42ceac45
commit c44e292747
7 changed files with 76 additions and 10 deletions

View File

@ -19,6 +19,7 @@
layui.pageTable = table.render({
elem: '#test'
,toolbar: '#toolbarDemo'
,defaultToolbar: false
,title:'审批列表'
,url: "/oa/approve/copy"
,page: true //开启分页

View File

@ -70,6 +70,7 @@
layui.pageTable = table.render({
elem: '#test'
,toolbar: '#toolbarDemo'
,defaultToolbar: false
,title:'审批列表'
,url: "/oa/approve/index"
,page: true //开启分页

View File

@ -36,6 +36,7 @@
layui.pageTable = table.render({
elem: '#test'
,toolbar: '#toolbarDemo'
,defaultToolbar: false
,title:'审批列表'
,url: "/oa/approve/list"
,page: true //开启分页

View File

@ -7,7 +7,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 id="barDate" class="layui-input-inline">
<div class="layui-input-inline" style="width:110px;">
<input type="text" class="layui-input" id="start_time" placeholder="选择时间区间" readonly name="start_time">
@ -85,6 +85,7 @@
layui.pageTable = table.render({
elem: '#test'
,toolbar: '#toolbarDemo'
,defaultToolbar:['filter', {title:'导出EXCEL',layEvent: 'LAYTABLE_EXCEL',icon: 'layui-icon-export'}]
,title:'日程安排列表'
,url: "/oa/plan/index"
,page: true //开启分页
@ -128,6 +129,22 @@
}}
]]
});
//表头工具栏事件
table.on('toolbar(test)', function(obj){
if(obj.event === 'LAYTABLE_EXCEL'){
var formSelect = form.val('barsearchform');
formSelect.limit=99999;
$.ajax({
url: '/oa/plan/index',
data: formSelect,
success:function(res){
table.exportFile('test', res.data,'xls');
}
});
return;
}
})
//操作
table.on('tool(test)', function(obj){
@ -152,7 +169,8 @@
addEvent(detail);
}
}
})
})
return;
}
else if(obj.event === 'view'){
$.ajax({
@ -164,7 +182,8 @@
viewEvent(e.data);
}
}
})
})
return;
}
});

View File

@ -7,7 +7,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 id="barDate" class="layui-input-inline">
<div class="layui-input-inline" style="width:110px;">
<input type="text" class="layui-input" id="start_time" placeholder="选择时间区间" readonly name="start_time">
@ -84,6 +84,7 @@
layui.scheduleTable = table.render({
elem: '#test'
,toolbar: '#toolbarDemo'
,defaultToolbar:['filter', {title:'导出EXCEL',layEvent: 'LAYTABLE_EXCEL',icon: 'layui-icon-export'}]
,title:'工作记录列表'
,url: "/oa/schedule/index"
,page: true //开启分页
@ -123,6 +124,22 @@
}}
]]
});
//表头工具栏事件
table.on('toolbar(test)', function(obj){
if(obj.event === 'LAYTABLE_EXCEL'){
var formSelect = form.val('barsearchform');
formSelect.limit=99999;
$.ajax({
url: '/oa/schedule/index',
data: formSelect,
success:function(res){
table.exportFile('test', res.data,'xls');
}
});
return;
}
})
//更改工时
table.on('tool(test)', function(obj){

View File

@ -10,7 +10,7 @@
</ul>
<div class="layui-tab-content" style="padding:0">
<div class="layui-tab-item layui-show">
<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-inline" id="date">
<div class="layui-input-inline" style="width:112px">
<input type="text" autocomplete="off" id="start_time" name="start_time" class="layui-input" placeholder="接收开始日期">
@ -33,7 +33,7 @@
<table class="layui-hide" id="test" lay-filter="test"></table>
</div>
<div class="layui-tab-item">
<form class="layui-form gg-form-bar border-x border-t">
<form class="layui-form gg-form-bar border-x border-t" lay-filter="barsearchform2">>
<div class="layui-inline" id="date1">
<div class="layui-input-inline" style="width:112px">
<input type="text" autocomplete="off" id="start_time1" name="start_time" class="layui-input" placeholder="接收开始日期">
@ -100,6 +100,7 @@
layui.pageTable = table.render({
elem: '#test',
toolbar: '#toolbarDemo',
defaultToolbar:['filter', {title:'导出EXCEL',layEvent: 'LAYTABLE_EXCEL',icon: 'layui-icon-export'}],
title:'工作汇报列表',
url: "/oa/work/index", //数据接口
where:{'send':1},
@ -151,6 +152,19 @@
if(obj.event === 'add'){
addNew();
return;
}
if(obj.event === 'LAYTABLE_EXCEL'){
var formSelect = form.val('barsearchform');
formSelect.limit=99999;
formSelect.send=1;
$.ajax({
url: '/oa/work/index',
data: formSelect,
success:function(res){
table.exportFile('test', res.data,'xls');
}
});
return;
}
});
@ -171,6 +185,7 @@
layui.pageTable1 = table.render({
elem: '#test1',
toolbar: '#toolbarDemo',
defaultToolbar:['filter', {title:'导出EXCEL',layEvent: 'LAYTABLE_EXCEL',icon: 'layui-icon-export'}],
title:'工作汇报列表',
url: "/oa/work/index", //数据接口
where:{'send':0},
@ -233,7 +248,20 @@
if(obj.event === 'add'){
addNew();
return;
}
}
if(obj.event === 'LAYTABLE_EXCEL'){
var formSelect = form.val('barsearchform1');
formSelect.limit=99999;
formSelect.send=0;
$.ajax({
url: '/oa/work/index',
data: formSelect,
success:function(res){
table.exportFile('test1', res.data,'xls');
}
});
return;
}
});
function addNew(){

View File

@ -24,7 +24,7 @@
<div id="depament"></div>
</div>
<div class="body-table" style="margin-left:228px;">
<form class="layui-form gg-form-bar border-t border-x" lay-filter="seachform">
<form class="layui-form gg-form-bar border-t border-x" lay-filter="barsearchform">
<div class="layui-input-inline" style="width:136px">
<select name="status">
<option value="">选择员工状态</option>
@ -320,9 +320,8 @@
table.on('toolbar(test)', function(obj){
var checkStatus = table.checkStatus(obj.config.id); //获取选中行状态
var data = checkStatus.data;
console.log(obj.event);
if(obj.event === 'LAYTABLE_EXCEL'){
var formSelect = form.val('seachform');
var formSelect = form.val('barsearchform');
formSelect.limit=99999;
$.ajax({
url: '/user/user/index',