Commit 71927fdf by wenyi.chen

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

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