Commit bb38f148 by 汪伟伟

tab

parent bb6b7a04
...@@ -26,9 +26,9 @@ class TaskController extends AdminController ...@@ -26,9 +26,9 @@ class TaskController extends AdminController
public function receiveIndex(Content $content) public function receiveIndex(Content $content)
{ {
return $content return $content
->translation($this->translation()) // ->translation($this->translation())
->title($this->title()) // ->title($this->title())
->description($this->description()['index'] ?? trans('admin.list')) // ->description($this->description()['index'] ?? trans('admin.list'))
->body($this->getData()); ->body($this->getData());
} }
......
...@@ -28,12 +28,12 @@ class TaskReceiveController extends AdminController ...@@ -28,12 +28,12 @@ class TaskReceiveController extends AdminController
// $tab->add('选项卡1', view('...')); // $tab->add('选项卡1', view('...'));
$user = Admin::user(); $user = Admin::user();
if ($user->is_admin){ if ($user->is_admin){
$tab->add('全部任务', $this->getData(-1)); $tab->add('全部任务', $this->getData(-1),true,'a');
}; };
$tab->add('待完成任务', $this->getData(0)); $tab->add('待完成任务', $this->getData(0),true,'b');
$tab->add('已完成任务', $this->getData(1)); $tab->add('已完成任务', $this->getData(1),true,'c');
if ($user->is_admin == 0) {//用户 if ($user->is_admin == 0) {//用户
$tab->add('已经结算任务', $this->getOrderData()); $tab->add('已经结算任务', $this->getOrderData(),true,'d');
} }
return $tab; return $tab;
} }
......
...@@ -31,8 +31,8 @@ class TasksApproveController extends AdminController ...@@ -31,8 +31,8 @@ class TasksApproveController extends AdminController
$tab = Tab::make(); $tab = Tab::make();
// $tab->add('选项卡1', view('...')); // $tab->add('选项卡1', view('...'));
$tab->add('未审核', $this->getData(0)); $tab->add('未审核', $this->getData(0),true,'a');
$tab->add('已审核', $this->getData(1)); $tab->add('已审核', $this->getData(1),true,'b');
return $tab; return $tab;
} }
......
...@@ -5,6 +5,7 @@ namespace App\Admin\Controllers; ...@@ -5,6 +5,7 @@ namespace App\Admin\Controllers;
use App\Admin\Extensions\Tools\CreateSettlementOrder; use App\Admin\Extensions\Tools\CreateSettlementOrder;
use App\Admin\Extensions\Tools\NotPassAction; use App\Admin\Extensions\Tools\NotPassAction;
use App\Admin\Repositories\TasksReceive; use App\Admin\Repositories\TasksReceive;
use App\Models\AdminUser;
use App\Models\TasksOrder; use App\Models\TasksOrder;
use Dcat\Admin\Actions\Action; use Dcat\Admin\Actions\Action;
use Dcat\Admin\Admin; use Dcat\Admin\Admin;
...@@ -27,9 +28,9 @@ class TasksOrderController extends AdminController ...@@ -27,9 +28,9 @@ class TasksOrderController extends AdminController
public function orderReceive($id,Content $content) public function orderReceive($id,Content $content)
{ {
return $content return $content
->translation($this->translation()) // ->translation($this->translation())
->title($this->title()) // ->title($this->title())
->description($this->description()['index'] ?? trans('admin.list')) // ->description($this->description()['index'] ?? trans('admin.list'))
->body($this->getOderDetail($id)); ->body($this->getOderDetail($id));
} }
...@@ -39,7 +40,7 @@ class TasksOrderController extends AdminController ...@@ -39,7 +40,7 @@ class TasksOrderController extends AdminController
$user = Admin::user(); $user = Admin::user();
// dd(trans('admin.view'));//查看 // dd(trans('admin.view'));//查看
$grid->title('算单详情'); $grid->title('算单详情');
$grid->header(function ($collection)use ($grid,$id) { $grid->header(function ($collection)use ($grid,$id) {
$data = $collection->toArray(); $data = $collection->toArray();
...@@ -56,6 +57,7 @@ class TasksOrderController extends AdminController ...@@ -56,6 +57,7 @@ class TasksOrderController extends AdminController
}); });
$grid->model()->where('order_id',$id); $grid->model()->where('order_id',$id);
// 在 display 回调中使用 // 在 display 回调中使用
$grid->column('序号')->display(function () { $grid->column('序号')->display(function () {
return $this->_index + 1; return $this->_index + 1;
...@@ -77,9 +79,12 @@ class TasksOrderController extends AdminController ...@@ -77,9 +79,12 @@ class TasksOrderController extends AdminController
if ($user->is_admin == 0){
$grid->tools(new CreateSettlementOrder('<button class="btn btn-primary ">确认结账</button>')); $grid->tools(new CreateSettlementOrder('<button class="btn btn-primary ">确认结账</button>'));
$grid->tools(new CreateSettlementOrder('<button class="btn btn-primary ">确认收款</button>')); $grid->tools(new CreateSettlementOrder('<button class="btn btn-primary ">确认收款</button>'));
}
$grid->disableRowSelector();//禁用行选择器
$grid->disableRefreshButton();// 禁用刷新功能 $grid->disableRefreshButton();// 禁用刷新功能
$grid->disablePagination();// 禁用分页功能 $grid->disablePagination();// 禁用分页功能
$grid->disableActions()->disableBatchActions()->disableCreateButton(); $grid->disableActions()->disableBatchActions()->disableCreateButton();
...@@ -87,7 +92,6 @@ class TasksOrderController extends AdminController ...@@ -87,7 +92,6 @@ class TasksOrderController extends AdminController
}); });
} }
/** /**
* @return Tab * @return Tab
*/ */
...@@ -98,8 +102,8 @@ class TasksOrderController extends AdminController ...@@ -98,8 +102,8 @@ class TasksOrderController extends AdminController
// $tab->add('选项卡1', view('...')); // $tab->add('选项卡1', view('...'));
// $user = Admin::user(); // $user = Admin::user();
$tab->add('结算列表', $this->getData()); $tab->add('结算列表', $this->getData(),true,'a');
$tab->add('生成结算单', $this->getReceiveData()); $tab->add('生成结算单', $this->getReceiveData(),true,'b');
return $tab; return $tab;
} }
...@@ -140,11 +144,22 @@ class TasksOrderController extends AdminController ...@@ -140,11 +144,22 @@ class TasksOrderController extends AdminController
$grid->filter(function (Grid\Filter $filter) { $grid->filter(function (Grid\Filter $filter) {
// $filter->equal('id');
$filter->like('task.name', '指标名称');
$filter->expand();//展开过滤器
// 更改为 panel 布局
$filter->panel();
// 注意切换为panel布局方式时需要重新调整表单字段的宽度
$filter->equal('user.id','用户')->width(2)->select(function (){
$userIds = \App\Models\TasksReceive::query()->where('status',3)->pluck('user_id')->toArray();
$userArr= AdminUser::query()->whereIn('id',$userIds)->get()->toArray();
return array_column($userArr,'name','id');
});
$filter->equal('status','状态')->width(2)->select(['3'=>'未结算'])->default(3);
}); });
$grid->disableFilterButton();
$grid->disableDeleteButton()->disableCreateButton()->disableEditButton()->disableViewButton()->disableActions()->disableBatchDelete(); $grid->disableDeleteButton()->disableCreateButton()->disableEditButton()->disableViewButton()->disableActions()->disableBatchDelete();
...@@ -200,22 +215,12 @@ class TasksOrderController extends AdminController ...@@ -200,22 +215,12 @@ class TasksOrderController extends AdminController
protected function detail($id) protected function detail($id)
{ {
return Content::make() return Content::make()
->translation($this->translation()) // ->translation($this->translation())
->title($this->title()) // ->title($this->title())
->description($this->description()['index'] ?? trans('admin.list')) // ->description($this->description()['index'] ?? trans('admin.list'))
->body($this->getOderDetail($id)); ->body($this->getOderDetail($id));
// return Show::make($id, new TasksOrder(), function (Show $show) {
// $show->field('id');
// $show->field('user_id');
// $show->field('time');
// $show->field('num');
// $show->field('amount');
// $show->field('pay_img');
// $show->field('status');
// $show->field('created_at');
// $show->field('updated_at');
// });
} }
/** /**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment