fix(admin): 修复仓库产品搜索未包含软删除商品的问题

- 在产品名称和条形码搜索中添加 withTrashed() 方法
- 确保软删除的商品也能在仓库产品搜索结果中显示
This commit is contained in:
mkm 2025-02-07 17:46:09 +08:00
parent 0594ce6f76
commit 850c06df40

View File

@ -54,7 +54,7 @@ class WarehouseProductLists extends BaseAdminDataLists implements ListsSearchInt
{
if ($this->request->get('product_id')) {
$product_id = $this->request->get('product_id');
$ids = StoreProduct::where('store_name', 'like', '%' . $product_id . '%')->column('id');
$ids = StoreProduct::where('store_name', 'like', '%' . $product_id . '%')->withTrashed()->column('id');
if ($ids) {
$this->searchWhere[] = ['product_id', 'in', $ids];
$this->ids = $ids;
@ -64,7 +64,7 @@ class WarehouseProductLists extends BaseAdminDataLists implements ListsSearchInt
}
if ($this->request->get('bar_code')) {
$bar_code = $this->request->get('bar_code');
$ids = StoreProduct::where('bar_code', 'like', '%' . $bar_code . '%')->column('id');
$ids = StoreProduct::where('bar_code', 'like', '%' . $bar_code . '%')->withTrashed()->column('id');
if ($ids) {
$this->searchWhere[] = ['product_id', 'in', $ids];
$this->ids = $ids;