['check_type', 'type','flow_cate'], '%like%' => ['name'], ]; } /** * @notes 获取审批流程列表 * @return array * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException * @author likeadmin * @date 2024/05/24 14:16 */ public function lists(): array { return OaFlow::where($this->searchWhere) ->limit($this->limitOffset, $this->limitLength) ->order(['id' => 'desc']) ->select()->each(function($data){ $data['type_text'] = $data->type_text; $data['check_type_text'] = $data->check_type_text; $flow_cate = OaFlowType::where('id',$data['flow_cate'])->findOrEmpty(); $data['flow_cate_name'] = $flow_cate['title']; if(!empty($data['department_ids'])){ $dept = Dept::where('id','in',$data['department_ids'])->column('name'); $data['department_names'] = implode(',',$dept); }else{ $data['department_names'] = '全公司'; } if(!empty($data['copy_uids'])){ $copy_user = Admin::where('id','in',$data['copy_uids'])->column('name'); $data['copy_user_names'] = implode(',',$copy_user); }else{ $data['copy_user_names'] = ''; } }) ->toArray(); } /** * @notes 获取审批流程数量 * @return int * @author likeadmin * @date 2024/05/24 14:16 */ public function count(): int { return OaFlow::where($this->searchWhere)->count(); } }