['bid_document_examination_id', 'project_id'], ]; } /** * @notes 获取投标结果列表 * @return array * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException * @author likeadmin * @date 2023/12/02 14:54 */ public function lists(): array { $params = $this->request->get(['bid_document_examination_code','project_name']); $where = []; if(isset($params['bid_document_examination_code']) && $params['bid_document_examination_code'] != ''){ $bid_document_examination_ids = BidDocumentExamination::where('code','like','%'.$params['bid_document_examination_code'].'%')->column('id'); $where[] = ['bid_document_examination_id','in',$bid_document_examination_ids]; } if(isset($params['project_name']) && $params['project_name'] != ''){ $project_ids = Project::where('code','like','%'.$params['project_name'].'%')->column('id'); $where[] = ['project_id','in',$project_ids]; } return BidResult::where($this->searchWhere)->where($where) ->field('id,bid_document_examination_id,project_id,is_successful,bidder_company,bidder_amount') ->limit($this->limitOffset, $this->limitLength) ->order(['id' => 'desc']) ->select()->each(function($data){ $project = Project::field('name,project_code,custom_id')->where('id',$data['project_id'])->findOrEmpty(); $custom = Custom::field('name')->where('id',$project['custom_id'])->findOrEmpty(); $bid_document_examination = BidDocumentExamination::field('code,buy_bidding_document_id')->where('id',$data['bid_document_examination_id'])->findOrEmpty(); $buy_bidding_document = BidBuyBiddingDocument::field('bid_decision_id')->where('id',$bid_document_examination['buy_bidding_document_id'])->findOrEmpty(); $bid_decision = BidBiddingDecision::field('bidding_time,bid_opening_date')->where('id',$buy_bidding_document['bid_decision_id'])->findOrEmpty(); $data['project_name'] = $project['name']; $data['project_code'] = $project['project_code']; $data['custom_name'] = $custom['name']; $data['bid_document_examination_code'] = $bid_document_examination['code']; $data['bidding_time'] = $bid_decision['bidding_time']; $data['bid_opening_date'] = $bid_decision['bid_opening_date']; $data['is_successful_text'] = $data->is_successful_text; }) ->toArray(); } /** * @notes 获取投标结果数量 * @return int * @author likeadmin * @date 2023/12/02 14:54 */ public function count(): int { $params = $this->request->get(['bid_document_examination_code','project_name']); $where = []; if(isset($params['bid_document_examination_code']) && $params['bid_document_examination_code'] != ''){ $bid_document_examination_ids = BidDocumentExamination::where('code','like','%'.$params['bid_document_examination_code'].'%')->column('id'); $where[] = ['bid_document_examination_id','in',$bid_document_examination_ids]; } if(isset($params['project_name']) && $params['project_name'] != ''){ $project_ids = Project::where('code','like','%'.$params['project_name'].'%')->column('id'); $where[] = ['project_id','in',$project_ids]; } return BidResult::where($this->searchWhere)->where($where)->count(); } public function setFileName(): string { return '投标结果列表'; } /** * @notes 导出字段 * @return string[] * @author 段誉 * @date 2022/11/24 16:17 */ public function setExcelFields(): array { return [ 'id' => 'id', 'bid_document_examination_code' => '标书审查编号', 'custom_name' => '客户名称', 'project_name' => '项目名称', 'project_code' => '项目编码', 'bidding_time' => '投标时间', 'bid_opening_date' => '开标日期', 'is_successful_text' => '是否中标', 'bidder_company' => '中标单位', 'bidder_amount' => '中标金额', ]; } }