['project_id', 'labor_budget_id'], ]; } /** * @notes 获取人工预算明细列表 * @return array * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException * @author likeadmin * @date 2024/01/16 09:26 */ public function lists(): array { return ProjectLaborBudgetDetail::where($this->searchWhere) ->field('id,project_id,labor_budget_id,job_type_id,desc,unit,num,price,amount,remark') ->limit($this->limitOffset, $this->limitLength) ->order(['id' => 'desc']) ->select()->each(function($data){ $labor_budget = ProjectLaborBudget::field('labor_budget_code')->where('id',$data['labor_budget_id'])->findOrEmpty(); $project = Project::field('name,project_code')->where('id',$data['project_id'])->findOrEmpty(); $job_type = ProjectJobType::field('type_name')->where('id',$data['job_type_id'])->findOrEmpty(); $data['labor_budget_code'] = $labor_budget['labor_budget_code']; $data['project_name'] = $project['name']; $data['project_code'] = $project['project_code']; $data['job_type_name'] = $job_type['type_name']; return $data; }) ->toArray(); } /** * @notes 获取人工预算明细数量 * @return int * @author likeadmin * @date 2024/01/16 09:26 */ public function count(): int { return ProjectLaborBudgetDetail::where($this->searchWhere)->count(); } public function setFileName(): string { return '人工预算明细列表'; } /** * @notes 导出字段 * @return string[] * @author 段誉 * @date 2022/11/24 16:17 */ public function setExcelFields(): array { return [ "id" => "id", "job_type_name" => "工种名称", "desc" => "人工说明", "unit" => "单位", "num" => "数量", "price" => "单价", "amount" => "金额", "remark" => "备注", ]; } }