diff --git a/Application/Admin/Controller/CompanyStatementOfflineController.class.php b/Application/Admin/Controller/CompanyStatementOfflineController.class.php index 4a01c16c3..96cc877ed 100644 --- a/Application/Admin/Controller/CompanyStatementOfflineController.class.php +++ b/Application/Admin/Controller/CompanyStatementOfflineController.class.php @@ -59,10 +59,24 @@ class CompanyStatementOfflineController extends ThinkController if(isset($_REQUEST['statement_pool_num'])){ $map['p.statement_num'] =["LIKE","%{$_REQUEST['statement_pool_num']}%"]; } - - //条件end + if (isset($_REQUEST['export']) && $_REQUEST['export']==1) { + $map['c.company_type'] = $_REQUEST['export_company_type']; + $data = SM("company_statement_info","tab_") + ->alias("c") + ->field("c.*,p.statement_num,p.verify_status") + ->where($map) + ->where(['p.verify_status'=>['neq',6]]) + ->join("tab_company_statement_pool as p ON c.pool_id = p.id") + ->order("id desc") + ->select(); + $ids = array_column($data, 'id'); + $ids = implode(',', $ids); + $this->export($ids); + return ; + } + $data = SM("company_statement_info","tab_") ->alias("c") ->field("c.*,p.statement_num,p.verify_status") @@ -287,9 +301,12 @@ class CompanyStatementOfflineController extends ThinkController } } - public function export(){ - if(!isset($_REQUEST['ids'])) $this->error("参数错误"); - $ids = $_REQUEST['ids']; + public function export($ids=''){ + if (!$ids) { + if (!isset($_REQUEST['ids'])) $this->error("参数错误"); + $ids = $_REQUEST['ids']; + } + $dbres = SM("company_statement_info","tab_")->where("id in ({$ids})")->select(); $is_export= false; @@ -351,6 +368,7 @@ class CompanyStatementOfflineController extends ThinkController "returnSetPayment"=>"打款信息确认撤回", "doPayment"=>"打款确认", "export"=>"批量导出", + "export_all"=>"导出所有", ]; $resarr = []; foreach ($mentBtn as $k => $v) { diff --git a/Application/Admin/View/CompanyStatementOffline/lists.html b/Application/Admin/View/CompanyStatementOffline/lists.html index 9ad1cfb8c..d7805a15b 100644 --- a/Application/Admin/View/CompanyStatementOffline/lists.html +++ b/Application/Admin/View/CompanyStatementOffline/lists.html @@ -467,9 +467,46 @@ $("body").append(iframeExcel) }); }) - + $("#export_all").click(function() { + var start = $("#time_start").val(); + var end = $("#time_end").val(); + if(start !='' && end != ''){ + if (Date.parse(start) > Date.parse(end)){ + layer.msg('开始时间必须小于等于结束时间'); + return false; + } + } + + var url = $('#search').attr('url'); + var query = $('.jssearch').find('input').serialize(); + query += "&"+$('.jssearch').find('select').serialize(); + query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g,''); + query = query.replace(/^&/g,''); + if( url.indexOf('?')>0 ){ + url += '&' + query; + }else{ + url += '?' + query; + } + + if ($("#company_type").val()) { + url += "&export=1&export_company_type=" + $("#company_type").val(); + var iframeExcel = ""; + $("body").append(iframeExcel); + return ; + } + url += "&export=1&export_company_type=1"; + var iframeExcel1 = ""; + $("body").append(iframeExcel1); + + url += "&export=1&export_company_type=2"; + var iframeExcel2 = ""; + $("body").append(iframeExcel2); + url += "&export=1&export_company_type=3"; + var iframeExcel3 = ""; + $("body").append(iframeExcel3); + }); $("#search").click(function(){