['detection_task', 'owning_stage', 'resp_user', 'standard_duration', 'document_number', 'document_name'], ]; } /** * @notes 获取质量检测列表 * @return array * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException * @author likeadmin * @date 2023/12/21 16:14 */ public function lists(): array { return QualityDetection::where($this->searchWhere) ->field(['id', 'org_id', 'dept_id', 'project_id', 'detection_task', 'owning_stage', 'resp_user', 'standard_duration', 'scheduled_start_time', 'scheduled_end_time', 'complete', 'actual_start_time', 'actual_end_time', 'document_number', 'document_name', 'document_manuscript', 'archiving', 'data_content_requirements', 'detection_situation', 'remark', '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 16:14 */ public function count(): int { return QualityDetection::where($this->searchWhere)->count(); } }