This commit is contained in:
weiz 2024-04-12 13:49:31 +08:00
parent e37557fe71
commit 8f134fe78c
10 changed files with 499 additions and 472 deletions

View File

@ -126,7 +126,7 @@
//获取审批流程列表 //获取审批流程列表
public function flows(): \think\response\Json public function flows(): \think\response\Json
{ {
$flow_type = FlowType::where('type', 1)->where('name', 'TBPS')->findOrEmpty(); $flow_type = FlowType::where('type', 1)->where('name', 'tbps')->findOrEmpty();
$data = Flow::field('id,name')->where('flow_cate', $flow_type['id'])->where('status', 2)->select(); $data = Flow::field('id,name')->where('flow_cate', $flow_type['id'])->where('status', 2)->select();
return $this->success('请求成功', $data->toArray()); return $this->success('请求成功', $data->toArray());
} }

View File

@ -22,7 +22,6 @@
use app\common\model\marketing\MarketingBidEvaluation; use app\common\model\marketing\MarketingBidEvaluation;
use app\common\model\marketing\MarketingBusinessOpportunity; use app\common\model\marketing\MarketingBusinessOpportunity;
use app\common\model\marketing\MarketingCustom; use app\common\model\marketing\MarketingCustom;
use app\common\model\oa\FlowApprove;
/** /**
@ -43,7 +42,7 @@
public function setSearch(): array public function setSearch(): array
{ {
return [ return [
'=' => ['business_opportunity_id', 'bid_type', 'bid_nature'], '=' => ['business_opportunity_id', 'bid_type', 'bid_nature', 'approve_check_status'],
'%like%' => ['bid_code'], '%like%' => ['bid_code'],
]; ];
} }
@ -60,7 +59,13 @@
*/ */
public function lists(): array public function lists(): array
{ {
return MarketingBidEvaluation::withoutField('create_time,update_time,delete_time')->where($this->searchWhere) $params = $this->request->get();
$where = [];
if (isset($params['construct_company']) && $params['construct_company'] != '') {
$business_opportunity_ids = MarketingBusinessOpportunity::where('construct_company', $params['construct_company'])->column('id');
$where[] = ['business_opportunity_id', 'in', $business_opportunity_ids];
}
return MarketingBidEvaluation::withoutField('create_time,update_time,delete_time')->where($this->searchWhere)->where($where)
->limit($this->limitOffset, $this->limitLength) ->limit($this->limitOffset, $this->limitLength)
->order(['id' => 'desc']) ->order(['id' => 'desc'])
->select()->each(function ($data) { ->select()->each(function ($data) {
@ -81,6 +86,7 @@
$data['business_opportunity']['leader_name'] = $admin[$data['leader']] ?? ''; $data['business_opportunity']['leader_name'] = $admin[$data['leader']] ?? '';
$data['bid_type_text'] = $data->bid_type_text; $data['bid_type_text'] = $data->bid_type_text;
$data['bid_nature_text'] = $data->bid_nature_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'] = '未报名';
@ -93,20 +99,6 @@
$data['reg_status_text'] = '报名不通过'; $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(); ->toArray();
} }
@ -120,7 +112,13 @@
*/ */
public function count(): int public function count(): int
{ {
return MarketingBidEvaluation::where($this->searchWhere)->count(); $params = $this->request->get();
$where = [];
if (isset($params['construct_company']) && $params['construct_company'] != '') {
$business_opportunity_ids = MarketingBusinessOpportunity::where('construct_company', $params['construct_company'])->column('id');
$where[] = ['business_opportunity_id', 'in', $business_opportunity_ids];
}
return MarketingBidEvaluation::where($this->searchWhere)->where($where)->count();
} }
} }

View File

@ -43,7 +43,7 @@
public function setSearch(): array public function setSearch(): array
{ {
return [ return [
'=' => ['bid_evaluation_id', 'general_manager', 'bid_head'], '=' => ['bid_evaluation_id', 'general_manager', 'bid_head', 'bid_status'],
]; ];
} }
@ -59,7 +59,18 @@
*/ */
public function lists(): array public function lists(): array
{ {
return MarketingBidInfo::withoutField('create_time,update_time,delete_time')->where($this->searchWhere) $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');
$where[] = ['bid_evaluation_id', 'in', $bid_evaluation_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');
$where[] = ['bid_evaluation_id', 'in', $bid_evaluation_ids];
}
return MarketingBidInfo::withoutField('create_time,update_time,delete_time')->where($this->searchWhere)->where($where)
->limit($this->limitOffset, $this->limitLength) ->limit($this->limitOffset, $this->limitLength)
->order(['id' => 'desc']) ->order(['id' => 'desc'])
->select()->each(function ($data) { ->select()->each(function ($data) {
@ -105,7 +116,18 @@
*/ */
public function count(): int public function count(): int
{ {
return MarketingBidInfo::where($this->searchWhere)->count(); $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');
$where[] = ['bid_evaluation_id', 'in', $bid_evaluation_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');
$where[] = ['bid_evaluation_id', 'in', $bid_evaluation_ids];
}
return MarketingBidInfo::where($this->searchWhere)->where($where)->count();
} }
} }

View File

@ -21,7 +21,6 @@
use app\common\model\dept\Dept; use app\common\model\dept\Dept;
use app\common\model\marketing\MarketingBusinessOpportunity; use app\common\model\marketing\MarketingBusinessOpportunity;
use app\common\model\marketing\MarketingCustom; use app\common\model\marketing\MarketingCustom;
use app\common\model\oa\FlowApprove;
/** /**
@ -42,7 +41,7 @@
public function setSearch(): array public function setSearch(): array
{ {
return [ return [
'=' => ['construct_company', 'business_nature', 'industry_nature', 'info_sources', 'fund_sources', 'const_area', 'status'], '=' => ['construct_company', 'business_nature', 'industry_nature', 'info_sources', 'fund_sources', 'const_area', 'status', 'approve_check_status'],
'%like%' => ['project_name', 'project_code'], '%like%' => ['project_name', 'project_code'],
]; ];
} }
@ -73,23 +72,10 @@
$data['fund_sources_text'] = $data->fund_sources_text; $data['fund_sources_text'] = $data->fund_sources_text;
$data['const_area_text'] = $data->const_area_text; $data['const_area_text'] = $data->const_area_text;
$data['status_text'] = $data->status_text; $data['status_text'] = $data->status_text;
$data['approve_check_status_text'] = $data->approve_check_status_text;
$data['dept_name'] = $dept?->name; $data['dept_name'] = $dept?->name;
$data['head_name'] = $admin[$data['head']] ?? ''; $data['head_name'] = $admin[$data['head']] ?? '';
$data['leader_name'] = $admin[$data['leader']] ?? ''; $data['leader_name'] = $admin[$data['leader']] ?? '';
if (!empty($data['approve_id'])) {
$approve = FlowApprove::field('check_status')->where('content_id', $data['id'])->where('content_model', 'app\common\model\marketing\MarketingBusinessOpportunity')->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(); ->toArray();
} }

View File

@ -15,10 +15,10 @@
namespace app\adminapi\logic\bid; namespace app\adminapi\logic\bid;
use app\common\logic\BaseLogic;
use app\common\model\bid\BidBiddingDecision; use app\common\model\bid\BidBiddingDecision;
use app\common\model\bid\BidBuyBiddingDocument; use app\common\model\bid\BidBuyBiddingDocument;
use app\common\model\custom\Custom; use app\common\model\custom\Custom;
use app\common\logic\BaseLogic;
use app\common\model\oa\FlowApprove; use app\common\model\oa\FlowApprove;
use app\common\model\project\Project; use app\common\model\project\Project;
use think\facade\Db; use think\facade\Db;
@ -153,12 +153,11 @@ class BidBiddingDecisionLogic extends BaseLogic
$data['is_margin_text'] = $data->is_margin_text; $data['is_margin_text'] = $data->is_margin_text;
$data['is_internal_resources_text'] = $data->is_internal_resources_text; $data['is_internal_resources_text'] = $data->is_internal_resources_text;
$data['project_assurance_text'] = $data->project_assurance_text; $data['project_assurance_text'] = $data->project_assurance_text;
$approve_data = FlowApprove::where('id',$data['approve_id'])->findOrEmpty();
$data['approve_check_status'] = $approve_data['check_status'];
return $data->toArray(); return $data->toArray();
} }
public static function approve($params,$admin_id): bool{ public static function approve($params, $admin_id): bool
{
$data = BidBiddingDecision::where('id', $params['id'])->findOrEmpty(); $data = BidBiddingDecision::where('id', $params['id'])->findOrEmpty();
$approve_data = FlowApprove::where('id', $data['approve_id'])->findOrEmpty(); $approve_data = FlowApprove::where('id', $data['approve_id'])->findOrEmpty();
if (!empty($data['approve_id']) && $approve_data['check_status'] != 3) { if (!empty($data['approve_id']) && $approve_data['check_status'] != 3) {

View File

@ -184,6 +184,7 @@
$data['business_opportunity']['leader_name'] = $admin[$data['leader']] ?? ''; $data['business_opportunity']['leader_name'] = $admin[$data['leader']] ?? '';
$data['bid_type_text'] = $data->bid_type_text; $data['bid_type_text'] = $data->bid_type_text;
$data['bid_nature_text'] = $data->bid_nature_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

@ -157,6 +157,7 @@
$data['fund_sources_text'] = $data->fund_sources_text; $data['fund_sources_text'] = $data->fund_sources_text;
$data['const_area_text'] = $data->const_area_text; $data['const_area_text'] = $data->const_area_text;
$data['status_text'] = $data->status_text; $data['status_text'] = $data->status_text;
$data['approve_check_status_text'] = $data->approve_check_status_text;
$data['dept_name'] = $dept?->name; $data['dept_name'] = $dept?->name;
$data['head_name'] = $admin[$data['head']] ?? ''; $data['head_name'] = $admin[$data['head']] ?? '';
$data['leader_name'] = $admin[$data['leader']] ?? ''; $data['leader_name'] = $admin[$data['leader']] ?? '';
@ -174,7 +175,7 @@
{ {
$data = MarketingBusinessOpportunity::where('id', $params['id'])->findOrEmpty(); $data = MarketingBusinessOpportunity::where('id', $params['id'])->findOrEmpty();
$approve_data = FlowApprove::where('id', $data['approve_id'])->findOrEmpty(); $approve_data = FlowApprove::where('id', $data['approve_id'])->findOrEmpty();
if (!empty($data['approve_id']) && $approve_data['check_status'] != 3) { if ((!empty($data['approve_id']) && $approve_data['check_status'] != 3) || (!empty($data['approve_id']) && $approve_data['check_status'] != 4)) {
self::setError('当前内容存在审核信息,请勿重复提交'); self::setError('当前内容存在审核信息,请勿重复提交');
return false; return false;
} }

View File

@ -1,10 +1,11 @@
<?php <?php
namespace app\adminapi\logic\oa; namespace app\adminapi\logic\oa;
use app\common\logic\BaseLogic;
use app\common\model\auth\Admin; use app\common\model\auth\Admin;
use app\common\model\oa\Flow; use app\common\model\oa\Flow;
use app\common\model\oa\FlowApprove; use app\common\model\oa\FlowApprove;
use app\common\logic\BaseLogic;
use app\common\model\oa\FlowRecord; use app\common\model\oa\FlowRecord;
use app\common\model\oa\FlowStep; use app\common\model\oa\FlowStep;
use think\facade\Db; use think\facade\Db;
@ -105,7 +106,7 @@ class FlowApproveLogic extends BaseLogic
'is_invalid' => 0 'is_invalid' => 0
]); ]);
$approve_data['content_model']::where('id', $approve_data['content_id'])->update([ $approve_data['content_model']::where('id', $approve_data['content_id'])->update([
'approve_id' => 0 'approve_check_status' => 4,
]); ]);
Db::commit(); Db::commit();
return true; return true;
@ -117,10 +118,12 @@ class FlowApproveLogic extends BaseLogic
} }
//审核申请 //审核申请
public static function check($params,$admin_id): bool{ public static function check($params, $admin_id): bool
{
$str = $params['check_status'] == 1 ? '通过' : '拒绝'; $str = $params['check_status'] == 1 ? '通过' : '拒绝';
$check_user = Admin::field('name')->where('id', $admin_id)->findOrEmpty(); $check_user = Admin::field('name')->where('id', $admin_id)->findOrEmpty();
$approve_data = FlowApprove::where('id', $params['id'])->findOrEmpty(); $approve_data = FlowApprove::where('id', $params['id'])->findOrEmpty();
$approve_status = 0;
if ($approve_data->isEmpty()) { if ($approve_data->isEmpty()) {
self::setError('当前审批信息不存在'); self::setError('当前审批信息不存在');
return false; return false;
@ -138,8 +141,6 @@ class FlowApproveLogic extends BaseLogic
//获取下一步步骤 //获取下一步步骤
$next_step = FlowStep::where('approve_id', $params['id'])->where('sort', $current_step['sort'] + 1)->findOrEmpty(); $next_step = FlowStep::where('approve_id', $params['id'])->where('sort', $current_step['sort'] + 1)->findOrEmpty();
$current_check_user = explode(',', $current_step['flow_user']); $current_check_user = explode(',', $current_step['flow_user']);
//获取当前审批信息的步骤总数
$step_count = FlowStep::where('approve_id',$params['id'])->count();
if (!in_array($admin_id, $current_check_user)) { if (!in_array($admin_id, $current_check_user)) {
self::setError('当前登录用户不是此审批信息的审核人'); self::setError('当前登录用户不是此审批信息的审核人');
return false; return false;
@ -165,6 +166,7 @@ class FlowApproveLogic extends BaseLogic
'check_status' => $params['check_status'] == 1 ? 2 : 3, 'check_status' => $params['check_status'] == 1 ? 2 : 3,
'update_time' => $check_time, 'update_time' => $check_time,
]); ]);
$approve_status = $params['check_status'] == 1 ? 2 : 3;
} else { } else {
FlowApprove::where('id', $params['id'])->update([ FlowApprove::where('id', $params['id'])->update([
'check_status' => $params['check_status'] == 1 ? 1 : 3, 'check_status' => $params['check_status'] == 1 ? 1 : 3,
@ -175,6 +177,7 @@ class FlowApproveLogic extends BaseLogic
FlowStep::where('id', $current_step['id'])->update(['is_active' => 0]); FlowStep::where('id', $current_step['id'])->update(['is_active' => 0]);
FlowStep::where('id', $next_step['id'])->update(['is_active' => 1]); FlowStep::where('id', $next_step['id'])->update(['is_active' => 1]);
} }
$approve_status = $params['check_status'] == 1 ? 1 : 3;
} }
break; break;
case 2: //指定人或签 case 2: //指定人或签
@ -203,6 +206,7 @@ class FlowApproveLogic extends BaseLogic
'check_status' => $approve_check_status, 'check_status' => $approve_check_status,
'update_time' => $check_time, 'update_time' => $check_time,
]); ]);
$approve_status = $approve_check_status;
break; break;
case 3: //指定人会签 case 3: //指定人会签
if ($params['check_status'] == 2) { if ($params['check_status'] == 2) {
@ -225,6 +229,7 @@ class FlowApproveLogic extends BaseLogic
'check_status' => $approve_check_status, 'check_status' => $approve_check_status,
'update_time' => $check_time, 'update_time' => $check_time,
]); ]);
$approve_status = $approve_check_status;
break; break;
} }
} else { } else {
@ -233,11 +238,13 @@ class FlowApproveLogic extends BaseLogic
'check_status' => $params['check_status'] == 1 ? 2 : 3, 'check_status' => $params['check_status'] == 1 ? 2 : 3,
'update_time' => $check_time, 'update_time' => $check_time,
]); ]);
$approve_status = $params['check_status'] == 1 ? 2 : 3;
} else { } else {
FlowApprove::where('id', $params['id'])->update([ FlowApprove::where('id', $params['id'])->update([
'check_status' => $params['check_status'] == 1 ? 1 : 3, 'check_status' => $params['check_status'] == 1 ? 1 : 3,
'update_time' => $check_time, 'update_time' => $check_time,
]); ]);
$approve_status = $params['check_status'] == 1 ? 1 : 3;
//设置下一步 //设置下一步
if ($params['check_status'] == 1) { if ($params['check_status'] == 1) {
FlowStep::where('id', $current_step['id'])->update(['is_active' => 0]); FlowStep::where('id', $current_step['id'])->update(['is_active' => 0]);
@ -256,6 +263,7 @@ class FlowApproveLogic extends BaseLogic
'content' => $params['check_reason'], 'content' => $params['check_reason'],
'is_invalid' => 0 'is_invalid' => 0
]); ]);
$approve_data['content_model']::where('id', $approve_data['content_id'])->update(['approve_check_status' => $approve_status]);
Db::commit(); Db::commit();
return true; return true;
} catch (\Exception $e) { } catch (\Exception $e) {

View File

@ -44,6 +44,12 @@
return !empty($data['bid_nature']) ? $dict[$data['bid_nature']] : ''; return !empty($data['bid_nature']) ? $dict[$data['bid_nature']] : '';
} }
public function getApproveCheckStatusTextAttr($value, $data)
{
$dict = DictData::where('type_value', 'check_status')->column('name', 'value');
return !empty($data['approve_check_status']) ? $dict[$data['approve_check_status']] : '';
}
public function getEndDateAttr($value): string public function getEndDateAttr($value): string
{ {
return !empty($value) ? date('Y-m-d', $value) : ''; return !empty($value) ? date('Y-m-d', $value) : '';

View File

@ -62,6 +62,12 @@
return !empty($data['const_area']) ? $dict[$data['const_area']] : ''; return !empty($data['const_area']) ? $dict[$data['const_area']] : '';
} }
public function getApproveCheckStatusTextAttr($value, $data)
{
$dict = DictData::where('type_value', 'check_status')->column('name', 'value');
return !empty($data['approve_check_status']) ? $dict[$data['approve_check_status']] : '';
}
public function getStatusTextAttr($value, $data): string public function getStatusTextAttr($value, $data): string
{ {
$arr = [0 => '未启动投标', 1 => '参与投标', 2 => '未开标']; $arr = [0 => '未启动投标', 1 => '参与投标', 2 => '未开标'];