feat(warehouse): 仓库产品列表增加分类名称显示

- 在仓库产品列表中添加分类名称字段
- 优化产品信息查询,包含分类 ID
- 修复部分产品无规格信息的问题
- 注释掉 OperationLog 中的 json 属性
This commit is contained in:
mkm 2024-10-27 18:09:48 +08:00
parent 9aa4431523
commit 61a5d5d6d5
2 changed files with 6 additions and 2 deletions

View File

@ -11,6 +11,7 @@ use app\common\model\store_product\StoreProduct;
use app\common\model\system_store\SystemStore;
use app\common\model\warehouse\Warehouse;
use app\common\lists\ListsExcelInterface;
use app\common\model\store_category\StoreCategory;
use app\common\model\store_product_unit\StoreProductUnit;
use app\common\model\supplier\Supplier;
@ -81,6 +82,7 @@ class WarehouseProductLists extends BaseAdminDataLists implements ListsSearchInt
$item->price = '';
$item->unit_name = '';
$item->store_info = '';
$item->top_cate_name = '';
if ($item->financial_pm == 0) {
$item->financial_pm_name = '出库';
} else {
@ -104,13 +106,14 @@ class WarehouseProductLists extends BaseAdminDataLists implements ListsSearchInt
$item->admin_name = '';
}
if ($item->product_id) {
$find = StoreProduct::where('id', $item->product_id)->field('price,image,store_name,unit,store_info')->find();
$find = StoreProduct::where('id', $item->product_id)->field('price,image,store_name,unit,store_info,top_cate_id')->withTrashed()->find();
if($find){
$item->store_name = $find->store_name . '|' . $item->product_id;
$item->image = $find->image;
$item->price = $find->price;
$item->unit_name = StoreProductUnit::where('id', $find->unit)->value('name');
$item->store_info =$find->store_info;
$item->top_cate_name =StoreCategory::where('id', $find->top_cate_id)->value('name');
}
}
if ($item->warehouse_id) {
@ -191,6 +194,7 @@ class WarehouseProductLists extends BaseAdminDataLists implements ListsSearchInt
'admin_name' => '操作人员',
'warehouse_name' => '仓库',
'store_name' => '商品名称',
'top_cate_name' => '分类',
'store_info' => '规格',
'unit_name' => '单位',
'financial_pm_name' => '出入库',

View File

@ -6,6 +6,6 @@ namespace app\common\model;
class OperationLog extends BaseModel
{
protected $json = ['params'];
// protected $json = ['params'];
}