laravel8 pdf导出

public function viewReport(Request $request, $projectId)
    {
        $this->initUser();
        $project = ProjectService::S()->getById($projectId);
        if (!$this->checkCanAccessProject($project)) {
            return ['status' => 500, 'message' => '访问错误!'];
        }
        $enterprise = EnterpriseService::S()->getById($project->eid);
        $type = $request->input('type', 'list');
        if ($type == 'list') {
            $data = ProjectReportService::S()->getListData($project);
            $str = view('pdf.ReportList', $data);
        } else if($type == 'checkSystem') {
            $data = ProjectReportService::S()->getCheckSystemData($project);
            $str = view('pdf.ReportCheckSystem', $data);
        } else if($type == 'checkList') {
            $data = ProjectReportService::S()->getCheckListData($project);
            $str = view('pdf.ReportCheckList', $data);
        }

        $waterText = $enterprise->fullName ?: $enterprise->name;
        $mpdf = new Mpdf();
        $mpdf->SetDisplayMode('fullpage');
        $mpdf->title = $project->name;
        $mpdf->autoScriptToLang = true;
        $mpdf->autoLangToFont = true;
//        $mpdf->SetProtection(array('copy','print'), 'a123456', 'a123456');

        $mpdf->SetWatermarkText($waterText,'0.1');// 添加水印
        $mpdf->showWatermarkText = true;
        $mpdf->watermark_font = 'Sun-ExtA'; // 水印字体
        $mpdf->SetHTMLHeader('
通用评估报告
'); $mpdf->SetHTMLFooter('
{PAGENO}/{nbpg}
'); $mpdf->WriteHTML($str, 2); $mpdf->Output(); return 0; }

{{$reportName}}

 

一、项目基本情况

  企业名称:{{$business->name}}

  所属行业:{{$business->industryStr}}

  业务形态:{{$business->patternStr}}

  评估对象:{{$func->name}}

  评估模板:{{$options['webConfigKV']['tpl'][$project->tpl]}}

  评估周期:{{$project->createTime}} 创建评估项目

{{$currentTime}} 报告生成

 

 

二、个人信息盘点

  盘点负责人:{{$project->managerName}}

  盘点对象:{{$func->name}}

  盘点时间:{{$process->lastTime}}

{{$func->name}}处理的个人信息数据项基本情况

@foreach($mainbodyList as $mainbody) @endforeach
个人信息主体 数据项 合计
主体名称 主体所在地 一般个人信息 敏感个人信息
{{$mainbody['name']}} {{$options['location'][$mainbody['location']]}} {{$process->mainbodyDataItems[$mainbody['id']]['commonDataItemsCount'] ?? 0}}项 @if(!empty($process->mainbodyDataItems[$mainbody['id']]['commonCats'])) @foreach($process->mainbodyDataItems[$mainbody['id']]['commonCats'] as $catId => $num) {{$templateCat[$catId]}}{{$num}}项 @endforeach @endif {{$process->mainbodyDataItems[$mainbody['id']]['senseDataItemsCount'] ?? 0}}项 @if(!empty($process->mainbodyDataItems[$mainbody['id']]['senseCats'])) @foreach($process->mainbodyDataItems[$mainbody['id']]['senseCats'] as $catId => $num) {{$templateCat[$catId]}}{{$num}}项 @endforeach @endif {{$mainbody['name']}}共计{{$process->mainbodyDataItems[$mainbody['id']]['dataItemsCount'] ?? 0}}项个人信息
合计 合计共{{$stat['count']}}类用户 分布在{{$stat['location']}}个国家/地区 共计{{$stat['common']}}项一般个人信息 共计{{$stat['sense']}}项敏感个人信息 总计{{$stat['all']}}项个人信息

 

{{$func->name}}的数据处理活动基本情况

 

  数据处理目的:{{\Util::getQuestionListData($project,70)}}

  数据处理合法性基础:{{\Util::getQuestionListData($project,100)}}

  告知形式:{{\Util::getQuestionListData($project,180)}}

@if(!empty($collect->useMethod)) @foreach($collect->useMethod as $useMethod) @endforeach @endif
数据收集 收集活动名称 收集目的 收集方式 收集频率 收集数据项
{{$useMethod['name']}} {{$useMethod['target']}} {{$useMethod['collectMethodInputSelect'] == 'select' ? $options['collectMethod'][$useMethod['collectMethod']] : $useMethod['collectMethodCustom']}} {{$useMethod['frequence']}} @foreach($useMethod['dataItem'] as $mainbodyKey => $items) {{$options['mainbodyKV'][$mainbodyKey]}}:
@foreach($items as $item) {{explode("|", $item)[0]}} @endforeach
@endforeach

 

@if(!empty($store->useMethod)) @foreach($store->useMethod as $useMethod) @endforeach @endif
数据存储 存储活动名称 存储目的 存储介质 涉及IT资产 存储期限 存储依据 存储数据项
{{$useMethod['name']}} {{$useMethod['purpose']}} {{$useMethod['storeMethodInputSelect'] == 'select' ? $options['storeMethod'][$useMethod['storeMethod']] : $useMethod['storeMethodCustom']}} {{$useMethod['assetsInputSelect'] == 'select' ? $options['assets'][$useMethod['assets']] : $useMethod['assetsCustom']}} {{$useMethod['timeLimit']}} {{$useMethod['timeLimitBase']}} @foreach($useMethod['mergedDataItem'] as $mainbodyKey => $items) {{$options['mainbodyKV'][$mainbodyKey]}}:
@foreach($items as $item) {{explode("|", $item)[0]}} @endforeach
@endforeach

 

@if(!empty($use['useMethod'])) @foreach($use['useMethod'] as $useMethod) @endforeach @endif
数据使用 使用活动名称 使用目的 使用者类型 使用者所在地 使用方式 使用数据项
{{$useMethod['name']}} {{$useMethod['purpose']}} {{$useMethod['useSideInputSelect'] == 'select' ? $options['useSide'][$useMethod['useSide']] : $useMethod['useSideCustom']}} {{$options['location'][$useMethod['location']]}} {{$useMethod['useMethodInputSelect'] == 'select' ? $options['useMethod'][$useMethod['useMethod']] : $useMethod['useMethodCustom']}} @foreach($useMethod['mergedDataItem'] as $mainbodyKey => $items) {{$options['mainbodyKV'][$mainbodyKey]}}:
@foreach($items as $item) {{explode("|", $item)[0]}} @endforeach
@endforeach

 

@if(!empty($transfer->useMethod)) @foreach($transfer->useMethod as $useMethod) @endforeach @endif
数据转移/披露 转移/披露活动名称 转移/披露目的 转移/披露方式 数据传输方式 受托方/接收方类型 转移/披露数据项
{{$useMethod['name']}} {{$useMethod['purpose']}} {{$useMethod['transferMethodInputSelect'] == 'select' ? $options['transferMethod'][$useMethod['transferMethod']] : $useMethod['transferMethodCustom']}} {{$useMethod['dataTransferMethodInputSelect'] == 'select' ? $options['dataTransferMethod'][$useMethod['dataTransferMethod']] : $useMethod['dataTransferMethodCustom']}} {{$useMethod['entityInputSelect'] == 'select' ? $options['entity'][$useMethod['entity']] : $useMethod['entityCustom']}} @foreach($useMethod['mergedDataItem'] as $mainbodyKey => $items) {{$options['mainbodyKV'][$mainbodyKey]}}:
@foreach($items as $item) {{explode("|", $item)[0]}} @endforeach
@endforeach

 

@if(!empty($handle->useMethod)) @foreach($handle->useMethod as $useMethod) @endforeach @endif
数据处置 处置活动名称 处置方式 处置数据项
{{$useMethod['name']}} {{$useMethod['handleMethodInputSelect'] == 'select' ? $options['handleMethod'][$useMethod['handleMethod']] : $useMethod['handleMethodCustom']}} @foreach($useMethod['mergedDataItem'] as $mainbodyKey => $items) {{$options['mainbodyKV'][$mainbodyKey]}}:
@foreach($items as $item) {{explode("|", $item)[0]}} @endforeach
@endforeach

 

@if($crossUseMethods) @foreach($crossUseMethods as $useMethod) @endforeach
数据出境 出境活动名称 出境目的 境外接收主体 出境国家/地区 出境数据项
{{$useMethod['name']}} {{$useMethod['purpose']}} @if($useMethod['tableType'] == 'store') {{$options['assets'][$useMethod['assets']]}} @elseif($useMethod['tableType'] == 'use') {{$useMethod['useSideInputSelect'] == 'select' ? $options['useSide'][$useMethod['useSide']] : $useMethod['useSideCustom']}} @elseif($useMethod['tableType'] == 'transfer') {{$options['entity'][$useMethod['entity']]}} @endif {{$options['location'][$useMethod['location']]}} @foreach($useMethod['mergedDataItem'] as $mainbodyKey => $items) {{$options['mainbodyKV'][$mainbodyKey]}}:
@foreach($items as $item) {{explode("|", $item)[0]}} @endforeach
@endforeach
@endif

你可能感兴趣的:(pdf导出)