| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 | 
							- <?php
 
- namespace App\Admin\Exports\Person;
 
- use App\Admin\Exports\RowExport;
 
- use Illuminate\Database\Eloquent\Model;
 
- use PhpOffice\PhpSpreadsheet\Style\NumberFormat;
 
- class MemberExport extends RowExport
 
- {
 
-     /**
 
-      * 设置标题,返回标题数组
 
-      * @return array
 
-      */
 
-     public function headings(): array
 
-     {
 
-         return [
 
-             '编号',
 
-             '用户名',
 
-             '姓名',
 
-             '性别',
 
-             '身份证',
 
-             '手机号码',
 
-             '籍贯',
 
-             '所属分站',
 
-             '注册时间',
 
-         ];
 
-     }
 
-     /**
 
-      * 处理行数据
 
-      * @param Model $row
 
-      * @return array
 
-      */
 
-     public function map($row): array
 
-     {
 
-         $result['id'] = $row->id;
 
-         $result['username'] = $row->username;
 
-         $result['realname'] =  $row->memberInfo ? $row->memberInfo->realname : '';
 
-         $result['sex_cn'] = $row->memberInfo? $row->memberInfo->sex_cn : '';
 
-         if($row->memberInfo && $row->memberInfo->card_t_cn==306){
 
-             $result['id_card'] = "\t".$row->memberInfo->id_card;
 
-         }else{
 
-             $result['id_card'] = '';
 
-         }
 
-         $result['mobile'] = $row->mobile;
 
-         $result['householdaddress_cn'] = $row->memberInfo ? $row->memberInfo->householdaddress_cn : '';
 
-         $result['subsite_id'] = $row->subsite_id==0?"总站":get_subsite_sitename($row->subsite_id);
 
-         $result['created_at'] = $row->created_at;
 
-         return $result;
 
-     }
 
-     /**
 
-      * 设置文件名
 
-      * @return string
 
-      */
 
-     public function getFilename(): string
 
-     {
 
-         return "member.xlsx";
 
-     }
 
-     /**
 
-      * 格式化指定列.
 
-      * 只有在需要的时候设置,例如在身份证不要显示科学计数时设定列格式:['A'=>NumberFormat::FORMAT_NUMBER]
 
-      * @return array
 
-      */
 
-     public function columnFormats(): array
 
-     {
 
-         return [
 
-             'E'=>NumberFormat::FORMAT_NUMBER
 
-         ];
 
-     }
 
- }
 
 
  |