Commit 8bc1dbc5 by 汪伟伟

1

parent ee060a49
...@@ -72,6 +72,7 @@ class TaskController extends AdminController ...@@ -72,6 +72,7 @@ class TaskController extends AdminController
}); });
$grid->disableEditButton()->disableDeleteButton()->disableCreateButton(); $grid->disableEditButton()->disableDeleteButton()->disableCreateButton();
$grid->disableBatchDelete();
$grid->tools(function (Grid\Tools $tools) use ($user){ $grid->tools(function (Grid\Tools $tools) use ($user){
if ($user->is_admin == 0) { if ($user->is_admin == 0) {
$tools->append(new BatchReceiveAction());//新增批量领取按钮 $tools->append(new BatchReceiveAction());//新增批量领取按钮
......
...@@ -18,6 +18,7 @@ use Dcat\Admin\Widgets\Tab; ...@@ -18,6 +18,7 @@ use Dcat\Admin\Widgets\Tab;
class TaskReceiveController extends AdminController class TaskReceiveController extends AdminController
{ {
protected $title = ' ';
/** /**
* @return Tab * @return Tab
*/ */
...@@ -125,6 +126,8 @@ class TaskReceiveController extends AdminController ...@@ -125,6 +126,8 @@ class TaskReceiveController extends AdminController
}); });
$grid->disableBatchDelete();
$grid->filter(function (Grid\Filter $filter) { $grid->filter(function (Grid\Filter $filter) {
// $filter->equal('id'); // $filter->equal('id');
$filter->like('task.name', '指标名称'); $filter->like('task.name', '指标名称');
......
...@@ -10,6 +10,7 @@ use Dcat\Admin\Grid; ...@@ -10,6 +10,7 @@ use Dcat\Admin\Grid;
use Dcat\Admin\Show; use Dcat\Admin\Show;
use Dcat\Admin\Http\Controllers\AdminController; use Dcat\Admin\Http\Controllers\AdminController;
use Dcat\Admin\Widgets\Tab; use Dcat\Admin\Widgets\Tab;
use SuperEggs\DcatDistpicker\DcatDistpickerHelper;
class TasksApproveController extends AdminController class TasksApproveController extends AdminController
{ {
...@@ -25,7 +26,9 @@ class TasksApproveController extends AdminController ...@@ -25,7 +26,9 @@ class TasksApproveController extends AdminController
$tab->add('未审核', $this->getData(0),true,'a'); $tab->add('未审核', $this->getData(0),true,'a');
$tab->add('已审核', $this->getData(1),true,'b'); $tab->add('已审核', $this->getData(1),true,'b');
return $tab->withCard(); return $tab;
} }
/** /**
...@@ -38,6 +41,7 @@ class TasksApproveController extends AdminController ...@@ -38,6 +41,7 @@ class TasksApproveController extends AdminController
// $taskIds = TasksReceive::query()->where('status',1)->pluck('task_id'); // $taskIds = TasksReceive::query()->where('status',1)->pluck('task_id');
// $model = \App\Models\Task::query()->with(['approves'])->whereIn('id',$taskIds); // $model = \App\Models\Task::query()->with(['approves'])->whereIn('id',$taskIds);
// dd($taskIds); // dd($taskIds);
return Grid::make(TasksApprove::with(['task', 'collects','user']), function (Grid $grid) use ($status) { return Grid::make(TasksApprove::with(['task', 'collects','user']), function (Grid $grid) use ($status) {
if ($status == 0) { if ($status == 0) {
$grid->model()->where('status', 0)->orderBy('task_id', 'desc'); $grid->model()->where('status', 0)->orderBy('task_id', 'desc');
...@@ -53,7 +57,7 @@ class TasksApproveController extends AdminController ...@@ -53,7 +57,7 @@ class TasksApproveController extends AdminController
// $grid->column('id')->sortable(); // $grid->column('id')->sortable();
$grid->column('task.name', '指标名称'); $grid->column('task.name', '指标名称');
$grid->column('task.city_id', '地区'); $grid->column('task.city_id', '地区')->distpicker();
$grid->column('task.year', '时间'); $grid->column('task.year', '时间');
$grid->column('task.refer', '参考信源'); $grid->column('task.refer', '参考信源');
$grid->column('task.price', '单价'); $grid->column('task.price', '单价');
...@@ -61,7 +65,7 @@ class TasksApproveController extends AdminController ...@@ -61,7 +65,7 @@ class TasksApproveController extends AdminController
$grid->column('collects.value', '指标值'); $grid->column('collects.value', '指标值');
$grid->column('collects.reality_refer', '实际信源'); $grid->column('collects.reality_refer', '实际信源');
$grid->column('collects.refer_level', '信源等级'); $grid->column('collects.refer_level', '信源等级');
$grid->column('collects.net_img', '截图链接'); // $grid->column('collects.net_img', '截图链接');
if ($status) { if ($status) {
$grid->column('status', '状态')->display(function ($statusValue) {//是当前字段的值 $grid->column('status', '状态')->display(function ($statusValue) {//是当前字段的值
return \App\Models\TasksApprove::APPROVE_STATUS_DESC[$statusValue]; return \App\Models\TasksApprove::APPROVE_STATUS_DESC[$statusValue];
...@@ -70,7 +74,7 @@ class TasksApproveController extends AdminController ...@@ -70,7 +74,7 @@ class TasksApproveController extends AdminController
// $grid->tools('<a class="btn btn-primary disable-outline">测试按钮</a>'); // $grid->tools('<a class="btn btn-primary disable-outline">测试按钮</a>');
$grid->disableEditButton()->disableDeleteButton()->disableCreateButton()->disableFilterButton()->disableViewButton()->disableBatchDelete(); $grid->disableEditButton()->disableDeleteButton()->disableCreateButton()->disableFilterButton()->disableBatchDelete();
$grid->filter(function (Grid\Filter $filter) { $grid->filter(function (Grid\Filter $filter) {
$filter->equal('id'); $filter->equal('id');
...@@ -95,15 +99,32 @@ class TasksApproveController extends AdminController ...@@ -95,15 +99,32 @@ class TasksApproveController extends AdminController
*/ */
protected function detail($id) protected function detail($id)
{ {
return Show::make($id, new TasksApprove(), function (Show $show) { return Show::make($id,TasksApprove::with(['task', 'collects','user']), function (Show $show) {
$show->field('id'); $show->field('user.name', '用户');
$show->field('task_id');
$show->field('user_id'); $show->field('task.name', '指标名称');
$show->field('receive_id'); $show->field('task.city_id', '地区')->as(function ($val){
$show->field('status'); return DcatDistpickerHelper::getAreaName($val);
});
$show->field('task.year', '时间');
$show->field('task.refer', '参考信源');
$show->field('task.price', '单价');
$show->field('collects.value', '指标值');
$show->field('collects.reality_refer', '实际信源');
$show->field('collects.refer_level', '信源等级');
$show->field('collects.net_img', '截图链接')->unescape();
$show->field('status','状态')->as(function ($statusValue){
// 获取当前行的其他字段
// $username = $this->username;
return \App\Models\TasksApprove::APPROVE_STATUS_DESC[$statusValue];
});
$show->field('msg'); $show->field('msg');
$show->field('created_at'); // $show->field('created_at');
$show->field('updated_at'); // $show->field('updated_at');
$show->disableDeleteButton()->disableEditButton();
}); });
} }
......
...@@ -3,15 +3,7 @@ ...@@ -3,15 +3,7 @@
namespace App\Admin\Extensions\Tools; namespace App\Admin\Extensions\Tools;
use App\Admin\Forms\MsgSetting;
use App\Admin\Forms\OrderDetailTc;
use App\Models\Task;
use App\Models\TasksReceive;
use Dcat\Admin\Actions\Action;
use Dcat\Admin\Admin;
use Dcat\Admin\Grid;
use Dcat\Admin\Grid\RowAction; use Dcat\Admin\Grid\RowAction;
use Dcat\Admin\Widgets\Modal;
use Illuminate\Http\Request; use Illuminate\Http\Request;
class OrderDetailAction extends RowAction class OrderDetailAction extends RowAction
......
<?php
namespace App\Admin\Forms;
use App\Models\TasksApprove;
use App\Models\TasksReceive;
use Dcat\Admin\Admin;
use Dcat\Admin\Contracts\LazyRenderable;
use Dcat\Admin\Grid;
use Dcat\Admin\Traits\LazyWidget;
use Dcat\Admin\Widgets\Form;
class OrderDetailTc extends Form implements LazyRenderable
{
use LazyWidget; // 使用异步加载功能
/**
* Handle the form request.
*
* @param array $input
*
* @return mixed
*/
public function handle(array $input)
{
// 获取外部传递参数
$id = $this->payload['id'] ?? null;
// 表单参数
// $msg = $input['msg'] ?? null;
return $this
->response()
->success('Processed successfully')
->refresh();
}
/**
* Build a form here.
*/
public function form()
{
// Since v1.6.5 弹出确认弹窗
// $this->confirm('您确定要提交表单吗', 'content');
// $this->text('msg','原因');
return Grid::make(\App\Admin\Repositories\TasksReceive::with(['task','collects','user']), function (Grid $grid) {
$user = Admin::user();
// dd(trans('admin.view'));//查看
// 在 display 回调中使用
$grid->column('序号')->display(function () {
return $this->_index + 1;
});
if ($user->is_admin == 1) {
$grid->column('user.name', '用户');
$grid->disableEditButton();
}
// $grid->column('id')->sortable();
$grid->column('task.name', '指标名称');
$grid->column('task.city_id', '地区')->distpicker();
$grid->column('task.year', '时间');
$grid->column('task.refer', '参考信源');
$grid->column('task.level', '等级');
$grid->column('task.price', '单价');
$grid->column('collects.value', '指标值');
$grid->column('collects.reality_refer', '实际信源');
// $grid->column('collects.net_img', '网页截图');
$grid->column('status', '状态')->display(function ($val){
return \App\Models\TasksReceive::STATUS_DESC[$val];
});
$grid->disableActions();
});
}
/**
* The data of the form.
*
* @return array
*/
public function default()
{
return [
// 'name' => 'John Doe',
// 'email' => 'John.Doe@gmail.com',
];
}
}
...@@ -35,6 +35,7 @@ return [ ...@@ -35,6 +35,7 @@ return [
'root' => public_path('uploads'), 'root' => public_path('uploads'),
'visibility' => 'public', 'visibility' => 'public',
'url' => env('APP_URL').'/uploads', 'url' => env('APP_URL').'/uploads',
// 'url' => request()->getHost().'/uploads',
], ],
'local' => [ 'local' => [
......
<?php <?php
return [ return [
'labels' => [ 'labels' => [
'TasksApprove' => 'TasksApprove', 'TasksApprove' => '',
'tasks-approve' => 'TasksApprove', 'tasks-approve' => 'TasksApprove',
], ],
'fields' => [ 'fields' => [
......
<?php <?php
return [ return [
'labels' => [ 'labels' => [
'TasksReceive' => 'TasksReceive2', 'TasksReceive' => '',
'tasks-receive' => 'TasksReceive3', 'tasks-receive' => 'TasksReceive3',
], ],
'fields' => [ 'fields' => [
......
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