fileName = $this->fileName.'_'.time().'.xlsx';//拼接下载文件名称 $this->titles = [ 'sfzh'=>'身份证', 'xh'=>'学号', 'xm'=>'姓名', 'annual_session'=>'年份', 'fylx'=>'费用类型', 'total'=>'贷款总额', 'xfje'=>'抵扣学费金额', 'zsje'=>'抵扣住宿费金额', 'is_push'=>'是否已推送', 'is_five_year'=>'是否为五年制一贯制', "create_time" => "导入时间", ]; parent::__construct(); } public function export() { // TODO: Implement export() method. $this->download($this->fileName)->prepare(request())->send(); exit; } public function collection() { // TODO: Implement collection() method. return collect($this->buildData()); } public function headings(): array { // TODO: Implement headings() method. return $this->titles(); } public function map($row): array { $fylx = "贷款计划"; if($row['fylx'] == LoanStudentsList::FYLX_DZ) $fylx = "贷款到账"; $is_push = "未推送"; if($row['is_push'] == LoanStudentsList::IS_PUSH_YES) $is_push = "已推送"; $is_five_year = "否"; if($row['is_five_year'] == LoanStudentsList::IS_FIVE_YEAR_YES) $is_five_year = "是"; // TODO: Implement map() method. return [ "'".$row['sfzh'].'', $row["xh"], $row["xm"], $row["annual_session"], $fylx, $row["total"], $row["xfje"], $row["zsje"], $is_push, $is_five_year, date("Y-m-d H:i:s", $row['create_time']), ]; } }