update
This commit is contained in:
parent
d1493ac92c
commit
156d5b79e5
app/adminapi
controller/bid
logic/bid
validate/bid
@ -20,6 +20,8 @@ use app\adminapi\controller\BaseAdminController;
|
||||
use app\adminapi\lists\bid\BidBiddingDecisionLists;
|
||||
use app\adminapi\logic\bid\BidBiddingDecisionLogic;
|
||||
use app\adminapi\validate\bid\BidBiddingDecisionValidate;
|
||||
use app\common\model\oa\Flow;
|
||||
use app\common\model\oa\FlowType;
|
||||
|
||||
|
||||
/**
|
||||
@ -73,5 +75,24 @@ class BidBiddingDecisionController extends BaseAdminController
|
||||
return $this->data($result);
|
||||
}
|
||||
|
||||
//获取审批流程列表
|
||||
public function flows(): \think\response\Json
|
||||
{
|
||||
$flow_type = FlowType::where('type',1)->where('name','tbjc')->findOrEmpty();
|
||||
$data = Flow::field('id,name')->where('flow_cate',$flow_type['id'])->where('status',2)->select();
|
||||
return $this->success('请求成功',$data->toArray());
|
||||
}
|
||||
|
||||
//添加审批
|
||||
public function approve(): \think\response\Json
|
||||
{
|
||||
$params = (new BidBiddingDecisionValidate())->post()->goCheck('approve');
|
||||
$result = BidBiddingDecisionLogic::approve($params,$this->adminId);
|
||||
if (true === $result) {
|
||||
return $this->success('提交审核信息成功', [], 1, 1);
|
||||
}
|
||||
return $this->fail(BidBiddingDecisionLogic::getError());
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -18,6 +18,7 @@ namespace app\adminapi\logic\bid;
|
||||
use app\common\model\bid\BidBiddingDecision;
|
||||
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;
|
||||
|
||||
@ -146,7 +147,40 @@ class BidBiddingDecisionLogic extends BaseLogic
|
||||
$data['is_margin'] = $data->is_margin_text;
|
||||
$data['is_internal_resources'] = $data->is_internal_resources_text;
|
||||
$data['project_assurance'] = $data->project_assurance_text;
|
||||
$approve_data = FlowApprove::where('id',$data['approve_id'])->findOrEmpty();
|
||||
$data['approve_check_status'] = $approve_data['check_status'];
|
||||
unset($data['org_id'],$data['dept_id'],$data['project_id'],$data['delete_time']);
|
||||
return $data->toArray();
|
||||
}
|
||||
|
||||
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){
|
||||
self::setError('当前内容存在审核信息,请勿重复提交');
|
||||
return false;
|
||||
}
|
||||
Db::startTrans();
|
||||
try {
|
||||
$res = addApprove(
|
||||
'投标决策',
|
||||
$params['id'],
|
||||
'app\common\model\bid\BidBiddingDecision',
|
||||
$params['path'],
|
||||
$params['flow_id'],
|
||||
$admin_id
|
||||
);
|
||||
if($res){
|
||||
BidBiddingDecision::where('id',$params['id'])->update([
|
||||
'approve_id' => $res,
|
||||
]);
|
||||
}
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
Db::rollback();
|
||||
self::setError($e->getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
@ -14,6 +14,7 @@
|
||||
|
||||
namespace app\adminapi\validate\bid;
|
||||
|
||||
use app\common\model\bid\BidBiddingDecision;
|
||||
use app\common\model\dict\DictData;
|
||||
use app\common\model\project\Project;
|
||||
use app\common\validate\BaseValidate;
|
||||
@ -32,7 +33,7 @@ class BidBiddingDecisionValidate extends BaseValidate
|
||||
* @var string[]
|
||||
*/
|
||||
protected $rule = [
|
||||
'id' => 'require',
|
||||
'id' => 'require|checkData',
|
||||
'project_id' => 'require|checkProject',
|
||||
'project_estimation' => 'require|float|egt:0',
|
||||
'bidding_project_fund_source' => 'checkBiddingProjectFundSource',
|
||||
@ -44,7 +45,9 @@ class BidBiddingDecisionValidate extends BaseValidate
|
||||
'margin_amount_return_date' => 'dateFormat:Y-m-d',
|
||||
'is_internal_resources' => 'in:1,2',
|
||||
'project_assurance' => 'checkProjectAssurance',
|
||||
'annex' => 'checkAnnex'
|
||||
'annex' => 'checkAnnex',
|
||||
'flow_id' => 'require|checkFlow',
|
||||
'path' => 'require',
|
||||
];
|
||||
|
||||
protected $message = [
|
||||
@ -73,7 +76,7 @@ class BidBiddingDecisionValidate extends BaseValidate
|
||||
*/
|
||||
public function sceneAdd()
|
||||
{
|
||||
return $this->remove('id', true);
|
||||
return $this->remove('id', true)->remove('flow_id',true)->remove('path',true);
|
||||
}
|
||||
|
||||
|
||||
@ -84,7 +87,9 @@ class BidBiddingDecisionValidate extends BaseValidate
|
||||
* @date 2023/11/27 18:14
|
||||
*/
|
||||
public function sceneEdit()
|
||||
{}
|
||||
{
|
||||
return $this->remove('flow_id',true)->remove('path',true);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@ -110,6 +115,20 @@ class BidBiddingDecisionValidate extends BaseValidate
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
public function sceneApprove()
|
||||
{
|
||||
return $this->only(['id','flow_id','path']);
|
||||
}
|
||||
|
||||
public function checkData($value): bool|string
|
||||
{
|
||||
$data = BidBiddingDecision::where('id',$value)->findOrEmpty();
|
||||
if($data->isEmpty()){
|
||||
return '数据不存在';
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public function checkProject($value): bool|string
|
||||
{
|
||||
$project = Project::where('id',$value)->findOrEmpty();
|
||||
|
@ -49,8 +49,6 @@ class BidDocumentExaminationValidate extends BaseValidate
|
||||
protected $message = [
|
||||
'id.require' => '缺少必要参数',
|
||||
'buy_bidding_document_id.require' => '请选择标书编号',
|
||||
'flow_id.require' => '审批流程',
|
||||
'path.require' => '前台路径',
|
||||
];
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user