['bid_document_examination_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 09:59 */ public function lists(): array { $params = $this->request->get(['bid_document_examination_code','product_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['product_name']) && $params['product_name'] != ''){ $product_ids = Material::where('name','like','%'.$params['product_name'].'%')->column('id'); $where[] = ['product_id','in',$product_ids]; } return BidDocumentExaminationDetail::where($this->searchWhere)->where($where) ->field('id,bid_document_examination_id,product_id,num,points,cost_price,cost_amount,sale_price,sale_amount') ->limit($this->limitOffset, $this->limitLength) ->order(['id' => 'desc']) ->select()->each(function($item){ $bid_document_examination = BidDocumentExamination::field('project_id,code')->where('id',$item['bid_document_examination_id'])->findOrEmpty(); $project = Project::field('name,project_code,custom_id')->where('id',$bid_document_examination['project_id'])->findOrEmpty(); $custom = Custom::field('name')->where('id',$project['custom_id'])->findOrEmpty(); $product = Material::field('name,specs,unit')->where('id',$item['product_id'])->findOrEmpty(); $item['bid_document_examination_code'] = $bid_document_examination['code']; $item['project_name'] = $project['name']; $item['project_code'] = $project['project_code']; $item['custom_name'] = $custom['name']; $item['product_name'] = $product['name']; $item['product_specs'] = $product['specs']; $item['product_unit'] = $product['unit']; }) ->toArray(); } /** * @notes 获取标书审查-报价明细数量 * @return int * @author likeadmin * @date 2023/12/02 09:59 */ public function count(): int { $params = $this->request->get(['bid_document_examination_code','product_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['product_name']) && $params['product_name'] != ''){ $product_ids = Material::where('name','like','%'.$params['product_name'].'%')->column('id'); $where[] = ['product_id','in',$product_ids]; } return BidDocumentExaminationDetail::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' => '项目编码', 'product_name' => '产品名称', 'product_specs' => '型号规格', 'product_unit' => '单位', 'num' => '数量', 'cost_price' => '成本单价', 'cost_amount' => '金额', 'points' => '点数', 'sale_price' => '报价单价', 'sale_amount' => '报价金额', ]; } }