Commit 71927fdf by wenyi.chen

完成批量导入批量导出,pdf多文件列表

parent 7f9a4c95
...@@ -51,6 +51,7 @@ class ExcelFile extends BaseController ...@@ -51,6 +51,7 @@ class ExcelFile extends BaseController
$title = $data[0]; // 表格标题 $title = $data[0]; // 表格标题
$imgIndex = 0; // 读取的图片当前下标 $imgIndex = 0; // 读取的图片当前下标
foreach ($data as $index=>$value){ foreach ($data as $index=>$value){
$value = str_replace(array("\r\n", "\r", "\n"), '', $value);
$num++; $num++;
if($index>0){ if($index>0){
$current = 0; // 当前读取到的下标位置,取一次加1 $current = 0; // 当前读取到的下标位置,取一次加1
...@@ -106,8 +107,9 @@ class ExcelFile extends BaseController ...@@ -106,8 +107,9 @@ class ExcelFile extends BaseController
if($value[$current]){ if($value[$current]){
$str = []; $str = [];
$ex = explode(",",$value[$current]); $ex = explode(",",$value[$current]);
$time = date("YmdHis");
foreach ($ex as $va){ foreach ($ex as $va){
array_push($str,config("config.resource_address").'/public/storage/import_pdf/'.$va); array_push($str,config("config.resource_address").'/public/storage/import_pdf/'.$time.'/'.$va);
} }
$arr['fileListPdf'] = implode(',',$str); $arr['fileListPdf'] = implode(',',$str);
}else{ }else{
...@@ -347,6 +349,7 @@ class ExcelFile extends BaseController ...@@ -347,6 +349,7 @@ class ExcelFile extends BaseController
'norm_id'=>$norm_id, 'norm_id'=>$norm_id,
'user_id'=>$user_id, 'user_id'=>$user_id,
'status'=>4, 'status'=>4,
'show'=>1,
'time'=>date('Y-m-d H:i:s'), 'time'=>date('Y-m-d H:i:s'),
'review_time'=>date('Y-m-d H:i:s'), 'review_time'=>date('Y-m-d H:i:s'),
'not_collectible'=>$value['not_collectible'], 'not_collectible'=>$value['not_collectible'],
...@@ -465,15 +468,19 @@ class ExcelFile extends BaseController ...@@ -465,15 +468,19 @@ class ExcelFile extends BaseController
$sheet = ['title'=>$value['name'],'data'=>[]]; $sheet = ['title'=>$value['name'],'data'=>[]];
$normList = Db::table('norm_list')->where('norm_id', $value['id'])->select(); $normList = Db::table('norm_list')->where('norm_id', $value['id'])->select();
foreach ($normList as $index=> $val){ foreach ($normList as $index=> $val){
$normReceives = Db::table('norm_receives')->where('norm_list_id', $val['id'])->find(); $normReceives = Db::table('norm_receives')->where('norm_list_id', $val['id'])->where('show',1)->where('status',3)->find();
$normCollects = Db::table('norm_collects')->where('norm_list_id', $val['id'])->find(); if(empty($normReceives)){
$referType = '/'; // 信源类型 $normCollects = [];
$imgPath = '/'; // 图片 }else{
$remark = '/'; $normCollects = Db::table('norm_collects')->where('norm_list_id', $val['id'])->where('norm_collects_id',$normReceives['id'])->find();
}
$referType = ''; // 信源类型
$imgPath = ''; // 图片
$remark = '';
$normCollectsId = ''; $normCollectsId = '';
$not_collectible = '/'; $not_collectible = '';
$not_collectible_remarks='/'; $not_collectible_remarks='';
$reviewStatus='/'; $reviewStatus='';
// 填写内容 // 填写内容
if ($normCollects){ if ($normCollects){
if($normCollects['refer_type']==1){ if($normCollects['refer_type']==1){
...@@ -510,14 +517,12 @@ class ExcelFile extends BaseController ...@@ -510,14 +517,12 @@ class ExcelFile extends BaseController
}else if($normReceives['status']==4){ }else if($normReceives['status']==4){
$reviewStatus = '已经结算'; $reviewStatus = '已经结算';
}else{ }else{
$reviewStatus = '/'; $reviewStatus = '未领取';
} }
} }
// 难度等级 // 难度等级
if(isset($val['level'])){ if(isset($val['level'])){
$val['level'] =$val['level'].'级'; $val['level'] =$val['level'].'级';
}else{
$val['level'] ='/';
} }
if(isset($val['sort'])){ if(isset($val['sort'])){
if ($val['sort'] ==1){ if ($val['sort'] ==1){
...@@ -527,8 +532,6 @@ class ExcelFile extends BaseController ...@@ -527,8 +532,6 @@ class ExcelFile extends BaseController
}else{ }else{
$val['sort'] ='高'; $val['sort'] ='高';
} }
}else{
$val['sort'] ='/';
} }
$data = [ $data = [
'norm'=>$value['name'], 'norm'=>$value['name'],
...@@ -579,7 +582,7 @@ class ExcelFile extends BaseController ...@@ -579,7 +582,7 @@ class ExcelFile extends BaseController
} }
// 保存 ExcelFile 文件 // 保存 ExcelFile 文件
$writer = new Xlsx($spreadsheet); $writer = new Xlsx($spreadsheet);
$name = 'storage/xlsx/'.$task['name'].'_'.date('YmdHis').'.xlsx'; $name = './storage/xlsx/'.$task['name'].'_'.date('YmdHis').'.xlsx';
$writer->save($name); $writer->save($name);
// header('Content-Type: application/vnd.ms-excel'); // header('Content-Type: application/vnd.ms-excel');
...@@ -616,15 +619,19 @@ class ExcelFile extends BaseController ...@@ -616,15 +619,19 @@ class ExcelFile extends BaseController
$sheet = ['title'=>$norm['name'],'data'=>[]]; $sheet = ['title'=>$norm['name'],'data'=>[]];
$normList = Db::table('norm_list')->where('norm_id', $norm['id'])->select(); $normList = Db::table('norm_list')->where('norm_id', $norm['id'])->select();
foreach ($normList as $index=> $val){ foreach ($normList as $index=> $val){
$normReceives = Db::table('norm_receives')->where('norm_list_id', $val['id'])->find(); $normReceives = Db::table('norm_receives')->where('norm_list_id', $val['id'])->where('show',1)->where('status',3)->find();
$normCollects = Db::table('norm_collects')->where('norm_list_id', $val['id'])->find(); if(empty($normReceives)){
$referType = '/'; // 信源类型 $normCollects = [];
$imgPath = '/'; // 图片 }else{
$remark = '/'; $normCollects = Db::table('norm_collects')->where('norm_list_id', $val['id'])->where('norm_collects_id',$normReceives['id'])->find();
}
$referType = ''; // 信源类型
$imgPath = ''; // 图片
$remark = '';
$normCollectsId = ''; $normCollectsId = '';
$not_collectible = '/'; $not_collectible = '';
$not_collectible_remarks='/'; $not_collectible_remarks='';
$reviewStatus='/'; $reviewStatus='';
// 填写内容 // 填写内容
if ($normCollects){ if ($normCollects){
if($normCollects['refer_type']==1){ if($normCollects['refer_type']==1){
...@@ -660,16 +667,13 @@ class ExcelFile extends BaseController ...@@ -660,16 +667,13 @@ class ExcelFile extends BaseController
$reviewStatus = '审核通过'; $reviewStatus = '审核通过';
}else if($normReceives['status']==4){ }else if($normReceives['status']==4){
$reviewStatus = '已经结算'; $reviewStatus = '已经结算';
}else{
$reviewStatus = '/';
} }
} }
// 难度等级 // 难度等级
if(isset($val['level'])){ if(isset($val['level'])){
$val['level'] =$val['level'].'级'; $val['level'] =$val['level'].'级';
}else{
$val['level'] ='/';
} }
// 优先级
if(isset($val['sort'])){ if(isset($val['sort'])){
if ($val['sort'] ==1){ if ($val['sort'] ==1){
$val['sort'] ='低'; $val['sort'] ='低';
...@@ -678,8 +682,6 @@ class ExcelFile extends BaseController ...@@ -678,8 +682,6 @@ class ExcelFile extends BaseController
}else{ }else{
$val['sort'] ='高'; $val['sort'] ='高';
} }
}else{
$val['sort'] ='/';
} }
$data = [ $data = [
'norm'=>$norm['name'], 'norm'=>$norm['name'],
...@@ -716,7 +718,7 @@ class ExcelFile extends BaseController ...@@ -716,7 +718,7 @@ class ExcelFile extends BaseController
}else{ }else{
$normExtendInfo = Db::table('norm_extend')->where('norm_id', $norm['id'])->where('user_filled', 1)->select(); $normExtendInfo = Db::table('norm_extend')->where('norm_id', $norm['id'])->where('user_filled', 1)->select();
foreach ($normExtendInfo as $normExtendInfoValue){ foreach ($normExtendInfo as $normExtendInfoValue){
$arr = ['name'=>$normExtendInfoValue['extend_name'],'value'=>$normExtendInfoValue['extend_value']?$normExtendInfoValue['extend_value']:'/']; $arr = ['name'=>$normExtendInfoValue['extend_name'],'value'=>$normExtendInfoValue['extend_value']];
array_push($data['user'],$arr); array_push($data['user'],$arr);
} }
} }
...@@ -733,7 +735,7 @@ class ExcelFile extends BaseController ...@@ -733,7 +735,7 @@ class ExcelFile extends BaseController
} }
// 保存 ExcelFile 文件 // 保存 ExcelFile 文件
$writer = new Xlsx($spreadsheet); $writer = new Xlsx($spreadsheet);
$name = 'storage/xlsx/'.$norm['name'].'_'.date('YmdHis').'.xlsx'; $name = './storage/xlsx/'.$norm['name'].'_'.date('YmdHis').'.xlsx';
$writer->save($name); $writer->save($name);
return returnResult(config("config.code.success"),config("config.describe.success"),config("config.resource_address").'public/'.$name); return returnResult(config("config.code.success"),config("config.describe.success"),config("config.resource_address").'public/'.$name);
}else{ }else{
...@@ -767,15 +769,19 @@ class ExcelFile extends BaseController ...@@ -767,15 +769,19 @@ class ExcelFile extends BaseController
$sheet = ['title'=>$value['name'],'data'=>[]]; $sheet = ['title'=>$value['name'],'data'=>[]];
$normList = Db::table('norm_list')->where('norm_id', $value['id'])->select(); $normList = Db::table('norm_list')->where('norm_id', $value['id'])->select();
foreach ($normList as $index=> $val){ foreach ($normList as $index=> $val){
$normReceives = Db::table('norm_receives')->where('norm_list_id', $val['id'])->find(); $normReceives = Db::table('norm_receives')->where('norm_list_id', $val['id'])->where('show',1)->where('status',3)->find();
$normCollects = Db::table('norm_collects')->where('norm_list_id', $val['id'])->find(); if(empty($normReceives)){
$referType = '/'; // 信源类型 $normCollects = [];
$imgPath = '/'; // 图片 }else{
$remark = '/'; $normCollects = Db::table('norm_collects')->where('norm_list_id', $val['id'])->where('norm_collects_id',$normReceives['id'])->find();
}
$referType = ''; // 信源类型
$imgPath = ''; // 图片
$remark = '';
$normCollectsId = ''; $normCollectsId = '';
$not_collectible = '/'; $not_collectible = '';
$not_collectible_remarks='/'; $not_collectible_remarks='';
$reviewStatus='/'; $reviewStatus='';
// 填写内容 // 填写内容
if ($normCollects){ if ($normCollects){
if($normCollects['refer_type']==1){ if($normCollects['refer_type']==1){
...@@ -811,15 +817,11 @@ class ExcelFile extends BaseController ...@@ -811,15 +817,11 @@ class ExcelFile extends BaseController
$reviewStatus = '审核通过'; $reviewStatus = '审核通过';
}else if($normReceives['status']==4){ }else if($normReceives['status']==4){
$reviewStatus = '已经结算'; $reviewStatus = '已经结算';
}else{
$reviewStatus = '/';
} }
} }
// 难度等级 // 难度等级
if(isset($val['level'])){ if(isset($val['level'])){
$val['level'] =$val['level'].'级'; $val['level'] =$val['level'].'级';
}else{
$val['level'] ='/';
} }
if(isset($val['sort'])){ if(isset($val['sort'])){
if ($val['sort'] ==1){ if ($val['sort'] ==1){
...@@ -829,8 +831,6 @@ class ExcelFile extends BaseController ...@@ -829,8 +831,6 @@ class ExcelFile extends BaseController
}else{ }else{
$val['sort'] ='高'; $val['sort'] ='高';
} }
}else{
$val['sort'] ='/';
} }
$data = [ $data = [
'norm'=>$value['name'], 'norm'=>$value['name'],
...@@ -881,7 +881,7 @@ class ExcelFile extends BaseController ...@@ -881,7 +881,7 @@ class ExcelFile extends BaseController
} }
// 保存 ExcelFile 文件 // 保存 ExcelFile 文件
$writer = new Xlsx($spreadsheet); $writer = new Xlsx($spreadsheet);
$name = 'storage/xlsx/多选子任务导出_'.date('YmdHis').'.xlsx'; $name = './storage/xlsx/多选子任务导出_'.date('YmdHis').'.xlsx';
$writer->save($name); $writer->save($name);
// header('Content-Type: application/vnd.ms-excel'); // header('Content-Type: application/vnd.ms-excel');
...@@ -897,6 +897,7 @@ class ExcelFile extends BaseController ...@@ -897,6 +897,7 @@ class ExcelFile extends BaseController
exception($e,'ExcelFile.multipleExportFile'); exception($e,'ExcelFile.multipleExportFile');
} }
} }
/** /**
* 格式化单页表格数据 * 格式化单页表格数据
* @param $spreadsheet * @param $spreadsheet
...@@ -1014,7 +1015,7 @@ class ExcelFile extends BaseController ...@@ -1014,7 +1015,7 @@ class ExcelFile extends BaseController
$sheet->getRowDimension($row)->setRowHeight(80); // 设置第n行的高度为30 $sheet->getRowDimension($row)->setRowHeight(80); // 设置第n行的高度为30
$sheet->getColumnDimension($column[$num+$position])->setWidth(30); // 设置A列的宽度为20 $sheet->getColumnDimension($column[$num+$position])->setWidth(30); // 设置A列的宽度为20
if($title[$position]=='图片'){ if($title[$position]=='图片'){
if($value['imgPath'] != "无" && $value['imgPath'] != "/"){ if($value['imgPath'] != "无" && $value['imgPath'] != "/"&& $value['imgPath'] != ""){
// 创建一个 Drawing 对象,并设置图片的路径 // 创建一个 Drawing 对象,并设置图片的路径
$drawing = new Drawing(); $drawing = new Drawing();
$drawing->setName('Sample Image'); $drawing->setName('Sample Image');
...@@ -1042,7 +1043,7 @@ class ExcelFile extends BaseController ...@@ -1042,7 +1043,7 @@ class ExcelFile extends BaseController
$sheet->setCellValue($column[$num+$position].$row, '/'); $sheet->setCellValue($column[$num+$position].$row, '/');
$position++; $position++;
} }
if($value['imgPath'] != "无" && $value['imgPath'] != "/"){ if($value['imgPath'] != "无" && $value['imgPath'] != "/"&& $value['imgPath'] != ""){
// 创建一个 Drawing 对象,并设置图片的路径 // 创建一个 Drawing 对象,并设置图片的路径
$drawing = new Drawing(); $drawing = new Drawing();
$drawing->setName('Sample Image'); $drawing->setName('Sample Image');
...@@ -1088,7 +1089,12 @@ class ExcelFile extends BaseController ...@@ -1088,7 +1089,12 @@ class ExcelFile extends BaseController
exception($e,'ExcelFile.exportFile'); exception($e,'ExcelFile.exportFile');
} }
} }
// 求$col 的下一个列号
/**
* 表格列
* @param $col
* @return string
*/
public function excelColPlus($col) public function excelColPlus($col)
{ {
//先转化成27进制数字 //先转化成27进制数字
......
...@@ -269,8 +269,8 @@ class Norm ...@@ -269,8 +269,8 @@ class Norm
$data['receivesList'][$index]['refer_type'] = ''; $data['receivesList'][$index]['refer_type'] = '';
$data['receivesList'][$index]['remark'] = ''; $data['receivesList'][$index]['remark'] = '';
$data['receivesList'][$index]['imgPath'] = ''; $data['receivesList'][$index]['imgPath'] = '';
$data['receivesList'][$index]['fileListPdf'] = $collectsInfo['fileListPdf']; $data['receivesList'][$index]['fileListPdf'] = '';
$data['receivesList'][$index]['file_name'] = $collectsInfo['file_name']; $data['receivesList'][$index]['file_name'] ='';
$data['receivesList'][$index]['normCollectsExtend'] =$res; $data['receivesList'][$index]['normCollectsExtend'] =$res;
} }
} }
...@@ -322,6 +322,7 @@ class Norm ...@@ -322,6 +322,7 @@ class Norm
$data['receivesList'][$index]['norm_list_extend'] = $NormListExtendBus->getConditionalQueryAll(['norm_list_id'=>$vlues['norm_list_id']]); $data['receivesList'][$index]['norm_list_extend'] = $NormListExtendBus->getConditionalQueryAll(['norm_list_id'=>$vlues['norm_list_id']]);
$NormCollectsBus = new CommonBus('NormCollectsBus'); // 通过公共业务初始化指标类 $NormCollectsBus = new CommonBus('NormCollectsBus'); // 通过公共业务初始化指标类
$collectsInfo = $NormCollectsBus->getConditionalQuery(['norm_receive_id'=>$vlues['id']]); $collectsInfo = $NormCollectsBus->getConditionalQuery(['norm_receive_id'=>$vlues['id']]);
// 用户没有填写信息
if ($collectsInfo){ if ($collectsInfo){
$NormCollectsExtendBus = new CommonBus('NormCollectsExtendBus'); // 通过公共业务初始化指标类 $NormCollectsExtendBus = new CommonBus('NormCollectsExtendBus'); // 通过公共业务初始化指标类
$normCollectsExtend = $NormCollectsExtendBus->getConditionalQueryAll(['norm_collects_id'=>$collectsInfo['id']]); $normCollectsExtend = $NormCollectsExtendBus->getConditionalQueryAll(['norm_collects_id'=>$collectsInfo['id']]);
...@@ -337,8 +338,8 @@ class Norm ...@@ -337,8 +338,8 @@ class Norm
$data['receivesList'][$index]['refer_type'] = ''; $data['receivesList'][$index]['refer_type'] = '';
$data['receivesList'][$index]['remark'] = ''; $data['receivesList'][$index]['remark'] = '';
$data['receivesList'][$index]['imgPath'] = ''; $data['receivesList'][$index]['imgPath'] = '';
$data['receivesList'][$index]['fileListPdf'] = $collectsInfo['fileListPdf']; $data['receivesList'][$index]['fileListPdf'] = '';
$data['receivesList'][$index]['file_name'] = $collectsInfo['file_name']; $data['receivesList'][$index]['file_name'] = '';
$data['receivesList'][$index]['normCollectsExtend'] =$res; $data['receivesList'][$index]['normCollectsExtend'] =$res;
} }
} }
......
...@@ -349,7 +349,7 @@ class NormCollects extends AuthBase ...@@ -349,7 +349,7 @@ class NormCollects extends AuthBase
} }
/** /**
* 数据保存 * 获取用户保存的数据
* @return void * @return void
*/ */
public function getPreserve() public function getPreserve()
...@@ -363,4 +363,9 @@ class NormCollects extends AuthBase ...@@ -363,4 +363,9 @@ class NormCollects extends AuthBase
exception($e,'NormCollects.getPreserve'); exception($e,'NormCollects.getPreserve');
} }
} }
public function getPdfList()
{
}
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment