This commit is contained in:
weiz 2024-04-12 14:48:11 +08:00
parent 8f134fe78c
commit 74d261bb28
16 changed files with 1141 additions and 23 deletions

View File

@ -0,0 +1,111 @@
<?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\controller\marketing;
use app\adminapi\controller\BaseAdminController;
use app\adminapi\lists\marketing\MarketingBidResultLists;
use app\adminapi\logic\marketing\MarketingBidResultLogic;
use app\adminapi\validate\marketing\MarketingBidResultValidate;
/**
* 市场经营--投标管理--投标结果控制器
* Class MarketingBidResultController
* @package app\adminapi\controller\marketing
*/
class MarketingBidResultController extends BaseAdminController
{
/**
* @notes 获取市场经营--投标管理--投标结果列表
* @return \think\response\Json
* @author likeadmin
* @date 2024/04/12 13:59
*/
public function lists()
{
return $this->dataLists(new MarketingBidResultLists());
}
/**
* @notes 添加市场经营--投标管理--投标结果
* @return \think\response\Json
* @author likeadmin
* @date 2024/04/12 13:59
*/
public function add()
{
$params = (new MarketingBidResultValidate())->post()->goCheck('add');
$result = MarketingBidResultLogic::add($params);
if (true === $result) {
return $this->success('添加成功', [], 1, 1);
}
return $this->fail(MarketingBidResultLogic::getError());
}
/**
* @notes 编辑市场经营--投标管理--投标结果
* @return \think\response\Json
* @author likeadmin
* @date 2024/04/12 13:59
*/
public function edit()
{
$params = (new MarketingBidResultValidate())->post()->goCheck('edit');
$result = MarketingBidResultLogic::edit($params);
if (true === $result) {
return $this->success('编辑成功', [], 1, 1);
}
return $this->fail(MarketingBidResultLogic::getError());
}
/**
* @notes 删除市场经营--投标管理--投标结果
* @return \think\response\Json
* @author likeadmin
* @date 2024/04/12 13:59
*/
public function delete()
{
$params = (new MarketingBidResultValidate())->post()->goCheck('delete');
$result = MarketingBidResultLogic::delete($params);
if (true === $result) {
return $this->success('删除成功', [], 1, 1);
}
return $this->fail(MarketingBidResultLogic::getError());
}
/**
* @notes 获取市场经营--投标管理--投标结果详情
* @return \think\response\Json
* @author likeadmin
* @date 2024/04/12 13:59
*/
public function detail()
{
$params = (new MarketingBidResultValidate())->goCheck('detail');
$result = MarketingBidResultLogic::detail($params);
return $this->data($result);
}
}

View File

@ -0,0 +1,108 @@
<?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\controller\marketing;
use app\adminapi\controller\BaseAdminController;
use app\adminapi\lists\marketing\MarketingBidResultDetailLists;
use app\adminapi\logic\marketing\MarketingBidResultDetailLogic;
use app\adminapi\validate\marketing\MarketingBidResultDetailValidate;
/**
* 市场经营--投标管理--投标结果--参标单位控制器
* Class MarketingBidResultDetailController
* @package app\adminapi\controller\marketing
*/
class MarketingBidResultDetailController extends BaseAdminController
{
/**
* @notes 获取市场经营--投标管理--投标结果--参标单位列表
* @return \think\response\Json
* @author likeadmin
* @date 2024/04/12 13:59
*/
public function lists()
{
return $this->dataLists(new MarketingBidResultDetailLists());
}
/**
* @notes 添加市场经营--投标管理--投标结果--参标单位
* @return \think\response\Json
* @author likeadmin
* @date 2024/04/12 13:59
*/
public function add()
{
$params = (new MarketingBidResultDetailValidate())->post()->goCheck('add');
$result = MarketingBidResultDetailLogic::add($params);
if (true === $result) {
return $this->success('添加成功', [], 1, 1);
}
return $this->fail(MarketingBidResultDetailLogic::getError());
}
/**
* @notes 编辑市场经营--投标管理--投标结果--参标单位
* @return \think\response\Json
* @author likeadmin
* @date 2024/04/12 13:59
*/
public function edit()
{
$params = (new MarketingBidResultDetailValidate())->post()->goCheck('edit');
$result = MarketingBidResultDetailLogic::edit($params);
if (true === $result) {
return $this->success('编辑成功', [], 1, 1);
}
return $this->fail(MarketingBidResultDetailLogic::getError());
}
/**
* @notes 删除市场经营--投标管理--投标结果--参标单位
* @return \think\response\Json
* @author likeadmin
* @date 2024/04/12 13:59
*/
public function delete()
{
$params = (new MarketingBidResultDetailValidate())->post()->goCheck('delete');
MarketingBidResultDetailLogic::delete($params);
return $this->success('删除成功', [], 1, 1);
}
/**
* @notes 获取市场经营--投标管理--投标结果--参标单位详情
* @return \think\response\Json
* @author likeadmin
* @date 2024/04/12 13:59
*/
public function detail()
{
$params = (new MarketingBidResultDetailValidate())->goCheck('detail');
$result = MarketingBidResultDetailLogic::detail($params);
return $this->data($result);
}
}

View File

@ -69,8 +69,12 @@
->limit($this->limitOffset, $this->limitLength) ->limit($this->limitOffset, $this->limitLength)
->order(['id' => 'desc']) ->order(['id' => 'desc'])
->select()->each(function ($data) { ->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['bid_type_text'] = $data->bid_type_text;
$data['business_opportunity'] = $business_opportunity->toArray(); $data['bid_nature_text'] = $data->bid_nature_text;
$data['approve_check_status_text'] = $data->approve_check_status_text;
//业务机会
$business_opportunity = MarketingBusinessOpportunity::withoutField('create_time,update_time,delete_time')->where('id', $data['business_opportunity_id'])->findOrEmpty();
$data['business_opportunity'] = $business_opportunity;
$construct_company = MarketingCustom::field('name')->where('id', $business_opportunity['construct_company'])->findOrEmpty(); $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'); $admin = Admin::where('id', 'in', [$business_opportunity['head'], $business_opportunity['leader']])->column('name', 'id');
$dept = Dept::field('name')->where('id', $business_opportunity['dept'])->findOrEmpty(); $dept = Dept::field('name')->where('id', $business_opportunity['dept'])->findOrEmpty();
@ -82,11 +86,8 @@
$data['business_opportunity']['const_area_text'] = $business_opportunity->const_area_text; $data['business_opportunity']['const_area_text'] = $business_opportunity->const_area_text;
$data['business_opportunity']['status_text'] = $business_opportunity->status_text; $data['business_opportunity']['status_text'] = $business_opportunity->status_text;
$data['business_opportunity']['dept_name'] = $dept?->name; $data['business_opportunity']['dept_name'] = $dept?->name;
$data['business_opportunity']['head_name'] = $admin[$data['head']] ?? ''; $data['business_opportunity']['head_name'] = $admin[$business_opportunity['head']] ?? '';
$data['business_opportunity']['leader_name'] = $admin[$data['leader']] ?? ''; $data['business_opportunity']['leader_name'] = $admin[$business_opportunity['leader']] ?? '';
$data['bid_type_text'] = $data->bid_type_text;
$data['bid_nature_text'] = $data->bid_nature_text;
$data['approve_check_status_text'] = $data->approve_check_status_text;
if (empty($data['reg_date'])) { if (empty($data['reg_date'])) {
$data['reg_status'] = 0; $data['reg_status'] = 0;
$data['reg_status_text'] = '未报名'; $data['reg_status_text'] = '未报名';

View File

@ -75,7 +75,7 @@
->order(['id' => 'desc']) ->order(['id' => 'desc'])
->select()->each(function ($data) { ->select()->each(function ($data) {
//投标审查信息 //投标审查信息
$bid_evaluation = MarketingBidEvaluation::withoutField('annex,create_time,update_time,delete_time')->where('id', $data['bid_evaluation_id'])->findOrEmpty(); $bid_evaluation = MarketingBidEvaluation::withoutField('create_time,update_time,delete_time')->where('id', $data['bid_evaluation_id'])->findOrEmpty();
$data['bid_evaluation'] = $bid_evaluation; $data['bid_evaluation'] = $bid_evaluation;
$data['bid_evaluation']['bid_type_text'] = $bid_evaluation->bid_type_text; $data['bid_evaluation']['bid_type_text'] = $bid_evaluation->bid_type_text;
$data['bid_evaluation']['bid_nature_text'] = $bid_evaluation->bid_nature_text; $data['bid_evaluation']['bid_nature_text'] = $bid_evaluation->bid_nature_text;
@ -93,8 +93,8 @@
$data['business_opportunity']['const_area_text'] = $business_opportunity->const_area_text; $data['business_opportunity']['const_area_text'] = $business_opportunity->const_area_text;
$data['business_opportunity']['status_text'] = $business_opportunity->status_text; $data['business_opportunity']['status_text'] = $business_opportunity->status_text;
$data['business_opportunity']['dept_name'] = $business_opportunity_dept?->name; $data['business_opportunity']['dept_name'] = $business_opportunity_dept?->name;
$data['business_opportunity']['head_name'] = $business_opportunity_admin[$data['head']] ?? ''; $data['business_opportunity']['head_name'] = $business_opportunity_admin[$business_opportunity['head']] ?? '';
$data['business_opportunity']['leader_name'] = $business_opportunity_admin[$data['leader']] ?? ''; $data['business_opportunity']['leader_name'] = $business_opportunity_admin[$business_opportunity['leader']] ?? '';
//投标信息 //投标信息
$admin = Admin::where('id', 'in', [$data['general_manager'], $data['bid_head'], $data['technology_head'], $data['business_head'], $data['other_user']])->column('name', 'id'); $admin = Admin::where('id', 'in', [$data['general_manager'], $data['bid_head'], $data['technology_head'], $data['business_head'], $data['other_user']])->column('name', 'id');
$data['general_manager_name'] = $admin[$data['general_manager']] ?? ''; $data['general_manager_name'] = $admin[$data['general_manager']] ?? '';

View File

@ -0,0 +1,77 @@
<?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\model\marketing\MarketingBidResultDetail;
use app\common\lists\ListsSearchInterface;
/**
* 市场经营--投标管理--投标结果--参标单位列表
* Class MarketingBidResultDetailLists
* @package app\adminapi\listsmarketing
*/
class MarketingBidResultDetailLists extends BaseAdminDataLists implements ListsSearchInterface
{
/**
* @notes 设置搜索条件
* @return \string[][]
* @author likeadmin
* @date 2024/04/12 13:59
*/
public function setSearch(): array
{
return [
'=' => ['bid_result_id'],
];
}
/**
* @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
{
return MarketingBidResultDetail::where($this->searchWhere)
->field(['id', 'bid_result_id', 'company', 'quotation_one', 'quotation_two', 'quotation_three', 'final_rate', 'manager', 'month', 'result'])
->limit($this->limitOffset, $this->limitLength)
->order(['id' => 'desc'])
->select()
->toArray();
}
/**
* @notes 获取市场经营--投标管理--投标结果--参标单位数量
* @return int
* @author likeadmin
* @date 2024/04/12 13:59
*/
public function count(): int
{
return MarketingBidResultDetail::where($this->searchWhere)->count();
}
}

View File

@ -0,0 +1,140 @@
<?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();
}
}

View File

@ -167,7 +167,11 @@
public static function detail($params): array public static function detail($params): array
{ {
$data = MarketingBidEvaluation::withoutField('create_time,update_time,delete_time')->findOrEmpty($params['id']); $data = MarketingBidEvaluation::withoutField('create_time,update_time,delete_time')->findOrEmpty($params['id']);
$business_opportunity = MarketingBusinessOpportunity::withoutField('bid_date,contacts,annex,approve_id,create_time,update_time,delete_time')->where('id', $data['business_opportunity_id'])->findOrEmpty(); $data['bid_type_text'] = $data->bid_type_text;
$data['bid_nature_text'] = $data->bid_nature_text;
$data['approve_check_status_text'] = $data->approve_check_status_text;
//业务机会
$business_opportunity = MarketingBusinessOpportunity::withoutField('create_time,update_time,delete_time')->where('id', $data['business_opportunity_id'])->findOrEmpty();
$data['business_opportunity'] = $business_opportunity; $data['business_opportunity'] = $business_opportunity;
$construct_company = MarketingCustom::field('name')->where('id', $business_opportunity['construct_company'])->findOrEmpty(); $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'); $admin = Admin::where('id', 'in', [$business_opportunity['head'], $business_opportunity['leader']])->column('name', 'id');
@ -180,11 +184,8 @@
$data['business_opportunity']['const_area_text'] = $business_opportunity->const_area_text; $data['business_opportunity']['const_area_text'] = $business_opportunity->const_area_text;
$data['business_opportunity']['status_text'] = $business_opportunity->status_text; $data['business_opportunity']['status_text'] = $business_opportunity->status_text;
$data['business_opportunity']['dept_name'] = $dept?->name; $data['business_opportunity']['dept_name'] = $dept?->name;
$data['business_opportunity']['head_name'] = $admin[$data['head']] ?? ''; $data['business_opportunity']['head_name'] = $admin[$business_opportunity['head']] ?? '';
$data['business_opportunity']['leader_name'] = $admin[$data['leader']] ?? ''; $data['business_opportunity']['leader_name'] = $admin[$business_opportunity['leader']] ?? '';
$data['bid_type_text'] = $data->bid_type_text;
$data['bid_nature_text'] = $data->bid_nature_text;
$data['approve_check_status_text'] = $data->approve_check_status_text;
return $data->toArray(); return $data->toArray();
} }

View File

@ -135,7 +135,7 @@
{ {
$data = MarketingBidInfo::withoutField('create_time,update_time,delete_time')->findOrEmpty($params['id']); $data = MarketingBidInfo::withoutField('create_time,update_time,delete_time')->findOrEmpty($params['id']);
//投标审查信息 //投标审查信息
$bid_evaluation = MarketingBidEvaluation::withoutField('annex,create_time,update_time,delete_time')->where('id', $data['bid_evaluation_id'])->findOrEmpty(); $bid_evaluation = MarketingBidEvaluation::withoutField('create_time,update_time,delete_time')->where('id', $data['bid_evaluation_id'])->findOrEmpty();
$data['bid_evaluation'] = $bid_evaluation; $data['bid_evaluation'] = $bid_evaluation;
$data['bid_evaluation']['bid_type_text'] = $bid_evaluation->bid_type_text; $data['bid_evaluation']['bid_type_text'] = $bid_evaluation->bid_type_text;
$data['bid_evaluation']['bid_nature_text'] = $bid_evaluation->bid_nature_text; $data['bid_evaluation']['bid_nature_text'] = $bid_evaluation->bid_nature_text;
@ -153,8 +153,8 @@
$data['business_opportunity']['const_area_text'] = $business_opportunity->const_area_text; $data['business_opportunity']['const_area_text'] = $business_opportunity->const_area_text;
$data['business_opportunity']['status_text'] = $business_opportunity->status_text; $data['business_opportunity']['status_text'] = $business_opportunity->status_text;
$data['business_opportunity']['dept_name'] = $business_opportunity_dept?->name; $data['business_opportunity']['dept_name'] = $business_opportunity_dept?->name;
$data['business_opportunity']['head_name'] = $business_opportunity_admin[$data['head']] ?? ''; $data['business_opportunity']['head_name'] = $business_opportunity_admin[$business_opportunity['head']] ?? '';
$data['business_opportunity']['leader_name'] = $business_opportunity_admin[$data['leader']] ?? ''; $data['business_opportunity']['leader_name'] = $business_opportunity_admin[$business_opportunity['leader']] ?? '';
//投标信息 //投标信息
$admin = Admin::where('id', 'in', [$data['general_manager'], $data['bid_head'], $data['technology_head'], $data['business_head'], $data['other_user']])->column('name', 'id'); $admin = Admin::where('id', 'in', [$data['general_manager'], $data['bid_head'], $data['technology_head'], $data['business_head'], $data['other_user']])->column('name', 'id');
$data['general_manager_name'] = $admin[$data['general_manager']] ?? ''; $data['general_manager_name'] = $admin[$data['general_manager']] ?? '';

View File

@ -0,0 +1,122 @@
<?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\logic\marketing;
use app\common\model\marketing\MarketingBidResultDetail;
use app\common\logic\BaseLogic;
use think\facade\Db;
/**
* 市场经营--投标管理--投标结果--参标单位逻辑
* Class MarketingBidResultDetailLogic
* @package app\adminapi\logic\marketing
*/
class MarketingBidResultDetailLogic extends BaseLogic
{
/**
* @notes 添加市场经营--投标管理--投标结果--参标单位
* @param array $params
* @return bool
* @author likeadmin
* @date 2024/04/12 13:59
*/
public static function add(array $params): bool
{
Db::startTrans();
try {
MarketingBidResultDetail::create([
'bid_result_id' => $params['bid_result_id'],
'company' => $params['company'],
'quotation_one' => $params['quotation_one'],
'quotation_two' => $params['quotation_two'],
'quotation_three' => $params['quotation_three'],
'final_rate' => $params['final_rate'],
'manager' => $params['manager'],
'month' => $params['month'],
'result' => $params['result'],
]);
Db::commit();
return true;
} catch (\Exception $e) {
Db::rollback();
self::setError($e->getMessage());
return false;
}
}
/**
* @notes 编辑市场经营--投标管理--投标结果--参标单位
* @param array $params
* @return bool
* @author likeadmin
* @date 2024/04/12 13:59
*/
public static function edit(array $params): bool
{
Db::startTrans();
try {
MarketingBidResultDetail::where('id', $params['id'])->update([
'bid_result_id' => $params['bid_result_id'],
'company' => $params['company'],
'quotation_one' => $params['quotation_one'],
'quotation_two' => $params['quotation_two'],
'quotation_three' => $params['quotation_three'],
'final_rate' => $params['final_rate'],
'manager' => $params['manager'],
'month' => $params['month'],
'result' => $params['result'],
]);
Db::commit();
return true;
} catch (\Exception $e) {
Db::rollback();
self::setError($e->getMessage());
return false;
}
}
/**
* @notes 删除市场经营--投标管理--投标结果--参标单位
* @param array $params
* @return bool
* @author likeadmin
* @date 2024/04/12 13:59
*/
public static function delete(array $params): bool
{
return MarketingBidResultDetail::destroy($params['id']);
}
/**
* @notes 获取市场经营--投标管理--投标结果--参标单位详情
* @param $params
* @return array
* @author likeadmin
* @date 2024/04/12 13:59
*/
public static function detail($params): array
{
return MarketingBidResultDetail::findOrEmpty($params['id'])->toArray();
}
}

View File

@ -0,0 +1,216 @@
<?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\logic\marketing;
use app\common\logic\BaseLogic;
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\MarketingBidResultDetail;
use app\common\model\marketing\MarketingBusinessOpportunity;
use app\common\model\marketing\MarketingCustom;
use think\facade\Db;
/**
* 市场经营--投标管理--投标结果逻辑
* Class MarketingBidResultLogic
* @package app\adminapi\logic\marketing
*/
class MarketingBidResultLogic extends BaseLogic
{
/**
* @notes 添加市场经营--投标管理--投标结果
* @param array $params
* @return bool
* @author likeadmin
* @date 2024/04/12 13:59
*/
public static function add(array $params): bool
{
$bid_info = MarketingBidInfo::where('id', $params['bid_info_id'])->findOrEmpty();
$bid_evaluation = MarketingBidEvaluation::where('id', $bid_info['bid_evaluation_id'])->findOrEmpty();
Db::startTrans();
try {
$res = MarketingBidResult::create([
'bid_info_id' => $params['bid_info_id'],
'bid_result' => $params['bid_result'],
'quotation' => $params['quotation'] ?? 0,
'bid_open_date' => !empty($params['bid_open_date']) ? strtotime($params['bid_open_date']) : 0,
'bid_open_address' => $params['bid_open_address'] ?? '',
'our_quotation' => $params['our_quotation'] ?? 0,
'rate' => $params['rate'] ?? 0,
'month' => $params['month'] ?? '',
'manager' => $params['manager'] ?? 0,
'bid_result analysis' => $params['bid_result analysis'] ?? '',
'annex' => $params['annex'] ? json_encode($params['annex']) : null,
]);
$status = $params['bid_result'] == 0 ? 3 : 4;
MarketingBusinessOpportunity::where('id', $bid_evaluation['business_opportunity_id'])->update(['status' => $status]);
if (!empty($params['detail'])) {
foreach ($params['detail'] as $v) {
MarketingBidResultDetail::create([
'bid_result_id' => $res->id,
'company' => $v['company'],
'quotation_one' => $v['quotation_one'] ?? 0,
'quotation_two' => $v['quotation_two'] ?? 0,
'quotation_three' => $v['quotation_three'] ?? 0,
'final_rate' => $v['final_rate'] ?? 0,
'manager' => $v['manager'] ?? '',
'month' => $v['month'] ?? '',
'result' => $v['result'] ?? 0,
]);
}
}
Db::commit();
return true;
} catch (\Exception $e) {
Db::rollback();
self::setError($e->getMessage());
return false;
}
}
/**
* @notes 编辑市场经营--投标管理--投标结果
* @param array $params
* @return bool
* @author likeadmin
* @date 2024/04/12 13:59
*/
public static function edit(array $params): bool
{
Db::startTrans();
try {
MarketingBidResult::where('id', $params['id'])->update([
'bid_info_id' => $params['bid_info_id'],
'bid_result' => $params['bid_result'],
'quotation' => $params['quotation'] ?? 0,
'bid_open_date' => !empty($params['bid_open_date']) ? strtotime($params['bid_open_date']) : 0,
'bid_open_address' => $params['bid_open_address'] ?? '',
'our_quotation' => $params['our_quotation'] ?? 0,
'rate' => $params['rate'] ?? 0,
'month' => $params['month'] ?? '',
'manager' => $params['manager'] ?? 0,
'bid_result analysis' => $params['bid_result analysis'] ?? '',
'annex' => $params['annex'] ? json_encode($params['annex']) : null,
]);
if (!empty($params['detail'])) {
foreach ($params['detail'] as $v) {
if (!empty($v['id'])) {
MarketingBidResultDetail::where('id', $v['id'])->update([
'bid_result_id' => $params['id'],
'company' => $v['company'],
'quotation_one' => $v['quotation_one'] ?? 0,
'quotation_two' => $v['quotation_two'] ?? 0,
'quotation_three' => $v['quotation_three'] ?? 0,
'final_rate' => $v['final_rate'] ?? 0,
'manager' => $v['manager'] ?? '',
'month' => $v['month'] ?? '',
'result' => $v['result'] ?? 0,
]);
} else {
MarketingBidResultDetail::create([
'bid_result_id' => $params['id'],
'company' => $v['company'],
'quotation_one' => $v['quotation_one'] ?? 0,
'quotation_two' => $v['quotation_two'] ?? 0,
'quotation_three' => $v['quotation_three'] ?? 0,
'final_rate' => $v['final_rate'] ?? 0,
'manager' => $v['manager'] ?? '',
'month' => $v['month'] ?? '',
'result' => $v['result'] ?? 0,
]);
}
}
}
Db::commit();
return true;
} catch (\Exception $e) {
Db::rollback();
self::setError($e->getMessage());
return false;
}
}
/**
* @notes 删除市场经营--投标管理--投标结果
* @param array $params
* @return bool
* @author likeadmin
* @date 2024/04/12 13:59
*/
public static function delete(array $params): bool
{
$detail = MarketingBidResultDetail::where('bid_result_id', 'in', $params['id'])->findOrEmpty();
if (!$detail->isEmpty()) {
self::setError('此数据关联了参标单位信息,需删除参标单位信息');
return false;
}
return MarketingBidResult::destroy($params['id']);
}
/**
* @notes 获取市场经营--投标管理--投标结果详情
* @param $params
* @return array
* @author likeadmin
* @date 2024/04/12 13:59
*/
public static function detail($params): array
{
$data = MarketingBidResult::withoutField('create_time,update_time,delete_time')->findOrEmpty($params['id']);
$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']] ?? '';
return $data->toArray();
}
}

View File

@ -42,12 +42,12 @@
'bid_margin' => 'float|egt:0', 'bid_margin' => 'float|egt:0',
'bid_amount' => 'float|egt:0', 'bid_amount' => 'float|egt:0',
'quotation_amount' => 'float|egt:0', 'quotation_amount' => 'float|egt:0',
'end_date' => 'dateFormat:y-m-d', 'end_date' => 'dateFormat:Y-m-d',
'bid_date' => 'require|dateFormat:y-m-d', 'bid_date' => 'require|dateFormat:Y-m-d',
'annex' => 'checkAnnex', 'annex' => 'checkAnnex',
'flow_id' => 'require|checkFlow', 'flow_id' => 'require|checkFlow',
'path' => 'require', 'path' => 'require',
'reg_date' => 'require|dateFormat:y-m-d', 'reg_date' => 'require|dateFormat:Y-m-d',
'review_status' => 'require|in:0,1', 'review_status' => 'require|in:0,1',
'reg_result' => 'require|in:0,1', 'reg_result' => 'require|in:0,1',
]; ];

View File

@ -0,0 +1,112 @@
<?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\validate\marketing;
use app\common\validate\BaseValidate;
/**
* 市场经营--投标管理--投标结果--参标单位验证器
* Class MarketingBidResultDetailValidate
* @package app\adminapi\validate\marketing
*/
class MarketingBidResultDetailValidate extends BaseValidate
{
/**
* 设置校验规则
* @var string[]
*/
protected $rule = [
'id' => 'require',
'bid_result_id' => 'require',
'company' => 'require',
'quotation_one' => 'require',
'quotation_two' => 'require',
'quotation_three' => 'require',
'final_rate' => 'require',
'manager' => 'require',
'month' => 'require',
'result' => 'require',
];
/**
* 参数描述
* @var string[]
*/
protected $field = [
'id' => 'id',
'bid_result_id' => '投标结果id',
'company' => '投标单位',
'quotation_one' => '报价1',
'quotation_two' => '报价2',
'quotation_three' => '报价3',
'final_rate' => '最终费率',
'manager' => '投标总监',
'month' => '投标人月数',
'result' => '投标结果 0-中标 1-不中标',
];
/**
* @notes 添加场景
* @return MarketingBidResultDetailValidate
* @author likeadmin
* @date 2024/04/12 13:59
*/
public function sceneAdd()
{
return $this->only(['bid_result_id','company','quotation_one','quotation_two','quotation_three','final_rate','manager','month','result']);
}
/**
* @notes 编辑场景
* @return MarketingBidResultDetailValidate
* @author likeadmin
* @date 2024/04/12 13:59
*/
public function sceneEdit()
{
return $this->only(['id','bid_result_id','company','quotation_one','quotation_two','quotation_three','final_rate','manager','month','result']);
}
/**
* @notes 删除场景
* @return MarketingBidResultDetailValidate
* @author likeadmin
* @date 2024/04/12 13:59
*/
public function sceneDelete()
{
return $this->only(['id']);
}
/**
* @notes 详情场景
* @return MarketingBidResultDetailValidate
* @author likeadmin
* @date 2024/04/12 13:59
*/
public function sceneDetail()
{
return $this->only(['id']);
}
}

View File

@ -0,0 +1,152 @@
<?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\validate\marketing;
use app\common\model\auth\Admin;
use app\common\model\marketing\MarketingBidInfo;
use app\common\model\marketing\MarketingBidResult;
use app\common\model\marketing\MarketingBidResultDetail;
use app\common\validate\BaseValidate;
/**
* 市场经营--投标管理--投标结果验证器
* Class MarketingBidResultValidate
* @package app\adminapi\validate\marketing
*/
class MarketingBidResultValidate extends BaseValidate
{
/**
* 设置校验规则
* @var string[]
*/
protected $rule = [
'id' => 'require|checkData',
'bid_info_id' => 'require|checkBidInfo',
'bid_result' => 'require|in:0,1',
'quotation' => 'requireIf:bid_result,0|float|egt:0',
'bid_open_date' => 'require|dateFormat:Y-m-d',
'our_quotation' => 'float|egt:0',
'rate' => 'float|egt:0',
'manager' => 'checkManager',
'bid_result analysis' => 'requireIf:bid_result,0',
'annex' => 'checkAnnex',
'detail' => 'checkDetail'
];
/**
* 参数描述
* @var string[]
*/
protected $field = [
'id' => 'id',
'bid_info_id' => '投标信息id',
'bid_result' => '投标结果 0-中标 1-不中标',
'quotation' => '中标报价',
'bid_open_date' => '开标日期',
'bid_open_address' => '开标地点',
'our_quotation' => '我方报价',
'rate' => '中标费率',
'month' => '投标人月数',
'manager' => '中标总监/经理',
'bid_result analysis' => '投标结果分析',
];
/**
* @notes 添加场景
* @return MarketingBidResultValidate
* @author likeadmin
* @date 2024/04/12 13:59
*/
public function sceneAdd()
{
return $this->remove('id', true);
}
/**
* @notes 编辑场景
* @return MarketingBidResultValidate
* @author likeadmin
* @date 2024/04/12 13:59
*/
public function sceneEdit()
{
}
/**
* @notes 删除场景
* @return MarketingBidResultValidate
* @author likeadmin
* @date 2024/04/12 13:59
*/
public function sceneDelete()
{
return $this->only(['id'])->remove('id', 'checkData');
}
/**
* @notes 详情场景
* @return MarketingBidResultValidate
* @author likeadmin
* @date 2024/04/12 13:59
*/
public function sceneDetail()
{
return $this->only(['id']);
}
public function checkData($value): bool|string
{
$data = MarketingBidResult::where('id', $value)->findOrEmpty();
return $data->isEmpty() ? '数据不存在' : true;
}
public function checkBidInfo($value): bool|string
{
$data = MarketingBidInfo::where('id', $value)->findOrEmpty();
return $data->isEmpty() ? '投标信息数据不存在' : true;
}
public function checkManager($value): bool|string
{
$data = Admin::where('id', $value)->findOrEmpty();
return $data->isEmpty() ? '中标总监/经理数据不存在' : true;
}
public function checkDetail($value): bool|string
{
if (!isset($value) || $value == '') return true;
if (!is_array($value)) return '参标单位数据格式错误';
foreach ($value as $k => $v) {
if (isset($v['id']) && !empty($v['id'])) {
$data = MarketingBidResultDetail::where('id', $v['id'])->findOrEmpty();
if ($data->isEmpty()) {
return '第' . ($k + 1) . '行参标单位信息不存在';
}
}
if (empty($v['company'])) {
return '参标单位列表第' . ($k + 1) . '行投标单位为空';
}
}
return true;
}
}

View File

@ -0,0 +1,44 @@
<?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\common\model\marketing;
use app\common\model\BaseModel;
use think\model\concern\SoftDelete;
/**
* 市场经营--投标管理--投标结果模型
* Class MarketingBidResult
* @package app\common\model\marketing
*/
class MarketingBidResult extends BaseModel
{
use SoftDelete;
protected $name = 'marketing_bid_result';
protected $deleteTime = 'delete_time';
public function getBidResultTextAttr($value, $data): string
{
$arr = [0 => '中标', 1 => '不中标'];
return $arr[$data['bid_result']];
}
public function getBidOpenDateAttr($value): string
{
return !empty($value) ? date('Y-m-d', $value) : '';
}
}

View File

@ -0,0 +1,34 @@
<?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\common\model\marketing;
use app\common\model\BaseModel;
use think\model\concern\SoftDelete;
/**
* 市场经营--投标管理--投标结果--参标单位模型
* Class MarketingBidResultDetail
* @package app\common\model\marketing
*/
class MarketingBidResultDetail extends BaseModel
{
use SoftDelete;
protected $name = 'marketing_bid_result_detail';
protected $deleteTime = 'delete_time';
}

View File

@ -70,7 +70,7 @@
public function getStatusTextAttr($value, $data): string public function getStatusTextAttr($value, $data): string
{ {
$arr = [0 => '未启动投标', 1 => '参与投标', 2 => '未开标']; $arr = [0 => '未启动投标', 1 => '参与投标', 2 => '未开标', 3 => '已中标', 4 => '未中标'];
return $arr[$data['status']]; return $arr[$data['status']];
} }