master
cody 3 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,14 +64,16 @@ class CommonExport implements FromCollection
} }
// 如果有自定义数据,全部附件上去 // 如果有自定义数据,全部附件上去
$t2 = []; $t2 = [];
if (isset($info['data']) && $info['data'] && !empty($moreFileds)) { if (empty($clear)) {
$dataCollect = collect($info['data']); if (isset($info['data']) && $info['data'] && !empty($moreFileds)) {
foreach ($moreFileds as $moreFiled) { $dataCollect = collect($info['data']);
$value = ($dataCollect->where('field', $moreFiled)->first()['value']) ?? ''; foreach ($moreFileds as $moreFiled) {
if (str_contains($moreFiled, 'idcard')) { $value = ($dataCollect->where('field', $moreFiled)->first()['value']) ?? '';
$t2[$moreFiled] = ' ' . $value; if (str_contains($moreFiled, 'idcard')) {
} else { $t2[$moreFiled] = ' ' . $value;
$t2[$moreFiled] = $value; } else {
$t2[$moreFiled] = $value;
}
} }
} }
} }

Loading…
Cancel
Save