Commit 58007519 by 叶明星

修复导出问题

parent b0edff9f
......@@ -26,13 +26,13 @@ class ApiController extends Controller
}
}
private function ExportLayui($errcode=0,$errmsg=0,$data=[],$count=0){
private function ExportLayui($errcode=0,$errmsg=0,$data=[],$count=0,$total=''){
if(is_array($errcode)){
ErrorLog($errcode[0],$errcode[1]);
echo json_encode(['code'=>$errcode[0],'msg'=>$errcode[1],'data'=>$errcode[2],'count'=>$errcode[3]]);
echo json_encode(['code'=>$errcode[0],'msg'=>$errcode[1],'data'=>$errcode[2],'count'=>$errcode[3],'total'=>!empty($errcode[4])?$errcode[4]:'']);
}else{
ErrorLog($errcode,$errmsg);
echo json_encode(['code'=>$errcode,'msg'=>$errmsg,'data'=>$data,'count'=>$count]);
echo json_encode(['code'=>$errcode,'msg'=>$errmsg,'data'=>$data,'count'=>$count,'total'=>$total]);
}
exit();
}
......
......@@ -44,7 +44,7 @@ class PaymentDaysModel extends Model
});
})->export('xls');
}
return [0,'成功',$list['data'],$list['total']];
return [0,'成功',$list['data'],$list['total'],$limit];
}
public function AuthPaymentDays(){
......
......@@ -35,6 +35,10 @@ layui.use(['table','form','laydate','layer'], function() {
,page: {
// layout: ['prev', 'page', 'next', 'count', 'skip'] //自定义分页布局
}
, done: function(res, curr, count){
$('input[name=limit]').val(res.total);
$('input[name=p]').val(curr);
}
});
form.on('submit(load)', function(data){
if($(data.elem).data('type')=='Export'){
......
......@@ -25,6 +25,8 @@
@endforeach
@endif
</div>
<input type="hidden" value="1" name="p">
<input type="hidden" value="10" name="limit">
<button lay-submit lay-filter="load" class="layui-btn layui-btn-lg reload" data-type="reload">搜索</button>
<button lay-submit lay-filter="load" data-type="Export" class="layui-btn float-r" type="submit"><i class="layui-icon">&#xe601;</i>导出</button>
</div>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment