update
This commit is contained in:
parent
e37557fe71
commit
8f134fe78c
@ -126,7 +126,7 @@
|
||||
//获取审批流程列表
|
||||
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();
|
||||
return $this->success('请求成功', $data->toArray());
|
||||
}
|
||||
|
@ -22,7 +22,6 @@
|
||||
use app\common\model\marketing\MarketingBidEvaluation;
|
||||
use app\common\model\marketing\MarketingBusinessOpportunity;
|
||||
use app\common\model\marketing\MarketingCustom;
|
||||
use app\common\model\oa\FlowApprove;
|
||||
|
||||
|
||||
/**
|
||||
@ -43,7 +42,7 @@
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'=' => ['business_opportunity_id', 'bid_type', 'bid_nature'],
|
||||
'=' => ['business_opportunity_id', 'bid_type', 'bid_nature', 'approve_check_status'],
|
||||
'%like%' => ['bid_code'],
|
||||
];
|
||||
}
|
||||
@ -60,7 +59,13 @@
|
||||
*/
|
||||
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)
|
||||
->order(['id' => 'desc'])
|
||||
->select()->each(function ($data) {
|
||||
@ -81,6 +86,7 @@
|
||||
$data['business_opportunity']['leader_name'] = $admin[$data['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'])) {
|
||||
$data['reg_status'] = 0;
|
||||
$data['reg_status_text'] = '未报名';
|
||||
@ -93,20 +99,6 @@
|
||||
$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();
|
||||
}
|
||||
@ -120,7 +112,13 @@
|
||||
*/
|
||||
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();
|
||||
}
|
||||
|
||||
}
|
@ -43,7 +43,7 @@
|
||||
public function setSearch(): array
|
||||
{
|
||||
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
|
||||
{
|
||||
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)
|
||||
->order(['id' => 'desc'])
|
||||
->select()->each(function ($data) {
|
||||
@ -105,7 +116,18 @@
|
||||
*/
|
||||
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();
|
||||
}
|
||||
|
||||
}
|
@ -21,7 +21,6 @@
|
||||
use app\common\model\dept\Dept;
|
||||
use app\common\model\marketing\MarketingBusinessOpportunity;
|
||||
use app\common\model\marketing\MarketingCustom;
|
||||
use app\common\model\oa\FlowApprove;
|
||||
|
||||
|
||||
/**
|
||||
@ -42,7 +41,7 @@
|
||||
public function setSearch(): array
|
||||
{
|
||||
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'],
|
||||
];
|
||||
}
|
||||
@ -73,23 +72,10 @@
|
||||
$data['fund_sources_text'] = $data->fund_sources_text;
|
||||
$data['const_area_text'] = $data->const_area_text;
|
||||
$data['status_text'] = $data->status_text;
|
||||
$data['approve_check_status_text'] = $data->approve_check_status_text;
|
||||
$data['dept_name'] = $dept?->name;
|
||||
$data['head_name'] = $admin[$data['head']] ?? '';
|
||||
$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();
|
||||
}
|
||||
|
@ -15,10 +15,10 @@
|
||||
namespace app\adminapi\logic\bid;
|
||||
|
||||
|
||||
use app\common\logic\BaseLogic;
|
||||
use app\common\model\bid\BidBiddingDecision;
|
||||
use app\common\model\bid\BidBuyBiddingDocument;
|
||||
use app\common\model\custom\Custom;
|
||||
use app\common\logic\BaseLogic;
|
||||
use app\common\model\oa\FlowApprove;
|
||||
use app\common\model\project\Project;
|
||||
use think\facade\Db;
|
||||
@ -153,12 +153,11 @@ class BidBiddingDecisionLogic extends BaseLogic
|
||||
$data['is_margin_text'] = $data->is_margin_text;
|
||||
$data['is_internal_resources_text'] = $data->is_internal_resources_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();
|
||||
}
|
||||
|
||||
public static function approve($params,$admin_id): bool{
|
||||
public static function approve($params, $admin_id): bool
|
||||
{
|
||||
$data = BidBiddingDecision::where('id', $params['id'])->findOrEmpty();
|
||||
$approve_data = FlowApprove::where('id', $data['approve_id'])->findOrEmpty();
|
||||
if (!empty($data['approve_id']) && $approve_data['check_status'] != 3) {
|
||||
|
@ -184,6 +184,7 @@
|
||||
$data['business_opportunity']['leader_name'] = $admin[$data['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();
|
||||
}
|
||||
|
||||
|
@ -157,6 +157,7 @@
|
||||
$data['fund_sources_text'] = $data->fund_sources_text;
|
||||
$data['const_area_text'] = $data->const_area_text;
|
||||
$data['status_text'] = $data->status_text;
|
||||
$data['approve_check_status_text'] = $data->approve_check_status_text;
|
||||
$data['dept_name'] = $dept?->name;
|
||||
$data['head_name'] = $admin[$data['head']] ?? '';
|
||||
$data['leader_name'] = $admin[$data['leader']] ?? '';
|
||||
@ -174,7 +175,7 @@
|
||||
{
|
||||
$data = MarketingBusinessOpportunity::where('id', $params['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('当前内容存在审核信息,请勿重复提交');
|
||||
return false;
|
||||
}
|
||||
|
@ -1,10 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace app\adminapi\logic\oa;
|
||||
|
||||
use app\common\logic\BaseLogic;
|
||||
use app\common\model\auth\Admin;
|
||||
use app\common\model\oa\Flow;
|
||||
use app\common\model\oa\FlowApprove;
|
||||
use app\common\logic\BaseLogic;
|
||||
use app\common\model\oa\FlowRecord;
|
||||
use app\common\model\oa\FlowStep;
|
||||
use think\facade\Db;
|
||||
@ -105,7 +106,7 @@ class FlowApproveLogic extends BaseLogic
|
||||
'is_invalid' => 0
|
||||
]);
|
||||
$approve_data['content_model']::where('id', $approve_data['content_id'])->update([
|
||||
'approve_id' => 0
|
||||
'approve_check_status' => 4,
|
||||
]);
|
||||
Db::commit();
|
||||
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 ? '通过' : '拒绝';
|
||||
$check_user = Admin::field('name')->where('id', $admin_id)->findOrEmpty();
|
||||
$approve_data = FlowApprove::where('id', $params['id'])->findOrEmpty();
|
||||
$approve_status = 0;
|
||||
if ($approve_data->isEmpty()) {
|
||||
self::setError('当前审批信息不存在');
|
||||
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();
|
||||
$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)) {
|
||||
self::setError('当前登录用户不是此审批信息的审核人');
|
||||
return false;
|
||||
@ -165,6 +166,7 @@ class FlowApproveLogic extends BaseLogic
|
||||
'check_status' => $params['check_status'] == 1 ? 2 : 3,
|
||||
'update_time' => $check_time,
|
||||
]);
|
||||
$approve_status = $params['check_status'] == 1 ? 2 : 3;
|
||||
} else {
|
||||
FlowApprove::where('id', $params['id'])->update([
|
||||
'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', $next_step['id'])->update(['is_active' => 1]);
|
||||
}
|
||||
$approve_status = $params['check_status'] == 1 ? 1 : 3;
|
||||
}
|
||||
break;
|
||||
case 2: //指定人或签
|
||||
@ -203,6 +206,7 @@ class FlowApproveLogic extends BaseLogic
|
||||
'check_status' => $approve_check_status,
|
||||
'update_time' => $check_time,
|
||||
]);
|
||||
$approve_status = $approve_check_status;
|
||||
break;
|
||||
case 3: //指定人会签
|
||||
if ($params['check_status'] == 2) {
|
||||
@ -225,6 +229,7 @@ class FlowApproveLogic extends BaseLogic
|
||||
'check_status' => $approve_check_status,
|
||||
'update_time' => $check_time,
|
||||
]);
|
||||
$approve_status = $approve_check_status;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
@ -233,11 +238,13 @@ class FlowApproveLogic extends BaseLogic
|
||||
'check_status' => $params['check_status'] == 1 ? 2 : 3,
|
||||
'update_time' => $check_time,
|
||||
]);
|
||||
$approve_status = $params['check_status'] == 1 ? 2 : 3;
|
||||
} else {
|
||||
FlowApprove::where('id', $params['id'])->update([
|
||||
'check_status' => $params['check_status'] == 1 ? 1 : 3,
|
||||
'update_time' => $check_time,
|
||||
]);
|
||||
$approve_status = $params['check_status'] == 1 ? 1 : 3;
|
||||
//设置下一步
|
||||
if ($params['check_status'] == 1) {
|
||||
FlowStep::where('id', $current_step['id'])->update(['is_active' => 0]);
|
||||
@ -256,6 +263,7 @@ class FlowApproveLogic extends BaseLogic
|
||||
'content' => $params['check_reason'],
|
||||
'is_invalid' => 0
|
||||
]);
|
||||
$approve_data['content_model']::where('id', $approve_data['content_id'])->update(['approve_check_status' => $approve_status]);
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
|
@ -44,6 +44,12 @@
|
||||
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
|
||||
{
|
||||
return !empty($value) ? date('Y-m-d', $value) : '';
|
||||
|
@ -62,6 +62,12 @@
|
||||
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
|
||||
{
|
||||
$arr = [0 => '未启动投标', 1 => '参与投标', 2 => '未开标'];
|
||||
|
Loading…
x
Reference in New Issue
Block a user