作者 董瑞恩
1 个管道 的构建 通过 耗费 0 秒

interface

@@ -183,20 +183,10 @@ class AdminEquipmentController extends AdminBaseController{ @@ -183,20 +183,10 @@ class AdminEquipmentController extends AdminBaseController{
183 } 183 }
184 } 184 }
185 185
186 - public function ceshi(){  
187 - $ids=$this->request->param('ids/a');  
188 - $data=$this->batch_export($ids);  
189 - if ($data==true){  
190 - $this->success('成功');  
191 - }else{  
192 - $this->error('失败');  
193 - }  
194 -  
195 - }  
196 -  
197 //批量导出 186 //批量导出
198 - public function batch_export($ids){  
199 - $data= Db::name('equipment')->where(['id' => ['in', $ids]])->select(); 187 + public function batch_export(){
  188 + //$ids=$this->request->param('ids');
  189 + $data= Db::name('equipment')->select();
200 // 导出Exl 190 // 导出Exl
201 vendor("VENDOR_PATH/phpoffice/phpexcel/Classes/PHPExcel"); 191 vendor("VENDOR_PATH/phpoffice/phpexcel/Classes/PHPExcel");
202 vendor("VENDOR_PATH/phpoffice/phpexcel/Classes/PHPExcel/Worksheet/Drawing"); 192 vendor("VENDOR_PATH/phpoffice/phpexcel/Classes/PHPExcel/Worksheet/Drawing");
@@ -215,12 +205,12 @@ class AdminEquipmentController extends AdminBaseController{ @@ -215,12 +205,12 @@ class AdminEquipmentController extends AdminBaseController{
215 $objPHPExcel->setActiveSheetIndex(0)->getStyle('E')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER); 205 $objPHPExcel->setActiveSheetIndex(0)->getStyle('E')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
216 $objPHPExcel->setActiveSheetIndex(0)->getStyle('F')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER); 206 $objPHPExcel->setActiveSheetIndex(0)->getStyle('F')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
217 207
218 - $objActSheet->setCellValue('A1', '商品货号');  
219 - $objActSheet->setCellValue('B1', '商品名称'); 208 + $objActSheet->setCellValue('A1', '设备锁编号');
  209 + $objActSheet->setCellValue('B1', '设备锁名称');
220 $objActSheet->setCellValue('C1', '商品图'); 210 $objActSheet->setCellValue('C1', '商品图');
221 - $objActSheet->setCellValue('D1', '商品条码');  
222 - $objActSheet->setCellValue('E1', '商品属性');  
223 - $objActSheet->setCellValue('F1', '报价(港币)'); 211 + $objActSheet->setCellValue('D1', '初始医院');
  212 + $objActSheet->setCellValue('E1', 'MAC地址');
  213 + $objActSheet->setCellValue('F1', '备注');
224 // 设置个表格宽度 214 // 设置个表格宽度
225 $objPHPExcel->getActiveSheet()->getColumnDimension('A')->setWidth(16); 215 $objPHPExcel->getActiveSheet()->getColumnDimension('A')->setWidth(16);
226 $objPHPExcel->getActiveSheet()->getColumnDimension('B')->setWidth(80); 216 $objPHPExcel->getActiveSheet()->getColumnDimension('B')->setWidth(80);
@@ -238,7 +228,7 @@ class AdminEquipmentController extends AdminBaseController{ @@ -238,7 +228,7 @@ class AdminEquipmentController extends AdminBaseController{
238 228
239 foreach($data as $k=>$v){ 229 foreach($data as $k=>$v){
240 $k +=2; 230 $k +=2;
241 - $objActSheet->setCellValue('A'.$k, $v['mac_address']); 231 + $objActSheet->setCellValue('A'.$k, $v['serial_number']);
242 $objActSheet->setCellValue('B'.$k, $v['name']); 232 $objActSheet->setCellValue('B'.$k, $v['name']);
243 233
244 $img = Db::name('equipment')->where('id',$v['id'])->find(); 234 $img = Db::name('equipment')->where('id',$v['id'])->find();
@@ -257,7 +247,7 @@ class AdminEquipmentController extends AdminBaseController{ @@ -257,7 +247,7 @@ class AdminEquipmentController extends AdminBaseController{
257 247
258 // 表格内容 248 // 表格内容
259 $objActSheet->setCellValue('D'.$k, $v['hospital']); 249 $objActSheet->setCellValue('D'.$k, $v['hospital']);
260 - $objActSheet->setCellValue('E'.$k, $v['key']); 250 + $objActSheet->setCellValue('E'.$k, $v['mac_address']);
261 $objActSheet->setCellValue('F'.$k, $v['note']); 251 $objActSheet->setCellValue('F'.$k, $v['note']);
262 252
263 // 表格高度 253 // 表格高度
@@ -265,7 +255,7 @@ class AdminEquipmentController extends AdminBaseController{ @@ -265,7 +255,7 @@ class AdminEquipmentController extends AdminBaseController{
265 255
266 } 256 }
267 257
268 - $fileName = '报价表'; 258 + $fileName = '设备信息表';
269 $date = date("Y-m-d",time()); 259 $date = date("Y-m-d",time());
270 $fileName .= "_{$date}.xls"; 260 $fileName .= "_{$date}.xls";
271 $fileName = iconv("utf-8", "gb2312", $fileName); 261 $fileName = iconv("utf-8", "gb2312", $fileName);
@@ -34,16 +34,18 @@ @@ -34,16 +34,18 @@
34 </form> 34 </form>
35 <form class="js-ajax-form" action="" method="post"> 35 <form class="js-ajax-form" action="" method="post">
36 <div class="table-actions"> 36 <div class="table-actions">
37 - <button class="btn btn-primary btn-sm js-ajax-submit" type="button" 37 + <button class="btn btn-primary btn-sm js-ajax-submit" type="submit"
38 onclick="doAdd()">新增 38 onclick="doAdd()">新增
39 </button> 39 </button>
40 <button class="btn btn-primary btn-sm js-ajax-submit" type="submit" 40 <button class="btn btn-primary btn-sm js-ajax-submit" type="submit"
41 onclick="batch_add()">批量新增 41 onclick="batch_add()">批量新增
42 </button> 42 </button>
  43 + <a class="btn btn-primary btn-sm" href="{:url('AdminEquipment/batch_export')}">批量导出
  44 + </a>
43 <!--js-ajax-submit--> 45 <!--js-ajax-submit-->
44 - <button class="btn btn-primary btn-sm js-ajax-submit" type="submit"  
45 - data-action="{:url('AdminEquipment/ceshi')}" data-subcheck="true">批量导出  
46 - </button> 46 + <!--<button class="btn btn-primary btn-sm js-ajax-submit" type="submit"-->
  47 + <!--data-action="{:url('AdminEquipment/ceshi')}" data-subcheck="true">批量导出-->
  48 + <!--</button>-->
47 </div> 49 </div>
48 <table class="table table-hover table-bordered table-list"> 50 <table class="table table-hover table-bordered table-list">
49 <thead> 51 <thead>