['project_id', 'cost_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 14:32 */ public function lists(): array { return ProjectCostBudgetDetail::where($this->searchWhere) ->field('id,project_id,cost_budget_id,project_cost_temp_id,unit,amount,standard,remark') ->limit($this->limitOffset, $this->limitLength) ->order(['id' => 'desc']) ->select()->each(function($data){ $cost_budget = ProjectCostBudget::field('cost_budget_code')->where('id',$data['cost_budget_id'])->findOrEmpty(); $project = Project::field('name,project_code')->where('id',$data['project_id'])->findOrEmpty(); $project_cost_temp = ProjectCostTempSet::field('first_level_subject,second_level_subject,third_level_subject,is_travel')->where('id',$data['project_cost_temp_id'])->findOrEmpty(); $data['cost_budget_code'] = $cost_budget['cost_budget_code']; $data['project_name'] = $project['name']; $data['project_code'] = $project['project_code']; $data['first_level_subject'] = $project_cost_temp['first_level_subject']; $data['second_level_subject'] = $project_cost_temp['second_level_subject']; $data['third_level_subject'] = $project_cost_temp['third_level_subject']; $data['is_travel'] = $project_cost_temp['is_travel']; $data['is_travel_text'] = $project_cost_temp->is_travel_text; return $data; }) ->toArray(); } /** * @notes 获取费用预算明细数量 * @return int * @author likeadmin * @date 2024/01/16 14:32 */ public function count(): int { return ProjectCostBudgetDetail::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", "project_name" => "项目名称", "cost_budget_code" => "费用预算单号", "first_level_subject" => "一级科目", "second_level_subject" => "二级科目", "third_level_subject" => "三级科目", "is_travel_text" => "是否差旅科目", "unit" => "单位", "amount" => "预算金额", "standard" => "编制标准", ]; } }