...
|
...
|
@@ -183,20 +183,10 @@ class AdminEquipmentController extends AdminBaseController{ |
|
|
}
|
|
|
}
|
|
|
|
|
|
public function ceshi(){
|
|
|
$ids=$this->request->param('ids/a');
|
|
|
$data=$this->batch_export($ids);
|
|
|
if ($data==true){
|
|
|
$this->success('成功');
|
|
|
}else{
|
|
|
$this->error('失败');
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
//批量导出
|
|
|
public function batch_export($ids){
|
|
|
$data= Db::name('equipment')->where(['id' => ['in', $ids]])->select();
|
|
|
public function batch_export(){
|
|
|
//$ids=$this->request->param('ids');
|
|
|
$data= Db::name('equipment')->select();
|
|
|
// 导出Exl
|
|
|
vendor("VENDOR_PATH/phpoffice/phpexcel/Classes/PHPExcel");
|
|
|
vendor("VENDOR_PATH/phpoffice/phpexcel/Classes/PHPExcel/Worksheet/Drawing");
|
...
|
...
|
@@ -215,12 +205,12 @@ class AdminEquipmentController extends AdminBaseController{ |
|
|
$objPHPExcel->setActiveSheetIndex(0)->getStyle('E')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
|
|
|
$objPHPExcel->setActiveSheetIndex(0)->getStyle('F')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
|
|
|
|
|
|
$objActSheet->setCellValue('A1', '商品货号');
|
|
|
$objActSheet->setCellValue('B1', '商品名称');
|
|
|
$objActSheet->setCellValue('A1', '设备锁编号');
|
|
|
$objActSheet->setCellValue('B1', '设备锁名称');
|
|
|
$objActSheet->setCellValue('C1', '商品图');
|
|
|
$objActSheet->setCellValue('D1', '商品条码');
|
|
|
$objActSheet->setCellValue('E1', '商品属性');
|
|
|
$objActSheet->setCellValue('F1', '报价(港币)');
|
|
|
$objActSheet->setCellValue('D1', '初始医院');
|
|
|
$objActSheet->setCellValue('E1', 'MAC地址');
|
|
|
$objActSheet->setCellValue('F1', '备注');
|
|
|
// 设置个表格宽度
|
|
|
$objPHPExcel->getActiveSheet()->getColumnDimension('A')->setWidth(16);
|
|
|
$objPHPExcel->getActiveSheet()->getColumnDimension('B')->setWidth(80);
|
...
|
...
|
@@ -238,7 +228,7 @@ class AdminEquipmentController extends AdminBaseController{ |
|
|
|
|
|
foreach($data as $k=>$v){
|
|
|
$k +=2;
|
|
|
$objActSheet->setCellValue('A'.$k, $v['mac_address']);
|
|
|
$objActSheet->setCellValue('A'.$k, $v['serial_number']);
|
|
|
$objActSheet->setCellValue('B'.$k, $v['name']);
|
|
|
|
|
|
$img = Db::name('equipment')->where('id',$v['id'])->find();
|
...
|
...
|
@@ -257,7 +247,7 @@ class AdminEquipmentController extends AdminBaseController{ |
|
|
|
|
|
// 表格内容
|
|
|
$objActSheet->setCellValue('D'.$k, $v['hospital']);
|
|
|
$objActSheet->setCellValue('E'.$k, $v['key']);
|
|
|
$objActSheet->setCellValue('E'.$k, $v['mac_address']);
|
|
|
$objActSheet->setCellValue('F'.$k, $v['note']);
|
|
|
|
|
|
// 表格高度
|
...
|
...
|
@@ -265,7 +255,7 @@ class AdminEquipmentController extends AdminBaseController{ |
|
|
|
|
|
}
|
|
|
|
|
|
$fileName = '报价表';
|
|
|
$fileName = '设备信息表';
|
|
|
$date = date("Y-m-d",time());
|
|
|
$fileName .= "_{$date}.xls";
|
|
|
$fileName = iconv("utf-8", "gb2312", $fileName);
|
...
|
...
|
|