feat(admin): 优化仓库产品列表搜索功能
- 将搜索字段从 'product_id' 改为 'product_name',以支持通过产品名称搜索 - 更新搜索逻辑,使用产品名称模糊匹配来获取产品 ID 列表 - 调整搜索条件,支持通过产品名称进行精确搜索
This commit is contained in:
parent
5eeffb91d3
commit
c14d3b8d47
@ -35,7 +35,7 @@ class WarehouseProductLists extends BaseAdminDataLists implements ListsSearchInt
|
|||||||
public function setSearch(): array
|
public function setSearch(): array
|
||||||
{
|
{
|
||||||
return [
|
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'
|
'between_time' => 'create_time'
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
@ -52,9 +52,9 @@ class WarehouseProductLists extends BaseAdminDataLists implements ListsSearchInt
|
|||||||
*/
|
*/
|
||||||
public function lists(): array
|
public function lists(): array
|
||||||
{
|
{
|
||||||
if ($this->request->get('product_id')) {
|
if ($this->request->get('product_name')) {
|
||||||
$product_id = $this->request->get('product_id');
|
$product_name = $this->request->get('product_name');
|
||||||
$ids = StoreProduct::where('store_name', 'like', '%' . $product_id . '%')->withTrashed()->column('id');
|
$ids = StoreProduct::where('store_name', 'like', '%' . $product_name . '%')->withTrashed()->column('id');
|
||||||
if ($ids) {
|
if ($ids) {
|
||||||
$this->searchWhere[] = ['product_id', 'in', $ids];
|
$this->searchWhere[] = ['product_id', 'in', $ids];
|
||||||
$this->ids = $ids;
|
$this->ids = $ids;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user