From c14d3b8d47448ff82b168509e5d572c7749768fd Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Sat, 8 Feb 2025 15:44:23 +0800 Subject: [PATCH] =?UTF-8?q?feat(admin):=20=E4=BC=98=E5=8C=96=E4=BB=93?= =?UTF-8?q?=E5=BA=93=E4=BA=A7=E5=93=81=E5=88=97=E8=A1=A8=E6=90=9C=E7=B4=A2?= =?UTF-8?q?=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 将搜索字段从 'product_id' 改为 'product_name',以支持通过产品名称搜索 - 更新搜索逻辑,使用产品名称模糊匹配来获取产品 ID 列表 - 调整搜索条件,支持通过产品名称进行精确搜索 --- .../lists/warehouse_product/WarehouseProductLists.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/admin/lists/warehouse_product/WarehouseProductLists.php b/app/admin/lists/warehouse_product/WarehouseProductLists.php index ec0fe5d90..20c42fcbd 100644 --- a/app/admin/lists/warehouse_product/WarehouseProductLists.php +++ b/app/admin/lists/warehouse_product/WarehouseProductLists.php @@ -35,7 +35,7 @@ class WarehouseProductLists extends BaseAdminDataLists implements ListsSearchInt public function setSearch(): array { return [ - '=' => ['warehouse_id', 'financial_pm', 'store_id','oid','supplier_id','is_pay','code'], + '=' => ['warehouse_id', 'financial_pm', 'product_id','store_id','oid','supplier_id','is_pay','code'], 'between_time' => 'create_time' ]; } @@ -52,9 +52,9 @@ class WarehouseProductLists extends BaseAdminDataLists implements ListsSearchInt */ public function lists(): array { - if ($this->request->get('product_id')) { - $product_id = $this->request->get('product_id'); - $ids = StoreProduct::where('store_name', 'like', '%' . $product_id . '%')->withTrashed()->column('id'); + if ($this->request->get('product_name')) { + $product_name = $this->request->get('product_name'); + $ids = StoreProduct::where('store_name', 'like', '%' . $product_name . '%')->withTrashed()->column('id'); if ($ids) { $this->searchWhere[] = ['product_id', 'in', $ids]; $this->ids = $ids;