diff --git a/app/Exports/CommonExport.php b/app/Exports/CommonExport.php index 1c982ff..b7f9104 100755 --- a/app/Exports/CommonExport.php +++ b/app/Exports/CommonExport.php @@ -396,12 +396,11 @@ class CommonExport implements FromCollection, WithStyles, WithColumnWidths, With $header = array_values($this->fields); $moreFileds = []; if (empty($clear)) { - // 容错,取前三个数据 - $otherData = ($this->data[0]['data'] ?? null); - if (empty($otherData)) { - $otherData = ($this->data[1]['data'] ?? null); - if (empty($otherData)) { - $otherData = ($this->data[2]['data'] ?? null); + // 容错,取数据不是空的数组 + foreach ($this->data as $value) { + if (!empty($value['data'])) { + $otherData = $value['data']; + break; } }