isAjax()){ $param=request()->get(); $where = "1=1 and persons like '%" . admin_id() . "%'"; if(isset($param['title']) && !empty($param['title'])){ $where .= " and title like '%" . $param['title'] . "%'"; } $patrolProblem = new \support\spark\model\bomb\Specialinspection(); $list = $patrolProblem->whereRaw($where)->paginate($param['limit'], '*', 'page', $param['page']); $list = json_decode(json_encode($list), true); if($list['total']>0) { foreach ($list['data'] as $key => $item) { if ($item['persons']) { $list['data'][$key]['writer'] = explode(',',$item['persons']); $list['data'][$key]['writer_info'] =(new AdminUser())->whereIn('id',explode(',',$item['persons']))->get()->toArray(); $persions_name = (new AdminUser())->whereIn('id',explode(',',$item['persons']))->pluck('nickname')->toArray(); $list['data'][$key]['persions_name'] = implode(' ',$persions_name); } else { $list['data'][$key]['writer'] = []; $list['data'][$key]['writer_info'] =[]; $list['data'][$key]['persions_name'] =''; } } } return sparkSuccess(dataReturn(0, '获取成功', ['data' => $list['data'], 'total' => $list['total']])); } return view('bomb/special/myspecial/index'); } # 上报我的专项巡检任务隐患 public function risk_submit() { $formData = request()->post(); ## if 指定项目部 任务的分配人 $task_allocation_org = (new AdminOrg) ->where('id', '=', $formData['find_problem_org_id'])->first(); $task_allocation_user_id = $task_allocation_org['task_allocation_user_id']; // $task_allocation_user_id = 1692028615; if (empty($task_allocation_user_id)) { return sparkSuccess(dataReturn(-1, '该项目部未指定任务分配人,无法添加任务', $formData['find_problem_org_id'])); } ## else 给一个默认的分配人 $formData['distribution_person_id'] = $task_allocation_user_id; # 问题发现人(上报人) $formData['find_problem_person_id'] = admin_id(); $formData['find_problem_org_deptcode'] = $task_allocation_org['deptcode']; $formData['find_problem_org_name'] = $task_allocation_org['name']; $formData['create_time'] = now(); $formData['update_time'] = now(); $formData['find_problem_time'] = date('Y-m-d H:i:s'); $patrolProblem = new PatrolProblem(); $patrolProblem->insertOne($formData); return sparkSuccess(dataReturn(0, '提交成功', $formData['find_problem_org_id'])); } public function getOrgInfo() { $orgList = asTreeArray((new AdminOrg())->getAllList([['status', '=', 1]]), 'pid'); return sparkSuccess(dataReturn(0, '成功',$orgList)); } }