🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
## 在对应js操作中增加如下,\yb.lan6.cn\public\assets\js\backend\yibao_recharge.js ``` {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, buttons: [ { name: 'addtabs', title: __('打印'), classname: 'btn btn-xs btn-primary btn-dialog btn-click', icon: 'fa fa-print', url: 'yibao_recharge/dayin', click: function () { layer.closeAll(); //关闭刚才打开的窗口 } }], formatter: Table.api.formatter.operate} ``` ## 对应控制器增加代码 ``` public function dayin($ids = null) { $row = $this->model->get($ids); if (!$row) { $this->error(__('No Results were found')); } $this->view->assign('row', $row); return $this->view->fetch(); } ``` ## 增加html页面 ``` <!DOCTYPE html> <html lang="zh"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <title>参保缴费</title> <!-- bootstrap - css --> <!-- <link href="__PUBLIC__/BJUI/themes/css/bootstrap.min.css" rel="stylesheet"> --> <script src="__CDN__/assets/js/jquery-1.7.2.min.js"></script> <script src="__CDN__/assets/js/jquery.PrintArea.js"></script> <style type="text/css"> *{padding:0;margin: 0;} h1{font-size: 20px;} h3{font-size: 16px;} .left{ float: left; } .right{ float:right; } .clearfix{ clear: both; } ul{list-style: none;} .print_container{ padding: 10px; width: 188px; } .section1{ } .section2 label{ display: block; } .section3 div{ display: block; width:100%; } .section4{ } .section4 .total label{ display: block; } .section4 .other_fee{ border-bottom: 1px solid #DADADA; } .section5 label{ display: block; } </style> </head> <body style="background-color:#fff;"> <!-- core - css --> <div class="container print_container" id="printArea" > <h1>参保缴费</h1> <!-- <span>**************************</span> <div class="section1"> <h3>百度外卖</h3> <h3>在线支付预约</h3> </div> <span>**************************</span> <div class="section2"> <label>期望送达时间:5678</label> <label>订单备注:1111</label> </div> --> <span>**************************</span> <div class="section3"> <div>姓名:{$row.user_name}</div> <div>身份证:{$row.idcard}</div> </div> <!-- <span>**************************</span> --> <!-- <div class="section4"> --> <span>**************************</span> <div class="other_fee"> <div class="canh"> <label class="left">参保金额:</label> <label class="right">{$row.amount}</label> <div class="clearfix"></div> </div> <div class="peis"> <label class="left">参保开始日期:</label> <label class="right">{$row.begindate}</label> <div class="clearfix"></div> </div> <div class="manj"> <label class="left">参保结束日期:</label> <label class="right">{$row.enddate}</label> <div class="clearfix"></div> </div> </div> <!-- </div> --> <span>**************************</span> </div> <!-- <div style="text-align:center;margin-top:50px;"> <button type="button" id="print_btn" class="btn btn-primary">打印</button>&nbsp; <button type="button" onclick="javascript:window.close();" class="btn">关闭</button> </div> --> <script type="text/javascript"> /** * 打印 **/ $(document).ready(function(){ window.print(); }); /* $('#print_btn').click(function(){ $('#printArea').printArea(); $(this).html('加载中 ...'); setTimeout("$('#print_btn').html('打印');",1200); });*/ </script> </body> </html> ```