| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 | 
							- <?php
 
- namespace App\Admin\Exports\Caiqing;
 
- use App\Admin\Exports\RowExport;
 
- use Illuminate\Support\Collection;
 
- class TradeExport extends RowExport
 
- {
 
-     public $name = '';
 
-     function __construct($name){
 
-         $this->name = $name;
 
-     }
 
-     /**
 
-      * 设置标题,返回标题数组
 
-      * @return array
 
-      */
 
-     public function headings(): array
 
-     {
 
-         return [
 
-             '行业',
 
-             '序号',
 
-             '需求人数(人)',
 
-             '所占比重(%)'
 
-         ];
 
-     }
 
-     /**
 
-      * 处理行数据
 
-      * @param Model $row
 
-      * @return array
 
-      */
 
-     public function map($row): array
 
-     {
 
-         $result = [];
 
-         foreach ($row as $k => $v) {
 
-             if ($k == 'rate') {
 
-                 $result[$k] = $v.'%';
 
-             } else {
 
-                 $result[$k] = $v.'';
 
-             }
 
-         }
 
-         return $result;
 
-     }
 
-     /**
 
-      * 设置文件名
 
-      * @return string
 
-      */
 
-     public function getFilename(): string
 
-     {
 
-         return $this->name.".xlsx";
 
-     }
 
-     /**
 
-      * 格式化指定列.
 
-      * 只有在需要的时候设置,例如在身份证不要显示科学计数时设定列格式:['A'=>NumberFormat::FORMAT_NUMBER]
 
-      * @return array
 
-      */
 
-     public function columnFormats(): array
 
-     {
 
-         return [
 
-         ];
 
-     }
 
- }
 
 
  |