master
cody 3 months ago
parent 7679d07dd4
commit abfa5e6456

@ -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;
}
}
}
}

Loading…
Cancel
Save