master
cody 4 months ago
parent 7679d07dd4
commit abfa5e6456

@ -29,6 +29,7 @@ class CommonExport implements FromCollection
*/ */
public function collection() public function collection()
{ {
$clear = request('clear', 0);
if (empty($this->fields)) { if (empty($this->fields)) {
throw new ErrorException('导出字段不能为空'); throw new ErrorException('导出字段不能为空');
} }
@ -63,6 +64,7 @@ class CommonExport implements FromCollection
} }
// 如果有自定义数据,全部附件上去 // 如果有自定义数据,全部附件上去
$t2 = []; $t2 = [];
if (empty($clear)) {
if (isset($info['data']) && $info['data'] && !empty($moreFileds)) { if (isset($info['data']) && $info['data'] && !empty($moreFileds)) {
$dataCollect = collect($info['data']); $dataCollect = collect($info['data']);
foreach ($moreFileds as $moreFiled) { foreach ($moreFileds as $moreFiled) {
@ -74,6 +76,7 @@ class CommonExport implements FromCollection
} }
} }
} }
}
$newList[] = $temp + $t2; $newList[] = $temp + $t2;
} }
array_unshift($newList, $header); //插入表头 array_unshift($newList, $header); //插入表头

Loading…
Cancel
Save