修复一些错误
This commit is contained in:
@@ -252,19 +252,15 @@ class PurchaseOrderController extends BaseController
|
||||
* @throws
|
||||
*/
|
||||
#[GetRoute(route: '/{id}/export', authorize: 'export', where: ['id' => '[0-9]+'])]
|
||||
public function export(int $id, Request $request): Response
|
||||
public function export(int $id): Response
|
||||
{
|
||||
$purchase = PurchaseOrderModel::find($id);
|
||||
if (empty($purchase)) {
|
||||
throw new RepositoryException('采购单不存在');
|
||||
}
|
||||
$type = (string) $request->query('type', 'all');
|
||||
if (! in_array($type, ['all', 'category'], true)) {
|
||||
throw new RepositoryException('导出类型参数不正确(all 全品类 / category 蔬果分类)');
|
||||
}
|
||||
|
||||
return Excel::download(
|
||||
new PurchaseOrderExport($purchase, $type),
|
||||
new PurchaseOrderExport($purchase),
|
||||
$purchase->purchase_no . '_采购单.xlsx',
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user