diff --git a/app/Exports/CommonExport.php b/app/Exports/CommonExport.php index 8cc6906..b0d9c4d 100755 --- a/app/Exports/CommonExport.php +++ b/app/Exports/CommonExport.php @@ -29,6 +29,7 @@ class CommonExport implements FromCollection */ public function collection() { + $clear = request('clear', 0); if (empty($this->fields)) { throw new ErrorException('导出字段不能为空'); } @@ -63,14 +64,16 @@ class CommonExport implements FromCollection } // 如果有自定义数据,全部附件上去 $t2 = []; - if (isset($info['data']) && $info['data'] && !empty($moreFileds)) { - $dataCollect = collect($info['data']); - foreach ($moreFileds as $moreFiled) { - $value = ($dataCollect->where('field', $moreFiled)->first()['value']) ?? ''; - if (str_contains($moreFiled, 'idcard')) { - $t2[$moreFiled] = ' ' . $value; - } else { - $t2[$moreFiled] = $value; + if (empty($clear)) { + if (isset($info['data']) && $info['data'] && !empty($moreFileds)) { + $dataCollect = collect($info['data']); + foreach ($moreFileds as $moreFiled) { + $value = ($dataCollect->where('field', $moreFiled)->first()['value']) ?? ''; + if (str_contains($moreFiled, 'idcard')) { + $t2[$moreFiled] = ' ' . $value; + } else { + $t2[$moreFiled] = $value; + } } } }