140 lines
7.4 KiB
PHP
140 lines
7.4 KiB
PHP
<?php
|
||
// +----------------------------------------------------------------------
|
||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||
// +----------------------------------------------------------------------
|
||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||
// | 开源版本可自由商用,可去除界面版权logo
|
||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||
// | 访问官网:https://www.likeadmin.cn
|
||
// | likeadmin团队 版权所有 拥有最终解释权
|
||
// +----------------------------------------------------------------------
|
||
// | author: likeadminTeam
|
||
// +----------------------------------------------------------------------
|
||
|
||
namespace app\adminapi\lists\marketing;
|
||
|
||
|
||
use app\adminapi\lists\BaseAdminDataLists;
|
||
use app\common\lists\ListsSearchInterface;
|
||
use app\common\model\auth\Admin;
|
||
use app\common\model\dept\Dept;
|
||
use app\common\model\marketing\MarketingBidEvaluation;
|
||
use app\common\model\marketing\MarketingBidInfo;
|
||
use app\common\model\marketing\MarketingBidResult;
|
||
use app\common\model\marketing\MarketingBusinessOpportunity;
|
||
use app\common\model\marketing\MarketingCustom;
|
||
|
||
|
||
/**
|
||
* 市场经营--投标管理--投标结果列表
|
||
* Class MarketingBidResultLists
|
||
* @package app\adminapi\listsmarketing
|
||
*/
|
||
class MarketingBidResultLists extends BaseAdminDataLists implements ListsSearchInterface
|
||
{
|
||
|
||
|
||
/**
|
||
* @notes 设置搜索条件
|
||
* @return \string[][]
|
||
* @author likeadmin
|
||
* @date 2024/04/12 13:59
|
||
*/
|
||
public function setSearch(): array
|
||
{
|
||
return [
|
||
'=' => ['bid_info_id', 'bid_result', 'bid_open_address', 'manager'],
|
||
];
|
||
}
|
||
|
||
|
||
/**
|
||
* @notes 获取市场经营--投标管理--投标结果列表
|
||
* @return array
|
||
* @throws \think\db\exception\DataNotFoundException
|
||
* @throws \think\db\exception\DbException
|
||
* @throws \think\db\exception\ModelNotFoundException
|
||
* @author likeadmin
|
||
* @date 2024/04/12 13:59
|
||
*/
|
||
public function lists(): array
|
||
{
|
||
$params = $this->request->get();
|
||
$where = [];
|
||
if (isset($params['business_opportunity_id']) && $params['business_opportunity_id'] != '') {
|
||
$bid_evaluation_ids0 = MarketingBidEvaluation::where('business_opportunity_id', $params['business_opportunity_id'])->column('id');
|
||
$bid_info_ids0 = MarketingBidInfo::where('bid_evaluation_id', 'in', $bid_evaluation_ids0)->column('id');
|
||
$where[] = ['bid_info_id', 'in', $bid_info_ids0];
|
||
}
|
||
if (isset($params['construct_company']) && $params['construct_company'] != '') {
|
||
$business_opportunity_ids = MarketingBusinessOpportunity::where('construct_company', $params['construct_company'])->column('id');
|
||
$bid_evaluation_ids = MarketingBidEvaluation::where('business_opportunity_id', 'in', $business_opportunity_ids)->column('id');
|
||
$bid_info_ids = MarketingBidInfo::where('bid_evaluation_id', 'in', $bid_evaluation_ids)->column('id');
|
||
$where[] = ['bid_info_id', 'in', $bid_info_ids];
|
||
}
|
||
return MarketingBidResult::withoutField('create_time,update_time,delete_time')->where($this->searchWhere)->where($where)
|
||
->limit($this->limitOffset, $this->limitLength)
|
||
->order(['id' => 'desc'])
|
||
->select()->each(function ($data) {
|
||
$data['bid_result_text'] = $data->bid_result_text;
|
||
//投标信息
|
||
$bid_info = MarketingBidInfo::withoutField('create_time,update_time,delete_time')->where('id', $data['bid_info_id'])->findOrEmpty();
|
||
$data['bid_info'] = $bid_info;
|
||
$bid_info_admin = Admin::where('id', 'in', [$bid_info['general_manager'], $bid_info['bid_head'], $bid_info['technology_head'], $bid_info['business_head'], $bid_info['other_user']])->column('name', 'id');
|
||
$data['bid_info']['general_manager_name'] = $bid_info_admin[$bid_info['general_manager']] ?? '';
|
||
$data['bid_info']['bid_head_name'] = $bid_info_admin[$bid_info['bid_head']] ?? '';
|
||
$data['bid_info']['technology_head_name'] = $bid_info_admin[$bid_info['technology_head']] ?? '';
|
||
$data['bid_info']['business_head_name'] = $bid_info_admin[$bid_info['business_head']] ?? '';
|
||
$data['bid_info']['other_user_name'] = $bid_info_admin[$bid_info['other_user']] ?? '';
|
||
//投标审查
|
||
$bid_evaluation = MarketingBidEvaluation::withoutField('create_time,update_time,delete_time')->where('id', $bid_info['bid_evaluation_id'])->findOrEmpty();
|
||
$data['bid_evaluation'] = $bid_evaluation;
|
||
$data['bid_evaluation']['bid_type_text'] = $bid_evaluation->bid_type_text;
|
||
$data['bid_evaluation']['bid_nature_text'] = $bid_evaluation->bid_nature_text;
|
||
//业务机会信息
|
||
$business_opportunity = MarketingBusinessOpportunity::withoutField('bid_date,contacts,annex,approve_id,create_time,update_time,delete_time')->where('id', $bid_evaluation['business_opportunity_id'])->findOrEmpty();
|
||
$construct_company = MarketingCustom::field('name')->where('id', $business_opportunity['construct_company'])->findOrEmpty();
|
||
$business_opportunity_admin = Admin::where('id', 'in', [$business_opportunity['head'], $business_opportunity['leader']])->column('name', 'id');
|
||
$business_opportunity_dept = Dept::field('name')->where('id', $business_opportunity['dept'])->findOrEmpty();
|
||
$data['business_opportunity'] = $business_opportunity;
|
||
$data['business_opportunity']['construct_company_name'] = $construct_company?->name;
|
||
$data['business_opportunity']['business_nature_text'] = $business_opportunity->business_nature_text;
|
||
$data['business_opportunity']['industry_nature_text'] = $business_opportunity->industry_nature_text;
|
||
$data['business_opportunity']['info_sources_text'] = $business_opportunity->info_sources_text;
|
||
$data['business_opportunity']['fund_sources_text'] = $business_opportunity->fund_sources_text;
|
||
$data['business_opportunity']['const_area_text'] = $business_opportunity->const_area_text;
|
||
$data['business_opportunity']['status_text'] = $business_opportunity->status_text;
|
||
$data['business_opportunity']['dept_name'] = $business_opportunity_dept?->name;
|
||
$data['business_opportunity']['head_name'] = $business_opportunity_admin[$business_opportunity['head']] ?? '';
|
||
$data['business_opportunity']['leader_name'] = $business_opportunity_admin[$business_opportunity['leader']] ?? '';
|
||
})
|
||
->toArray();
|
||
}
|
||
|
||
|
||
/**
|
||
* @notes 获取市场经营--投标管理--投标结果数量
|
||
* @return int
|
||
* @author likeadmin
|
||
* @date 2024/04/12 13:59
|
||
*/
|
||
public function count(): int
|
||
{
|
||
$params = $this->request->get();
|
||
$where = [];
|
||
if (isset($params['business_opportunity_id']) && $params['business_opportunity_id'] != '') {
|
||
$bid_evaluation_ids0 = MarketingBidEvaluation::where('business_opportunity_id', $params['business_opportunity_id'])->column('id');
|
||
$bid_info_ids0 = MarketingBidInfo::where('bid_evaluation_id', 'in', $bid_evaluation_ids0)->column('id');
|
||
$where[] = ['bid_info_id', 'in', $bid_info_ids0];
|
||
}
|
||
if (isset($params['construct_company']) && $params['construct_company'] != '') {
|
||
$business_opportunity_ids = MarketingBusinessOpportunity::where('construct_company', $params['construct_company'])->column('id');
|
||
$bid_evaluation_ids = MarketingBidEvaluation::where('business_opportunity_id', 'in', $business_opportunity_ids)->column('id');
|
||
$bid_info_ids = MarketingBidInfo::where('bid_evaluation_id', 'in', $bid_evaluation_ids)->column('id');
|
||
$where[] = ['bid_info_id', 'in', $bid_info_ids];
|
||
}
|
||
return MarketingBidResult::where($this->searchWhere)->where($where)->count();
|
||
}
|
||
|
||
} |