| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 | 
							- <?php
 
- namespace App\Admin\Exports\Content;
 
- use App\Admin\Exports\ViewExport;
 
- use Illuminate\Contracts\View\View;
 
- use Illuminate\Support\Collection;
 
- class SelectHouseExport extends ViewExport
 
- {
 
-     /**
 
-      * 设置文件名
 
-      * @return string
 
-      */
 
-     public function getFilename(): string
 
-     {
 
-         return "select_house.xlsx";
 
-     }
 
-     /**
 
-      * 渲染对应的视图
 
-      * @param Collection $data 导出的数据
 
-      * @return View
 
-      */
 
-     public function getView(Collection $data): View
 
-     {
 
-         $res = [];
 
-         foreach ($data as $row) {
 
-             $result            = [];
 
-             $result['child']   = '';
 
-             $result['id_card'] = '';
 
-             $family = empty($row->family) ? '' : json_decode($row->family, true);
 
-             if (!empty($family)) {
 
-                 $child   = [];
 
-                 $id_card = [];
 
-                 foreach ($family as $v) {
 
-                     if (strpos($v['relation'], '未成年子女') !== false) {
 
-                         $child[]   = $v['realname'];
 
-                         $id_card[] = $v['idcard'];
 
-                     }
 
-                 }
 
-                 $result['child']   = implode('/', $child);
 
-                 $result['id_card'] = implode('/', $id_card);
 
-             }
 
-             $result['register_no']   = '';
 
-             $result['mobile']        = $row->mobile;
 
-             $result['marry']         = $row->marry > 1 ? '是' : '否';
 
-             $result['select_status'] = $row->select_house_no == 999999 ? '否' : '是';
 
-             $res[] = $result;
 
-         }
 
-         return view('admin.content.export_select_house', ['data' => $res]);
 
-     }
 
- }
 
 
  |