Commit 3d6cbdcf by 杨树贤

Merge branch 'master' into ysx-供应商新建-20220701

parents c9e9d2fc 0446c0b7
...@@ -613,5 +613,38 @@ class DataService ...@@ -613,5 +613,38 @@ class DataService
} }
} }
//导出供应商基础信息
public function exportSuppliers()
{
$suppliers = SupplierChannelModel::where('is_type', 0)->select([
'supplier_name',
'supplier_group',
'status',
])->get()->toArray();
$excelData = [];
$header = [
'供应商名称',
'供应商性质',
'供应商状态',
];
foreach ($suppliers as $supplier) {
$itemData = [
$supplier['supplier_name'],
array_get(config('fixed.SupplierGroup'), $supplier['supplier_group']),
array_get(config('fixed.SupplierStatus'), $supplier['status']),
];
$excelData[] = $itemData;
}
array_unshift($excelData, $header);
Excel::create('供应商导出', function ($excel) use ($excelData) {
$excel->sheet('sheet1', function ($sheet) use ($excelData) {
$sheet->fromArray($excelData);
});
})->export('xlsx');
}
} }
...@@ -60,5 +60,5 @@ Route::group(['middleware' => ['external'], 'namespace' => 'Sync'], function () ...@@ -60,5 +60,5 @@ Route::group(['middleware' => ['external'], 'namespace' => 'Sync'], function ()
}); });
Route::match(['get', 'post'], '/test', function () { Route::match(['get', 'post'], '/test', function () {
(new \App\Http\Services\DataService())->exportSupplierForUnionData(); (new \App\Http\Services\DataService())->exportSuppliers();
}); });
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment