PersonalTalentsExport.php 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: Administrator
  5. * Date: 2019/4/13
  6. * Time: 10:29
  7. */
  8. namespace App\Admin\Exports\PersonalTalents;
  9. use App\Admin\Exports\RowExport;
  10. class PersonalTalentsExport extends RowExport
  11. {
  12. /**
  13. * 设置标题,返回标题数组
  14. * @return array
  15. */
  16. public function headings(): array
  17. {
  18. return [
  19. '会员名称',
  20. '人才等级',
  21. '人才来源',
  22. '审核状态',
  23. '完结状态',
  24. '所属客服',
  25. '创建时间'
  26. ];
  27. }
  28. /**
  29. * 处理行数据
  30. * @param Model $row
  31. * @return array
  32. */
  33. public function map($row): array
  34. {
  35. $result['rc_username'] = $row->rc_username;
  36. if ($row->ifconform == 1) {
  37. $result['ifconform'] = $row->rc_level;
  38. } elseif ($row->ifconform == 2) {
  39. $result['ifconform'] = '不符合人才标准';
  40. }
  41. if ($row->rc_where == 1) {
  42. $result['rc_where'] = '自主申报';
  43. } elseif ($row->rc_where == 2) {
  44. $result['rc_where'] = '企业申报';
  45. } elseif ($row->rc_where == 3) {
  46. $result['rc_where'] = '信息采集';
  47. }
  48. if ($row->rc_audit == 1) {
  49. $result['rc_audit'] = '认证通过';
  50. } elseif ($row->rc_audit == 2) {
  51. $result['rc_audit'] = '预判';
  52. } elseif ($row->rc_audit == 3) {
  53. $result['rc_audit'] = '认证不通过';
  54. }
  55. if ($row->if_finish == 1) {
  56. $result['if_finish'] = '已完结';
  57. } else {
  58. $result['if_finish'] = '未完结';
  59. }
  60. $result['admin_id'] = isset($row->admin_user->name) ? $row->admin_user->name : '';
  61. $result['created_at'] = $row->created_at;
  62. return $result;
  63. }
  64. /**
  65. * 设置文件名
  66. * @return string
  67. */
  68. public function getFilename(): string
  69. {
  70. return "人才服务.xlsx";
  71. }
  72. /**
  73. * 格式化指定列.
  74. * 只有在需要的时候设置,例如在身份证不要显示科学计数时设定列格式:['A'=>NumberFormat::FORMAT_NUMBER]
  75. * @return array
  76. */
  77. public function columnFormats(): array
  78. {
  79. return [
  80. ];
  81. }
  82. }