126 lines
5.1 KiB
PHP
126 lines
5.1 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\MarketingBusinessOpportunity;
|
||
use app\common\model\marketing\MarketingCustom;
|
||
use app\common\model\oa\FlowApprove;
|
||
|
||
|
||
/**
|
||
* 市场经营--投标管理--投标评审列表
|
||
* Class MarketingBidEvaluationLists
|
||
* @package app\adminapi\listsmarketing
|
||
*/
|
||
class MarketingBidEvaluationLists extends BaseAdminDataLists implements ListsSearchInterface
|
||
{
|
||
|
||
|
||
/**
|
||
* @notes 设置搜索条件
|
||
* @return \string[][]
|
||
* @author likeadmin
|
||
* @date 2024/04/11 15:42
|
||
*/
|
||
public function setSearch(): array
|
||
{
|
||
return [
|
||
'=' => ['business_opportunity_id', 'bid_type', 'bid_nature'],
|
||
'%like%' => ['bid_code'],
|
||
];
|
||
}
|
||
|
||
|
||
/**
|
||
* @notes 获取市场经营--投标管理--投标评审列表
|
||
* @return array
|
||
* @throws \think\db\exception\DataNotFoundException
|
||
* @throws \think\db\exception\DbException
|
||
* @throws \think\db\exception\ModelNotFoundException
|
||
* @author likeadmin
|
||
* @date 2024/04/11 15:42
|
||
*/
|
||
public function lists(): array
|
||
{
|
||
return MarketingBidEvaluation::withoutField('create_time,update_time,delete_time')->where($this->searchWhere)
|
||
->limit($this->limitOffset, $this->limitLength)
|
||
->order(['id' => 'desc'])
|
||
->select()->each(function ($data) {
|
||
$business_opportunity = MarketingBusinessOpportunity::withoutField('bid_date,contacts,annex,approve_id,create_time,update_time,delete_time')->where('id', $data['business_opportunity_id'])->findOrEmpty();
|
||
$data['business_opportunity'] = $business_opportunity->toArray();
|
||
$construct_company = MarketingCustom::field('name')->where('id', $business_opportunity['construct_company'])->findOrEmpty();
|
||
$admin = Admin::where('id', 'in', [$business_opportunity['head'], $business_opportunity['leader']])->column('name', 'id');
|
||
$dept = Dept::field('name')->where('id', $business_opportunity['dept'])->findOrEmpty();
|
||
$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'] = $dept?->name;
|
||
$data['business_opportunity']['head_name'] = $admin[$data['head']] ?? '';
|
||
$data['business_opportunity']['leader_name'] = $admin[$data['leader']] ?? '';
|
||
$data['bid_type_text'] = $data->bid_type_text;
|
||
$data['bid_nature_text'] = $data->bid_nature_text;
|
||
if (empty($data['reg_date'])) {
|
||
$data['reg_status'] = 0;
|
||
$data['reg_status_text'] = '未报名';
|
||
} else {
|
||
if ($data['review_status'] == 0 && $data['reg_result'] == 0) {
|
||
$data['reg_status'] = 1;
|
||
$data['reg_status_text'] = '报名通过';
|
||
} else {
|
||
$data['reg_status'] = 2;
|
||
$data['reg_status_text'] = '报名不通过';
|
||
}
|
||
}
|
||
if (!empty($data['approve_id'])) {
|
||
$approve = FlowApprove::field('check_status')->where('content_id', $data['id'])->where('content_model', 'app\common\model\marketing\MarketingBidEvaluation')->findOrEmpty();
|
||
$data['approve_status'] = $approve['check_status'];
|
||
$data['approve_status_text'] = match ($approve['check_status']) {
|
||
0 => '待审核',
|
||
1 => '审核中',
|
||
2 => '审核通过',
|
||
3 => '审核不通过',
|
||
4 => '撤销审核',
|
||
};
|
||
} else {
|
||
$data['approve_status'] = 0;
|
||
$data['approve_status_text'] = '待审核';
|
||
}
|
||
})
|
||
->toArray();
|
||
}
|
||
|
||
|
||
/**
|
||
* @notes 获取市场经营--投标管理--投标评审数量
|
||
* @return int
|
||
* @author likeadmin
|
||
* @date 2024/04/11 15:42
|
||
*/
|
||
public function count(): int
|
||
{
|
||
return MarketingBidEvaluation::where($this->searchWhere)->count();
|
||
}
|
||
|
||
} |