Commit 91d21562 by 汪伟伟

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

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