['target'], ]; } /** * @notes 获取目标管理列表 * @return array * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException * @author likeadmin * @date 2023/12/21 09:17 */ public function lists(): array { return QualityMbo::where($this->searchWhere) ->field(['id', 'org_id', 'dept_id', 'project_id', 'target', 'pass_rate', 'target_specification', 'basic_requirements', 'allowable_deviation', 'file']) ->limit($this->limitOffset, $this->limitLength) ->order(['id' => 'desc']) ->select()->each(function($item){ $project = Project::field('name,project_code')->where('id',$item['project_id'])->findOrEmpty(); $org = Orgs::field('name')->where('id',$item['org_id'])->findOrEmpty(); $dept = Dept::field('name')->where('id',$item['dept_id'])->findOrEmpty(); $item['org_name'] = $org['name']; $item['dept_name'] = $dept['name']; $item['project_name'] = $project['name']; $item['project_code'] = $project['project_code']; return $item; }) ->toArray(); } /** * @notes 获取目标管理数量 * @return int * @author likeadmin * @date 2023/12/21 09:17 */ public function count(): int { return QualityMbo::where($this->searchWhere)->count(); } }