['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/04 13:37 */ public function lists(): array { $params = $this->request->get(); if(!empty($params['bkh_user'])){ $admin_ids = Admin::where('name','like','%'.$params['bkh_user'].'%')->column('id'); $this->where[] = ['bkh_user_id','in',$admin_ids]; } $this->where[] = ['kh_user_id','=',$this->adminId]; return OaExamine::withoutField('update_time,delete_time')->where($this->searchWhere)->where($this->where) ->limit($this->limitOffset, $this->limitLength) ->order(['id' => 'desc']) ->select()->each(function($data){ $self_examine = OaSelfExamine::where('id',$data['self_examine_id'])->findOrEmpty(); $data['kh_user_name'] = Admin::where('id',$data['kh_user_id'])->value('name'); $data['bkh_user_name'] = Admin::where('id',$data['bkh_user_id'])->value('name'); $data['examine_type_text'] = $data->examine_type_text; $data['examine_month'] = $self_examine['examine_month']; $data['total_score'] = OaExamineDetail::where('examine_id',$data['id'])->sum('score'); $data['total_self_score'] = OaExamineDetail::where('examine_id',$data['id'])->sum('self_score'); $data['total_superior_score'] = OaExamineDetail::where('examine_id',$data['id'])->sum('superior_score'); $data['final_score'] = bcadd($data['total_self_score'],$data['total_superior_score'],2) / 2; }) ->toArray(); } /** * @notes 获取考核下属记录数量 * @return int * @author likeadmin * @date 2024/06/04 13:37 */ public function count(): int { return OaExamine::where($this->searchWhere)->where($this->where)->count(); } }