diff --git a/app/adminapi/controller/bid/BidDocumentExaminationController.php b/app/adminapi/controller/bid/BidDocumentExaminationController.php index 611298eeb..5f796975f 100644 --- a/app/adminapi/controller/bid/BidDocumentExaminationController.php +++ b/app/adminapi/controller/bid/BidDocumentExaminationController.php @@ -20,6 +20,8 @@ use app\adminapi\controller\BaseAdminController; use app\adminapi\lists\bid\BidDocumentExaminationLists; use app\adminapi\logic\bid\BidDocumentExaminationLogic; use app\adminapi\validate\bid\BidDocumentExaminationValidate; +use app\common\model\oa\Flow; +use app\common\model\oa\FlowType; /** @@ -72,5 +74,23 @@ class BidDocumentExaminationController extends BaseAdminController return $this->data($result); } + //获取审批流程列表 + public function flows(): \think\response\Json + { + $flow_type = FlowType::where('type',1)->where('name','bssc')->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 BidDocumentExaminationValidate())->post()->goCheck('approve'); + $result = BidDocumentExaminationLogic::approve($params,$this->adminId); + if (true === $result) { + return $this->success('提交审核信息成功', [], 1, 1); + } + return $this->fail(BidDocumentExaminationLogic::getError()); + } } \ No newline at end of file diff --git a/app/adminapi/logic/bid/BidDocumentExaminationLogic.php b/app/adminapi/logic/bid/BidDocumentExaminationLogic.php index fdc82543d..9db1b58c8 100644 --- a/app/adminapi/logic/bid/BidDocumentExaminationLogic.php +++ b/app/adminapi/logic/bid/BidDocumentExaminationLogic.php @@ -130,4 +130,20 @@ class BidDocumentExaminationLogic extends BaseLogic $data['approve_id'] = $approve_info['id']; return $data->toArray(); } + + public static function approve($params,$admin_id): bool{ + $res = addApprove( + '标书审查', + $params['id'], + 'app\common\model\bid\BidDocumentExamination', + $params['path'], + $params['flow_id'], + $admin_id + ); + if($res){ + return true; + }else{ + return false; + } + } } \ No newline at end of file diff --git a/app/adminapi/validate/bid/BidDocumentExaminationValidate.php b/app/adminapi/validate/bid/BidDocumentExaminationValidate.php index 46fe3f726..0b230d98c 100644 --- a/app/adminapi/validate/bid/BidDocumentExaminationValidate.php +++ b/app/adminapi/validate/bid/BidDocumentExaminationValidate.php @@ -16,6 +16,7 @@ namespace app\adminapi\validate\bid; use app\common\model\bid\BidBuyBiddingDocument; +use app\common\model\bid\BidDocumentExamination; use app\common\model\dict\DictData; use app\common\model\material\Material; use app\common\validate\BaseValidate; @@ -34,18 +35,22 @@ class BidDocumentExaminationValidate extends BaseValidate * @var string[] */ protected $rule = [ - 'id' => 'require', + 'id' => 'require|checkData', 'buy_bidding_document_id' => 'require|checkBuyBiddingDocument', 'technical_review_annex' => 'checkAnnex', 'business_contract_deviation_annex' => 'checkAnnex', 'tax_rate' => 'checkTaxRate', 'pay_type' => 'checkPayType', 'quotation_detail' => 'checkQuotationDetail', + 'flow_id' => 'require|checkFlow', + 'path' => 'require', ]; protected $message = [ 'id.require' => '缺少必要参数', 'buy_bidding_document_id.require' => '请选择标书编号', + 'flow_id.require' => '审批流程', + 'path.require' => '前台路径', ]; @@ -57,7 +62,7 @@ class BidDocumentExaminationValidate extends BaseValidate */ public function sceneAdd() { - return $this->remove('id', true); + return $this->remove('id', true)->remove('flow_id',true)->remove('path',true); } @@ -68,7 +73,9 @@ class BidDocumentExaminationValidate extends BaseValidate * @date 2023/12/02 09:52 */ public function sceneEdit() - {} + { + return $this->remove('flow_id',true)->remove('path',true); + } /** @@ -81,6 +88,11 @@ class BidDocumentExaminationValidate extends BaseValidate { return $this->only(['id']); } + + public function sceneApprove() + { + return $this->only(['id','flow_id','path']); + } /** @@ -94,6 +106,15 @@ class BidDocumentExaminationValidate extends BaseValidate return $this->only(['id']); } + public function checkData($value): bool|string + { + $data = BidDocumentExamination::where('id',$value)->findOrEmpty(); + if($data->isEmpty()){ + return '数据不存在'; + } + return true; + } + public function checkBuyBiddingDocument($value): bool|string { $data = BidBuyBiddingDocument::where('id',$value)->findOrEmpty(); diff --git a/app/common/model/oa/FlowApprove.php b/app/common/model/oa/FlowApprove.php index c60b3f22d..ebdb8189e 100644 --- a/app/common/model/oa/FlowApprove.php +++ b/app/common/model/oa/FlowApprove.php @@ -33,6 +33,6 @@ class FlowApprove extends BaseModel public function getCheckStatusTextAttr($value,$data){ $dict = DictData::where('type_value','check_status')->column('name','value'); - return !empty($data['check_status']) ? $dict[$data['check_status']] : ''; + return $dict[$data['check_status']]; } } \ No newline at end of file diff --git a/app/common/validate/BaseValidate.php b/app/common/validate/BaseValidate.php index d1f6c44aa..44f474967 100755 --- a/app/common/validate/BaseValidate.php +++ b/app/common/validate/BaseValidate.php @@ -86,4 +86,13 @@ class BaseValidate extends Validate // 3.成功返回数据 return $params; } + + public function checkFlow($value): bool|string + { + $flow = Flow::where('id',$value)->findOrEmpty(); + if($flow->isEmpty()){ + return '审批流程信息不存在'; + } + return true; + } } \ No newline at end of file