|
@@ -4,7 +4,6 @@ namespace App\Service;
|
|
|
|
|
|
|
|
use App\Exports\ExportOrder;
|
|
use App\Exports\ExportOrder;
|
|
|
use App\Exports\MultiSheetExport;
|
|
use App\Exports\MultiSheetExport;
|
|
|
-use App\Model\RevenueCost;
|
|
|
|
|
use Maatwebsite\Excel\Facades\Excel;
|
|
use Maatwebsite\Excel\Facades\Excel;
|
|
|
|
|
|
|
|
class ExportFileService extends Service
|
|
class ExportFileService extends Service
|
|
@@ -18,9 +17,11 @@ class ExportFileService extends Service
|
|
|
];
|
|
];
|
|
|
|
|
|
|
|
public function exportAll($data,$user){
|
|
public function exportAll($data,$user){
|
|
|
- if(empty($data['menu_id'])) return [false, '菜单ID不能为空'];
|
|
|
|
|
- list($function, $name) = EmployeeService::fillMenu2($data['menu_id'], $user);
|
|
|
|
|
- if (empty($function) || ! method_exists(self::class, $function)) return [false, "导出方法不存在,请联系开发"];
|
|
|
|
|
|
|
+ if(empty($data['menu_id'])) return [false, 'menu_id不能为空'];
|
|
|
|
|
+ if(empty($data['type'])) return [false, 'type不能为空'];
|
|
|
|
|
+ $function = $data['type'];
|
|
|
|
|
+ $name = $this->fillE($data['type'], $user);
|
|
|
|
|
+ if (! method_exists(self::class, $function)) return [false, "导出方法不存在,请联系开发"];
|
|
|
self::$filename = $name;
|
|
self::$filename = $name;
|
|
|
|
|
|
|
|
$export_type = $data['export_type'] ?? 0;
|
|
$export_type = $data['export_type'] ?? 0;
|
|
@@ -44,6 +45,19 @@ class ExportFileService extends Service
|
|
|
return [true, $return];
|
|
return [true, $return];
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ public function fillE($type, &$user){
|
|
|
|
|
+ $header = config("excel." . $type) ?? [];
|
|
|
|
|
+ $funcName = $header['name'] ?? "";
|
|
|
|
|
+
|
|
|
|
|
+// $header_f = "extra_" . $menu_id;
|
|
|
|
|
+// $service = new TableHeadService();
|
|
|
|
|
+// if(method_exists($service,$header_f)) $service->$header_f($header_default);
|
|
|
|
|
+
|
|
|
|
|
+ $user['e_header_default'] = $header['array'];
|
|
|
|
|
+
|
|
|
|
|
+ return $funcName;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
private function fillData($data, $column, &$return)
|
|
private function fillData($data, $column, &$return)
|
|
|
{
|
|
{
|
|
|
// 预先创建包含默认值的键数组
|
|
// 预先创建包含默认值的键数组
|