From f507dde70b23be9ec2339b5b352b9d4c800dbf95 Mon Sep 17 00:00:00 2001 From: chenzhi Date: Fri, 14 Feb 2020 16:26:07 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=8E=A8=E5=B9=BF=E5=85=AC?= =?UTF-8?q?=E5=8F=B8=E5=AF=BC=E5=87=BA=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../PromoteCompanyController.class.php | 18 +- .../Admin/View/PromoteCompany/export.html | 178 ++++++++++++++++++ .../Admin/View/PromoteCompany/lists.html | 16 ++ Public/static/table2excel.js | 1 + 4 files changed, 210 insertions(+), 3 deletions(-) create mode 100644 Application/Admin/View/PromoteCompany/export.html create mode 100644 Public/static/table2excel.js diff --git a/Application/Admin/Controller/PromoteCompanyController.class.php b/Application/Admin/Controller/PromoteCompanyController.class.php index 55b05428a..18de5eb23 100644 --- a/Application/Admin/Controller/PromoteCompanyController.class.php +++ b/Application/Admin/Controller/PromoteCompanyController.class.php @@ -19,6 +19,10 @@ class PromoteCompanyController extends ThinkController public function lists() { $model = M($this->modelName, 'tab_'); + $is_export= false; + if (isset($_REQUEST['export']) && $_REQUEST['export']==1){ + $is_export = true; + } $map = []; $promotemap=[]; $company_name = trim(I('company_name')); @@ -45,9 +49,12 @@ class PromoteCompanyController extends ThinkController //获取分页公司数据 $companyres = $model->field("*") ->where($map) - ->order("last_up_time desc") - ->page($page,$row) - ->select(); + ->order("last_up_time desc"); + if($is_export){ + $companyres = $companyres->select(); + }else{ + $companyres = $companyres->page($page,$row)->select(); + } //获取公司id $companyids = implode(',', array_column($companyres, 'id')); //获取所属会长及其游戏分成 @@ -175,6 +182,11 @@ class PromoteCompanyController extends ThinkController } // dd($companyres); + if($is_export){ + $this->assign('listData', $companyres); + $this->display("export"); + die(); + } /* 查询记录总数 */ $count = $model ->where($map) diff --git a/Application/Admin/View/PromoteCompany/export.html b/Application/Admin/View/PromoteCompany/export.html new file mode 100644 index 000000000..b359b2ad2 --- /dev/null +++ b/Application/Admin/View/PromoteCompany/export.html @@ -0,0 +1,178 @@ + + + + + + 游戏登陆列表|----软件管理平台 + + + + + + + + + + + +
+ 导出进行中。。。
+ 如果导出成功你也可以手动关闭此页面 +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
合作方名称对应平台合同期限开票税点开户行银行账号是否签署合同备注会长账号结算周期产品类型游戏名称合作方分成比例
aOh! 暂时还没有内容!
{$data.company_name}{$data.platform_name}{$data.contact_begin} - {$data.contact_end}{$data.fax_ratio}%{$data.bank_name}{$data.bank_card}{$data.is_sign_contact}{$data.content}
{$promote['account']} {$promote['settlement_type']}
{$game['game_type_name']}{$game['relation_game_name']}
{$ratio['name']}{$ratio['ratio']}
{$ratio['name']}{$ratio['ratio']}
{$game['game_type_name']}{$game['relation_game_name']}
{$ratio['name']}{$ratio['ratio']}
{$ratio['name']}{$ratio['ratio']}
{$promote['account']} {$promote['settlement_type']}{$game['game_type_name']}{$game['relation_game_name']}
{$ratio['name']}{$ratio['ratio']}
{$ratio['name']}{$ratio['ratio']}
{$game['game_type_name']}{$game['relation_game_name']}
{$ratio['name']}{$ratio['ratio']}
{$ratio['name']}{$ratio['ratio']}
+ + + + + diff --git a/Application/Admin/View/PromoteCompany/lists.html b/Application/Admin/View/PromoteCompany/lists.html index 34766efc3..9b4d36746 100644 --- a/Application/Admin/View/PromoteCompany/lists.html +++ b/Application/Admin/View/PromoteCompany/lists.html @@ -76,6 +76,9 @@
搜索
+
+ 导出excel +
@@ -266,6 +269,19 @@ window.location.href = url; }); + $("#downloadexcel").on("click",function(){ + var url = $(this).attr("url"); + var title = '推广公司导出'; + layer.open({ + type: 2, + title: title, + shadeClose: true, + shade: 0.8, + area: ['40%', '60%'], + content: url + + }); + }) //回车自动提交 $('.jssearch').find('input').keyup(function(event){ diff --git a/Public/static/table2excel.js b/Public/static/table2excel.js new file mode 100644 index 000000000..d4427f88c --- /dev/null +++ b/Public/static/table2excel.js @@ -0,0 +1 @@ +(function($,window,document,undefined){var pluginName="table2excel",defaults={exclude:".noExl",name:"Table2Excel",filename:"table2excel",fileext:".xls",exclude_img:true,exclude_links:true,exclude_inputs:true,preserveColors:false};function Plugin(element,options){this.element=element;this.settings=$.extend({},defaults,options);this._defaults=defaults;this._name=pluginName;this.init()}Plugin.prototype={init:function(){var e=this;var utf8Heading='';e.template={head:''+utf8Heading+"",table:{head:"",tail:"
"},foot:""};e.tableRows=[];var additionalStyles="";var compStyle=null;$(e.element).each(function(i,o){var tempRows="";$(o).find("tr").not(e.settings.exclude).each(function(i,p){additionalStyles="";if(e.settings.preserveColors){compStyle=getComputedStyle(p);additionalStyles+=(compStyle&&compStyle.backgroundColor?"background-color: "+compStyle.backgroundColor+";":"");additionalStyles+=(compStyle&&compStyle.color?"color: "+compStyle.color+";":"")}tempRows+="";$(p).find("td,th").not(e.settings.exclude).each(function(i,q){additionalStyles="";if(e.settings.preserveColors){compStyle=getComputedStyle(q);additionalStyles+=(compStyle&&compStyle.backgroundColor?"background-color: "+compStyle.backgroundColor+";":"");additionalStyles+=(compStyle&&compStyle.color?"color: "+compStyle.color+";":"")}var rc={rows:$(this).attr("rowspan"),cols:$(this).attr("colspan"),flag:$(q).find(e.settings.exclude)};if(rc.flag.length>0){tempRows+=" "}else{tempRows+="0){tempRows+=" rowspan='"+rc.rows+"' "}if(rc.cols>0){tempRows+=" colspan='"+rc.cols+"' "}if(additionalStyles){tempRows+=" style='"+additionalStyles+"'"}tempRows+=">"+$(q).html()+""}});tempRows+=""});if(e.settings.exclude_img){tempRows=exclude_img(tempRows)}if(e.settings.exclude_links){tempRows=exclude_links(tempRows)}if(e.settings.exclude_inputs){tempRows=exclude_inputs(tempRows)}e.tableRows.push(tempRows)});e.tableToExcel(e.tableRows,e.settings.name,e.settings.sheetName)},tableToExcel:function(table,name,sheetName){var e=this,fullTemplate="",i,link,a;e.format=function(s,c){return s.replace(/{(\w+)}/g,function(m,p){return c[p]})};sheetName=typeof sheetName==="undefined"?"Sheet":sheetName;e.ctx={worksheet:name||"Worksheet",table:table,sheetName:sheetName};fullTemplate=e.template.head;if($.isArray(table)){Object.keys(table).forEach(function(i){fullTemplate+=e.template.sheet.head+sheetName+i+e.template.sheet.tail})}fullTemplate+=e.template.mid;if($.isArray(table)){Object.keys(table).forEach(function(i){fullTemplate+=e.template.table.head+"{table"+i+"}"+e.template.table.tail})}fullTemplate+=e.template.foot;for(i in table){e.ctx["table"+i]=table[i]}delete e.ctx.table;var isIE=navigator.appVersion.indexOf("MSIE 10")!==-1||(navigator.userAgent.indexOf("Trident")!==-1&&navigator.userAgent.indexOf("rv:11")!==-1);if(isIE){if(typeof Blob!=="undefined"){fullTemplate=e.format(fullTemplate,e.ctx);fullTemplate=[fullTemplate];var blob1=new Blob(fullTemplate,{type:"text/html"});window.navigator.msSaveBlob(blob1,getFileName(e.settings))}else{txtArea1.document.open("text/html","replace");txtArea1.document.write(e.format(fullTemplate,e.ctx));txtArea1.document.close();txtArea1.focus();sa=txtArea1.document.execCommand("SaveAs",true,getFileName(e.settings))}}else{var blob=new Blob([e.format(fullTemplate,e.ctx)],{type:"application/vnd.ms-excel"});window.URL=window.URL||window.webkitURL;link=window.URL.createObjectURL(blob);a=document.createElement("a");a.download=getFileName(e.settings);a.href=link;document.body.appendChild(a);a.click();document.body.removeChild(a)}return true}};function getFileName(settings){return(settings.filename?settings.filename:"table2excel")}function exclude_img(string){var _patt=/(\s+alt\s*=\s*"([^"]*)"|\s+alt\s*=\s*'([^']*)')/i;return string.replace(/]*>/gi,function myFunction(x){var res=_patt.exec(x);if(res!==null&&res.length>=2){return res[2]}else{return""}})}function exclude_links(string){return string.replace(/]*>|<\/a>/gi,"")}function exclude_inputs(string){var _patt=/(\s+value\s*=\s*"([^"]*)"|\s+value\s*=\s*'([^']*)')/i;return string.replace(/]*>|<\/input>/gi,function myFunction(x){var res=_patt.exec(x);if(res!==null&&res.length>=2){return res[2]}else{return""}})}$.fn[pluginName]=function(options){var e=this;e.each(function(){if(!$.data(e,"plugin_"+pluginName)){$.data(e,"plugin_"+pluginName,new Plugin(this,options))}});return e}})(jQuery,window,document); \ No newline at end of file