['examine_type'], ]; } /** * @notes 获取自评记录列表 * @return array * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException * @author likeadmin * @date 2024/06/03 15:36 */ public function lists(): array { $params = $this->request->get(); if(!empty($params['examine_month'])){ $this->where[] = ['examine_month','=',strtotime($params['examine_month'])]; } if(!empty($params['user_id'])){ $this->where[] = ['user_id','=',$params['user_id']]; }else{ $this->where[] = ['user_id','=',$this->adminId]; } return OaSelfExamine::withoutField('update_time,delete_time')->where($this->searchWhere)->where($this->where) ->limit($this->limitOffset, $this->limitLength) ->order(['id' => 'desc']) ->select()->each(function($data){ $data['user_name'] = Admin::where('id',$data['user_id'])->value('name'); $data['temp_name'] = OaExamineTemp::where('id',$data['examine_temp_id'])->value('temp_name'); $data['examine_type_text'] = $data->examine_type_text; $data['total_score'] = OaExamineTempItem::where('examine_temp_id',$data['examine_temp_id'])->sum('score'); $data['total_self_score'] = OaSelfExamineDetail::where('self_examine_id',$data['id'])->sum('self_score'); }) ->toArray(); } /** * @notes 获取自评记录数量 * @return int * @author likeadmin * @date 2024/06/03 15:36 */ public function count(): int { return OaSelfExamine::where($this->searchWhere)->where($this->where)->count(); } }