123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596 |
- <?php
- /**
- * Created by PhpStorm.
- * User: Administrator
- * Date: 2019/4/13
- * Time: 10:29
- */
- namespace App\Admin\Exports\Jobfairout;
- use App\Admin\Exports\RowExport;
- use PhpOffice\PhpSpreadsheet\Style\NumberFormat;
- class PutJobsExport extends RowExport
- {
- /**
- * 设置标题,返回标题数组
- * @return array
- */
- public function headings(): array
- {
- if(get_subsite_open()) {
- return [
- '职位名称',
- '发布公司',
- '招聘会标题',
- '招聘人数',
- '工作地区',
- '所属分站',
- '性别',
- '年龄',
- '学历',
- '工资',
- '报名时间',
- ];
- }else {
- return [
- '职位名称',
- '发布公司',
- '招聘会标题',
- '招聘人数',
- '工作地区',
- '性别',
- '年龄',
- '学历',
- '工资',
- '报名时间',
- ];
- }
- }
- /**
- * 处理行数据
- * @param Model $row
- * @return array
- */
- public function map($row): array
- {
- $result['jobs_name'] = $row->jobs_name;
- $result['company_name'] = $row->company_name;
- $result['title'] = $row->jobfairs->title;
- $result['amount'] = empty($row->amount) ? '若干': $row->amount;$row->amount;
- $result['district_cn'] = empty($row->district_cn) ? '不限': $row->district_cn;$row->district_cn;
- if(get_subsite_open()) {
- $result['subsite'] = empty($row->jobfairs->sitename->sitename) ? '总站': $row->jobfairs->sitename->sitename;
- }
- $result['sex'] = empty($row->sex_cn) ? '不限': $row->sex_cn;
- $result['age'] = $row->age == '-'|| empty($row->age) ? '不限' :$row->age;
- $result['education'] = empty($row->education_cn) ? '不限': $row->education_cn;
- $result['wage_cn'] = empty($row->wage_cn) ? '不限': $row->wage_cn;
- $result['created_at'] = $row->created_at;
- return $result;
- }
- /**
- * 设置文件名
- * @return string
- */
- public function getFilename(): string
- {
- return "jobfairout_put_jobs.xlsx";
- }
- /**
- * 格式化指定列.
- * 只有在需要的时候设置,例如在身份证不要显示科学计数时设定列格式:['A'=>NumberFormat::FORMAT_NUMBER]
- * @return array
- */
- public function columnFormats(): array
- {
- return [
- ];
- }
- }
|