3 changed files with 69 additions and 1 deletions
-
19app/AdminAgent/Controllers/IndustryOrderController.php
-
50app/AdminAgent/Renderable/SelectIndustryProductSpec.php
-
1resources/lang/zh_CN/product.php
@ -0,0 +1,50 @@ |
|||||
|
<?php |
||||
|
|
||||
|
namespace App\AdminAgent\Renderable; |
||||
|
use App\Models\IndustryProductSpec; |
||||
|
use Dcat\Admin\Admin; |
||||
|
use Dcat\Admin\Grid; |
||||
|
use Dcat\Admin\Grid\LazyRenderable; |
||||
|
|
||||
|
/** |
||||
|
* 选择行业产品规格 |
||||
|
* Class SelectProduct |
||||
|
* @package App\AdminAgent\Renderable |
||||
|
*/ |
||||
|
class SelectIndustryProductSpec extends LazyRenderable |
||||
|
{ |
||||
|
public function grid(): Grid |
||||
|
{ |
||||
|
// 获取外部传递的参数
|
||||
|
// $id = $this->id;
|
||||
|
Admin::translation('product'); |
||||
|
return Grid::make(new IndustryProductSpec(), function (Grid $grid) { |
||||
|
$grid->disableActions(); |
||||
|
$grid->disableBatchDelete(); |
||||
|
$grid->disableBatchActions(); |
||||
|
|
||||
|
$grid->model()->where([ |
||||
|
['stock', '>', 0], |
||||
|
['date', '>=', date('Y-m-d')], |
||||
|
['industry_product_id', '=', $this->industry_product_id], |
||||
|
])->selectRaw('*,concat(name, " | ", date) AS title'); |
||||
|
|
||||
|
$grid->quickSearch(['name', 'date'])->placeholder('搜索规格名称、日期'); |
||||
|
|
||||
|
$grid->column('id'); |
||||
|
$grid->column('name'); |
||||
|
$grid->column('date'); |
||||
|
$grid->column('stock'); |
||||
|
$grid->column('original_price'); |
||||
|
$grid->column('price'); |
||||
|
|
||||
|
$grid->paginate(15); |
||||
|
|
||||
|
$grid->filter(function (Grid\Filter $filter) { |
||||
|
$filter->panel(); |
||||
|
$filter->like('name')->width(3); |
||||
|
$filter->like('date')->width(2); |
||||
|
}); |
||||
|
}); |
||||
|
} |
||||
|
} |
||||
Write
Preview
Loading…
Cancel
Save
Reference in new issue