update
This commit is contained in:
parent
4bb44bfca4
commit
e37557fe71
@ -102,8 +102,11 @@
|
||||
public function delete()
|
||||
{
|
||||
$params = (new MarketingBidEvaluationValidate())->post()->goCheck('delete');
|
||||
MarketingBidEvaluationLogic::delete($params);
|
||||
return $this->success('删除成功', [], 1, 1);
|
||||
$result = MarketingBidEvaluationLogic::delete($params);
|
||||
if (true === $result) {
|
||||
return $this->success('删除成功', [], 1, 1);
|
||||
}
|
||||
return $this->fail(MarketingBidEvaluationLogic::getError());
|
||||
}
|
||||
|
||||
|
||||
|
108
app/adminapi/controller/marketing/MarketingBidInfoController.php
Normal file
108
app/adminapi/controller/marketing/MarketingBidInfoController.php
Normal 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\MarketingBidInfoLists;
|
||||
use app\adminapi\logic\marketing\MarketingBidInfoLogic;
|
||||
use app\adminapi\validate\marketing\MarketingBidInfoValidate;
|
||||
|
||||
|
||||
/**
|
||||
* 市场经营--投标管理--投标信息控制器
|
||||
* Class MarketingBidInfoController
|
||||
* @package app\adminapi\controller\marketing
|
||||
*/
|
||||
class MarketingBidInfoController extends BaseAdminController
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取市场经营--投标管理--投标信息列表
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2024/04/12 09:23
|
||||
*/
|
||||
public function lists()
|
||||
{
|
||||
return $this->dataLists(new MarketingBidInfoLists());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加市场经营--投标管理--投标信息
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2024/04/12 09:23
|
||||
*/
|
||||
public function add()
|
||||
{
|
||||
$params = (new MarketingBidInfoValidate())->post()->goCheck('add');
|
||||
$result = MarketingBidInfoLogic::add($params);
|
||||
if (true === $result) {
|
||||
return $this->success('添加成功', [], 1, 1);
|
||||
}
|
||||
return $this->fail(MarketingBidInfoLogic::getError());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 编辑市场经营--投标管理--投标信息
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2024/04/12 09:23
|
||||
*/
|
||||
public function edit()
|
||||
{
|
||||
$params = (new MarketingBidInfoValidate())->post()->goCheck('edit');
|
||||
$result = MarketingBidInfoLogic::edit($params);
|
||||
if (true === $result) {
|
||||
return $this->success('编辑成功', [], 1, 1);
|
||||
}
|
||||
return $this->fail(MarketingBidInfoLogic::getError());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 删除市场经营--投标管理--投标信息
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2024/04/12 09:23
|
||||
*/
|
||||
public function delete()
|
||||
{
|
||||
$params = (new MarketingBidInfoValidate())->post()->goCheck('delete');
|
||||
MarketingBidInfoLogic::delete($params);
|
||||
return $this->success('删除成功', [], 1, 1);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取市场经营--投标管理--投标信息详情
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2024/04/12 09:23
|
||||
*/
|
||||
public function detail()
|
||||
{
|
||||
$params = (new MarketingBidInfoValidate())->goCheck('detail');
|
||||
$result = MarketingBidInfoLogic::detail($params);
|
||||
return $this->data($result);
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -88,8 +88,11 @@
|
||||
public function delete()
|
||||
{
|
||||
$params = (new MarketingBusinessOpportunityValidate())->post()->goCheck('delete');
|
||||
MarketingBusinessOpportunityLogic::delete($params);
|
||||
return $this->success('删除成功', [], 1, 1);
|
||||
$result = MarketingBusinessOpportunityLogic::delete($params);
|
||||
if (true === $result) {
|
||||
return $this->success('删除成功', [], 1, 1);
|
||||
}
|
||||
return $this->fail(MarketingBusinessOpportunityLogic::getError());
|
||||
}
|
||||
|
||||
public function datas(): \think\response\Json
|
||||
|
@ -66,9 +66,9 @@
|
||||
->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', $data['construct_company'])->findOrEmpty();
|
||||
$admin = Admin::where('id', 'in', [$data['head'], $data['leader']])->column('name', 'id');
|
||||
$dept = Dept::field('name')->where('id', $data['dept'])->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');
|
||||
$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;
|
||||
@ -85,8 +85,13 @@
|
||||
$data['reg_status'] = 0;
|
||||
$data['reg_status_text'] = '未报名';
|
||||
} else {
|
||||
$data['reg_status'] = 1;
|
||||
$data['reg_status_text'] = '已报名';
|
||||
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();
|
||||
|
111
app/adminapi/lists/marketing/MarketingBidInfoLists.php
Normal file
111
app/adminapi/lists/marketing/MarketingBidInfoLists.php
Normal 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\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\MarketingBusinessOpportunity;
|
||||
use app\common\model\marketing\MarketingCustom;
|
||||
|
||||
|
||||
/**
|
||||
* 市场经营--投标管理--投标信息列表
|
||||
* Class MarketingBidInfoLists
|
||||
* @package app\adminapi\listsmarketing
|
||||
*/
|
||||
class MarketingBidInfoLists extends BaseAdminDataLists implements ListsSearchInterface
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 设置搜索条件
|
||||
* @return \string[][]
|
||||
* @author likeadmin
|
||||
* @date 2024/04/12 09:23
|
||||
*/
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'=' => ['bid_evaluation_id', 'general_manager', 'bid_head'],
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取市场经营--投标管理--投标信息列表
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author likeadmin
|
||||
* @date 2024/04/12 09:23
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
return MarketingBidInfo::withoutField('create_time,update_time,delete_time')->where($this->searchWhere)
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order(['id' => 'desc'])
|
||||
->select()->each(function ($data) {
|
||||
//投标审查信息
|
||||
$bid_evaluation = MarketingBidEvaluation::withoutField('annex,create_time,update_time,delete_time')->where('id', $data['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[$data['head']] ?? '';
|
||||
$data['business_opportunity']['leader_name'] = $business_opportunity_admin[$data['leader']] ?? '';
|
||||
//投标信息
|
||||
$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['bid_head_name'] = $admin[$data['bid_head']] ?? '';
|
||||
$data['technology_head_name'] = $admin[$data['technology_head']] ?? '';
|
||||
$data['business_head_name'] = $admin[$data['business_head']] ?? '';
|
||||
$data['other_user_name'] = $admin[$data['other_user']] ?? '';
|
||||
$data['bid_status_text'] = $data->bid_status_text;
|
||||
})
|
||||
->toArray();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取市场经营--投标管理--投标信息数量
|
||||
* @return int
|
||||
* @author likeadmin
|
||||
* @date 2024/04/12 09:23
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
return MarketingBidInfo::where($this->searchWhere)->count();
|
||||
}
|
||||
|
||||
}
|
@ -19,6 +19,7 @@
|
||||
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\MarketingBusinessOpportunity;
|
||||
use app\common\model\marketing\MarketingCustom;
|
||||
use app\common\model\oa\FlowApprove;
|
||||
@ -147,6 +148,11 @@
|
||||
*/
|
||||
public static function delete(array $params): bool
|
||||
{
|
||||
$bid_info = MarketingBidInfo::where('bid_evaluation_id', 'in', $params['id'])->findOrEmpty();
|
||||
if (!$bid_info->isEmpty()) {
|
||||
self::setError('此数据关联了投标信息内容,需删除投标信息内容');
|
||||
return false;
|
||||
}
|
||||
return MarketingBidEvaluation::destroy($params['id']);
|
||||
}
|
||||
|
||||
@ -162,10 +168,10 @@
|
||||
{
|
||||
$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['business_opportunity'] = $business_opportunity->toArray();
|
||||
$construct_company = MarketingCustom::field('name')->where('id', $data['construct_company'])->findOrEmpty();
|
||||
$admin = Admin::where('id', 'in', [$data['head'], $data['leader']])->column('name', 'id');
|
||||
$dept = Dept::field('name')->where('id', $data['dept'])->findOrEmpty();
|
||||
$data['business_opportunity'] = $business_opportunity;
|
||||
$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;
|
||||
|
168
app/adminapi/logic/marketing/MarketingBidInfoLogic.php
Normal file
168
app/adminapi/logic/marketing/MarketingBidInfoLogic.php
Normal file
@ -0,0 +1,168 @@
|
||||
<?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\MarketingBusinessOpportunity;
|
||||
use app\common\model\marketing\MarketingCustom;
|
||||
use think\facade\Db;
|
||||
|
||||
|
||||
/**
|
||||
* 市场经营--投标管理--投标信息逻辑
|
||||
* Class MarketingBidInfoLogic
|
||||
* @package app\adminapi\logic\marketing
|
||||
*/
|
||||
class MarketingBidInfoLogic extends BaseLogic
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加市场经营--投标管理--投标信息
|
||||
* @param array $params
|
||||
* @return bool
|
||||
* @author likeadmin
|
||||
* @date 2024/04/12 09:23
|
||||
*/
|
||||
public static function add(array $params): bool
|
||||
{
|
||||
$bid_evaluation = MarketingBidEvaluation::where('id', $params['bid_evaluation_id'])->findOrEmpty();
|
||||
Db::startTrans();
|
||||
try {
|
||||
MarketingBidInfo::create([
|
||||
'bid_evaluation_id' => $params['bid_evaluation_id'],
|
||||
'margin_end_date' => !empty($params['margin_end_date']) ? strtotime($params['margin_end_date']) : 0,
|
||||
'expected_return_date' => !empty($params['expected_return_date']) ? strtotime($params['expected_return_date']) : 0,
|
||||
'service_charge' => $params['service_charge'] ?? 0,
|
||||
'publish_website' => $params['publish_website'] ?? '',
|
||||
'general_manager' => $params['general_manager'],
|
||||
'bid_quotation' => $params['bid_quotation'] ?? 0,
|
||||
'bid_rate' => $params['bid_rate'] ?? 0,
|
||||
'bid_head' => $params['bid_head'] ?? 0,
|
||||
'technology_head' => $params['technology_head'] ?? 0,
|
||||
'business_head' => $params['business_head'] ?? 0,
|
||||
'other_user' => $params['other_user'] ?? 0,
|
||||
'remark' => $params['remark'] ?? '',
|
||||
'annex' => $params['annex'] ? json_encode($params['annex']) : null,
|
||||
'bid_status' => 0,
|
||||
]);
|
||||
MarketingBusinessOpportunity::where('id', $bid_evaluation['business_opportunity_id'])->update(['status' => 2]);
|
||||
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 09:23
|
||||
*/
|
||||
public static function edit(array $params): bool
|
||||
{
|
||||
Db::startTrans();
|
||||
try {
|
||||
MarketingBidInfo::where('id', $params['id'])->update([
|
||||
'bid_evaluation_id' => $params['bid_evaluation_id'],
|
||||
'margin_end_date' => !empty($params['margin_end_date']) ? strtotime($params['margin_end_date']) : 0,
|
||||
'expected_return_date' => !empty($params['expected_return_date']) ? strtotime($params['expected_return_date']) : 0,
|
||||
'service_charge' => $params['service_charge'] ?? 0,
|
||||
'publish_website' => $params['publish_website'] ?? '',
|
||||
'general_manager' => $params['general_manager'],
|
||||
'bid_quotation' => $params['bid_quotation'] ?? 0,
|
||||
'bid_rate' => $params['bid_rate'] ?? 0,
|
||||
'bid_head' => $params['bid_head'] ?? 0,
|
||||
'technology_head' => $params['technology_head'] ?? 0,
|
||||
'business_head' => $params['business_head'] ?? 0,
|
||||
'other_user' => $params['other_user'] ?? 0,
|
||||
'remark' => $params['remark'] ?? '',
|
||||
'annex' => $params['annex'] ? json_encode($params['annex']) : null,
|
||||
]);
|
||||
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 09:23
|
||||
*/
|
||||
public static function delete(array $params): bool
|
||||
{
|
||||
return MarketingBidInfo::destroy($params['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取市场经营--投标管理--投标信息详情
|
||||
* @param $params
|
||||
* @return array
|
||||
* @author likeadmin
|
||||
* @date 2024/04/12 09:23
|
||||
*/
|
||||
public static function detail($params): array
|
||||
{
|
||||
$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();
|
||||
$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[$data['head']] ?? '';
|
||||
$data['business_opportunity']['leader_name'] = $business_opportunity_admin[$data['leader']] ?? '';
|
||||
//投标信息
|
||||
$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['bid_head_name'] = $admin[$data['bid_head']] ?? '';
|
||||
$data['technology_head_name'] = $admin[$data['technology_head']] ?? '';
|
||||
$data['business_head_name'] = $admin[$data['business_head']] ?? '';
|
||||
$data['other_user_name'] = $admin[$data['other_user']] ?? '';
|
||||
$data['bid_status_text'] = $data->bid_status_text;
|
||||
return $data->toArray();
|
||||
}
|
||||
}
|
@ -18,6 +18,7 @@
|
||||
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\MarketingBusinessOpportunity;
|
||||
use app\common\model\marketing\MarketingCustom;
|
||||
use app\common\model\oa\FlowApprove;
|
||||
@ -127,6 +128,11 @@
|
||||
*/
|
||||
public static function delete(array $params): bool
|
||||
{
|
||||
$bid_evaluation = MarketingBidEvaluation::where('business_opportunity_id', 'in', $params['id'])->findOrEmpty();
|
||||
if (!$bid_evaluation->isEmpty()) {
|
||||
self::setError('此数据关联了投标评审内容,需删除投标评审内容');
|
||||
return false;
|
||||
}
|
||||
return MarketingBusinessOpportunity::destroy($params['id']);
|
||||
}
|
||||
|
||||
|
164
app/adminapi/validate/marketing/MarketingBidInfoValidate.php
Normal file
164
app/adminapi/validate/marketing/MarketingBidInfoValidate.php
Normal file
@ -0,0 +1,164 @@
|
||||
<?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\MarketingBidEvaluation;
|
||||
use app\common\model\marketing\MarketingBidInfo;
|
||||
use app\common\validate\BaseValidate;
|
||||
|
||||
|
||||
/**
|
||||
* 市场经营--投标管理--投标信息验证器
|
||||
* Class MarketingBidInfoValidate
|
||||
* @package app\adminapi\validate\marketing
|
||||
*/
|
||||
class MarketingBidInfoValidate extends BaseValidate
|
||||
{
|
||||
|
||||
/**
|
||||
* 设置校验规则
|
||||
* @var string[]
|
||||
*/
|
||||
protected $rule = [
|
||||
'id' => 'require|checkData',
|
||||
'bid_evaluation_id' => 'require|checkBidEvaluation',
|
||||
'margin_end_date' => 'dateFormat:Y-m-d',
|
||||
'expected_return_date' => 'dateFormat:Y-m-d',
|
||||
'service_charge' => 'float|egt:0',
|
||||
'publish_website' => 'url',
|
||||
'general_manager' => 'require|checkGeneralManager',
|
||||
'bid_quotation' => 'float|egt:0',
|
||||
'bid_rate' => 'float|egt:0',
|
||||
'bid_head' => 'require|checkBidHead',
|
||||
'technology_head' => 'checkTechnologyHead',
|
||||
'business_head' => 'checkBusinessHead',
|
||||
'other_user' => 'checkOtherUser',
|
||||
'annex' => 'checkAnnex',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* 参数描述
|
||||
* @var string[]
|
||||
*/
|
||||
protected $field = [
|
||||
'id' => 'id',
|
||||
'bid_evaluation_id' => '投标审查id',
|
||||
'margin_end_date' => '保证金递交截止日期',
|
||||
'expected_return_date' => '预计归还日期',
|
||||
'service_charge' => '中标服务费',
|
||||
'publish_website' => '发布网址',
|
||||
'general_manager' => '拟派总监/经理',
|
||||
'bid_quotation' => '拟投标报价',
|
||||
'bid_rate' => '拟投标费率',
|
||||
'bid_head' => '投标负责人',
|
||||
'technology_head' => '技术标负责人',
|
||||
'business_head' => '商务标负责人',
|
||||
'other_user' => '其他拟派人员',
|
||||
'remark' => '备注',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加场景
|
||||
* @return MarketingBidInfoValidate
|
||||
* @author likeadmin
|
||||
* @date 2024/04/12 09:23
|
||||
*/
|
||||
public function sceneAdd()
|
||||
{
|
||||
return $this->remove('id', true);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 编辑场景
|
||||
* @return MarketingBidInfoValidate
|
||||
* @author likeadmin
|
||||
* @date 2024/04/12 09:23
|
||||
*/
|
||||
public function sceneEdit()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 删除场景
|
||||
* @return MarketingBidInfoValidate
|
||||
* @author likeadmin
|
||||
* @date 2024/04/12 09:23
|
||||
*/
|
||||
public function sceneDelete()
|
||||
{
|
||||
return $this->only(['id'])->remove('id', 'checkData');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 详情场景
|
||||
* @return MarketingBidInfoValidate
|
||||
* @author likeadmin
|
||||
* @date 2024/04/12 09:23
|
||||
*/
|
||||
public function sceneDetail()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
public function checkData($value): bool|string
|
||||
{
|
||||
$data = MarketingBidInfo::where('id', $value)->findOrEmpty();
|
||||
return $data->isEmpty() ? '数据不存在' : true;
|
||||
}
|
||||
|
||||
public function checkBidEvaluation($value): bool|string
|
||||
{
|
||||
$data = MarketingBidEvaluation::where('id', $value)->findOrEmpty();
|
||||
return $data->isEmpty() ? '投标评审数据不存在' : true;
|
||||
}
|
||||
|
||||
public function checkGeneralManager($value): bool|string
|
||||
{
|
||||
$data = Admin::where('id', $value)->findOrEmpty();
|
||||
return $data->isEmpty() ? '拟派总监/经理数据不存在' : true;
|
||||
}
|
||||
|
||||
public function checkBidHead($value): bool|string
|
||||
{
|
||||
$data = Admin::where('id', $value)->findOrEmpty();
|
||||
return $data->isEmpty() ? '投标负责人数据不存在' : true;
|
||||
}
|
||||
|
||||
public function checkTechnologyHead($value): bool|string
|
||||
{
|
||||
$data = Admin::where('id', $value)->findOrEmpty();
|
||||
return $data->isEmpty() ? '技术标负责人数据不存在' : true;
|
||||
}
|
||||
|
||||
public function checkBusinessHead($value): bool|string
|
||||
{
|
||||
$data = Admin::where('id', $value)->findOrEmpty();
|
||||
return $data->isEmpty() ? '商务标负责人数据不存在' : true;
|
||||
}
|
||||
|
||||
public function checkOtherUser($value): bool|string
|
||||
{
|
||||
$data = Admin::where('id', $value)->findOrEmpty();
|
||||
return $data->isEmpty() ? '其他拟派人员数据不存在' : true;
|
||||
}
|
||||
|
||||
}
|
49
app/common/model/marketing/MarketingBidInfo.php
Normal file
49
app/common/model/marketing/MarketingBidInfo.php
Normal file
@ -0,0 +1,49 @@
|
||||
<?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 MarketingBidInfo
|
||||
* @package app\common\model\marketing
|
||||
*/
|
||||
class MarketingBidInfo extends BaseModel
|
||||
{
|
||||
use SoftDelete;
|
||||
|
||||
protected $name = 'marketing_bid_info';
|
||||
protected $deleteTime = 'delete_time';
|
||||
|
||||
public function getMarginEndDateAttr($value): string
|
||||
{
|
||||
return !empty($value) ? date('Y-m-d', $value) : '';
|
||||
}
|
||||
|
||||
public function getExpectedReturnDateAttr($value): string
|
||||
{
|
||||
return !empty($value) ? date('Y-m-d', $value) : '';
|
||||
}
|
||||
|
||||
public function getBidStatusTextAttr($value, $data): string
|
||||
{
|
||||
$arr = [0 => '未开标', 1 => '已中标', 2 => '未中标'];
|
||||
return $arr[$data['review_status']];
|
||||
}
|
||||
}
|
@ -64,7 +64,7 @@
|
||||
|
||||
public function getStatusTextAttr($value, $data): string
|
||||
{
|
||||
$arr = [0 => '未启动投标', 1 => '参与投标'];
|
||||
$arr = [0 => '未启动投标', 1 => '参与投标', 2 => '未开标'];
|
||||
return $arr[$data['status']];
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user