123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107 |
- <?php
- namespace App\Admin\Exports\Person;
- use App\Admin\Exports\RowExport;
- class ResumeExport extends RowExport
- {
- /**
- * 设置标题,返回标题数组
- * @return array
- */
- public function headings(): array
- {
- return [
- '编号',
- '姓名',
- '简历名称',
- '公开设置',
- '简历完整度',
- '审核状态',
- '性别',
- '年龄',
- '现居地',
- '户籍',
- '婚姻状况',
- '工作经验',
- '期望岗位性质',
- '期望职位',
- '期望工作地点',
- '期望月薪',
- '最高学历',
- '毕业院校',
- '专业',
- '电话',
- '邮箱',
- '创建时间',
- '最后更新时间'
- ];
- }
- /**
- * 处理行数据
- * @param Model $row
- * @return array
- */
- public function map($row): array
- {
- $result['id'] = $row->id;
- $result['realname'] = $row->memberInfos ? $row->memberInfos->realname : '';
- $result['title'] = $row->title;
- $result['display'] = $row->display ? '公开' : '保密';
- $result['complete_percent'] = $row->complete_percent.'%';
- if($row->audit==0){
- $audit = '审核未通过';
- }elseif ($row->audit==2){
- $audit = '审核通过';
- }else{
- $audit = '等待审核';
- }
- $result['audit'] = $audit;
- $result['sex_cn'] = $row->memberInfos ? $row->memberInfos->sex_cn : '';
- $birthday = '';
- if($row->memberInfos){
- $birthday = date('Y')-$row->memberInfos->birthday;
- }
- $result['birthday'] = $birthday;
- $result['residence_cn'] = $row->memberInfos ? $row->memberInfos->residence_cn : '';
- $result['householdaddress_cn'] = $row->memberInfos ? $row->memberInfos->householdaddress_cn : '';
- $result['marriage_cn'] = $row->memberInfos ? $row->memberInfos->marriage_cn : '';
- $result['experience_cn'] = $row->memberInfos ? $row->memberInfos->experience_cn : '';
- $result['nature_cn'] = $row->nature_cn;
- $result['intention_jobs'] = $row->intention_jobs;
- $result['district_cn'] = $row->district_cn;
- $result['wage_cn'] = $row->wage_cn;
- $result['education_cn'] = $row->memberInfos ? $row->memberInfos->education_cn : '';
- $education = $row->resumeEducation()->orderByRaw('startyear desc, startmonth desc')->first();
- $result['school'] = $education ? $education->school : '';
- $result['major_cn'] = $row->memberInfos ? $row->memberInfos->major_cn : '';
- $result['phone'] = $row->memberInfos ? $row->memberInfos->phone : '';
- $result['email'] = $row->memberInfos ? $row->memberInfos->email : '';
- $result['created_at'] = $row->created_at;
- $result['updated_at'] = $row->updated_at;
- return $result;
- }
- /**
- * 设置文件名
- * @return string
- */
- public function getFilename(): string
- {
- return "resume.xlsx";
- }
- /**
- * 格式化指定列.
- * 只有在需要的时候设置,例如在身份证不要显示科学计数时设定列格式:['A'=>NumberFormat::FORMAT_NUMBER]
- * @return array
- */
- public function columnFormats(): array
- {
- return [
- ];
- }
- }
|