['project_id', 'inspection_type'], '%like%' => ['inspection_code'], ]; } /** * @notes 获取工程监理--巡视登记列表 * @return array * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException * @author likeadmin * @date 2024/02/26 17:18 */ public function lists(): array { return SupervisionInspection::withoutField('update_time,delete_time')->where($this->searchWhere) ->limit($this->limitOffset, $this->limitLength) ->order(['id' => 'desc']) ->select()->each(function ($data) { $project = SupervisionProject::field('project_name')->where('id', $data['project_id'])->findOrEmpty(); $check_item = SupervisionCheckItem::field('node_name')->where('id', $data['check_item_id'])->findOrEmpty(); $company = SupervisionParticipatingUnits::field('unit_name')->where('id', $data['company_id'])->findOrEmpty(); $check_item_detail = SupervisionCheckItem::where('id', 'in', $data['check_item_detail_ids'])->column('node_name'); $admin = Admin::where('id', 'in', [$data['inspection_user'], $data['follow_user']])->column('name', 'id'); $data['project_name'] = $project['project_name']; $data['check_item_name'] = $check_item['node_name']; $data['company_name'] = $company['unit_name']; $data['check_item_detail_name'] = implode(',', $check_item_detail); $data['inspection_type_text'] = $data->inspection_type_text; $data['is_important_text'] = $data->is_important_text; $data['follow_user_name'] = $admin[$data['follow_user']] ?? ''; $data['problem_num'] = SupervisionProblem::field('id')->where('data_id', $data['id'])->where('data_type', 1)->count(); $data['reply_num'] = SupervisionProblem::field('id')->where('data_id', $data['id'])->where('data_type', 1)->where('is_rectification', 1)->count(); }) ->toArray(); } /** * @notes 获取工程监理--巡视登记数量 * @return int * @author likeadmin * @date 2024/02/26 17:18 */ public function count(): int { return SupervisionInspection::where($this->searchWhere)->count(); } }