|
@@ -10,13 +10,14 @@ class DistDistributorTable extends LazyRenderable
|
|
|
{
|
|
|
public function grid(): Grid
|
|
|
{
|
|
|
-
|
|
|
return Grid::make(DistAdminDistributor::with(['appearance']), function (Grid $grid) {
|
|
|
- $grid->column('id');
|
|
|
- $grid->column('company_name', 'Company Name')->width('35%');
|
|
|
- $grid->column('appearance.title' ,admin_trans_field('appearance'));
|
|
|
- $grid->column('country', 'Country');
|
|
|
- $grid->column('site_name', 'Site Name');
|
|
|
+ $grid->view('admin.grid.table');
|
|
|
+
|
|
|
+ $grid->column('id')->width('5%');
|
|
|
+ $grid->column('company_name', 'Company Name')->width('25%');
|
|
|
+ $grid->column('appearance.title' ,admin_trans_field('appearance'))->width('15%');
|
|
|
+ // $grid->column('country', 'Country');
|
|
|
+ $grid->column('site_name');
|
|
|
$grid->column('domain_type',admin_trans_label('domain'))->display(function ($domainType) {
|
|
|
$title = "";
|
|
|
if ($domainType == 0) {
|
|
@@ -26,20 +27,19 @@ class DistDistributorTable extends LazyRenderable
|
|
|
}
|
|
|
return "<span style='color:#586cb1'>$title</span>";
|
|
|
});
|
|
|
- //$grid->column('created_at');
|
|
|
- //$grid->column('updated_at');
|
|
|
+ $grid->actions(function (Grid\Displayers\Actions $actions) {
|
|
|
+ $actions->disableDelete();
|
|
|
+ $actions->disableEdit();
|
|
|
+ $actions->disableQuickEdit();
|
|
|
+ $actions->disableView();
|
|
|
+ $url = $actions->row->domain_type == 0 ? $actions->row->secondary_domain : $actions->row->custom_domain;
|
|
|
+ $url = 'http://'.$url.':'.env('DIST_SITE_PORT');
|
|
|
+ $actions->prepend('<a href="'.$url.'" target="_blank"><i class="fa fa-paper-plane"></i> 浏览</a>');
|
|
|
+ });
|
|
|
|
|
|
- // 指定行选择器选中时显示的值的字段名称
|
|
|
- // 指定行选择器选中时显示的值的字段名称
|
|
|
- // 指定行选择器选中时显示的值的字段名称
|
|
|
- // 如果表格数据中带有 “name”、“title”或“username”字段,则可以不用设置
|
|
|
$grid->rowSelector()->titleColumn('company_name');
|
|
|
-
|
|
|
$grid->quickSearch(['company_name']);
|
|
|
-
|
|
|
$grid->paginate(10);
|
|
|
- $grid->disableActions();
|
|
|
-
|
|
|
$grid->filter(function (Grid\Filter $filter) {
|
|
|
$filter->like('company_name')->width(4);
|
|
|
$filter->like('site_name')->width(4);
|