Commit 91d21562 by 汪伟伟

完成 按照 名称 时间 地区 跳转

parent 74eee49d
/node_modules /node_modules
/public/hot /public/hot
/public/storage /public/storage
/public/uploads
/storage/*.key /storage/*.key
.env .env
.env.backup .env.backup
......
...@@ -38,13 +38,19 @@ class NoDoneTaskController extends AdminController ...@@ -38,13 +38,19 @@ class NoDoneTaskController extends AdminController
return Grid::make(TasksReceive::with(['task', 'collects', 'user']), function (Grid $grid) { return Grid::make(TasksReceive::with(['task', 'collects', 'user']), function (Grid $grid) {
$user = Admin::user(); $user = Admin::user();
$user->is_admin == 0 && $grid->model()->where('user_id', $user->id); $grid->model()
->select('tasks_receives.*')
->join('tasks as b','b.id','=','tasks_receives.task_id')
->where('tasks_receives.user_id', $user->id)
->where('tasks_receives.status', 0)
->orderByRaw('b.city_id desc,b.year desc')
// ->orderBy('b.year','desc')
;
$grid->addTableClass(['table-text-center']);//设置表格文字居中 $grid->addTableClass(['table-text-center']);//设置表格文字居中
$grid->withBorder(); $grid->withBorder();
$grid->model()->where('status', 0);
// dd(trans('admin.view'));//查看 // dd(trans('admin.view'));//查看
$grid->model()->orderBy('created_at', 'desc');
// 在 display 回调中使用 // 在 display 回调中使用
$grid->column('序号')->display(function () { $grid->column('序号')->display(function () {
return $this->_index + 1; return $this->_index + 1;
...@@ -283,13 +289,17 @@ class NoDoneTaskController extends AdminController ...@@ -283,13 +289,17 @@ class NoDoneTaskController extends AdminController
]); ]);
} }
$no = \App\Models\TasksReceive::query() $no = DB::table('tasks_receives as a')
->where('id', '!=', $id) ->leftJoin('tasks as b','a.task_id','=','b.id')
->where('user_id', (Admin::user())->id) ->where('a.id', '!=', $id)
->where('status', 0) ->where('a.user_id', (Admin::user())->id)
->first(); ->where('a.status', 0)
->orderBy('b.city_id','desc')
->orderBy('b.year','desc')
->get(['a.id','b.name','b.city_id','b.year'])->toArray();
if ($no) { if ($no) {
$url = '/noDone/' . $no->id . '/edit'; $url = '/noDone/' . $no[0]->id . '/edit';
} else { } else {
$url = '/noDone'; $url = '/noDone';
} }
...@@ -318,7 +328,7 @@ class NoDoneTaskController extends AdminController ...@@ -318,7 +328,7 @@ class NoDoneTaskController extends AdminController
$form->display('id'); $form->display('id');
$form->display('task.name', '指标名称'); $form->display('task.name', '指标名称');
// $form->select('task.sort','优先级')->options([3 => '高', 2 => '中', 1 => '低']); // $form->select('task.sort','优先级')->options([3 => '高', 2 => '中', 1 => '低']);
$form->display('area', '地区'); $form->display('task.city_id', '地区');
// $form->distpicker(['city_id'=>'市']); // $form->distpicker(['city_id'=>'市']);
$form->display('task.year', '时间'); $form->display('task.year', '时间');
$form->display('task.refer', '参考信源'); $form->display('task.refer', '参考信源');
...@@ -356,6 +366,7 @@ class NoDoneTaskController extends AdminController ...@@ -356,6 +366,7 @@ class NoDoneTaskController extends AdminController
// }); // });
//保存后回调 //保存后回调
$form->saved(function (Form $form) { $form->saved(function (Form $form) {
$start = 'src="'; $start = 'src="';
$end = '" alt'; $end = '" alt';
$pattern = '/' . preg_quote($start) . '(.*?)' . preg_quote($end) . '/'; $pattern = '/' . preg_quote($start) . '(.*?)' . preg_quote($end) . '/';
...@@ -391,13 +402,19 @@ class NoDoneTaskController extends AdminController ...@@ -391,13 +402,19 @@ class NoDoneTaskController extends AdminController
'receive_id' => $this->id, 'receive_id' => $this->id,
]); ]);
$no = \App\Models\TasksReceive::query()
->where('id', '!=', $this->id) $no = DB::table('tasks_receives as a')
->where('user_id', (Admin::user())->id) ->leftJoin('tasks as b','a.task_id','=','b.id')
->where('status', 0) ->where('a.id', '!=', $this->id)
->first(); ->where('a.user_id', (Admin::user())->id)
->where('a.status', 0)
->orderBy('b.city_id','desc')
->orderBy('b.year','desc')
->get(['a.id','b.name','b.city_id','b.year'])->toArray();
// dd($no[0]->id,$no);
if ($no) { if ($no) {
$url = '/noDone/' . $no->id . '/edit'; $url = '/noDone/' . $no[0]->id . '/edit';
} else { } else {
$url = '/noDone'; $url = '/noDone';
} }
......
...@@ -67,7 +67,7 @@ class ReceiveAction extends RowAction ...@@ -67,7 +67,7 @@ class ReceiveAction extends RowAction
'tas_id' => $task->tas_id, 'tas_id' => $task->tas_id,
'task_id' => $id, 'task_id' => $id,
'user_id' => $user->id, 'user_id' => $user->id,
'area' => CityAreaService::getAreaName($task->city_id), 'area' => $task->city_id,
]); ]);
$task->num -= 1; $task->num -= 1;
$task->save(); $task->save();
......
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