['project_id', 'side_station_type'], '%like%' => ['side_station_code'], ]; } /** * @notes 获取工程监理--旁站登记列表 * @return array * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException * @author likeadmin * @date 2024/02/27 13:58 */ public function lists(): array { return SupervisionSideStation::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::field('name')->where('id', $data['side_station_user'])->findOrEmpty(); $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['side_station_type_text'] = $data->side_station_type_text; $data['side_station_result_text'] = $data->side_station_result_text; $data['side_station_user_name'] = $admin?->name; $data['problem_num'] = SupervisionProblem::field('id')->where('data_id', $data['id'])->where('data_type', 2)->count(); $data['reply_num'] = SupervisionProblem::field('id')->where('data_id', $data['id'])->where('data_type', 2)->where('is_rectification', 1)->count(); }) ->toArray(); } /** * @notes 获取工程监理--旁站登记数量 * @return int * @author likeadmin * @date 2024/02/27 13:58 */ public function count(): int { return SupervisionSideStation::where($this->searchWhere)->count(); } }