This commit is contained in:
weiz 2024-02-03 14:06:08 +08:00
parent 1397544f1c
commit 41ca64f735
6 changed files with 36 additions and 6 deletions

View File

@ -52,7 +52,6 @@ class BidDocumentExaminationController extends BaseAdminController
public function add() public function add()
{ {
$params = (new BidDocumentExaminationValidate())->post()->goCheck('add'); $params = (new BidDocumentExaminationValidate())->post()->goCheck('add');
halt($params);
$result = BidDocumentExaminationLogic::add($params,$this->adminId); $result = BidDocumentExaminationLogic::add($params,$this->adminId);
if (true === $result) { if (true === $result) {
return $this->success('添加成功', [], 1, 1); return $this->success('添加成功', [], 1, 1);

View File

@ -39,8 +39,6 @@ class FlowApproveController extends BaseAdminController
*/ */
public function lists() public function lists()
{ {
// $res = addApprove('项目年假申请',9,'app\common\model\project\ProjectTripApply','app\adminapi\logic\project\ProjectTripApplyLogic',3,4,2);
// halt($res);
$params = (new FlowApproveValidate())->get()->goCheck('lists'); $params = (new FlowApproveValidate())->get()->goCheck('lists');
return $this->dataLists(new FlowApproveLists($params['type'])); return $this->dataLists(new FlowApproveLists($params['type']));
} }

View File

@ -47,7 +47,7 @@ class BidDocumentExaminationLogic extends BaseLogic
$buy_bidding_document = BidBuyBiddingDocument::field('project_id')->where('id',$params['buy_bidding_document_id'])->findOrEmpty(); $buy_bidding_document = BidBuyBiddingDocument::field('project_id')->where('id',$params['buy_bidding_document_id'])->findOrEmpty();
Db::startTrans(); Db::startTrans();
try { try {
$bidDocumentExamination = BidDocumentExamination::create([ $res = $bidDocumentExamination = BidDocumentExamination::create([
'code' => data_unique_code('标书审查'), 'code' => data_unique_code('标书审查'),
'project_id' => $buy_bidding_document['project_id'], 'project_id' => $buy_bidding_document['project_id'],
'buy_bidding_document_id' => $params['buy_bidding_document_id'], 'buy_bidding_document_id' => $params['buy_bidding_document_id'],
@ -79,6 +79,16 @@ class BidDocumentExaminationLogic extends BaseLogic
]); ]);
} }
} }
//添加审批信息
$res2 = addApprove(
'标书审查',
$res->id,
'app\common\model\bid\BidDocumentExamination',
'app\adminapi\logic\bid\BidDocumentExaminationLogic',
$params['approve_detail']['flow_type'],
$params['approve_detail']['flow_path'],
$admin_id
);
Db::commit(); Db::commit();
return true; return true;
} catch (\Exception $e) { } catch (\Exception $e) {

View File

@ -41,12 +41,13 @@ class BidDocumentExaminationValidate extends BaseValidate
'tax_rate' => 'checkTaxRate', 'tax_rate' => 'checkTaxRate',
'pay_type' => 'checkPayType', 'pay_type' => 'checkPayType',
'quotation_detail' => 'checkQuotationDetail', 'quotation_detail' => 'checkQuotationDetail',
'approve_detail' => 'require|checkApproveDetail',
]; ];
protected $message = [ protected $message = [
'id.require' => '缺少必要参数', 'id.require' => '缺少必要参数',
'buy_bidding_document_id.require' => '请选择标书编号', 'buy_bidding_document_id.require' => '请选择标书编号',
'quotation_detail' => 'checkQuotationDetail', 'approve_detail.require' => '请填写审批流程信息',
]; ];

View File

@ -382,7 +382,7 @@ function addApprove($title,$content_id,$content_model,$content_logic,$flow_type_
//获取部门负责人id //获取部门负责人id
if($v['flow_step'] == 1){ if($v['flow_step'] == 1){
$dept = Dept::field('leader')->where('id',$createUser['dept_id'])->findOrEmpty(); $dept = Dept::field('leader')->where('id',$createUser['dept_id'])->findOrEmpty();
$flow_user = $dept['leader']; $flow_user = !$dept->isEmpty() ? $dept['leader'] : 0;
}else{ }else{
$flow_user = implode(',',$v['flow_user']); $flow_user = implode(',',$v['flow_user']);
} }

View File

@ -16,6 +16,8 @@ declare(strict_types=1);
namespace app\common\validate; namespace app\common\validate;
use app\common\model\oa\Flow;
use app\common\model\oa\FlowType;
use app\common\service\JsonService; use app\common\service\JsonService;
use think\Validate; use think\Validate;
@ -84,4 +86,24 @@ class BaseValidate extends Validate
// 3.成功返回数据 // 3.成功返回数据
return $params; return $params;
} }
public function checkApproveDetail($value): bool|string
{
if(empty($value) || !is_array($value)){
return '审批流程数据格式错误';
}
if(empty($value['flow_type'])){
return '请选择审批类型';
}else{
$ft = FlowType::where('id',$value['flow_type'])->findOrEmpty();
if($ft->isEmpty()) return '审批类型数据不存在';
}
if(empty($value['flow_path'])){
return '请选择审批流程';
}else{
$fp = Flow::where('id',$value['flow_path'])->where('flow_cate',$value['flow_type'])->findOrEmpty();
if($fp->isEmpty()) return '审批流程数据不存在';
}
return true;
}
} }