diff --git a/app/adminapi/validate/ApprovalIssuanceAchievementDocumentsValidate.php b/app/adminapi/validate/ApprovalIssuanceAchievementDocumentsValidate.php index 92917a464..b59ce0a55 100644 --- a/app/adminapi/validate/ApprovalIssuanceAchievementDocumentsValidate.php +++ b/app/adminapi/validate/ApprovalIssuanceAchievementDocumentsValidate.php @@ -1,94 +1,96 @@ - 'require', - ]; - - - /** - * 参数描述 - * @var string[] - */ - protected $field = [ - 'id' => 'id', - ]; - - - /** - * @notes 添加场景 - * @return ApprovalIssuanceAchievementDocumentsValidate - * @author likeadmin - * @date 2024/02/22 17:57 - */ - public function sceneAdd() - { - return $this->remove('id', true); - } - - - /** - * @notes 编辑场景 - * @return ApprovalIssuanceAchievementDocumentsValidate - * @author likeadmin - * @date 2024/02/22 17:57 - */ - public function sceneEdit() - { - return $this->only(['id']); - } - - - /** - * @notes 删除场景 - * @return ApprovalIssuanceAchievementDocumentsValidate - * @author likeadmin - * @date 2024/02/22 17:57 - */ - public function sceneDelete() - { - return $this->only(['id']); - } - - - /** - * @notes 详情场景 - * @return ApprovalIssuanceAchievementDocumentsValidate - * @author likeadmin - * @date 2024/02/22 17:57 - */ - public function sceneDetail() - { - return $this->only(['id']); - } - -} \ No newline at end of file + 'require', + + ]; + + + /** + * 参数描述 + * @var string[] + */ + protected $field = [ + 'id' => 'id', + + ]; + + + /** + * @notes 添加场景 + * @return ApprovalIssuanceAchievementDocumentsValidate + * @author likeadmin + * @date 2024/02/22 17:57 + */ + public function sceneAdd() + { + return $this->remove('id', true); + } + + + /** + * @notes 编辑场景 + * @return ApprovalIssuanceAchievementDocumentsValidate + * @author likeadmin + * @date 2024/02/22 17:57 + */ + public function sceneEdit() + { + return $this->only(['id']); + } + + + /** + * @notes 删除场景 + * @return ApprovalIssuanceAchievementDocumentsValidate + * @author likeadmin + * @date 2024/02/22 17:57 + */ + public function sceneDelete() + { + return $this->only(['id'])->remove('id', 'checkData'); + } + + + /** + * @notes 详情场景 + * @return ApprovalIssuanceAchievementDocumentsValidate + * @author likeadmin + * @date 2024/02/22 17:57 + */ + public function sceneDetail() + { + return $this->only(['id']); + } + + } \ No newline at end of file diff --git a/app/adminapi/validate/DataReceptionValidate.php b/app/adminapi/validate/DataReceptionValidate.php index 2e8a8f8a8..228ae4348 100644 --- a/app/adminapi/validate/DataReceptionValidate.php +++ b/app/adminapi/validate/DataReceptionValidate.php @@ -1,94 +1,96 @@ - 'require', - ]; - - - /** - * 参数描述 - * @var string[] - */ - protected $field = [ - 'id' => 'id', - ]; - - - /** - * @notes 添加场景 - * @return DataReceptionValidate - * @author likeadmin - * @date 2024/02/23 09:21 - */ - public function sceneAdd() - { - return $this->remove('id', true); - } - - - /** - * @notes 编辑场景 - * @return DataReceptionValidate - * @author likeadmin - * @date 2024/02/23 09:21 - */ - public function sceneEdit() - { - return $this->only(['id']); - } - - - /** - * @notes 删除场景 - * @return DataReceptionValidate - * @author likeadmin - * @date 2024/02/23 09:21 - */ - public function sceneDelete() - { - return $this->only(['id']); - } - - - /** - * @notes 详情场景 - * @return DataReceptionValidate - * @author likeadmin - * @date 2024/02/23 09:21 - */ - public function sceneDetail() - { - return $this->only(['id']); - } - -} \ No newline at end of file + 'require', + + ]; + + + /** + * 参数描述 + * @var string[] + */ + protected $field = [ + 'id' => 'id', + + ]; + + + /** + * @notes 添加场景 + * @return DataReceptionValidate + * @author likeadmin + * @date 2024/02/23 09:21 + */ + public function sceneAdd() + { + return $this->remove('id', true); + } + + + /** + * @notes 编辑场景 + * @return DataReceptionValidate + * @author likeadmin + * @date 2024/02/23 09:21 + */ + public function sceneEdit() + { + return $this->only(['id']); + } + + + /** + * @notes 删除场景 + * @return DataReceptionValidate + * @author likeadmin + * @date 2024/02/23 09:21 + */ + public function sceneDelete() + { + return $this->only(['id'])->remove('id', 'checkData'); + } + + + /** + * @notes 详情场景 + * @return DataReceptionValidate + * @author likeadmin + * @date 2024/02/23 09:21 + */ + public function sceneDetail() + { + return $this->only(['id']); + } + + } \ No newline at end of file diff --git a/app/adminapi/validate/ProjectCommissionDetailValidate.php b/app/adminapi/validate/ProjectCommissionDetailValidate.php index f2f7df3e8..37ba64f69 100644 --- a/app/adminapi/validate/ProjectCommissionDetailValidate.php +++ b/app/adminapi/validate/ProjectCommissionDetailValidate.php @@ -1,94 +1,96 @@ - 'require', - ]; - - - /** - * 参数描述 - * @var string[] - */ - protected $field = [ - 'id' => 'id', - ]; - - - /** - * @notes 添加场景 - * @return ProjectCommissionDetailValidate - * @author likeadmin - * @date 2024/02/23 09:48 - */ - public function sceneAdd() - { - return $this->remove('id', true); - } - - - /** - * @notes 编辑场景 - * @return ProjectCommissionDetailValidate - * @author likeadmin - * @date 2024/02/23 09:48 - */ - public function sceneEdit() - { - return $this->only(['id']); - } - - - /** - * @notes 删除场景 - * @return ProjectCommissionDetailValidate - * @author likeadmin - * @date 2024/02/23 09:48 - */ - public function sceneDelete() - { - return $this->only(['id']); - } - - - /** - * @notes 详情场景 - * @return ProjectCommissionDetailValidate - * @author likeadmin - * @date 2024/02/23 09:48 - */ - public function sceneDetail() - { - return $this->only(['id']); - } - -} \ No newline at end of file + 'require', + + ]; + + + /** + * 参数描述 + * @var string[] + */ + protected $field = [ + 'id' => 'id', + + ]; + + + /** + * @notes 添加场景 + * @return ProjectCommissionDetailValidate + * @author likeadmin + * @date 2024/02/23 09:48 + */ + public function sceneAdd() + { + return $this->remove('id', true); + } + + + /** + * @notes 编辑场景 + * @return ProjectCommissionDetailValidate + * @author likeadmin + * @date 2024/02/23 09:48 + */ + public function sceneEdit() + { + return $this->only(['id']); + } + + + /** + * @notes 删除场景 + * @return ProjectCommissionDetailValidate + * @author likeadmin + * @date 2024/02/23 09:48 + */ + public function sceneDelete() + { + return $this->only(['id'])->remove('id', 'checkData'); + } + + + /** + * @notes 详情场景 + * @return ProjectCommissionDetailValidate + * @author likeadmin + * @date 2024/02/23 09:48 + */ + public function sceneDetail() + { + return $this->only(['id']); + } + + } \ No newline at end of file diff --git a/app/adminapi/validate/ProjectCommissionValidate.php b/app/adminapi/validate/ProjectCommissionValidate.php index 13b2a81db..c12e3d63b 100644 --- a/app/adminapi/validate/ProjectCommissionValidate.php +++ b/app/adminapi/validate/ProjectCommissionValidate.php @@ -11,108 +11,108 @@ // +---------------------------------------------------------------------- // | author: likeadminTeam // +---------------------------------------------------------------------- - -namespace app\adminapi\validate; - - -use app\common\model\cost_project\CostProject; -use app\common\model\ProjectCommission; -use app\common\validate\BaseValidate; - - -/** - * ProjectCommission验证器 - * Class ProjectCommissionValidate - * @package app\adminapi\validate - */ -class ProjectCommissionValidate extends BaseValidate -{ - - /** - * 设置校验规则 - * @var string[] - */ - protected $rule = [ - 'id' => 'require|checkData', - 'project_id' => 'require|checkProject', - 'rate' => 'require|float|gt:0', - 'bczfze' => 'require|float|egt:0', - 'djr' => 'require', - 'apptime' => 'require|dateFormat:Y-m-d', - ]; - - - /** - * 参数描述 - * @var string[] - */ - protected $field = [ - 'id' => 'id', - 'project_id' => '项目id', - 'rate' => '提成比例', - 'bczfze' => '本次支付总额', - 'djr' => '登记人', - 'apptime' => '登记日期', - ]; - - - /** - * @notes 添加场景 - * @return ProjectCommissionValidate - * @author likeadmin - * @date 2024/02/23 09:37 - */ - public function sceneAdd() - { - return $this->remove('id', true); - } - - - /** - * @notes 编辑场景 - * @return ProjectCommissionValidate - * @author likeadmin - * @date 2024/02/23 09:37 - */ - public function sceneEdit() - { - return $this->only(['id']); - } - - - /** - * @notes 删除场景 - * @return ProjectCommissionValidate - * @author likeadmin - * @date 2024/02/23 09:37 - */ - public function sceneDelete() - { - return $this->only(['id']); - } - - - /** - * @notes 详情场景 - * @return ProjectCommissionValidate - * @author likeadmin - * @date 2024/02/23 09:37 - */ - public function sceneDetail() - { - return $this->only(['id']); - } - public function checkData($value): bool|string - { - $data = ProjectCommission::where('id',$value)->findOrEmpty(); - return $data->isEmpty() ? '数据不存在' : true; - } + namespace app\adminapi\validate; - public function checkProject($value): bool|string + + use app\common\model\cost_project\CostProject; + use app\common\model\ProjectCommission; + use app\common\validate\BaseValidate; + + + /** + * ProjectCommission验证器 + * Class ProjectCommissionValidate + * @package app\adminapi\validate + */ + class ProjectCommissionValidate extends BaseValidate { - $data = CostProject::where('id',$value)->findOrEmpty(); - return $data->isEmpty() ? '项目信息不存在' : true; - } - -} \ No newline at end of file + + /** + * 设置校验规则 + * @var string[] + */ + protected $rule = [ + 'id' => 'require|checkData', + 'project_id' => 'require|checkProject', + 'rate' => 'require|float|gt:0', + 'bczfze' => 'require|float|egt:0', + 'djr' => 'require', + 'apptime' => 'require|dateFormat:Y-m-d', + ]; + + + /** + * 参数描述 + * @var string[] + */ + protected $field = [ + 'id' => 'id', + 'project_id' => '项目id', + 'rate' => '提成比例', + 'bczfze' => '本次支付总额', + 'djr' => '登记人', + 'apptime' => '登记日期', + ]; + + + /** + * @notes 添加场景 + * @return ProjectCommissionValidate + * @author likeadmin + * @date 2024/02/23 09:37 + */ + public function sceneAdd() + { + return $this->remove('id', true); + } + + + /** + * @notes 编辑场景 + * @return ProjectCommissionValidate + * @author likeadmin + * @date 2024/02/23 09:37 + */ + public function sceneEdit() + { + return $this->only(['id']); + } + + + /** + * @notes 删除场景 + * @return ProjectCommissionValidate + * @author likeadmin + * @date 2024/02/23 09:37 + */ + public function sceneDelete() + { + return $this->only(['id'])->remove('id', 'checkData'); + } + + + /** + * @notes 详情场景 + * @return ProjectCommissionValidate + * @author likeadmin + * @date 2024/02/23 09:37 + */ + public function sceneDetail() + { + return $this->only(['id']); + } + + public function checkData($value): bool|string + { + $data = ProjectCommission::where('id', $value)->findOrEmpty(); + return $data->isEmpty() ? '数据不存在' : true; + } + + public function checkProject($value): bool|string + { + $data = CostProject::where('id', $value)->findOrEmpty(); + return $data->isEmpty() ? '项目信息不存在' : true; + } + + } \ No newline at end of file diff --git a/app/adminapi/validate/TaskDetailValidate.php b/app/adminapi/validate/TaskDetailValidate.php index ac15fdb0d..751185752 100644 --- a/app/adminapi/validate/TaskDetailValidate.php +++ b/app/adminapi/validate/TaskDetailValidate.php @@ -1,94 +1,96 @@ - 'require', - ]; - - - /** - * 参数描述 - * @var string[] - */ - protected $field = [ - 'id' => 'id', - ]; - - - /** - * @notes 添加场景 - * @return TaskDetailValidate - * @author likeadmin - * @date 2024/02/22 11:58 - */ - public function sceneAdd() - { - return $this->remove('id', true); - } - - - /** - * @notes 编辑场景 - * @return TaskDetailValidate - * @author likeadmin - * @date 2024/02/22 11:58 - */ - public function sceneEdit() - { - return $this->only(['id']); - } - - - /** - * @notes 删除场景 - * @return TaskDetailValidate - * @author likeadmin - * @date 2024/02/22 11:58 - */ - public function sceneDelete() - { - return $this->only(['id']); - } - - - /** - * @notes 详情场景 - * @return TaskDetailValidate - * @author likeadmin - * @date 2024/02/22 11:58 - */ - public function sceneDetail() - { - return $this->only(['id']); - } - -} \ No newline at end of file + 'require', + + ]; + + + /** + * 参数描述 + * @var string[] + */ + protected $field = [ + 'id' => 'id', + + ]; + + + /** + * @notes 添加场景 + * @return TaskDetailValidate + * @author likeadmin + * @date 2024/02/22 11:58 + */ + public function sceneAdd() + { + return $this->remove('id', true); + } + + + /** + * @notes 编辑场景 + * @return TaskDetailValidate + * @author likeadmin + * @date 2024/02/22 11:58 + */ + public function sceneEdit() + { + return $this->only(['id']); + } + + + /** + * @notes 删除场景 + * @return TaskDetailValidate + * @author likeadmin + * @date 2024/02/22 11:58 + */ + public function sceneDelete() + { + return $this->only(['id'])->remove('id', 'checkData'); + } + + + /** + * @notes 详情场景 + * @return TaskDetailValidate + * @author likeadmin + * @date 2024/02/22 11:58 + */ + public function sceneDetail() + { + return $this->only(['id']); + } + + } \ No newline at end of file diff --git a/app/adminapi/validate/TaskHandlingThreeLevelReviewValidate.php b/app/adminapi/validate/TaskHandlingThreeLevelReviewValidate.php index 8bfcced01..c7d8c98b3 100644 --- a/app/adminapi/validate/TaskHandlingThreeLevelReviewValidate.php +++ b/app/adminapi/validate/TaskHandlingThreeLevelReviewValidate.php @@ -1,94 +1,96 @@ - 'require', - ]; - - - /** - * 参数描述 - * @var string[] - */ - protected $field = [ - 'id' => 'id', - ]; - - - /** - * @notes 添加场景 - * @return TaskHandlingThreeLevelReviewValidate - * @author likeadmin - * @date 2024/02/22 17:18 - */ - public function sceneAdd() - { - return $this->remove('id', true); - } - - - /** - * @notes 编辑场景 - * @return TaskHandlingThreeLevelReviewValidate - * @author likeadmin - * @date 2024/02/22 17:18 - */ - public function sceneEdit() - { - return $this->only(['id']); - } - - - /** - * @notes 删除场景 - * @return TaskHandlingThreeLevelReviewValidate - * @author likeadmin - * @date 2024/02/22 17:18 - */ - public function sceneDelete() - { - return $this->only(['id']); - } - - - /** - * @notes 详情场景 - * @return TaskHandlingThreeLevelReviewValidate - * @author likeadmin - * @date 2024/02/22 17:18 - */ - public function sceneDetail() - { - return $this->only(['id']); - } - -} \ No newline at end of file + 'require', + + ]; + + + /** + * 参数描述 + * @var string[] + */ + protected $field = [ + 'id' => 'id', + + ]; + + + /** + * @notes 添加场景 + * @return TaskHandlingThreeLevelReviewValidate + * @author likeadmin + * @date 2024/02/22 17:18 + */ + public function sceneAdd() + { + return $this->remove('id', true); + } + + + /** + * @notes 编辑场景 + * @return TaskHandlingThreeLevelReviewValidate + * @author likeadmin + * @date 2024/02/22 17:18 + */ + public function sceneEdit() + { + return $this->only(['id']); + } + + + /** + * @notes 删除场景 + * @return TaskHandlingThreeLevelReviewValidate + * @author likeadmin + * @date 2024/02/22 17:18 + */ + public function sceneDelete() + { + return $this->only(['id'])->remove('id', 'checkData'); + } + + + /** + * @notes 详情场景 + * @return TaskHandlingThreeLevelReviewValidate + * @author likeadmin + * @date 2024/02/22 17:18 + */ + public function sceneDetail() + { + return $this->only(['id']); + } + + } \ No newline at end of file diff --git a/app/adminapi/validate/administrative/AdministrativePaymentsValidate.php b/app/adminapi/validate/administrative/AdministrativePaymentsValidate.php index 8f1fa7859..174870e33 100644 --- a/app/adminapi/validate/administrative/AdministrativePaymentsValidate.php +++ b/app/adminapi/validate/administrative/AdministrativePaymentsValidate.php @@ -11,94 +11,94 @@ // +---------------------------------------------------------------------- // | author: likeadminTeam // +---------------------------------------------------------------------- - -namespace app\adminapi\validate\administrative; - - -use app\common\validate\BaseValidate; - - -/** - * AdministrativePayments验证器 - * Class AdministrativePaymentsValidate - * @package app\adminapi\validate\administrative - */ -class AdministrativePaymentsValidate extends BaseValidate -{ - - /** - * 设置校验规则 - * @var string[] - */ - protected $rule = [ - 'id' => 'require', - 'org_id' => 'require', - 'dept_id' => 'require', - 'approve_id' => 'require', - 'pay_type' => 'require', - 'payment_amount' => 'require', - ]; - - - /** - * 参数描述 - * @var string[] - */ - protected $field = [ - 'id' => 'id', - 'org_id' => '组织id', - 'dept_id' => '部门id', - 'approve_id' => '审批id', - 'pay_type' => '付款方式', - 'payment_amount' => '本次支付金额', - ]; - - - /** - * @notes 添加场景 - * @return AdministrativePaymentsValidate - * @author likeadmin - * @date 2023/12/19 14:50 - */ - public function sceneAdd() - { - return $this->only(['org_id','dept_id','approve_id','pay_type','payment_amount']); - } - - - /** - * @notes 编辑场景 - * @return AdministrativePaymentsValidate - * @author likeadmin - * @date 2023/12/19 14:50 - */ - public function sceneEdit() - { - return $this->only(['id','org_id','dept_id','approve_id','pay_type','payment_amount']); - } - - - /** - * @notes 删除场景 - * @return AdministrativePaymentsValidate - * @author likeadmin - * @date 2023/12/19 14:50 - */ - public function sceneDelete() - { - return $this->only(['id']); - } - - - /** - * @notes 详情场景 - * @return AdministrativePaymentsValidate - * @author likeadmin - * @date 2023/12/19 14:50 - */ - public function sceneDetail() - { - return $this->only(['id']); - } - -} \ No newline at end of file + + namespace app\adminapi\validate\administrative; + + + use app\common\validate\BaseValidate; + + + /** + * AdministrativePayments验证器 + * Class AdministrativePaymentsValidate + * @package app\adminapi\validate\administrative + */ + class AdministrativePaymentsValidate extends BaseValidate + { + + /** + * 设置校验规则 + * @var string[] + */ + protected $rule = [ + 'id' => 'require', + 'org_id' => 'require', + 'dept_id' => 'require', + 'approve_id' => 'require', + 'pay_type' => 'require', + 'payment_amount' => 'require', + ]; + + + /** + * 参数描述 + * @var string[] + */ + protected $field = [ + 'id' => 'id', + 'org_id' => '组织id', + 'dept_id' => '部门id', + 'approve_id' => '审批id', + 'pay_type' => '付款方式', + 'payment_amount' => '本次支付金额', + ]; + + + /** + * @notes 添加场景 + * @return AdministrativePaymentsValidate + * @author likeadmin + * @date 2023/12/19 14:50 + */ + public function sceneAdd() + { + return $this->only(['org_id', 'dept_id', 'approve_id', 'pay_type', 'payment_amount']); + } + + + /** + * @notes 编辑场景 + * @return AdministrativePaymentsValidate + * @author likeadmin + * @date 2023/12/19 14:50 + */ + public function sceneEdit() + { + return $this->only(['id', 'org_id', 'dept_id', 'approve_id', 'pay_type', 'payment_amount']); + } + + + /** + * @notes 删除场景 + * @return AdministrativePaymentsValidate + * @author likeadmin + * @date 2023/12/19 14:50 + */ + public function sceneDelete() + { + return $this->only(['id'])->remove('id', 'checkData'); + } + + + /** + * @notes 详情场景 + * @return AdministrativePaymentsValidate + * @author likeadmin + * @date 2023/12/19 14:50 + */ + public function sceneDetail() + { + return $this->only(['id']); + } + + } \ No newline at end of file diff --git a/app/adminapi/validate/administrative/AdministrativeTicketCollectionValidate.php b/app/adminapi/validate/administrative/AdministrativeTicketCollectionValidate.php index 03d3f0665..b41281cf8 100644 --- a/app/adminapi/validate/administrative/AdministrativeTicketCollectionValidate.php +++ b/app/adminapi/validate/administrative/AdministrativeTicketCollectionValidate.php @@ -11,94 +11,94 @@ // +---------------------------------------------------------------------- // | author: likeadminTeam // +---------------------------------------------------------------------- - -namespace app\adminapi\validate\administrative; - - -use app\common\validate\BaseValidate; - - -/** - * AdministrativeTicketCollection验证器 - * Class AdministrativeTicketCollectionValidate - * @package app\adminapi\validate\administrative - */ -class AdministrativeTicketCollectionValidate extends BaseValidate -{ - - /** - * 设置校验规则 - * @var string[] - */ - protected $rule = [ - 'id' => 'require', - 'org_id' => 'require', - 'dept_id' => 'require', - 'administrative_contract_id' => 'require', - 'invoice_amount' => 'require', - 'receipt_date' => 'require', - ]; - - - /** - * 参数描述 - * @var string[] - */ - protected $field = [ - 'id' => 'id', - 'org_id' => '组织id', - 'dept_id' => '部门id', - 'administrative_contract_id' => '行政合同id', - 'invoice_amount' => '发票金额', - 'receipt_date' => '收票日期', - ]; - - - /** - * @notes 添加场景 - * @return AdministrativeTicketCollectionValidate - * @author likeadmin - * @date 2023/12/19 14:00 - */ - public function sceneAdd() - { - return $this->only(['org_id','dept_id','administrative_contract_id','invoice_amount','receipt_date']); - } - - - /** - * @notes 编辑场景 - * @return AdministrativeTicketCollectionValidate - * @author likeadmin - * @date 2023/12/19 14:00 - */ - public function sceneEdit() - { - return $this->only(['id','org_id','dept_id','administrative_contract_id','invoice_amount','receipt_date']); - } - - - /** - * @notes 删除场景 - * @return AdministrativeTicketCollectionValidate - * @author likeadmin - * @date 2023/12/19 14:00 - */ - public function sceneDelete() - { - return $this->only(['id']); - } - - - /** - * @notes 详情场景 - * @return AdministrativeTicketCollectionValidate - * @author likeadmin - * @date 2023/12/19 14:00 - */ - public function sceneDetail() - { - return $this->only(['id']); - } - -} \ No newline at end of file + + namespace app\adminapi\validate\administrative; + + + use app\common\validate\BaseValidate; + + + /** + * AdministrativeTicketCollection验证器 + * Class AdministrativeTicketCollectionValidate + * @package app\adminapi\validate\administrative + */ + class AdministrativeTicketCollectionValidate extends BaseValidate + { + + /** + * 设置校验规则 + * @var string[] + */ + protected $rule = [ + 'id' => 'require', + 'org_id' => 'require', + 'dept_id' => 'require', + 'administrative_contract_id' => 'require', + 'invoice_amount' => 'require', + 'receipt_date' => 'require', + ]; + + + /** + * 参数描述 + * @var string[] + */ + protected $field = [ + 'id' => 'id', + 'org_id' => '组织id', + 'dept_id' => '部门id', + 'administrative_contract_id' => '行政合同id', + 'invoice_amount' => '发票金额', + 'receipt_date' => '收票日期', + ]; + + + /** + * @notes 添加场景 + * @return AdministrativeTicketCollectionValidate + * @author likeadmin + * @date 2023/12/19 14:00 + */ + public function sceneAdd() + { + return $this->only(['org_id', 'dept_id', 'administrative_contract_id', 'invoice_amount', 'receipt_date']); + } + + + /** + * @notes 编辑场景 + * @return AdministrativeTicketCollectionValidate + * @author likeadmin + * @date 2023/12/19 14:00 + */ + public function sceneEdit() + { + return $this->only(['id', 'org_id', 'dept_id', 'administrative_contract_id', 'invoice_amount', 'receipt_date']); + } + + + /** + * @notes 删除场景 + * @return AdministrativeTicketCollectionValidate + * @author likeadmin + * @date 2023/12/19 14:00 + */ + public function sceneDelete() + { + return $this->only(['id'])->remove('id', 'checkData'); + } + + + /** + * @notes 详情场景 + * @return AdministrativeTicketCollectionValidate + * @author likeadmin + * @date 2023/12/19 14:00 + */ + public function sceneDetail() + { + return $this->only(['id']); + } + + } \ No newline at end of file diff --git a/app/adminapi/validate/article/ArticleValidate.php b/app/adminapi/validate/article/ArticleValidate.php index 7fc896e52..74440141f 100755 --- a/app/adminapi/validate/article/ArticleValidate.php +++ b/app/adminapi/validate/article/ArticleValidate.php @@ -11,98 +11,98 @@ // +---------------------------------------------------------------------- // | author: likeadminTeam // +---------------------------------------------------------------------- - -namespace app\adminapi\validate\article; - -use app\common\validate\BaseValidate; -use app\common\model\article\Article; - -/** - * 资讯管理验证 - * Class ArticleValidate - * @package app\adminapi\validate\article - */ -class ArticleValidate extends BaseValidate -{ - protected $rule = [ - 'id' => 'require|checkArticle', - 'title' => 'require|length:1,255', + + namespace app\adminapi\validate\article; + + use app\common\model\article\Article; + use app\common\validate\BaseValidate; + + /** + * 资讯管理验证 + * Class ArticleValidate + * @package app\adminapi\validate\article + */ + class ArticleValidate extends BaseValidate + { + protected $rule = [ + 'id' => 'require|checkArticle', + 'title' => 'require|length:1,255', // 'image' => 'require', - 'cid' => 'require', - 'is_show' => 'require|in:0,1', - ]; - - protected $message = [ - 'id.require' => '资讯id不能为空', - 'title.require' => '标题不能为空', - 'title.length' => '标题长度须在1-255位字符', + 'cid' => 'require', + 'is_show' => 'require|in:0,1', + ]; + + protected $message = [ + 'id.require' => '资讯id不能为空', + 'title.require' => '标题不能为空', + 'title.length' => '标题长度须在1-255位字符', // 'image.require' => '封面图必须存在', - 'cid.require' => '所属栏目必须存在', - ]; - - /** - * @notes 添加场景 - * @return ArticleValidate - * @author heshihu - * @date 2022/2/22 9:57 - */ - public function sceneAdd() - { - return $this->remove(['id']) - ->remove('id','require|checkArticle'); - } - - /** - * @notes 详情场景 - * @return ArticleValidate - * @author heshihu - * @date 2022/2/22 10:15 - */ - public function sceneDetail() - { - return $this->only(['id']); - } - - /** - * @notes 更改状态场景 - * @return ArticleValidate - * @author heshihu - * @date 2022/2/22 10:18 - */ - public function sceneStatus() - { - return $this->only(['id', 'is_show']); - } - - public function sceneEdit() - { - } - - /** - * @notes 删除场景 - * @return ArticleValidate - * @author heshihu - * @date 2022/2/22 10:17 - */ - public function sceneDelete() - { - return $this->only(['id']); - } - - /** - * @notes 检查指定资讯是否存在 - * @param $value - * @return bool|string - * @author heshihu - * @date 2022/2/22 10:11 - */ - public function checkArticle($value) - { - $article = Article::findOrEmpty($value); - if ($article->isEmpty()) { - return '资讯不存在'; - } - return true; - } - -} \ No newline at end of file + 'cid.require' => '所属栏目必须存在', + ]; + + /** + * @notes 添加场景 + * @return ArticleValidate + * @author heshihu + * @date 2022/2/22 9:57 + */ + public function sceneAdd() + { + return $this->remove(['id']) + ->remove('id', 'require|checkArticle'); + } + + /** + * @notes 详情场景 + * @return ArticleValidate + * @author heshihu + * @date 2022/2/22 10:15 + */ + public function sceneDetail() + { + return $this->only(['id']); + } + + /** + * @notes 更改状态场景 + * @return ArticleValidate + * @author heshihu + * @date 2022/2/22 10:18 + */ + public function sceneStatus() + { + return $this->only(['id', 'is_show']); + } + + public function sceneEdit() + { + } + + /** + * @notes 删除场景 + * @return ArticleValidate + * @author heshihu + * @date 2022/2/22 10:17 + */ + public function sceneDelete() + { + return $this->only(['id'])->remove('id', 'checkData'); + } + + /** + * @notes 检查指定资讯是否存在 + * @param $value + * @return bool|string + * @author heshihu + * @date 2022/2/22 10:11 + */ + public function checkArticle($value) + { + $article = Article::findOrEmpty($value); + if ($article->isEmpty()) { + return '资讯不存在'; + } + return true; + } + + } \ No newline at end of file diff --git a/app/adminapi/validate/auth/AdminValidate.php b/app/adminapi/validate/auth/AdminValidate.php index bf4d9176b..9028d63f5 100755 --- a/app/adminapi/validate/auth/AdminValidate.php +++ b/app/adminapi/validate/auth/AdminValidate.php @@ -11,201 +11,200 @@ // +---------------------------------------------------------------------- // | author: likeadminTeam // +---------------------------------------------------------------------- - -namespace app\adminapi\validate\auth; - -use app\common\model\dept\Dept; -use app\common\model\dept\Jobs; -use app\common\model\dept\Orgs; -use app\common\validate\BaseValidate; -use app\common\model\auth\Admin; - -/** - * 管理员验证 - * Class AdminValidate - * @package app\adminapi\validate\auth - */ -class AdminValidate extends BaseValidate -{ - protected $rule = [ - 'id' => 'require|checkAdmin', - 'account' => 'require|length:1,32|unique:'.Admin::class, - 'name' => 'require|length:1,16|unique:'.Admin::class, - 'password' => 'require|length:6,32|edit', - 'password_confirm' => 'requireWith:password|confirm', - 'role_id' => 'require', - 'disable' => 'require|in:0,1|checkAbleDisable', - 'multipoint_login' => 'require|in:0,1', - 'org_id' => 'require|checkOrg', - 'dept_id' => 'requireWith:org_id|checkDept', - 'job_id' => 'requireWith:dept_id|checkJob' - ]; - - protected $message = [ - 'id.require' => '管理员id不能为空', - 'account.require' => '账号不能为空', - 'account.length' => '账号长度须在1-32位字符', - 'account.unique' => '账号已存在', - 'password.require' => '密码不能为空', - 'password.length' => '密码长度须在6-32位字符', - 'password_confirm.requireWith' => '确认密码不能为空', - 'password_confirm.confirm' => '两次输入的密码不一致', - 'name.require' => '名称不能为空', - 'name.length' => '名称须在1-16位字符', - 'name.unique' => '名称已存在', - 'role_id.require' => '请选择角色', - 'disable.require' => '请选择状态', - 'disable.in' => '状态值错误', - 'multipoint_login.require' => '请选择是否支持多处登录', - 'multipoint_login.in' => '多处登录状态值为误', - 'org_id.require' => '请选择组织', - 'dept_id.requireWith' => '请选择部门', - 'job_id.requireWith' => '请选择岗位', - ]; - - /** - * @notes 添加场景 - * @return AdminValidate - * @author 段誉 - * @date 2021/12/29 15:46 - */ - public function sceneAdd() - { - return $this->remove(['password', 'edit']) - ->remove('id', 'require|checkAdmin') - ->remove('disable', 'checkAbleDisable'); - } - - /** - * @notes 详情场景 - * @return AdminValidate - * @author 段誉 - * @date 2021/12/29 15:46 - */ - public function sceneDetail() - { - return $this->only(['id']); - } - - /** - * @notes 编辑场景 - * @return AdminValidate - * @author 段誉 - * @date 2021/12/29 15:47 - */ - public function sceneEdit() - { - return $this->remove('password', 'require|length') - ->append('id', 'require|checkAdmin'); - } - - - /** - * @notes 删除场景 - * @return AdminValidate - * @author 段誉 - * @date 2021/12/29 15:47 - */ - public function sceneDelete() - { - return $this->only(['id']); - } - - - - /** - * @notes 编辑情况下,检查是否填密码 - * @param $value - * @param $rule - * @param $data - * @return bool|string - * @author 段誉 - * @date 2021/12/29 10:19 - */ - public function edit($value, $rule, $data) - { - if (empty($data['password']) && empty($data['password_confirm'])) { - return true; - } - $len = strlen($value); - if ($len < 6 || $len > 32) { - return '密码长度须在6-32位字符'; - } - return true; - } - - - /** - * @notes 检查指定管理员是否存在 - * @param $value - * @return bool|string - * @author 段誉 - * @date 2021/12/29 10:19 - */ - public function checkAdmin($value) - { - $admin = Admin::findOrEmpty($value); - if ($admin->isEmpty()) { - return '管理员不存在'; - } - return true; - } - - - /** - * @notes 禁用校验 - * @param $value - * @param $rule - * @param $data - * @return bool|string - * @author 段誉 - * @date 2022/8/11 9:59 - */ - public function checkAbleDisable($value, $rule, $data) - { - $admin = Admin::findOrEmpty($data['id']); - if ($admin->isEmpty()) { - return '管理员不存在'; - } - - if ($value && $admin['root']) { - return '超级管理员不允许被禁用'; - } - return true; - } - //验证组织 - public function checkOrg($value): bool|string - { - $org = Orgs::where('id',$value)->findOrEmpty(); - if($org->isEmpty()){ - return '组织不存在'; - } - return true; - } + namespace app\adminapi\validate\auth; - public function checkDept($value, $rule, $data): bool|string - { - $dept = Dept::where('id',$value)->findOrEmpty(); - if($dept->isEmpty()){ - return '部门不存在'; - } - if($dept['org_id'] != $data['org_id']){ - return '该部门不属于当前选择的组织'; - } - return true; - } + use app\common\model\auth\Admin; + use app\common\model\dept\Dept; + use app\common\model\dept\Jobs; + use app\common\model\dept\Orgs; + use app\common\validate\BaseValidate; - public function checkJob($value, $rule, $data): bool|string + /** + * 管理员验证 + * Class AdminValidate + * @package app\adminapi\validate\auth + */ + class AdminValidate extends BaseValidate { - $job = Jobs::where('id',$value)->findOrEmpty(); - if($job->isEmpty()){ - return '岗位不存在'; + protected $rule = [ + 'id' => 'require|checkAdmin', + 'account' => 'require|length:1,32|unique:' . Admin::class, + 'name' => 'require|length:1,16|unique:' . Admin::class, + 'password' => 'require|length:6,32|edit', + 'password_confirm' => 'requireWith:password|confirm', + 'role_id' => 'require', + 'disable' => 'require|in:0,1|checkAbleDisable', + 'multipoint_login' => 'require|in:0,1', + 'org_id' => 'require|checkOrg', + 'dept_id' => 'requireWith:org_id|checkDept', + 'job_id' => 'requireWith:dept_id|checkJob' + ]; + + protected $message = [ + 'id.require' => '管理员id不能为空', + 'account.require' => '账号不能为空', + 'account.length' => '账号长度须在1-32位字符', + 'account.unique' => '账号已存在', + 'password.require' => '密码不能为空', + 'password.length' => '密码长度须在6-32位字符', + 'password_confirm.requireWith' => '确认密码不能为空', + 'password_confirm.confirm' => '两次输入的密码不一致', + 'name.require' => '名称不能为空', + 'name.length' => '名称须在1-16位字符', + 'name.unique' => '名称已存在', + 'role_id.require' => '请选择角色', + 'disable.require' => '请选择状态', + 'disable.in' => '状态值错误', + 'multipoint_login.require' => '请选择是否支持多处登录', + 'multipoint_login.in' => '多处登录状态值为误', + 'org_id.require' => '请选择组织', + 'dept_id.requireWith' => '请选择部门', + 'job_id.requireWith' => '请选择岗位', + ]; + + /** + * @notes 添加场景 + * @return AdminValidate + * @author 段誉 + * @date 2021/12/29 15:46 + */ + public function sceneAdd() + { + return $this->remove(['password', 'edit']) + ->remove('id', 'require|checkAdmin') + ->remove('disable', 'checkAbleDisable'); } - if($job['dept_id'] != $data['dept_id']){ - return '该岗位不属于当前选择的部门'; + + /** + * @notes 详情场景 + * @return AdminValidate + * @author 段誉 + * @date 2021/12/29 15:46 + */ + public function sceneDetail() + { + return $this->only(['id']); } - return true; - } - -} \ No newline at end of file + + /** + * @notes 编辑场景 + * @return AdminValidate + * @author 段誉 + * @date 2021/12/29 15:47 + */ + public function sceneEdit() + { + return $this->remove('password', 'require|length') + ->append('id', 'require|checkAdmin'); + } + + + /** + * @notes 删除场景 + * @return AdminValidate + * @author 段誉 + * @date 2021/12/29 15:47 + */ + public function sceneDelete() + { + return $this->only(['id'])->remove('id', 'checkData'); + } + + + /** + * @notes 编辑情况下,检查是否填密码 + * @param $value + * @param $rule + * @param $data + * @return bool|string + * @author 段誉 + * @date 2021/12/29 10:19 + */ + public function edit($value, $rule, $data) + { + if (empty($data['password']) && empty($data['password_confirm'])) { + return true; + } + $len = strlen($value); + if ($len < 6 || $len > 32) { + return '密码长度须在6-32位字符'; + } + return true; + } + + + /** + * @notes 检查指定管理员是否存在 + * @param $value + * @return bool|string + * @author 段誉 + * @date 2021/12/29 10:19 + */ + public function checkAdmin($value) + { + $admin = Admin::findOrEmpty($value); + if ($admin->isEmpty()) { + return '管理员不存在'; + } + return true; + } + + + /** + * @notes 禁用校验 + * @param $value + * @param $rule + * @param $data + * @return bool|string + * @author 段誉 + * @date 2022/8/11 9:59 + */ + public function checkAbleDisable($value, $rule, $data) + { + $admin = Admin::findOrEmpty($data['id']); + if ($admin->isEmpty()) { + return '管理员不存在'; + } + + if ($value && $admin['root']) { + return '超级管理员不允许被禁用'; + } + return true; + } + + //验证组织 + public function checkOrg($value): bool|string + { + $org = Orgs::where('id', $value)->findOrEmpty(); + if ($org->isEmpty()) { + return '组织不存在'; + } + return true; + } + + public function checkDept($value, $rule, $data): bool|string + { + $dept = Dept::where('id', $value)->findOrEmpty(); + if ($dept->isEmpty()) { + return '部门不存在'; + } + if ($dept['org_id'] != $data['org_id']) { + return '该部门不属于当前选择的组织'; + } + return true; + } + + public function checkJob($value, $rule, $data): bool|string + { + $job = Jobs::where('id', $value)->findOrEmpty(); + if ($job->isEmpty()) { + return '岗位不存在'; + } + if ($job['dept_id'] != $data['dept_id']) { + return '该岗位不属于当前选择的部门'; + } + return true; + } + + } \ No newline at end of file diff --git a/app/adminapi/validate/bank/BankAccountValidate.php b/app/adminapi/validate/bank/BankAccountValidate.php index 515e3c005..d57b42622 100644 --- a/app/adminapi/validate/bank/BankAccountValidate.php +++ b/app/adminapi/validate/bank/BankAccountValidate.php @@ -11,91 +11,92 @@ // +---------------------------------------------------------------------- // | author: likeadminTeam // +---------------------------------------------------------------------- - -namespace app\adminapi\validate\bank; - -use app\common\validate\BaseValidate; - - -/** - * BankAccount验证器 - * Class BankAccountValidate - * @package app\adminapi\validate\bank - */ -class BankAccountValidate extends BaseValidate -{ - - /** - * 设置校验规则 - * @var string[] - */ - protected $rule = [ - 'id' => 'require', - 'deposit_bank' => 'require', - 'account_name' => 'require', - 'account' => 'require', - 'account_opening_date' => 'dateFormat:Y-m-d', - 'opening_amount' => 'require|float|egt:0', - ]; - - - /** - * 参数描述 - * @var string[] - */ - protected $field = [ - 'id' => 'id', - 'deposit_bank' => '开户银行', - 'account_name' => '开户名称', - 'account' => '账号', - 'account_opening_date' => '开户日期', - 'opening_amount' => '期初金额', - ]; - - - /** - * @notes 添加场景 - * @return BankAccountValidate - * @author likeadmin - * @date 2023/12/20 15:04 - */ - public function sceneAdd() - { - return $this->remove('id',true); - } - - - /** - * @notes 编辑场景 - * @return BankAccountValidate - * @author likeadmin - * @date 2023/12/20 15:04 - */ - public function sceneEdit() - {} - - - /** - * @notes 删除场景 - * @return BankAccountValidate - * @author likeadmin - * @date 2023/12/20 15:04 - */ - public function sceneDelete() - { - return $this->only(['id']); - } - - - /** - * @notes 详情场景 - * @return BankAccountValidate - * @author likeadmin - * @date 2023/12/20 15:04 - */ - public function sceneDetail() - { - return $this->only(['id']); - } - -} \ No newline at end of file + + namespace app\adminapi\validate\bank; + + use app\common\validate\BaseValidate; + + + /** + * BankAccount验证器 + * Class BankAccountValidate + * @package app\adminapi\validate\bank + */ + class BankAccountValidate extends BaseValidate + { + + /** + * 设置校验规则 + * @var string[] + */ + protected $rule = [ + 'id' => 'require', + 'deposit_bank' => 'require', + 'account_name' => 'require', + 'account' => 'require', + 'account_opening_date' => 'dateFormat:Y-m-d', + 'opening_amount' => 'require|float|egt:0', + ]; + + + /** + * 参数描述 + * @var string[] + */ + protected $field = [ + 'id' => 'id', + 'deposit_bank' => '开户银行', + 'account_name' => '开户名称', + 'account' => '账号', + 'account_opening_date' => '开户日期', + 'opening_amount' => '期初金额', + ]; + + + /** + * @notes 添加场景 + * @return BankAccountValidate + * @author likeadmin + * @date 2023/12/20 15:04 + */ + public function sceneAdd() + { + return $this->remove('id', true); + } + + + /** + * @notes 编辑场景 + * @return BankAccountValidate + * @author likeadmin + * @date 2023/12/20 15:04 + */ + public function sceneEdit() + { + } + + + /** + * @notes 删除场景 + * @return BankAccountValidate + * @author likeadmin + * @date 2023/12/20 15:04 + */ + public function sceneDelete() + { + return $this->only(['id'])->remove('id', 'checkData'); + } + + + /** + * @notes 详情场景 + * @return BankAccountValidate + * @author likeadmin + * @date 2023/12/20 15:04 + */ + public function sceneDetail() + { + return $this->only(['id']); + } + + } \ No newline at end of file diff --git a/app/adminapi/validate/bank/RateSettingValidate.php b/app/adminapi/validate/bank/RateSettingValidate.php index 8a0c4abd5..c005b2432 100644 --- a/app/adminapi/validate/bank/RateSettingValidate.php +++ b/app/adminapi/validate/bank/RateSettingValidate.php @@ -11,88 +11,88 @@ // +---------------------------------------------------------------------- // | author: likeadminTeam // +---------------------------------------------------------------------- - -namespace app\adminapi\validate\bank; - - -use app\common\validate\BaseValidate; - - -/** - * RateSetting验证器 - * Class RateSettingValidate - * @package app\adminapi\validate\bank - */ -class RateSettingValidate extends BaseValidate -{ - - /** - * 设置校验规则 - * @var string[] - */ - protected $rule = [ - 'id' => 'require', - 'starting_effective_date' => 'require', - 'annualized_interest_rate' => 'require', - ]; - - - /** - * 参数描述 - * @var string[] - */ - protected $field = [ - 'id' => 'id', - 'starting_effective_date' => '生效日期', - 'annualized_interest_rate' => '年化利率(', - ]; - - - /** - * @notes 添加场景 - * @return RateSettingValidate - * @author likeadmin - * @date 2023/12/20 16:22 - */ - public function sceneAdd() - { - return $this->only(['starting_effective_date','annualized_interest_rate']); - } - - - /** - * @notes 编辑场景 - * @return RateSettingValidate - * @author likeadmin - * @date 2023/12/20 16:22 - */ - public function sceneEdit() - { - return $this->only(['id','starting_effective_date','annualized_interest_rate']); - } - - - /** - * @notes 删除场景 - * @return RateSettingValidate - * @author likeadmin - * @date 2023/12/20 16:22 - */ - public function sceneDelete() - { - return $this->only(['id']); - } - - - /** - * @notes 详情场景 - * @return RateSettingValidate - * @author likeadmin - * @date 2023/12/20 16:22 - */ - public function sceneDetail() - { - return $this->only(['id']); - } - -} \ No newline at end of file + + namespace app\adminapi\validate\bank; + + + use app\common\validate\BaseValidate; + + + /** + * RateSetting验证器 + * Class RateSettingValidate + * @package app\adminapi\validate\bank + */ + class RateSettingValidate extends BaseValidate + { + + /** + * 设置校验规则 + * @var string[] + */ + protected $rule = [ + 'id' => 'require', + 'starting_effective_date' => 'require', + 'annualized_interest_rate' => 'require', + ]; + + + /** + * 参数描述 + * @var string[] + */ + protected $field = [ + 'id' => 'id', + 'starting_effective_date' => '生效日期', + 'annualized_interest_rate' => '年化利率(', + ]; + + + /** + * @notes 添加场景 + * @return RateSettingValidate + * @author likeadmin + * @date 2023/12/20 16:22 + */ + public function sceneAdd() + { + return $this->only(['starting_effective_date', 'annualized_interest_rate']); + } + + + /** + * @notes 编辑场景 + * @return RateSettingValidate + * @author likeadmin + * @date 2023/12/20 16:22 + */ + public function sceneEdit() + { + return $this->only(['id', 'starting_effective_date', 'annualized_interest_rate']); + } + + + /** + * @notes 删除场景 + * @return RateSettingValidate + * @author likeadmin + * @date 2023/12/20 16:22 + */ + public function sceneDelete() + { + return $this->only(['id'])->remove('id', 'checkData'); + } + + + /** + * @notes 详情场景 + * @return RateSettingValidate + * @author likeadmin + * @date 2023/12/20 16:22 + */ + public function sceneDetail() + { + return $this->only(['id']); + } + + } \ No newline at end of file diff --git a/app/adminapi/validate/bank/RevenueExpenditureStatementValidate.php b/app/adminapi/validate/bank/RevenueExpenditureStatementValidate.php index a8d5b0ef2..e2c1eeb6b 100644 --- a/app/adminapi/validate/bank/RevenueExpenditureStatementValidate.php +++ b/app/adminapi/validate/bank/RevenueExpenditureStatementValidate.php @@ -11,92 +11,92 @@ // +---------------------------------------------------------------------- // | author: likeadminTeam // +---------------------------------------------------------------------- - -namespace app\adminapi\validate\bank; - - -use app\common\validate\BaseValidate; - - -/** - * RevenueExpenditureStatement验证器 - * Class RevenueExpenditureStatementValidate - * @package app\adminapi\validate\bank - */ -class RevenueExpenditureStatementValidate extends BaseValidate -{ - - /** - * 设置校验规则 - * @var string[] - */ - protected $rule = [ - 'id' => 'require', - 'org_id' => 'require', - 'dept_id' => 'require', - 'document_type' => 'require', - 'amount' => 'require', - ]; - - - /** - * 参数描述 - * @var string[] - */ - protected $field = [ - 'id' => 'id', - 'org_id' => '组织id', - 'dept_id' => '部门id', - 'document_type' => '单据类型', - 'amount' => '金额', - ]; - - - /** - * @notes 添加场景 - * @return RevenueExpenditureStatementValidate - * @author likeadmin - * @date 2023/12/20 15:51 - */ - public function sceneAdd() - { - return $this->only(['org_id','dept_id','document_type','amount']); - } - - - /** - * @notes 编辑场景 - * @return RevenueExpenditureStatementValidate - * @author likeadmin - * @date 2023/12/20 15:51 - */ - public function sceneEdit() - { - return $this->only(['id','org_id','dept_id','document_type','amount']); - } - - - /** - * @notes 删除场景 - * @return RevenueExpenditureStatementValidate - * @author likeadmin - * @date 2023/12/20 15:51 - */ - public function sceneDelete() - { - return $this->only(['id']); - } - - - /** - * @notes 详情场景 - * @return RevenueExpenditureStatementValidate - * @author likeadmin - * @date 2023/12/20 15:51 - */ - public function sceneDetail() - { - return $this->only(['id']); - } - -} \ No newline at end of file + + namespace app\adminapi\validate\bank; + + + use app\common\validate\BaseValidate; + + + /** + * RevenueExpenditureStatement验证器 + * Class RevenueExpenditureStatementValidate + * @package app\adminapi\validate\bank + */ + class RevenueExpenditureStatementValidate extends BaseValidate + { + + /** + * 设置校验规则 + * @var string[] + */ + protected $rule = [ + 'id' => 'require', + 'org_id' => 'require', + 'dept_id' => 'require', + 'document_type' => 'require', + 'amount' => 'require', + ]; + + + /** + * 参数描述 + * @var string[] + */ + protected $field = [ + 'id' => 'id', + 'org_id' => '组织id', + 'dept_id' => '部门id', + 'document_type' => '单据类型', + 'amount' => '金额', + ]; + + + /** + * @notes 添加场景 + * @return RevenueExpenditureStatementValidate + * @author likeadmin + * @date 2023/12/20 15:51 + */ + public function sceneAdd() + { + return $this->only(['org_id', 'dept_id', 'document_type', 'amount']); + } + + + /** + * @notes 编辑场景 + * @return RevenueExpenditureStatementValidate + * @author likeadmin + * @date 2023/12/20 15:51 + */ + public function sceneEdit() + { + return $this->only(['id', 'org_id', 'dept_id', 'document_type', 'amount']); + } + + + /** + * @notes 删除场景 + * @return RevenueExpenditureStatementValidate + * @author likeadmin + * @date 2023/12/20 15:51 + */ + public function sceneDelete() + { + return $this->only(['id'])->remove('id', 'checkData'); + } + + + /** + * @notes 详情场景 + * @return RevenueExpenditureStatementValidate + * @author likeadmin + * @date 2023/12/20 15:51 + */ + public function sceneDetail() + { + return $this->only(['id']); + } + + } \ No newline at end of file diff --git a/app/adminapi/validate/bid/BidBiddingDecisionValidate.php b/app/adminapi/validate/bid/BidBiddingDecisionValidate.php index d16413fe5..6a6cf38df 100644 --- a/app/adminapi/validate/bid/BidBiddingDecisionValidate.php +++ b/app/adminapi/validate/bid/BidBiddingDecisionValidate.php @@ -11,158 +11,158 @@ // +---------------------------------------------------------------------- // | author: likeadminTeam // +---------------------------------------------------------------------- - -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; - - -/** - * 投标决策验证器 - * Class BidBiddingDecisionValidate - * @package app\adminapi\validate\bid - */ -class BidBiddingDecisionValidate extends BaseValidate -{ - - /** - * 设置校验规则 - * @var string[] - */ - protected $rule = [ - 'id' => 'require|checkData', - 'project_id' => 'require|checkProject', - 'project_estimation' => 'require|float|egt:0', - 'bidding_project_fund_source' => 'checkBiddingProjectFundSource', - 'bidding_time' => 'dateFormat:Y-m-d', - 'bid_type' => 'checkBidType', - 'is_margin' => 'require|in:1,2', - 'margin_amount' => 'requireIf:is_margin,1|float|egt:0', - 'bid_opening_date' => 'dateFormat:Y-m-d', - 'margin_amount_return_date' => 'dateFormat:Y-m-d', - 'is_internal_resources' => 'in:1,2', - 'project_assurance' => 'checkProjectAssurance', - 'annex' => 'checkAnnex', - 'flow_id' => 'require|checkFlow', - 'path' => 'require', - ]; - - protected $message = [ - 'id.require' => '缺少必要参数', - 'project_id.require' => '请选择项目', - 'project_estimation.require' => '请填写项目估算', - 'project_estimation.float' => '项目估算值必须是数字', - 'project_estimation.egt' => '项目估算值必须大于等于0', - 'bidding_time.dateFormat' => '投标时间数据格式错误', - 'is_margin.require' => '请选择是否需要保证金', - 'is_margin.in' => '是否需要保证金选项值错误', - 'margin_amount.requireIf' => '请填写保证金金额', - 'margin_amount.float' => '保证金金额值必须是数字', - 'margin_amount.egt' => '保证金金额值必须大于等于0', - 'bid_opening_date.dateFormat' => '开标日期数据格式错误', - 'margin_amount_return_date.dateFormat' => '保证金退还时间数据格式错误', - 'is_internal_resources.in' => '有无内部资源选项值错误', - ]; - - - /** - * @notes 添加场景 - * @return BidBiddingDecisionValidate - * @author likeadmin - * @date 2023/11/27 18:14 - */ - public function sceneAdd() - { - return $this->remove('id', true)->remove('flow_id',true)->remove('path',true); - } - - - /** - * @notes 编辑场景 - * @return BidBiddingDecisionValidate - * @author likeadmin - * @date 2023/11/27 18:14 - */ - public function sceneEdit() - { - return $this->remove('flow_id',true)->remove('path',true); - } - - - /** - * @notes 删除场景 - * @return BidBiddingDecisionValidate - * @author likeadmin - * @date 2023/11/27 18:14 - */ - public function sceneDelete() - { - return $this->only(['id']); - } - - - /** - * @notes 详情场景 - * @return BidBiddingDecisionValidate - * @author likeadmin - * @date 2023/11/27 18:14 - */ - public function sceneDetail() - { - return $this->only(['id']); - } - public function sceneApprove() - { - return $this->only(['id','flow_id','path']); - } + namespace app\adminapi\validate\bid; - public function checkData($value): bool|string + use app\common\model\bid\BidBiddingDecision; + use app\common\model\dict\DictData; + use app\common\model\project\Project; + use app\common\validate\BaseValidate; + + + /** + * 投标决策验证器 + * Class BidBiddingDecisionValidate + * @package app\adminapi\validate\bid + */ + class BidBiddingDecisionValidate extends BaseValidate { - $data = BidBiddingDecision::where('id',$value)->findOrEmpty(); - if($data->isEmpty()){ - return '数据不存在'; + + /** + * 设置校验规则 + * @var string[] + */ + protected $rule = [ + 'id' => 'require|checkData', + 'project_id' => 'require|checkProject', + 'project_estimation' => 'require|float|egt:0', + 'bidding_project_fund_source' => 'checkBiddingProjectFundSource', + 'bidding_time' => 'dateFormat:Y-m-d', + 'bid_type' => 'checkBidType', + 'is_margin' => 'require|in:1,2', + 'margin_amount' => 'requireIf:is_margin,1|float|egt:0', + 'bid_opening_date' => 'dateFormat:Y-m-d', + 'margin_amount_return_date' => 'dateFormat:Y-m-d', + 'is_internal_resources' => 'in:1,2', + 'project_assurance' => 'checkProjectAssurance', + 'annex' => 'checkAnnex', + 'flow_id' => 'require|checkFlow', + 'path' => 'require', + ]; + + protected $message = [ + 'id.require' => '缺少必要参数', + 'project_id.require' => '请选择项目', + 'project_estimation.require' => '请填写项目估算', + 'project_estimation.float' => '项目估算值必须是数字', + 'project_estimation.egt' => '项目估算值必须大于等于0', + 'bidding_time.dateFormat' => '投标时间数据格式错误', + 'is_margin.require' => '请选择是否需要保证金', + 'is_margin.in' => '是否需要保证金选项值错误', + 'margin_amount.requireIf' => '请填写保证金金额', + 'margin_amount.float' => '保证金金额值必须是数字', + 'margin_amount.egt' => '保证金金额值必须大于等于0', + 'bid_opening_date.dateFormat' => '开标日期数据格式错误', + 'margin_amount_return_date.dateFormat' => '保证金退还时间数据格式错误', + 'is_internal_resources.in' => '有无内部资源选项值错误', + ]; + + + /** + * @notes 添加场景 + * @return BidBiddingDecisionValidate + * @author likeadmin + * @date 2023/11/27 18:14 + */ + public function sceneAdd() + { + return $this->remove('id', true)->remove('flow_id', true)->remove('path', true); } - return true; - } - - public function checkProject($value): bool|string - { - $project = Project::where('id',$value)->findOrEmpty(); - if($project->isEmpty()){ - return '项目不存在'; + + + /** + * @notes 编辑场景 + * @return BidBiddingDecisionValidate + * @author likeadmin + * @date 2023/11/27 18:14 + */ + public function sceneEdit() + { + return $this->remove('flow_id', true)->remove('path', true); } - return true; - } - - public function checkBiddingProjectFundSource($value): bool|string - { - $dictData = DictData::where('type_value','construction_funds_sources')->column('value'); - if(!in_array($value,$dictData)){ - return '招标项目资金来源无效'; + + + /** + * @notes 删除场景 + * @return BidBiddingDecisionValidate + * @author likeadmin + * @date 2023/11/27 18:14 + */ + public function sceneDelete() + { + return $this->only(['id'])->remove('id', 'checkData'); } - return true; - } - - public function checkBidType($value): bool|string - { - $dictData = DictData::where('type_value','bidding_method')->column('value'); - if(!in_array($value,$dictData)){ - return '招标方式无效'; + + + /** + * @notes 详情场景 + * @return BidBiddingDecisionValidate + * @author likeadmin + * @date 2023/11/27 18:14 + */ + public function sceneDetail() + { + return $this->only(['id']); } - return true; - } - - public function checkProjectAssurance($value): bool|string - { - $dictData = DictData::where('type_value','project_assurance')->column('value'); - if(!in_array($value,$dictData)){ - return '项目把握度无效'; + + public function sceneApprove() + { + return $this->only(['id', 'flow_id', 'path']); } - return true; - } - -} \ No newline at end of file + + 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(); + if ($project->isEmpty()) { + return '项目不存在'; + } + return true; + } + + public function checkBiddingProjectFundSource($value): bool|string + { + $dictData = DictData::where('type_value', 'construction_funds_sources')->column('value'); + if (!in_array($value, $dictData)) { + return '招标项目资金来源无效'; + } + return true; + } + + public function checkBidType($value): bool|string + { + $dictData = DictData::where('type_value', 'bidding_method')->column('value'); + if (!in_array($value, $dictData)) { + return '招标方式无效'; + } + return true; + } + + public function checkProjectAssurance($value): bool|string + { + $dictData = DictData::where('type_value', 'project_assurance')->column('value'); + if (!in_array($value, $dictData)) { + return '项目把握度无效'; + } + return true; + } + + } \ No newline at end of file diff --git a/app/adminapi/validate/bid/BidBuyBiddingDocumentValidate.php b/app/adminapi/validate/bid/BidBuyBiddingDocumentValidate.php index d48d4d204..3483a9f65 100644 --- a/app/adminapi/validate/bid/BidBuyBiddingDocumentValidate.php +++ b/app/adminapi/validate/bid/BidBuyBiddingDocumentValidate.php @@ -11,146 +11,146 @@ // +---------------------------------------------------------------------- // | author: likeadminTeam // +---------------------------------------------------------------------- - -namespace app\adminapi\validate\bid; - - -use app\common\model\auth\Admin; -use app\common\model\bid\BidBiddingDecision; -use app\common\model\bid\BidBuyBiddingDocument; -use app\common\model\project\Project; -use app\common\validate\BaseValidate; - - -/** - * 购买标书验证器 - * Class BidBuyBiddingDocumentValidate - * @package app\adminapi\validate\bid - */ -class BidBuyBiddingDocumentValidate extends BaseValidate -{ - - /** - * 设置校验规则 - * @var string[] - */ - protected $rule = [ - 'id' => 'require|checkData', - 'project_id' => 'require|checkProject', - 'bid_decision_id' => 'require|checkBidDecision', - 'bid_document_no' => 'require', - 'invite_tenders_company_name' => 'require', - 'bid_company_name' => 'require', - 'buyer' => 'checkBuyer', - 'amount' => 'float|egt:0', - 'project_fund_source' => 'checkProjectFundSource', - 'buy_date' => 'dateFormat:Y-m-d', - 'flow_id' => 'require|checkFlow', - 'path' => 'require', - ]; - - protected $message = [ - 'id.require' => '缺少必要参数', - 'project_id.require' => '请选择项目', - 'bid_decision_id.require' => '请选择投标决策', - 'bid_document_no.require' => '请填写标书编号', - 'invite_tenders_company_name.require' => '请填写招标公司名称', - 'bid_company_name.require' => '请填写投标公司名称', - 'amount.float' => '购买标书金额值必须是数字', - 'amount.egt' => '购买标书金额值必须大于等于0', - 'buy_date.dateFormat' => '购买标书时间数据格式错误', - ]; - - - /** - * @notes 添加场景 - * @return BidBuyBiddingDocumentValidate - * @author likeadmin - * @date 2023/11/27 18:22 - */ - public function sceneAdd() - { - return $this->remove('id', true)->remove('flow_id',true)->remove('path',true); - } - - - /** - * @notes 编辑场景 - * @return BidBuyBiddingDocumentValidate - * @author likeadmin - * @date 2023/11/27 18:22 - */ - public function sceneEdit() - { - return $this->remove('flow_id',true)->remove('path',true); - } - - - /** - * @notes 删除场景 - * @return BidBuyBiddingDocumentValidate - * @author likeadmin - * @date 2023/11/27 18:22 - */ - public function sceneDelete() - { - return $this->only(['id']); - } - - - /** - * @notes 详情场景 - * @return BidBuyBiddingDocumentValidate - * @author likeadmin - * @date 2023/11/27 18:22 - */ - public function sceneDetail() - { - return $this->only(['id']); - } - public function sceneApprove() - { - return $this->only(['id','flow_id','path']); - } + namespace app\adminapi\validate\bid; - public function checkData($value): bool|string - { - $data = BidBuyBiddingDocument::where('id',$value)->findOrEmpty(); - if($data->isEmpty()){ - return '数据不存在'; - } - return true; - } - public function checkProject($value): bool|string - { - $project = Project::where('id',$value)->findOrEmpty(); - if($project->isEmpty()){ - return '项目不存在'; - } - return true; - } + use app\common\model\auth\Admin; + use app\common\model\bid\BidBiddingDecision; + use app\common\model\bid\BidBuyBiddingDocument; + use app\common\model\project\Project; + use app\common\validate\BaseValidate; - public function checkBidDecision($value,$rule,$data): bool|string - { - $bid_decision = BidBiddingDecision::where('id',$value)->findOrEmpty(); - if($bid_decision->isEmpty()){ - return '投标决策信息不存在'; - } - if($bid_decision['project_id'] != $data['project_id']){ - return '投标决策信息无效'; - } - return true; - } - public function checkBuyer($value): bool|string + /** + * 购买标书验证器 + * Class BidBuyBiddingDocumentValidate + * @package app\adminapi\validate\bid + */ + class BidBuyBiddingDocumentValidate extends BaseValidate { - $admin = Admin::where('id',$value)->findOrEmpty(); - if($admin->isEmpty()){ - return '购买人员信息不存在'; + + /** + * 设置校验规则 + * @var string[] + */ + protected $rule = [ + 'id' => 'require|checkData', + 'project_id' => 'require|checkProject', + 'bid_decision_id' => 'require|checkBidDecision', + 'bid_document_no' => 'require', + 'invite_tenders_company_name' => 'require', + 'bid_company_name' => 'require', + 'buyer' => 'checkBuyer', + 'amount' => 'float|egt:0', + 'project_fund_source' => 'checkProjectFundSource', + 'buy_date' => 'dateFormat:Y-m-d', + 'flow_id' => 'require|checkFlow', + 'path' => 'require', + ]; + + protected $message = [ + 'id.require' => '缺少必要参数', + 'project_id.require' => '请选择项目', + 'bid_decision_id.require' => '请选择投标决策', + 'bid_document_no.require' => '请填写标书编号', + 'invite_tenders_company_name.require' => '请填写招标公司名称', + 'bid_company_name.require' => '请填写投标公司名称', + 'amount.float' => '购买标书金额值必须是数字', + 'amount.egt' => '购买标书金额值必须大于等于0', + 'buy_date.dateFormat' => '购买标书时间数据格式错误', + ]; + + + /** + * @notes 添加场景 + * @return BidBuyBiddingDocumentValidate + * @author likeadmin + * @date 2023/11/27 18:22 + */ + public function sceneAdd() + { + return $this->remove('id', true)->remove('flow_id', true)->remove('path', true); } - return true; - } - -} \ No newline at end of file + + + /** + * @notes 编辑场景 + * @return BidBuyBiddingDocumentValidate + * @author likeadmin + * @date 2023/11/27 18:22 + */ + public function sceneEdit() + { + return $this->remove('flow_id', true)->remove('path', true); + } + + + /** + * @notes 删除场景 + * @return BidBuyBiddingDocumentValidate + * @author likeadmin + * @date 2023/11/27 18:22 + */ + public function sceneDelete() + { + return $this->only(['id'])->remove('id', 'checkData'); + } + + + /** + * @notes 详情场景 + * @return BidBuyBiddingDocumentValidate + * @author likeadmin + * @date 2023/11/27 18:22 + */ + public function sceneDetail() + { + return $this->only(['id']); + } + + public function sceneApprove() + { + return $this->only(['id', 'flow_id', 'path']); + } + + public function checkData($value): bool|string + { + $data = BidBuyBiddingDocument::where('id', $value)->findOrEmpty(); + if ($data->isEmpty()) { + return '数据不存在'; + } + return true; + } + + public function checkProject($value): bool|string + { + $project = Project::where('id', $value)->findOrEmpty(); + if ($project->isEmpty()) { + return '项目不存在'; + } + return true; + } + + public function checkBidDecision($value, $rule, $data): bool|string + { + $bid_decision = BidBiddingDecision::where('id', $value)->findOrEmpty(); + if ($bid_decision->isEmpty()) { + return '投标决策信息不存在'; + } + if ($bid_decision['project_id'] != $data['project_id']) { + return '投标决策信息无效'; + } + return true; + } + + public function checkBuyer($value): bool|string + { + $admin = Admin::where('id', $value)->findOrEmpty(); + if ($admin->isEmpty()) { + return '购买人员信息不存在'; + } + return true; + } + + } \ No newline at end of file diff --git a/app/adminapi/validate/bid/BidDocumentExaminationDetailValidate.php b/app/adminapi/validate/bid/BidDocumentExaminationDetailValidate.php index 546b8dcae..d9ef2551e 100644 --- a/app/adminapi/validate/bid/BidDocumentExaminationDetailValidate.php +++ b/app/adminapi/validate/bid/BidDocumentExaminationDetailValidate.php @@ -11,117 +11,118 @@ // +---------------------------------------------------------------------- // | author: likeadminTeam // +---------------------------------------------------------------------- - -namespace app\adminapi\validate\bid; - - -use app\common\model\bid\BidDocumentExamination; -use app\common\model\material\Material; -use app\common\validate\BaseValidate; - - -/** - * 标书审查-报价明细验证器 - * Class BidDocumentExaminationDetailValidate - * @package app\adminapi\validate\bid - */ -class BidDocumentExaminationDetailValidate extends BaseValidate -{ - - /** - * 设置校验规则 - * @var string[] - */ - protected $rule = [ - 'id' => 'require', - 'bid_document_examination_id' => 'require|checkBidDocumentExamination', - 'product_id' => 'require|checkProduct', - 'num' => 'require|integer|egt:0', - 'points' => 'require|integer|egt:0', - 'cost_price' => 'require|float|egt:0', - 'sale_price' => 'require|float|egt:0', - ]; - - protected $message = [ - 'id.require' => '缺少必要参数', - 'bid_document_examination_id.require' => '请选择审查内容', - 'product_id.require' => '请选择产品', - 'num.require' => '请填写产品数量', - 'num.integer' => '产品数量值必须是整数', - 'num.egt' => '产品数量值必须大于等于0', - 'points.require' => '请填写点数', - 'points.integer' => '点数值必须是整数', - 'points.egt' => '点数值必须大于等于0', - 'cost_price.require' => '请填写成本单价', - 'cost_price.float' => '成本单价值必须是数字', - 'cost_price.egt' => '成本单价值必须大于等于0', - 'sale_price.require' => '请填写报价单价', - 'sale_price.float' => '报价单价值必须是数字', - 'sale_price.egt' => '报价单价值必须大于等于0', - ]; - - - /** - * @notes 添加场景 - * @return BidDocumentExaminationDetailValidate - * @author likeadmin - * @date 2023/12/02 09:59 - */ - public function sceneAdd() - { - return $this->remove('id', true); - } - - - /** - * @notes 编辑场景 - * @return BidDocumentExaminationDetailValidate - * @author likeadmin - * @date 2023/12/02 09:59 - */ - public function sceneEdit() - {} - - - /** - * @notes 删除场景 - * @return BidDocumentExaminationDetailValidate - * @author likeadmin - * @date 2023/12/02 09:59 - */ - public function sceneDelete() - { - return $this->only(['id']); - } - - - /** - * @notes 详情场景 - * @return BidDocumentExaminationDetailValidate - * @author likeadmin - * @date 2023/12/02 09:59 - */ - public function sceneDetail() - { - return $this->only(['id']); - } - public function checkBidDocumentExamination($value): bool|string - { - $data = BidDocumentExamination::where('id',$value)->findOrEmpty(); - if($data->isEmpty()){ - return '标书审查内容不存在'; - } - return true; - } + namespace app\adminapi\validate\bid; - public function checkProduct($value): bool|string + + use app\common\model\bid\BidDocumentExamination; + use app\common\model\material\Material; + use app\common\validate\BaseValidate; + + + /** + * 标书审查-报价明细验证器 + * Class BidDocumentExaminationDetailValidate + * @package app\adminapi\validate\bid + */ + class BidDocumentExaminationDetailValidate extends BaseValidate { - $data = Material::where('id',$value)->findOrEmpty(); - if($data->isEmpty()){ - return '产品信息不存在'; + + /** + * 设置校验规则 + * @var string[] + */ + protected $rule = [ + 'id' => 'require', + 'bid_document_examination_id' => 'require|checkBidDocumentExamination', + 'product_id' => 'require|checkProduct', + 'num' => 'require|integer|egt:0', + 'points' => 'require|integer|egt:0', + 'cost_price' => 'require|float|egt:0', + 'sale_price' => 'require|float|egt:0', + ]; + + protected $message = [ + 'id.require' => '缺少必要参数', + 'bid_document_examination_id.require' => '请选择审查内容', + 'product_id.require' => '请选择产品', + 'num.require' => '请填写产品数量', + 'num.integer' => '产品数量值必须是整数', + 'num.egt' => '产品数量值必须大于等于0', + 'points.require' => '请填写点数', + 'points.integer' => '点数值必须是整数', + 'points.egt' => '点数值必须大于等于0', + 'cost_price.require' => '请填写成本单价', + 'cost_price.float' => '成本单价值必须是数字', + 'cost_price.egt' => '成本单价值必须大于等于0', + 'sale_price.require' => '请填写报价单价', + 'sale_price.float' => '报价单价值必须是数字', + 'sale_price.egt' => '报价单价值必须大于等于0', + ]; + + + /** + * @notes 添加场景 + * @return BidDocumentExaminationDetailValidate + * @author likeadmin + * @date 2023/12/02 09:59 + */ + public function sceneAdd() + { + return $this->remove('id', true); } - return true; - } - -} \ No newline at end of file + + + /** + * @notes 编辑场景 + * @return BidDocumentExaminationDetailValidate + * @author likeadmin + * @date 2023/12/02 09:59 + */ + public function sceneEdit() + { + } + + + /** + * @notes 删除场景 + * @return BidDocumentExaminationDetailValidate + * @author likeadmin + * @date 2023/12/02 09:59 + */ + public function sceneDelete() + { + return $this->only(['id'])->remove('id', 'checkData'); + } + + + /** + * @notes 详情场景 + * @return BidDocumentExaminationDetailValidate + * @author likeadmin + * @date 2023/12/02 09:59 + */ + public function sceneDetail() + { + return $this->only(['id']); + } + + public function checkBidDocumentExamination($value): bool|string + { + $data = BidDocumentExamination::where('id', $value)->findOrEmpty(); + if ($data->isEmpty()) { + return '标书审查内容不存在'; + } + return true; + } + + public function checkProduct($value): bool|string + { + $data = Material::where('id', $value)->findOrEmpty(); + if ($data->isEmpty()) { + return '产品信息不存在'; + } + return true; + } + + } \ No newline at end of file diff --git a/app/adminapi/validate/bid/BidDocumentExaminationValidate.php b/app/adminapi/validate/bid/BidDocumentExaminationValidate.php index 3f52db5ea..9da287cc8 100644 --- a/app/adminapi/validate/bid/BidDocumentExaminationValidate.php +++ b/app/adminapi/validate/bid/BidDocumentExaminationValidate.php @@ -11,184 +11,184 @@ // +---------------------------------------------------------------------- // | author: likeadminTeam // +---------------------------------------------------------------------- - -namespace app\adminapi\validate\bid; - - -use app\common\model\bid\BidBuyBiddingDocument; -use app\common\model\bid\BidDocumentExamination; -use app\common\model\bid\BidDocumentExaminationDetail; -use app\common\model\dict\DictData; -use app\common\model\material\Material; -use app\common\validate\BaseValidate; - - -/** - * 标书审查验证器 - * Class BidDocumentExaminationValidate - * @package app\adminapi\validate\bid - */ -class BidDocumentExaminationValidate extends BaseValidate -{ - - /** - * 设置校验规则 - * @var string[] - */ - protected $rule = [ - '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' => '请选择标书编号', - ]; - - - /** - * @notes 添加场景 - * @return BidDocumentExaminationValidate - * @author likeadmin - * @date 2023/12/02 09:52 - */ - public function sceneAdd() - { - return $this->remove('id', true)->remove('flow_id',true)->remove('path',true); - } - - - /** - * @notes 编辑场景 - * @return BidDocumentExaminationValidate - * @author likeadmin - * @date 2023/12/02 09:52 - */ - public function sceneEdit() - { - return $this->remove('flow_id',true)->remove('path',true); - } - - - /** - * @notes 删除场景 - * @return BidDocumentExaminationValidate - * @author likeadmin - * @date 2023/12/02 09:52 - */ - public function sceneDelete() - { - return $this->only(['id']); - } + namespace app\adminapi\validate\bid; - public function sceneApprove() + + use app\common\model\bid\BidBuyBiddingDocument; + use app\common\model\bid\BidDocumentExamination; + use app\common\model\bid\BidDocumentExaminationDetail; + use app\common\model\dict\DictData; + use app\common\model\material\Material; + use app\common\validate\BaseValidate; + + + /** + * 标书审查验证器 + * Class BidDocumentExaminationValidate + * @package app\adminapi\validate\bid + */ + class BidDocumentExaminationValidate extends BaseValidate { - return $this->only(['id','flow_id','path']); - } - - - /** - * @notes 详情场景 - * @return BidDocumentExaminationValidate - * @author likeadmin - * @date 2023/12/02 09:52 - */ - public function sceneDetail() - { - return $this->only(['id']); - } - - public function checkData($value): bool|string - { - $data = BidDocumentExamination::where('id',$value)->findOrEmpty(); - if($data->isEmpty()){ - return '数据不存在'; + + /** + * 设置校验规则 + * @var string[] + */ + protected $rule = [ + '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' => '请选择标书编号', + ]; + + + /** + * @notes 添加场景 + * @return BidDocumentExaminationValidate + * @author likeadmin + * @date 2023/12/02 09:52 + */ + public function sceneAdd() + { + return $this->remove('id', true)->remove('flow_id', true)->remove('path', true); } - return true; - } - - public function checkBuyBiddingDocument($value): bool|string - { - $data = BidBuyBiddingDocument::where('id',$value)->findOrEmpty(); - if($data->isEmpty()){ - return '标书信息不存在'; + + + /** + * @notes 编辑场景 + * @return BidDocumentExaminationValidate + * @author likeadmin + * @date 2023/12/02 09:52 + */ + public function sceneEdit() + { + return $this->remove('flow_id', true)->remove('path', true); } - return true; - } - - public function checkTaxRate($value): bool|string - { - $dictDate = DictData::where('type_value','tax_rate')->column('value'); - if(!in_array($value,$dictDate)){ - return '税率无效'; + + + /** + * @notes 删除场景 + * @return BidDocumentExaminationValidate + * @author likeadmin + * @date 2023/12/02 09:52 + */ + public function sceneDelete() + { + return $this->only(['id'])->remove('id', 'checkData'); } - return true; - } - - public function checkPayType($value): bool|string - { - $dictDate = DictData::where('type_value','pay_type')->column('value'); - if(!in_array($value,$dictDate)){ - return '付款方式无效'; + + public function sceneApprove() + { + return $this->only(['id', 'flow_id', 'path']); } - return true; - } - - public function checkQuotationDetail($value): bool|string - { - if(!empty($value) && !is_array($value)){ - return '审查明细数据格式错误'; + + + /** + * @notes 详情场景 + * @return BidDocumentExaminationValidate + * @author likeadmin + * @date 2023/12/02 09:52 + */ + public function sceneDetail() + { + return $this->only(['id']); } - foreach($value as $k=>$v) { - if(!empty($v['id'])){ - $quotation_detail = BidDocumentExaminationDetail::where('id',$v['id'])->findOrEmpty(); - if($quotation_detail->isEmpty()) return '审查明细列表第'.($k+1).'行审查明细数据不存在'; + + public function checkData($value): bool|string + { + $data = BidDocumentExamination::where('id', $value)->findOrEmpty(); + if ($data->isEmpty()) { + return '数据不存在'; } - if(empty($v['product_id'])){ - return '请选择产品'; - }else{ - $product = Material::where('id',$v['product_id'])->findOrEmpty(); - if($product->isEmpty()){ - return '产品信息不存在'; - } - } - if(empty($v['num'])){ - return '审查明细列表第'.($k+1).'数量不能为空'; - }else{ - if(!is_numeric($v['num']) || $v['num'] < 0){ - return '审查明细列表第'.($k+1).'数量必须是大于0的数字'; - } - } - if(empty($v['cost_price'])){ - return '审查明细列表第'.($k+1).'成本单价不能为空'; - }else{ - if(!is_numeric($v['cost_price']) || $v['cost_price'] < 0){ - return '审查明细列表第'.($k+1).'成本单价必须是大于0的数字'; - } - } - if(empty($v['sale_price'])){ - return '审查明细列表第'.($k+1).'报价单价不能为空'; - }else{ - if(!is_numeric($v['sale_price']) || $v['sale_price'] < 0){ - return '审查明细列表第'.($k+1).'报价单价必须是大于0的数字'; - } - } - if(empty($v['points'])){ - return '审查明细列表第'.($k+1).'点数不能为空'; - }else{ - if(!is_numeric($v['points']) || $v['points'] < 0){ - return '审查明细列表第'.($k+1).'点数必须是大于0的数字'; + return true; + } + + public function checkBuyBiddingDocument($value): bool|string + { + $data = BidBuyBiddingDocument::where('id', $value)->findOrEmpty(); + if ($data->isEmpty()) { + return '标书信息不存在'; + } + return true; + } + + public function checkTaxRate($value): bool|string + { + $dictDate = DictData::where('type_value', 'tax_rate')->column('value'); + if (!in_array($value, $dictDate)) { + return '税率无效'; + } + return true; + } + + public function checkPayType($value): bool|string + { + $dictDate = DictData::where('type_value', 'pay_type')->column('value'); + if (!in_array($value, $dictDate)) { + return '付款方式无效'; + } + return true; + } + + public function checkQuotationDetail($value): bool|string + { + if (!empty($value) && !is_array($value)) { + return '审查明细数据格式错误'; + } + foreach ($value as $k => $v) { + if (!empty($v['id'])) { + $quotation_detail = BidDocumentExaminationDetail::where('id', $v['id'])->findOrEmpty(); + if ($quotation_detail->isEmpty()) return '审查明细列表第' . ($k + 1) . '行审查明细数据不存在'; + } + if (empty($v['product_id'])) { + return '请选择产品'; + } else { + $product = Material::where('id', $v['product_id'])->findOrEmpty(); + if ($product->isEmpty()) { + return '产品信息不存在'; + } + } + if (empty($v['num'])) { + return '审查明细列表第' . ($k + 1) . '数量不能为空'; + } else { + if (!is_numeric($v['num']) || $v['num'] < 0) { + return '审查明细列表第' . ($k + 1) . '数量必须是大于0的数字'; + } + } + if (empty($v['cost_price'])) { + return '审查明细列表第' . ($k + 1) . '成本单价不能为空'; + } else { + if (!is_numeric($v['cost_price']) || $v['cost_price'] < 0) { + return '审查明细列表第' . ($k + 1) . '成本单价必须是大于0的数字'; + } + } + if (empty($v['sale_price'])) { + return '审查明细列表第' . ($k + 1) . '报价单价不能为空'; + } else { + if (!is_numeric($v['sale_price']) || $v['sale_price'] < 0) { + return '审查明细列表第' . ($k + 1) . '报价单价必须是大于0的数字'; + } + } + if (empty($v['points'])) { + return '审查明细列表第' . ($k + 1) . '点数不能为空'; + } else { + if (!is_numeric($v['points']) || $v['points'] < 0) { + return '审查明细列表第' . ($k + 1) . '点数必须是大于0的数字'; + } } } + return true; } - return true; - } - -} \ No newline at end of file + + } \ No newline at end of file diff --git a/app/adminapi/validate/bid/BidResultValidate.php b/app/adminapi/validate/bid/BidResultValidate.php index 19dccf9a4..a269b9a1e 100644 --- a/app/adminapi/validate/bid/BidResultValidate.php +++ b/app/adminapi/validate/bid/BidResultValidate.php @@ -11,99 +11,100 @@ // +---------------------------------------------------------------------- // | author: likeadminTeam // +---------------------------------------------------------------------- - -namespace app\adminapi\validate\bid; - - -use app\common\model\bid\BidDocumentExamination; -use app\common\validate\BaseValidate; - - -/** - * 投标结果验证器 - * Class BidResultValidate - * @package app\adminapi\validate\bid - */ -class BidResultValidate extends BaseValidate -{ - - /** - * 设置校验规则 - * @var string[] - */ - protected $rule = [ - 'id' => 'require', - 'bid_document_examination_id'=> 'require|checkBidDocumentExamination', - 'is_successful' => 'require|in:0,1', - 'bidder_company' => 'require', - 'bidder_amount' => 'require|float|egt:0', - 'annex' => 'checkAnnex' - ]; - protected $message = [ - 'id.require' => '缺少必要参数', - 'bid_document_examination_id.require'=> '请选择投标编号', - 'is_successful.require' => '请选择是否中标', - 'is_successful.in' => '是否中标选项无效', - 'bidder_company.require' => '请填写中标单位', - 'bidder_amount.require' => '请填写中标金额', - 'bidder_amount.float' => '中标金额值必须是数字', - 'bidder_amount.egt' => '中标金额值必须大于等于0', - ]; - - - /** - * @notes 添加场景 - * @return BidResultValidate - * @author likeadmin - * @date 2023/12/02 14:54 - */ - public function sceneAdd() - { - return $this->remove('id', true); - } - - - /** - * @notes 编辑场景 - * @return BidResultValidate - * @author likeadmin - * @date 2023/12/02 14:54 - */ - public function sceneEdit() - {} - - - /** - * @notes 删除场景 - * @return BidResultValidate - * @author likeadmin - * @date 2023/12/02 14:54 - */ - public function sceneDelete() - { - return $this->only(['id']); - } - - - /** - * @notes 详情场景 - * @return BidResultValidate - * @author likeadmin - * @date 2023/12/02 14:54 - */ - public function sceneDetail() - { - return $this->only(['id']); - } + namespace app\adminapi\validate\bid; - public function checkBidDocumentExamination($value): bool|string + + use app\common\model\bid\BidDocumentExamination; + use app\common\validate\BaseValidate; + + + /** + * 投标结果验证器 + * Class BidResultValidate + * @package app\adminapi\validate\bid + */ + class BidResultValidate extends BaseValidate { - $data = BidDocumentExamination::where('id',$value)->findOrEmpty(); - if($data->isEmpty()){ - return '投标信息不存在'; + + /** + * 设置校验规则 + * @var string[] + */ + protected $rule = [ + 'id' => 'require', + 'bid_document_examination_id' => 'require|checkBidDocumentExamination', + 'is_successful' => 'require|in:0,1', + 'bidder_company' => 'require', + 'bidder_amount' => 'require|float|egt:0', + 'annex' => 'checkAnnex' + ]; + + protected $message = [ + 'id.require' => '缺少必要参数', + 'bid_document_examination_id.require' => '请选择投标编号', + 'is_successful.require' => '请选择是否中标', + 'is_successful.in' => '是否中标选项无效', + 'bidder_company.require' => '请填写中标单位', + 'bidder_amount.require' => '请填写中标金额', + 'bidder_amount.float' => '中标金额值必须是数字', + 'bidder_amount.egt' => '中标金额值必须大于等于0', + ]; + + + /** + * @notes 添加场景 + * @return BidResultValidate + * @author likeadmin + * @date 2023/12/02 14:54 + */ + public function sceneAdd() + { + return $this->remove('id', true); } - return true; - } - -} \ No newline at end of file + + + /** + * @notes 编辑场景 + * @return BidResultValidate + * @author likeadmin + * @date 2023/12/02 14:54 + */ + public function sceneEdit() + { + } + + + /** + * @notes 删除场景 + * @return BidResultValidate + * @author likeadmin + * @date 2023/12/02 14:54 + */ + public function sceneDelete() + { + return $this->only(['id'])->remove('id', 'checkData'); + } + + + /** + * @notes 详情场景 + * @return BidResultValidate + * @author likeadmin + * @date 2023/12/02 14:54 + */ + public function sceneDetail() + { + return $this->only(['id']); + } + + public function checkBidDocumentExamination($value): bool|string + { + $data = BidDocumentExamination::where('id', $value)->findOrEmpty(); + if ($data->isEmpty()) { + return '投标信息不存在'; + } + return true; + } + + } \ No newline at end of file diff --git a/app/adminapi/validate/bill/AcceptanceBillValidate.php b/app/adminapi/validate/bill/AcceptanceBillValidate.php index b67199b28..468724a99 100644 --- a/app/adminapi/validate/bill/AcceptanceBillValidate.php +++ b/app/adminapi/validate/bill/AcceptanceBillValidate.php @@ -11,106 +11,106 @@ // +---------------------------------------------------------------------- // | author: likeadminTeam // +---------------------------------------------------------------------- - -namespace app\adminapi\validate\bill; - - -use app\common\validate\BaseValidate; - - -/** - * AcceptanceBill验证器 - * Class AcceptanceBillValidate - * @package app\adminapi\validate\bill - */ -class AcceptanceBillValidate extends BaseValidate -{ - - /** - * 设置校验规则 - * @var string[] - */ - protected $rule = [ - 'id' => 'require', - 'org_id' => 'require', - 'dept_id' => 'require', - 'customer_id' => 'require', - 'project_id' => 'require', - 'contract_id' => 'require', - 'receipt_date' => 'require', - 'bill_sn' => 'require', - 'bank_account_id' => 'require', - 'bill_type' => 'require', - 'draft_acceptance_bank' => 'require', - 'receipt_amount' => 'require', - ]; - - - /** - * 参数描述 - * @var string[] - */ - protected $field = [ - 'id' => 'id', - 'org_id' => '组织id', - 'dept_id' => '部门id', - 'customer_id' => '客户id', - 'project_id' => '项目id', - 'contract_id' => '销售合同id', - 'receipt_date' => '收票日期', - 'bill_sn' => '票据编号', - 'bank_account_id' => '收票银行id', - 'bill_type' => '汇票类型', - 'draft_acceptance_bank' => '汇票承兑银行', - 'receipt_amount' => '收款金额', - ]; - - - /** - * @notes 添加场景 - * @return AcceptanceBillValidate - * @author likeadmin - * @date 2023/12/19 15:18 - */ - public function sceneAdd() - { - return $this->only(['org_id','dept_id','customer_id','project_id','contract_id','receipt_date','bill_sn','bank_account_id','bill_type','draft_acceptance_bank','receipt_amount']); - } - - - /** - * @notes 编辑场景 - * @return AcceptanceBillValidate - * @author likeadmin - * @date 2023/12/19 15:18 - */ - public function sceneEdit() - { - return $this->only(['id','org_id','dept_id','customer_id','project_id','contract_id','receipt_date','bill_sn','bank_account_id','bill_type','draft_acceptance_bank','receipt_amount']); - } - - - /** - * @notes 删除场景 - * @return AcceptanceBillValidate - * @author likeadmin - * @date 2023/12/19 15:18 - */ - public function sceneDelete() - { - return $this->only(['id']); - } - - - /** - * @notes 详情场景 - * @return AcceptanceBillValidate - * @author likeadmin - * @date 2023/12/19 15:18 - */ - public function sceneDetail() - { - return $this->only(['id']); - } - -} \ No newline at end of file + + namespace app\adminapi\validate\bill; + + + use app\common\validate\BaseValidate; + + + /** + * AcceptanceBill验证器 + * Class AcceptanceBillValidate + * @package app\adminapi\validate\bill + */ + class AcceptanceBillValidate extends BaseValidate + { + + /** + * 设置校验规则 + * @var string[] + */ + protected $rule = [ + 'id' => 'require', + 'org_id' => 'require', + 'dept_id' => 'require', + 'customer_id' => 'require', + 'project_id' => 'require', + 'contract_id' => 'require', + 'receipt_date' => 'require', + 'bill_sn' => 'require', + 'bank_account_id' => 'require', + 'bill_type' => 'require', + 'draft_acceptance_bank' => 'require', + 'receipt_amount' => 'require', + ]; + + + /** + * 参数描述 + * @var string[] + */ + protected $field = [ + 'id' => 'id', + 'org_id' => '组织id', + 'dept_id' => '部门id', + 'customer_id' => '客户id', + 'project_id' => '项目id', + 'contract_id' => '销售合同id', + 'receipt_date' => '收票日期', + 'bill_sn' => '票据编号', + 'bank_account_id' => '收票银行id', + 'bill_type' => '汇票类型', + 'draft_acceptance_bank' => '汇票承兑银行', + 'receipt_amount' => '收款金额', + ]; + + + /** + * @notes 添加场景 + * @return AcceptanceBillValidate + * @author likeadmin + * @date 2023/12/19 15:18 + */ + public function sceneAdd() + { + return $this->only(['org_id', 'dept_id', 'customer_id', 'project_id', 'contract_id', 'receipt_date', 'bill_sn', 'bank_account_id', 'bill_type', 'draft_acceptance_bank', 'receipt_amount']); + } + + + /** + * @notes 编辑场景 + * @return AcceptanceBillValidate + * @author likeadmin + * @date 2023/12/19 15:18 + */ + public function sceneEdit() + { + return $this->only(['id', 'org_id', 'dept_id', 'customer_id', 'project_id', 'contract_id', 'receipt_date', 'bill_sn', 'bank_account_id', 'bill_type', 'draft_acceptance_bank', 'receipt_amount']); + } + + + /** + * @notes 删除场景 + * @return AcceptanceBillValidate + * @author likeadmin + * @date 2023/12/19 15:18 + */ + public function sceneDelete() + { + return $this->only(['id'])->remove('id', 'checkData'); + } + + + /** + * @notes 详情场景 + * @return AcceptanceBillValidate + * @author likeadmin + * @date 2023/12/19 15:18 + */ + public function sceneDetail() + { + return $this->only(['id']); + } + + } \ No newline at end of file diff --git a/app/adminapi/validate/bill/RedemptionBillValidate.php b/app/adminapi/validate/bill/RedemptionBillValidate.php index fa7f1f713..6bccb2fd7 100644 --- a/app/adminapi/validate/bill/RedemptionBillValidate.php +++ b/app/adminapi/validate/bill/RedemptionBillValidate.php @@ -11,90 +11,90 @@ // +---------------------------------------------------------------------- // | author: likeadminTeam // +---------------------------------------------------------------------- - -namespace app\adminapi\validate\bill; - - -use app\common\validate\BaseValidate; - - -/** - * RedemptionBill验证器 - * Class RedemptionBillValidate - * @package app\adminapi\validate\bill - */ -class RedemptionBillValidate extends BaseValidate -{ - - /** - * 设置校验规则 - * @var string[] - */ - protected $rule = [ - 'id' => 'require', - 'org_id' => 'require', - 'dept_id' => 'require', - 'acceptance_bill_id' => 'require', - ]; - - - /** - * 参数描述 - * @var string[] - */ - protected $field = [ - 'id' => 'id', - 'org_id' => '组织id', - 'dept_id' => '部门id', - 'acceptance_bill_id' => '承兑汇票id', - ]; - - - /** - * @notes 添加场景 - * @return RedemptionBillValidate - * @author likeadmin - * @date 2023/12/20 11:01 - */ - public function sceneAdd() - { - return $this->only(['org_id','dept_id','acceptance_bill_id']); - } - - - /** - * @notes 编辑场景 - * @return RedemptionBillValidate - * @author likeadmin - * @date 2023/12/20 11:01 - */ - public function sceneEdit() - { - return $this->only(['id','org_id','dept_id','acceptance_bill_id']); - } - - - /** - * @notes 删除场景 - * @return RedemptionBillValidate - * @author likeadmin - * @date 2023/12/20 11:01 - */ - public function sceneDelete() - { - return $this->only(['id']); - } - - - /** - * @notes 详情场景 - * @return RedemptionBillValidate - * @author likeadmin - * @date 2023/12/20 11:01 - */ - public function sceneDetail() - { - return $this->only(['id']); - } - -} \ No newline at end of file + + namespace app\adminapi\validate\bill; + + + use app\common\validate\BaseValidate; + + + /** + * RedemptionBill验证器 + * Class RedemptionBillValidate + * @package app\adminapi\validate\bill + */ + class RedemptionBillValidate extends BaseValidate + { + + /** + * 设置校验规则 + * @var string[] + */ + protected $rule = [ + 'id' => 'require', + 'org_id' => 'require', + 'dept_id' => 'require', + 'acceptance_bill_id' => 'require', + ]; + + + /** + * 参数描述 + * @var string[] + */ + protected $field = [ + 'id' => 'id', + 'org_id' => '组织id', + 'dept_id' => '部门id', + 'acceptance_bill_id' => '承兑汇票id', + ]; + + + /** + * @notes 添加场景 + * @return RedemptionBillValidate + * @author likeadmin + * @date 2023/12/20 11:01 + */ + public function sceneAdd() + { + return $this->only(['org_id', 'dept_id', 'acceptance_bill_id']); + } + + + /** + * @notes 编辑场景 + * @return RedemptionBillValidate + * @author likeadmin + * @date 2023/12/20 11:01 + */ + public function sceneEdit() + { + return $this->only(['id', 'org_id', 'dept_id', 'acceptance_bill_id']); + } + + + /** + * @notes 删除场景 + * @return RedemptionBillValidate + * @author likeadmin + * @date 2023/12/20 11:01 + */ + public function sceneDelete() + { + return $this->only(['id'])->remove('id', 'checkData'); + } + + + /** + * @notes 详情场景 + * @return RedemptionBillValidate + * @author likeadmin + * @date 2023/12/20 11:01 + */ + public function sceneDetail() + { + return $this->only(['id']); + } + + } \ No newline at end of file diff --git a/app/adminapi/validate/bill/TransferBillValidate.php b/app/adminapi/validate/bill/TransferBillValidate.php index 4e0a52a4c..a22443fe8 100644 --- a/app/adminapi/validate/bill/TransferBillValidate.php +++ b/app/adminapi/validate/bill/TransferBillValidate.php @@ -11,94 +11,94 @@ // +---------------------------------------------------------------------- // | author: likeadminTeam // +---------------------------------------------------------------------- - -namespace app\adminapi\validate\bill; - - -use app\common\validate\BaseValidate; - - -/** - * TransferBill验证器 - * Class TransferBillValidate - * @package app\adminapi\validate\bill - */ -class TransferBillValidate extends BaseValidate -{ - - /** - * 设置校验规则 - * @var string[] - */ - protected $rule = [ - 'id' => 'require', - 'org_id' => 'require', - 'dept_id' => 'require', - 'supplier_id' => 'require', - 'procurement_contract_id' => 'require', - 'amount' => 'require', - ]; - - - /** - * 参数描述 - * @var string[] - */ - protected $field = [ - 'id' => 'id', - 'org_id' => '组织id', - 'dept_id' => '部门id', - 'supplier_id' => '客户id', - 'procurement_contract_id' => '采购/分包合同id', - 'amount' => '金额', - ]; - - - /** - * @notes 添加场景 - * @return TransferBillValidate - * @author likeadmin - * @date 2023/12/20 10:14 - */ - public function sceneAdd() - { - return $this->only(['org_id','dept_id','supplier_id','procurement_contract_id','amount']); - } - - - /** - * @notes 编辑场景 - * @return TransferBillValidate - * @author likeadmin - * @date 2023/12/20 10:14 - */ - public function sceneEdit() - { - return $this->only(['id','org_id','dept_id','supplier_id','procurement_contract_id','amount']); - } - - - /** - * @notes 删除场景 - * @return TransferBillValidate - * @author likeadmin - * @date 2023/12/20 10:14 - */ - public function sceneDelete() - { - return $this->only(['id']); - } - - - /** - * @notes 详情场景 - * @return TransferBillValidate - * @author likeadmin - * @date 2023/12/20 10:14 - */ - public function sceneDetail() - { - return $this->only(['id']); - } - -} \ No newline at end of file + + namespace app\adminapi\validate\bill; + + + use app\common\validate\BaseValidate; + + + /** + * TransferBill验证器 + * Class TransferBillValidate + * @package app\adminapi\validate\bill + */ + class TransferBillValidate extends BaseValidate + { + + /** + * 设置校验规则 + * @var string[] + */ + protected $rule = [ + 'id' => 'require', + 'org_id' => 'require', + 'dept_id' => 'require', + 'supplier_id' => 'require', + 'procurement_contract_id' => 'require', + 'amount' => 'require', + ]; + + + /** + * 参数描述 + * @var string[] + */ + protected $field = [ + 'id' => 'id', + 'org_id' => '组织id', + 'dept_id' => '部门id', + 'supplier_id' => '客户id', + 'procurement_contract_id' => '采购/分包合同id', + 'amount' => '金额', + ]; + + + /** + * @notes 添加场景 + * @return TransferBillValidate + * @author likeadmin + * @date 2023/12/20 10:14 + */ + public function sceneAdd() + { + return $this->only(['org_id', 'dept_id', 'supplier_id', 'procurement_contract_id', 'amount']); + } + + + /** + * @notes 编辑场景 + * @return TransferBillValidate + * @author likeadmin + * @date 2023/12/20 10:14 + */ + public function sceneEdit() + { + return $this->only(['id', 'org_id', 'dept_id', 'supplier_id', 'procurement_contract_id', 'amount']); + } + + + /** + * @notes 删除场景 + * @return TransferBillValidate + * @author likeadmin + * @date 2023/12/20 10:14 + */ + public function sceneDelete() + { + return $this->only(['id'])->remove('id', 'checkData'); + } + + + /** + * @notes 详情场景 + * @return TransferBillValidate + * @author likeadmin + * @date 2023/12/20 10:14 + */ + public function sceneDetail() + { + return $this->only(['id']); + } + + } \ No newline at end of file diff --git a/app/adminapi/validate/build/BuildDivisionValidate.php b/app/adminapi/validate/build/BuildDivisionValidate.php index 52939e22b..b2f1120cd 100644 --- a/app/adminapi/validate/build/BuildDivisionValidate.php +++ b/app/adminapi/validate/build/BuildDivisionValidate.php @@ -11,102 +11,102 @@ // +---------------------------------------------------------------------- // | author: likeadminTeam // +---------------------------------------------------------------------- - -namespace app\adminapi\validate\build; - - -use app\common\validate\BaseValidate; - - -/** - * 分部分项划分验证器 - * Class BuildDivisionValidate - * @package app\adminapi\validate\build - */ -class BuildDivisionValidate extends BaseValidate -{ - - /** - * 设置校验规则 - * @var string[] - */ - protected $rule = [ - 'id' => 'require', - 'division_engineering' => 'require', - 'sub_division_engineering' => 'require', - 'subentry_engineering' => 'require', - 'subentry_engineering_code' => 'require' - ]; - protected $message = [ - 'id.require' => '缺少必要参数', - 'division_engineering.require' => '请填写分部工程', - 'sub_division_engineering.require' => '请填写子分部工程', - 'subentry_engineering.require' => '请填写分项工程', - 'subentry_engineering_code.require' => '请填写分项工程编码' - ]; - - - /** - * 参数描述 - * @var string[] - */ - protected $field = [ - 'id' => 'id', - 'division_engineering' => '分部工程', - 'sub_division_engineering' => '子分部工程', - 'subentry_engineering' => '分项工程', - 'subentry_engineering_code' => '分项工程编码', - 'add_user' => '添加人', - 'update_user' => '更新人', - ]; - - - /** - * @notes 添加场景 - * @return BuildDivisionValidate - * @author likeadmin - * @date 2023/12/22 09:17 - */ - public function sceneAdd() - { - return $this->only(['division_engineering','sub_division_engineering','subentry_engineering','subentry_engineering_code']); - } - - - /** - * @notes 编辑场景 - * @return BuildDivisionValidate - * @author likeadmin - * @date 2023/12/22 09:17 - */ - public function sceneEdit() - { - return $this->only(['id','division_engineering','sub_division_engineering','subentry_engineering','subentry_engineering_code']); - } - - - /** - * @notes 删除场景 - * @return BuildDivisionValidate - * @author likeadmin - * @date 2023/12/22 09:17 - */ - public function sceneDelete() - { - return $this->only(['id']); - } - - - /** - * @notes 详情场景 - * @return BuildDivisionValidate - * @author likeadmin - * @date 2023/12/22 09:17 - */ - public function sceneDetail() - { - return $this->only(['id']); - } - -} \ No newline at end of file + namespace app\adminapi\validate\build; + + + use app\common\validate\BaseValidate; + + + /** + * 分部分项划分验证器 + * Class BuildDivisionValidate + * @package app\adminapi\validate\build + */ + class BuildDivisionValidate extends BaseValidate + { + + /** + * 设置校验规则 + * @var string[] + */ + protected $rule = [ + 'id' => 'require', + 'division_engineering' => 'require', + 'sub_division_engineering' => 'require', + 'subentry_engineering' => 'require', + 'subentry_engineering_code' => 'require' + ]; + + protected $message = [ + 'id.require' => '缺少必要参数', + 'division_engineering.require' => '请填写分部工程', + 'sub_division_engineering.require' => '请填写子分部工程', + 'subentry_engineering.require' => '请填写分项工程', + 'subentry_engineering_code.require' => '请填写分项工程编码' + ]; + + + /** + * 参数描述 + * @var string[] + */ + protected $field = [ + 'id' => 'id', + 'division_engineering' => '分部工程', + 'sub_division_engineering' => '子分部工程', + 'subentry_engineering' => '分项工程', + 'subentry_engineering_code' => '分项工程编码', + 'add_user' => '添加人', + 'update_user' => '更新人', + ]; + + + /** + * @notes 添加场景 + * @return BuildDivisionValidate + * @author likeadmin + * @date 2023/12/22 09:17 + */ + public function sceneAdd() + { + return $this->only(['division_engineering', 'sub_division_engineering', 'subentry_engineering', 'subentry_engineering_code']); + } + + + /** + * @notes 编辑场景 + * @return BuildDivisionValidate + * @author likeadmin + * @date 2023/12/22 09:17 + */ + public function sceneEdit() + { + return $this->only(['id', 'division_engineering', 'sub_division_engineering', 'subentry_engineering', 'subentry_engineering_code']); + } + + + /** + * @notes 删除场景 + * @return BuildDivisionValidate + * @author likeadmin + * @date 2023/12/22 09:17 + */ + public function sceneDelete() + { + return $this->only(['id'])->remove('id', 'checkData'); + } + + + /** + * @notes 详情场景 + * @return BuildDivisionValidate + * @author likeadmin + * @date 2023/12/22 09:17 + */ + public function sceneDetail() + { + return $this->only(['id']); + } + + } \ No newline at end of file diff --git a/app/adminapi/validate/build/BuildPlanValidate.php b/app/adminapi/validate/build/BuildPlanValidate.php index 7c9bb012e..0f9ccf79f 100644 --- a/app/adminapi/validate/build/BuildPlanValidate.php +++ b/app/adminapi/validate/build/BuildPlanValidate.php @@ -11,143 +11,144 @@ // +---------------------------------------------------------------------- // | author: likeadminTeam // +---------------------------------------------------------------------- - -namespace app\adminapi\validate\build; - - -use app\common\model\build\BuildProcessSettings; -use app\common\model\project\Project; -use app\common\model\project\ProjectMember; -use app\common\validate\BaseValidate; - - -/** - * 施工计划验证器 - * Class BuildPlanValidate - * @package app\adminapi\validate\build - */ -class BuildPlanValidate extends BaseValidate -{ - - /** - * 设置校验规则 - * @var string[] - */ - protected $rule = [ - 'id' => 'require', - 'project_id' => 'require|checkProject', - 'process_id' => 'require|checkProcess', - 'project_member_id' => 'require|checkMember', - 'plan_start_date' => 'require|dateFormat:Y-m-d', - 'plan_end_date' => 'require|dateFormat:Y-m-d|checkPlanEndDate', - 'workload' => 'require|integer|egt:0', - 'unit' => 'require', - 'price' => 'require|float|egt:0', - 'amount' => 'require|float|egt:0', - ]; - protected $message = [ - 'id.require' => '缺少必要参数', - 'project_id.require' => '请选择项目', - 'process_id.require' => '请选择工序步骤', - 'project_member_id.require' => '请选择班组长', - 'plan_start_date.require' => '请选择计划开始日期', - 'plan_start_date.dateFormat' => '计划开始日期格式错误', - 'plan_end_date.require' => '请选择计划结束日期', - 'plan_end_date.dateFormat' => '计划结束日期格式错误', - 'workload.require' => '请填写作业量', - 'workload.integer' => '作业量值必须是整数', - 'workload.egt' => '作业量值必须大于等于0', - 'unit.require' => '请填写单位', - 'price.require' => '请填写单价', - 'price.float' => '单价值必须是数字', - 'price.egt' => '单价值必须大于等于0', - 'amount.require' => '请填写金额', - 'amount.float' => '金额值必须是数字', - 'amount.egt' => '金额值必须大于等于0', - ]; - - /** - * @notes 添加场景 - * @return BuildPlanValidate - * @author likeadmin - * @date 2023/12/22 11:04 - */ - public function sceneAdd() - { - return $this->remove('id',true); - } - - - /** - * @notes 编辑场景 - * @return BuildPlanValidate - * @author likeadmin - * @date 2023/12/22 11:04 - */ - public function sceneEdit() - {} - - - /** - * @notes 删除场景 - * @return BuildPlanValidate - * @author likeadmin - * @date 2023/12/22 11:04 - */ - public function sceneDelete() - { - return $this->only(['id']); - } - - - /** - * @notes 详情场景 - * @return BuildPlanValidate - * @author likeadmin - * @date 2023/12/22 11:04 - */ - public function sceneDetail() - { - return $this->only(['id']); - } + namespace app\adminapi\validate\build; - public function checkProject($value): bool|string + + use app\common\model\build\BuildProcessSettings; + use app\common\model\project\Project; + use app\common\model\project\ProjectMember; + use app\common\validate\BaseValidate; + + + /** + * 施工计划验证器 + * Class BuildPlanValidate + * @package app\adminapi\validate\build + */ + class BuildPlanValidate extends BaseValidate { - $data = Project::where('id',$value)->findOrEmpty(); - if($data->isEmpty()){ - return '项目不存在'; + + /** + * 设置校验规则 + * @var string[] + */ + protected $rule = [ + 'id' => 'require', + 'project_id' => 'require|checkProject', + 'process_id' => 'require|checkProcess', + 'project_member_id' => 'require|checkMember', + 'plan_start_date' => 'require|dateFormat:Y-m-d', + 'plan_end_date' => 'require|dateFormat:Y-m-d|checkPlanEndDate', + 'workload' => 'require|integer|egt:0', + 'unit' => 'require', + 'price' => 'require|float|egt:0', + 'amount' => 'require|float|egt:0', + ]; + + protected $message = [ + 'id.require' => '缺少必要参数', + 'project_id.require' => '请选择项目', + 'process_id.require' => '请选择工序步骤', + 'project_member_id.require' => '请选择班组长', + 'plan_start_date.require' => '请选择计划开始日期', + 'plan_start_date.dateFormat' => '计划开始日期格式错误', + 'plan_end_date.require' => '请选择计划结束日期', + 'plan_end_date.dateFormat' => '计划结束日期格式错误', + 'workload.require' => '请填写作业量', + 'workload.integer' => '作业量值必须是整数', + 'workload.egt' => '作业量值必须大于等于0', + 'unit.require' => '请填写单位', + 'price.require' => '请填写单价', + 'price.float' => '单价值必须是数字', + 'price.egt' => '单价值必须大于等于0', + 'amount.require' => '请填写金额', + 'amount.float' => '金额值必须是数字', + 'amount.egt' => '金额值必须大于等于0', + ]; + + /** + * @notes 添加场景 + * @return BuildPlanValidate + * @author likeadmin + * @date 2023/12/22 11:04 + */ + public function sceneAdd() + { + return $this->remove('id', true); } - return true; - } - - public function checkProcess($value): bool|string - { - $data = BuildProcessSettings::where('id',$value)->findOrEmpty(); - if($data->isEmpty()){ - return '工序步骤不存在'; + + + /** + * @notes 编辑场景 + * @return BuildPlanValidate + * @author likeadmin + * @date 2023/12/22 11:04 + */ + public function sceneEdit() + { } - return true; - } - - public function checkMember($value,$rule,$data): bool|string - { - $member = ProjectMember::where('id',$value)->findOrEmpty(); - if($member->isEmpty()){ - return '班组长不存在'; + + + /** + * @notes 删除场景 + * @return BuildPlanValidate + * @author likeadmin + * @date 2023/12/22 11:04 + */ + public function sceneDelete() + { + return $this->only(['id'])->remove('id', 'checkData'); } - if($member['project_id'] != $data['project_id']){ - return '班组长无效'; + + + /** + * @notes 详情场景 + * @return BuildPlanValidate + * @author likeadmin + * @date 2023/12/22 11:04 + */ + public function sceneDetail() + { + return $this->only(['id']); } - return true; - } - - public function checkPlanEndDate($value,$rule,$data): bool|string - { - if(strtotime($value) - strtotime($data['plan_start_date']) <= 0){ - return '计划结束日期必须大于计划开始日期'; + + public function checkProject($value): bool|string + { + $data = Project::where('id', $value)->findOrEmpty(); + if ($data->isEmpty()) { + return '项目不存在'; + } + return true; } - return true; - } - -} \ No newline at end of file + + public function checkProcess($value): bool|string + { + $data = BuildProcessSettings::where('id', $value)->findOrEmpty(); + if ($data->isEmpty()) { + return '工序步骤不存在'; + } + return true; + } + + public function checkMember($value, $rule, $data): bool|string + { + $member = ProjectMember::where('id', $value)->findOrEmpty(); + if ($member->isEmpty()) { + return '班组长不存在'; + } + if ($member['project_id'] != $data['project_id']) { + return '班组长无效'; + } + return true; + } + + public function checkPlanEndDate($value, $rule, $data): bool|string + { + if (strtotime($value) - strtotime($data['plan_start_date']) <= 0) { + return '计划结束日期必须大于计划开始日期'; + } + return true; + } + + } \ No newline at end of file diff --git a/app/adminapi/validate/build/BuildProcessSettingsValidate.php b/app/adminapi/validate/build/BuildProcessSettingsValidate.php index 1d428ff5e..f25758878 100644 --- a/app/adminapi/validate/build/BuildProcessSettingsValidate.php +++ b/app/adminapi/validate/build/BuildProcessSettingsValidate.php @@ -11,125 +11,125 @@ // +---------------------------------------------------------------------- // | author: likeadminTeam // +---------------------------------------------------------------------- - -namespace app\adminapi\validate\build; - - -use app\common\model\build\BuildDivision; -use app\common\validate\BaseValidate; - - -/** - * 施工工序设置验证器 - * Class BuildProcessSettingsValidate - * @package app\adminapi\validate\build - */ -class BuildProcessSettingsValidate extends BaseValidate -{ - - /** - * 设置校验规则 - * @var string[] - */ - protected $rule = [ - 'id' => 'require', - 'division_id' => 'require|checkDivision', - 'process_step_no' => 'require|integer|gt:0', - 'process_step' => 'require', - 'quality_control_points' => 'require', - 'annex' => 'checkAnnex' - ]; - protected $message = [ - 'id.require' => '缺少必要参数', - 'division_id.require' => '请选择分部工程', - 'process_step_no.require' => '请填写工序步骤号', - 'process_step_no.integer' => '序步骤号值必须是整数', - 'process_step_no.gt' => '序步骤号值必须大于0', - 'process_step.require' => '请填写工序步骤', - 'quality_control_points.require' => '请填写质量控制点', - ]; - - - /** - * 参数描述 - * @var string[] - */ - protected $field = [ - 'id' => 'id', - 'division_id' => '分部分项id', - 'process_step_no' => '工序步骤号', - 'process_step' => '工序步骤', - 'quality_control_points' => '质量控制点', - 'add_user' => '添加人', - 'update_user' => '更新人', - ]; - - - /** - * @notes 添加场景 - * @return BuildProcessSettingsValidate - * @author likeadmin - * @date 2023/12/22 09:51 - */ - public function sceneAdd() - { - return $this->only(['division_id','process_step_no','process_step','quality_control_points','file']); - } - - - /** - * @notes 编辑场景 - * @return BuildProcessSettingsValidate - * @author likeadmin - * @date 2023/12/22 09:51 - */ - public function sceneEdit() - { - return $this->only(['id','division_id','process_step_no','process_step','quality_control_points','file']); - } - - - /** - * @notes 删除场景 - * @return BuildProcessSettingsValidate - * @author likeadmin - * @date 2023/12/22 09:51 - */ - public function sceneDelete() - { - return $this->only(['id']); - } - - - /** - * @notes 详情场景 - * @return BuildProcessSettingsValidate - * @author likeadmin - * @date 2023/12/22 09:51 - */ - public function sceneDetail() - { - return $this->only(['id']); - } + namespace app\adminapi\validate\build; - public function checkDivision($value): bool|string + + use app\common\model\build\BuildDivision; + use app\common\validate\BaseValidate; + + + /** + * 施工工序设置验证器 + * Class BuildProcessSettingsValidate + * @package app\adminapi\validate\build + */ + class BuildProcessSettingsValidate extends BaseValidate { - $data = BuildDivision::where('id',$value)->findOrEmpty(); - if($data->isEmpty()){ - return '分部工程不存在'; + + /** + * 设置校验规则 + * @var string[] + */ + protected $rule = [ + 'id' => 'require', + 'division_id' => 'require|checkDivision', + 'process_step_no' => 'require|integer|gt:0', + 'process_step' => 'require', + 'quality_control_points' => 'require', + 'annex' => 'checkAnnex' + ]; + + protected $message = [ + 'id.require' => '缺少必要参数', + 'division_id.require' => '请选择分部工程', + 'process_step_no.require' => '请填写工序步骤号', + 'process_step_no.integer' => '序步骤号值必须是整数', + 'process_step_no.gt' => '序步骤号值必须大于0', + 'process_step.require' => '请填写工序步骤', + 'quality_control_points.require' => '请填写质量控制点', + ]; + + + /** + * 参数描述 + * @var string[] + */ + protected $field = [ + 'id' => 'id', + 'division_id' => '分部分项id', + 'process_step_no' => '工序步骤号', + 'process_step' => '工序步骤', + 'quality_control_points' => '质量控制点', + 'add_user' => '添加人', + 'update_user' => '更新人', + ]; + + + /** + * @notes 添加场景 + * @return BuildProcessSettingsValidate + * @author likeadmin + * @date 2023/12/22 09:51 + */ + public function sceneAdd() + { + return $this->only(['division_id', 'process_step_no', 'process_step', 'quality_control_points', 'file']); } - return true; - } - - public function checkAnnex($value): bool|string - { - if(!empty($value) && $value != ''){ - if(!is_array($value)){ - return '附件必须是json数组'; + + + /** + * @notes 编辑场景 + * @return BuildProcessSettingsValidate + * @author likeadmin + * @date 2023/12/22 09:51 + */ + public function sceneEdit() + { + return $this->only(['id', 'division_id', 'process_step_no', 'process_step', 'quality_control_points', 'file']); + } + + + /** + * @notes 删除场景 + * @return BuildProcessSettingsValidate + * @author likeadmin + * @date 2023/12/22 09:51 + */ + public function sceneDelete() + { + return $this->only(['id'])->remove('id', 'checkData'); + } + + + /** + * @notes 详情场景 + * @return BuildProcessSettingsValidate + * @author likeadmin + * @date 2023/12/22 09:51 + */ + public function sceneDetail() + { + return $this->only(['id']); + } + + public function checkDivision($value): bool|string + { + $data = BuildDivision::where('id', $value)->findOrEmpty(); + if ($data->isEmpty()) { + return '分部工程不存在'; } + return true; } - return true; - } - -} \ No newline at end of file + + public function checkAnnex($value): bool|string + { + if (!empty($value) && $value != '') { + if (!is_array($value)) { + return '附件必须是json数组'; + } + } + return true; + } + + } \ No newline at end of file diff --git a/app/adminapi/validate/build/BuildReportValidate.php b/app/adminapi/validate/build/BuildReportValidate.php index 51e9f880b..92f6609d4 100644 --- a/app/adminapi/validate/build/BuildReportValidate.php +++ b/app/adminapi/validate/build/BuildReportValidate.php @@ -11,141 +11,142 @@ // +---------------------------------------------------------------------- // | author: likeadminTeam // +---------------------------------------------------------------------- - -namespace app\adminapi\validate\build; - - -use app\common\model\build\BuildPlan; -use app\common\model\project\ProjectPersonnel; -use app\common\validate\BaseValidate; - - -/** - * 施工汇报验证器 - * Class BuildReportValidate - * @package app\adminapi\validate\build - */ -class BuildReportValidate extends BaseValidate -{ - - /** - * 设置校验规则 - * @var string[] - */ - protected $rule = [ - 'id' => 'require', - 'plan_id' => 'require|checkPlan', - 'person_detail' => 'require|checkDetail', - 'scene_file' => 'require|checkFile', - 'report_workload' => 'require|float|egt:0', - 'report_amount' => 'require|float|egt:0' - ]; - protected $message = [ - 'id.require' => '缺少必要参数', - 'plan_id.require' => '请选择施工计划', - 'person_detail.require' => '请填写人工明细', - 'scene_file.require' => '请上传现场照片', - 'report_workload.require' => '请填写完工量', - 'report_workload.float' => '完工量值必须是数字', - 'report_workload.egt' => '完工量值必须大于等于0', - 'report_amount.require' => '请填写金额', - 'report_amount.float' => '金额值必须是数字', - 'report_amount.egt' => '金额值必须大于等于0', - ]; + namespace app\adminapi\validate\build; - - /** - * @notes 添加场景 - * @return BuildReportValidate - * @author likeadmin - * @date 2023/12/22 16:08 - */ - public function sceneAdd() - { - return $this->remove('id',true); - } - - - /** - * @notes 编辑场景 - * @return BuildReportValidate - * @author likeadmin - * @date 2023/12/22 16:08 - */ - public function sceneEdit() - {} - - - /** - * @notes 删除场景 - * @return BuildReportValidate - * @author likeadmin - * @date 2023/12/22 16:08 - */ - public function sceneDelete() - { - return $this->only(['id']); - } - - - /** - * @notes 详情场景 - * @return BuildReportValidate - * @author likeadmin - * @date 2023/12/22 16:08 - */ - public function sceneDetail() - { - return $this->only(['id']); - } - public function checkPlan($value): bool|string + use app\common\model\build\BuildPlan; + use app\common\model\project\ProjectPersonnel; + use app\common\validate\BaseValidate; + + + /** + * 施工汇报验证器 + * Class BuildReportValidate + * @package app\adminapi\validate\build + */ + class BuildReportValidate extends BaseValidate { - $data = BuildPlan::where('id',$value)->findOrEmpty(); - if($data->isEmpty()){ - return '施工计划不存在'; + + /** + * 设置校验规则 + * @var string[] + */ + protected $rule = [ + 'id' => 'require', + 'plan_id' => 'require|checkPlan', + 'person_detail' => 'require|checkDetail', + 'scene_file' => 'require|checkFile', + 'report_workload' => 'require|float|egt:0', + 'report_amount' => 'require|float|egt:0' + ]; + + protected $message = [ + 'id.require' => '缺少必要参数', + 'plan_id.require' => '请选择施工计划', + 'person_detail.require' => '请填写人工明细', + 'scene_file.require' => '请上传现场照片', + 'report_workload.require' => '请填写完工量', + 'report_workload.float' => '完工量值必须是数字', + 'report_workload.egt' => '完工量值必须大于等于0', + 'report_amount.require' => '请填写金额', + 'report_amount.float' => '金额值必须是数字', + 'report_amount.egt' => '金额值必须大于等于0', + ]; + + + /** + * @notes 添加场景 + * @return BuildReportValidate + * @author likeadmin + * @date 2023/12/22 16:08 + */ + public function sceneAdd() + { + return $this->remove('id', true); } - return true; - } - - public function checkFile($value): bool|string - { - $file = $value;//json_decode($value,true); - if(empty($file)){ - return '附件必须是json数组'; + + + /** + * @notes 编辑场景 + * @return BuildReportValidate + * @author likeadmin + * @date 2023/12/22 16:08 + */ + public function sceneEdit() + { } - return true; - } - - public function checkDetail($value,$rule,$data): bool|string - { - $person_detail =$value;// json_decode($value,true); - if(empty($person_detail) || !is_array($person_detail)){ - return '人工明细数据格式错误'; + + + /** + * @notes 删除场景 + * @return BuildReportValidate + * @author likeadmin + * @date 2023/12/22 16:08 + */ + public function sceneDelete() + { + return $this->only(['id'])->remove('id', 'checkData'); } - foreach($person_detail as $v) { - if(empty($v['person_id'])){ - return '人工明细缺少必要参数'; - }else{ - $person = ProjectPersonnel::where('id',$v['person_id'])->findOrEmpty(); - if($person->isEmpty()){ - return '项目人员不存在'; + + + /** + * @notes 详情场景 + * @return BuildReportValidate + * @author likeadmin + * @date 2023/12/22 16:08 + */ + public function sceneDetail() + { + return $this->only(['id']); + } + + public function checkPlan($value): bool|string + { + $data = BuildPlan::where('id', $value)->findOrEmpty(); + if ($data->isEmpty()) { + return '施工计划不存在'; + } + return true; + } + + public function checkFile($value): bool|string + { + $file = $value;//json_decode($value,true); + if (empty($file)) { + return '附件必须是json数组'; + } + return true; + } + + public function checkDetail($value, $rule, $data): bool|string + { + $person_detail = $value;// json_decode($value,true); + if (empty($person_detail) || !is_array($person_detail)) { + return '人工明细数据格式错误'; + } + foreach ($person_detail as $v) { + if (empty($v['person_id'])) { + return '人工明细缺少必要参数'; + } else { + $person = ProjectPersonnel::where('id', $v['person_id'])->findOrEmpty(); + if ($person->isEmpty()) { + return '项目人员不存在'; + } + $plan = BuildPlan::field('project_id')->where('id', $data['plan_id'])->findOrEmpty(); + if ($plan['project_id'] != $person['project_id']) { + return '项目人员无效'; + } } - $plan = BuildPlan::field('project_id')->where('id',$data['plan_id'])->findOrEmpty(); - if($plan['project_id'] != $person['project_id']){ - return '项目人员无效'; - } - } - if(empty($v['work_num'])){ - return '请填写项目人员完工量'; - }else{ - if(!is_numeric($v['work_num']) || $v['work_num'] < 0){ - return '项目人员完工量值必须是大于等于0的数字'; + if (empty($v['work_num'])) { + return '请填写项目人员完工量'; + } else { + if (!is_numeric($v['work_num']) || $v['work_num'] < 0) { + return '项目人员完工量值必须是大于等于0的数字'; + } } } + return true; } - return true; - } - -} \ No newline at end of file + + } \ No newline at end of file diff --git a/app/adminapi/validate/contract/AdministrativeContractValidate.php b/app/adminapi/validate/contract/AdministrativeContractValidate.php index b2072735d..7041be191 100644 --- a/app/adminapi/validate/contract/AdministrativeContractValidate.php +++ b/app/adminapi/validate/contract/AdministrativeContractValidate.php @@ -11,86 +11,86 @@ // +---------------------------------------------------------------------- // | author: likeadminTeam // +---------------------------------------------------------------------- - -namespace app\adminapi\validate\contract; - - -use app\common\validate\BaseValidate; - - -/** - * AdministrativeContract验证器 - * Class AdministrativeContractValidate - * @package app\adminapi\validate\contract - */ -class AdministrativeContractValidate extends BaseValidate -{ - - /** - * 设置校验规则 - * @var string[] - */ - protected $rule = [ - 'id' => 'require', - 'supplier_id' => 'require', - 'contract_name' => 'require', - ]; - - - /** - * 参数描述 - * @var string[] - */ - protected $field = [ - 'id' => 'id', - ]; - - - /** - * @notes 添加场景 - * @return AdministrativeContractValidate - * @author likeadmin - * @date 2023/12/13 11:40 - */ - public function sceneAdd() - { - return $this->remove('id', true); - } - - - /** - * @notes 编辑场景 - * @return AdministrativeContractValidate - * @author likeadmin - * @date 2023/12/13 11:40 - */ - public function sceneEdit() - { - return $this->only(['id', 'supplier_id', 'contract_no', 'contract_name']); - } - - - /** - * @notes 删除场景 - * @return AdministrativeContractValidate - * @author likeadmin - * @date 2023/12/13 11:40 - */ - public function sceneDelete() - { - return $this->only(['id']); - } - - - /** - * @notes 详情场景 - * @return AdministrativeContractValidate - * @author likeadmin - * @date 2023/12/13 11:40 - */ - public function sceneDetail() - { - return $this->only(['id']); - } - -} \ No newline at end of file + + namespace app\adminapi\validate\contract; + + + use app\common\validate\BaseValidate; + + + /** + * AdministrativeContract验证器 + * Class AdministrativeContractValidate + * @package app\adminapi\validate\contract + */ + class AdministrativeContractValidate extends BaseValidate + { + + /** + * 设置校验规则 + * @var string[] + */ + protected $rule = [ + 'id' => 'require', + 'supplier_id' => 'require', + 'contract_name' => 'require', + ]; + + + /** + * 参数描述 + * @var string[] + */ + protected $field = [ + 'id' => 'id', + ]; + + + /** + * @notes 添加场景 + * @return AdministrativeContractValidate + * @author likeadmin + * @date 2023/12/13 11:40 + */ + public function sceneAdd() + { + return $this->remove('id', true); + } + + + /** + * @notes 编辑场景 + * @return AdministrativeContractValidate + * @author likeadmin + * @date 2023/12/13 11:40 + */ + public function sceneEdit() + { + return $this->only(['id', 'supplier_id', 'contract_no', 'contract_name']); + } + + + /** + * @notes 删除场景 + * @return AdministrativeContractValidate + * @author likeadmin + * @date 2023/12/13 11:40 + */ + public function sceneDelete() + { + return $this->only(['id'])->remove('id', 'checkData'); + } + + + /** + * @notes 详情场景 + * @return AdministrativeContractValidate + * @author likeadmin + * @date 2023/12/13 11:40 + */ + public function sceneDetail() + { + return $this->only(['id']); + } + + } \ No newline at end of file diff --git a/app/adminapi/validate/contract/ProcurementContractChangeValidate.php b/app/adminapi/validate/contract/ProcurementContractChangeValidate.php index 8b4544371..9654d317e 100644 --- a/app/adminapi/validate/contract/ProcurementContractChangeValidate.php +++ b/app/adminapi/validate/contract/ProcurementContractChangeValidate.php @@ -11,128 +11,128 @@ // +---------------------------------------------------------------------- // | author: likeadminTeam // +---------------------------------------------------------------------- - -namespace app\adminapi\validate\contract; - - -use app\common\validate\BaseValidate; - - -/** - * ProcurementContractChange验证器 - * Class ProcurementContractChangeValidate - * @package app\adminapi\validate\contract - */ -class ProcurementContractChangeValidate extends BaseValidate -{ - - /** - * 设置校验规则 - * @var string[] - */ - protected $rule = [ - 'id' => 'require', - 'procurement_contract_id' => 'require', - 'supplier_id' => 'require', - 'approve_id' => 'require', - 'project_id' => 'require', - 'material' => 'require|array|checkMaterial', - 'pay_plan' => 'require|array|checkPlan', - ]; - - - /** - * 参数描述 - * @var string[] - */ - protected $field = [ - 'id' => 'id', - ]; - - - /** - * @notes 添加场景 - * @return ProcurementContractChangeValidate - * @author likeadmin - * @date 2023/12/12 15:31 - */ - public function sceneAdd() - { - return $this->remove('id', true); - } - - /** - * @notes 编辑场景 - * @return ProcurementContractChangeValidate - * @author likeadmin - * @date 2023/12/12 15:31 - */ - public function sceneEdit() - { - return $this->only(['id', 'procurement_contract_id', 'supplier_id', 'approve_id', 'project_id', 'material', 'pay_plan']); - } - - - /** - * @notes 删除场景 - * @return ProcurementContractChangeValidate - * @author likeadmin - * @date 2023/12/12 15:31 - */ - public function sceneDelete() - { - return $this->only(['id']); - } - - - /** - * @notes 详情场景 - * @return ProcurementContractChangeValidate - * @author likeadmin - * @date 2023/12/12 15:31 - */ - public function sceneDetail() - { - return $this->only(['id']); - } - - public function checkMaterial($value, $rule, $data) - { - $firstData = $value[0] ?? []; - if (empty($firstData['material_procurement_application_id'])) { - return '材料采购申请id不能为空!'; - } - if (empty($firstData['num'])) { - return '材料数量不能为空!'; - } - if (empty($firstData['unit_price_including_tax'])) { - return '材料含税单价不能为空!'; - } - if (empty($firstData['tax_rate'])) { - return '材料税率不能为空!'; - } - if (empty($firstData['amount_excluding_tax'])) { - return '材料不含税金额不能为空!'; - } - if (empty($firstData['amount_including_tax'])) { - return '材料含税金额不能为空!'; - } - return true; - } - - public function checkPlan($value, $rule, $data) - { - $firstData = $value[0] ?? []; - if (empty($firstData['period'])) { - return '付款期次不能为空!'; - } - if (empty($firstData['pay_date'])) { - return '付款日期不能为空!'; - } - if (empty($firstData['pay_amount'])) { - return '付款金额不能为空!'; - } - return true; - } - -} \ No newline at end of file + + namespace app\adminapi\validate\contract; + + + use app\common\validate\BaseValidate; + + + /** + * ProcurementContractChange验证器 + * Class ProcurementContractChangeValidate + * @package app\adminapi\validate\contract + */ + class ProcurementContractChangeValidate extends BaseValidate + { + + /** + * 设置校验规则 + * @var string[] + */ + protected $rule = [ + 'id' => 'require', + 'procurement_contract_id' => 'require', + 'supplier_id' => 'require', + 'approve_id' => 'require', + 'project_id' => 'require', + 'material' => 'require|array|checkMaterial', + 'pay_plan' => 'require|array|checkPlan', + ]; + + + /** + * 参数描述 + * @var string[] + */ + protected $field = [ + 'id' => 'id', + ]; + + + /** + * @notes 添加场景 + * @return ProcurementContractChangeValidate + * @author likeadmin + * @date 2023/12/12 15:31 + */ + public function sceneAdd() + { + return $this->remove('id', true); + } + + /** + * @notes 编辑场景 + * @return ProcurementContractChangeValidate + * @author likeadmin + * @date 2023/12/12 15:31 + */ + public function sceneEdit() + { + return $this->only(['id', 'procurement_contract_id', 'supplier_id', 'approve_id', 'project_id', 'material', 'pay_plan']); + } + + + /** + * @notes 删除场景 + * @return ProcurementContractChangeValidate + * @author likeadmin + * @date 2023/12/12 15:31 + */ + public function sceneDelete() + { + return $this->only(['id'])->remove('id', 'checkData'); + } + + + /** + * @notes 详情场景 + * @return ProcurementContractChangeValidate + * @author likeadmin + * @date 2023/12/12 15:31 + */ + public function sceneDetail() + { + return $this->only(['id']); + } + + public function checkMaterial($value, $rule, $data) + { + $firstData = $value[0] ?? []; + if (empty($firstData['material_procurement_application_id'])) { + return '材料采购申请id不能为空!'; + } + if (empty($firstData['num'])) { + return '材料数量不能为空!'; + } + if (empty($firstData['unit_price_including_tax'])) { + return '材料含税单价不能为空!'; + } + if (empty($firstData['tax_rate'])) { + return '材料税率不能为空!'; + } + if (empty($firstData['amount_excluding_tax'])) { + return '材料不含税金额不能为空!'; + } + if (empty($firstData['amount_including_tax'])) { + return '材料含税金额不能为空!'; + } + return true; + } + + public function checkPlan($value, $rule, $data) + { + $firstData = $value[0] ?? []; + if (empty($firstData['period'])) { + return '付款期次不能为空!'; + } + if (empty($firstData['pay_date'])) { + return '付款日期不能为空!'; + } + if (empty($firstData['pay_amount'])) { + return '付款金额不能为空!'; + } + return true; + } + + } \ No newline at end of file diff --git a/app/adminapi/validate/contract/ProcurementContractDetailValidate.php b/app/adminapi/validate/contract/ProcurementContractDetailValidate.php index c09e8edc7..005996af1 100644 --- a/app/adminapi/validate/contract/ProcurementContractDetailValidate.php +++ b/app/adminapi/validate/contract/ProcurementContractDetailValidate.php @@ -11,85 +11,85 @@ // +---------------------------------------------------------------------- // | author: likeadminTeam // +---------------------------------------------------------------------- - -namespace app\adminapi\validate\contract; - - -use app\common\validate\BaseValidate; - - -/** - * 采购明细验证器 - * Class ProcurementContractDetailValidate - * @package app\adminapi\validate\contract - */ -class ProcurementContractDetailValidate extends BaseValidate -{ - - /** - * 设置校验规则 - * @var string[] - */ - protected $rule = [ - 'id' => 'require', - ]; - - - /** - * 参数描述 - * @var string[] - */ - protected $field = [ - 'id' => 'id', - ]; - - - /** - * @notes 添加场景 - * @return ProcurementContractDetailValidate - * @author likeadmin - * @date 2023/12/04 22:30 - */ - public function sceneAdd() - { - return $this->remove('id', true); - } - - - /** - * @notes 编辑场景 - * @return ProcurementContractDetailValidate - * @author likeadmin - * @date 2023/12/04 22:30 - */ - public function sceneEdit() - { - return $this->only(['id']); - } - - - /** - * @notes 删除场景 - * @return ProcurementContractDetailValidate - * @author likeadmin - * @date 2023/12/04 22:30 - */ - public function sceneDelete() - { - return $this->only(['id']); - } - - - /** - * @notes 详情场景 - * @return ProcurementContractDetailValidate - * @author likeadmin - * @date 2023/12/04 22:30 - */ - public function sceneDetail() - { - return $this->only(['id']); - } - -} \ No newline at end of file + namespace app\adminapi\validate\contract; + + + use app\common\validate\BaseValidate; + + + /** + * 采购明细验证器 + * Class ProcurementContractDetailValidate + * @package app\adminapi\validate\contract + */ + class ProcurementContractDetailValidate extends BaseValidate + { + + /** + * 设置校验规则 + * @var string[] + */ + protected $rule = [ + 'id' => 'require', + ]; + + + /** + * 参数描述 + * @var string[] + */ + protected $field = [ + 'id' => 'id', + ]; + + + /** + * @notes 添加场景 + * @return ProcurementContractDetailValidate + * @author likeadmin + * @date 2023/12/04 22:30 + */ + public function sceneAdd() + { + return $this->remove('id', true); + } + + + /** + * @notes 编辑场景 + * @return ProcurementContractDetailValidate + * @author likeadmin + * @date 2023/12/04 22:30 + */ + public function sceneEdit() + { + return $this->only(['id']); + } + + + /** + * @notes 删除场景 + * @return ProcurementContractDetailValidate + * @author likeadmin + * @date 2023/12/04 22:30 + */ + public function sceneDelete() + { + return $this->only(['id'])->remove('id', 'checkData'); + } + + + /** + * @notes 详情场景 + * @return ProcurementContractDetailValidate + * @author likeadmin + * @date 2023/12/04 22:30 + */ + public function sceneDetail() + { + return $this->only(['id']); + } + + + } \ No newline at end of file diff --git a/app/adminapi/validate/contract/SubcontractingContractDetailValidate.php b/app/adminapi/validate/contract/SubcontractingContractDetailValidate.php index 5c60e4b04..16253703d 100644 --- a/app/adminapi/validate/contract/SubcontractingContractDetailValidate.php +++ b/app/adminapi/validate/contract/SubcontractingContractDetailValidate.php @@ -11,84 +11,84 @@ // +---------------------------------------------------------------------- // | author: likeadminTeam // +---------------------------------------------------------------------- - -namespace app\adminapi\validate\contract; - - -use app\common\validate\BaseValidate; - - -/** - * 分包合同-分包明细验证器 - * Class SubcontractingContractDetailValidate - * @package app\adminapi\validate\contract - */ -class SubcontractingContractDetailValidate extends BaseValidate -{ - - /** - * 设置校验规则 - * @var string[] - */ - protected $rule = [ - 'id' => 'require', - ]; - - - /** - * 参数描述 - * @var string[] - */ - protected $field = [ - 'id' => 'id', - ]; - - - /** - * @notes 添加场景 - * @return SubcontractingContractDetailValidate - * @author likeadmin - * @date 2023/12/28 22:08 - */ - public function sceneAdd() - { - return $this->remove('id', true); - } - - - /** - * @notes 编辑场景 - * @return SubcontractingContractDetailValidate - * @author likeadmin - * @date 2023/12/28 22:08 - */ - public function sceneEdit() - { - return $this->only(['id']); - } - - - /** - * @notes 删除场景 - * @return SubcontractingContractDetailValidate - * @author likeadmin - * @date 2023/12/28 22:08 - */ - public function sceneDelete() - { - return $this->only(['id']); - } - - - /** - * @notes 详情场景 - * @return SubcontractingContractDetailValidate - * @author likeadmin - * @date 2023/12/28 22:08 - */ - public function sceneDetail() - { - return $this->only(['id']); - } - -} \ No newline at end of file + + namespace app\adminapi\validate\contract; + + + use app\common\validate\BaseValidate; + + + /** + * 分包合同-分包明细验证器 + * Class SubcontractingContractDetailValidate + * @package app\adminapi\validate\contract + */ + class SubcontractingContractDetailValidate extends BaseValidate + { + + /** + * 设置校验规则 + * @var string[] + */ + protected $rule = [ + 'id' => 'require', + ]; + + + /** + * 参数描述 + * @var string[] + */ + protected $field = [ + 'id' => 'id', + ]; + + + /** + * @notes 添加场景 + * @return SubcontractingContractDetailValidate + * @author likeadmin + * @date 2023/12/28 22:08 + */ + public function sceneAdd() + { + return $this->remove('id', true); + } + + + /** + * @notes 编辑场景 + * @return SubcontractingContractDetailValidate + * @author likeadmin + * @date 2023/12/28 22:08 + */ + public function sceneEdit() + { + return $this->only(['id']); + } + + + /** + * @notes 删除场景 + * @return SubcontractingContractDetailValidate + * @author likeadmin + * @date 2023/12/28 22:08 + */ + public function sceneDelete() + { + return $this->only(['id'])->remove('id', 'checkData'); + } + + + /** + * @notes 详情场景 + * @return SubcontractingContractDetailValidate + * @author likeadmin + * @date 2023/12/28 22:08 + */ + public function sceneDetail() + { + return $this->only(['id']); + } + + } \ No newline at end of file diff --git a/app/adminapi/validate/cost/CostBudgetAdjustDetailValidate.php b/app/adminapi/validate/cost/CostBudgetAdjustDetailValidate.php index 82cbda4c0..b44568f23 100644 --- a/app/adminapi/validate/cost/CostBudgetAdjustDetailValidate.php +++ b/app/adminapi/validate/cost/CostBudgetAdjustDetailValidate.php @@ -11,88 +11,88 @@ // +---------------------------------------------------------------------- // | author: likeadminTeam // +---------------------------------------------------------------------- - -namespace app\adminapi\validate\cost; - - -use app\common\validate\BaseValidate; - - -/** - * CostBudgetAdjustDetail验证器 - * Class CostBudgetAdjustDetailValidate - * @package app\adminapi\validate\cost - */ -class CostBudgetAdjustDetailValidate extends BaseValidate -{ - - /** - * 设置校验规则 - * @var string[] - */ - protected $rule = [ - 'id' => 'require', - 'cost_subject_id' => 'require', - 'cost_budget_adjust_id' => 'require', - ]; - - - /** - * 参数描述 - * @var string[] - */ - protected $field = [ - 'id' => 'id', - 'cost_subject_id' => 'cost_subject_id', - 'cost_budget_adjust_id' => '预算调整id', - ]; - - - /** - * @notes 添加场景 - * @return CostBudgetAdjustDetailValidate - * @author likeadmin - * @date 2023/12/18 15:06 - */ - public function sceneAdd() - { - return $this->only(['cost_subject_id','cost_budget_adjust_id']); - } - - - /** - * @notes 编辑场景 - * @return CostBudgetAdjustDetailValidate - * @author likeadmin - * @date 2023/12/18 15:06 - */ - public function sceneEdit() - { - return $this->only(['id','cost_subject_id','cost_budget_adjust_id']); - } - - - /** - * @notes 删除场景 - * @return CostBudgetAdjustDetailValidate - * @author likeadmin - * @date 2023/12/18 15:06 - */ - public function sceneDelete() - { - return $this->only(['id']); - } - - - /** - * @notes 详情场景 - * @return CostBudgetAdjustDetailValidate - * @author likeadmin - * @date 2023/12/18 15:06 - */ - public function sceneDetail() - { - return $this->only(['id']); - } - -} \ No newline at end of file + + namespace app\adminapi\validate\cost; + + + use app\common\validate\BaseValidate; + + + /** + * CostBudgetAdjustDetail验证器 + * Class CostBudgetAdjustDetailValidate + * @package app\adminapi\validate\cost + */ + class CostBudgetAdjustDetailValidate extends BaseValidate + { + + /** + * 设置校验规则 + * @var string[] + */ + protected $rule = [ + 'id' => 'require', + 'cost_subject_id' => 'require', + 'cost_budget_adjust_id' => 'require', + ]; + + + /** + * 参数描述 + * @var string[] + */ + protected $field = [ + 'id' => 'id', + 'cost_subject_id' => 'cost_subject_id', + 'cost_budget_adjust_id' => '预算调整id', + ]; + + + /** + * @notes 添加场景 + * @return CostBudgetAdjustDetailValidate + * @author likeadmin + * @date 2023/12/18 15:06 + */ + public function sceneAdd() + { + return $this->only(['cost_subject_id', 'cost_budget_adjust_id']); + } + + + /** + * @notes 编辑场景 + * @return CostBudgetAdjustDetailValidate + * @author likeadmin + * @date 2023/12/18 15:06 + */ + public function sceneEdit() + { + return $this->only(['id', 'cost_subject_id', 'cost_budget_adjust_id']); + } + + + /** + * @notes 删除场景 + * @return CostBudgetAdjustDetailValidate + * @author likeadmin + * @date 2023/12/18 15:06 + */ + public function sceneDelete() + { + return $this->only(['id'])->remove('id', 'checkData'); + } + + + /** + * @notes 详情场景 + * @return CostBudgetAdjustDetailValidate + * @author likeadmin + * @date 2023/12/18 15:06 + */ + public function sceneDetail() + { + return $this->only(['id']); + } + + } \ No newline at end of file diff --git a/app/adminapi/validate/cost/CostBudgetAdjustValidate.php b/app/adminapi/validate/cost/CostBudgetAdjustValidate.php index 6981f2cd6..37455013d 100644 --- a/app/adminapi/validate/cost/CostBudgetAdjustValidate.php +++ b/app/adminapi/validate/cost/CostBudgetAdjustValidate.php @@ -11,92 +11,92 @@ // +---------------------------------------------------------------------- // | author: likeadminTeam // +---------------------------------------------------------------------- - -namespace app\adminapi\validate\cost; - - -use app\common\validate\BaseValidate; - - -/** - * CostBudgetAdjust验证器 - * Class CostBudgetAdjustValidate - * @package app\adminapi\validate\cost - */ -class CostBudgetAdjustValidate extends BaseValidate -{ - - /** - * 设置校验规则 - * @var string[] - */ - protected $rule = [ - 'id' => 'require', - 'org_id' => 'require', - 'dept_id' => 'require', - 'approve_id' => 'require', - 'years' => 'require', - 'document_preparation_time' => 'require', - ]; - - - /** - * 参数描述 - * @var string[] - */ - protected $field = [ - 'id' => 'id', - 'approve_id' => '审批id', - 'years' => '年份', - 'document_preparation_time' => '制单时间', - ]; - - - /** - * @notes 添加场景 - * @return CostBudgetAdjustValidate - * @author likeadmin - * @date 2023/12/18 15:17 - */ - public function sceneAdd() - { - return $this->only(['approve_id','years','document_preparation_time']); - } - - - /** - * @notes 编辑场景 - * @return CostBudgetAdjustValidate - * @author likeadmin - * @date 2023/12/18 15:17 - */ - public function sceneEdit() - { - return $this->only(['id','approve_id','years','document_preparation_time']); - } - - - /** - * @notes 删除场景 - * @return CostBudgetAdjustValidate - * @author likeadmin - * @date 2023/12/18 15:17 - */ - public function sceneDelete() - { - return $this->only(['id']); - } - - - /** - * @notes 详情场景 - * @return CostBudgetAdjustValidate - * @author likeadmin - * @date 2023/12/18 15:17 - */ - public function sceneDetail() - { - return $this->only(['id']); - } - -} \ No newline at end of file + + namespace app\adminapi\validate\cost; + + + use app\common\validate\BaseValidate; + + + /** + * CostBudgetAdjust验证器 + * Class CostBudgetAdjustValidate + * @package app\adminapi\validate\cost + */ + class CostBudgetAdjustValidate extends BaseValidate + { + + /** + * 设置校验规则 + * @var string[] + */ + protected $rule = [ + 'id' => 'require', + 'org_id' => 'require', + 'dept_id' => 'require', + 'approve_id' => 'require', + 'years' => 'require', + 'document_preparation_time' => 'require', + ]; + + + /** + * 参数描述 + * @var string[] + */ + protected $field = [ + 'id' => 'id', + 'approve_id' => '审批id', + 'years' => '年份', + 'document_preparation_time' => '制单时间', + ]; + + + /** + * @notes 添加场景 + * @return CostBudgetAdjustValidate + * @author likeadmin + * @date 2023/12/18 15:17 + */ + public function sceneAdd() + { + return $this->only(['approve_id', 'years', 'document_preparation_time']); + } + + + /** + * @notes 编辑场景 + * @return CostBudgetAdjustValidate + * @author likeadmin + * @date 2023/12/18 15:17 + */ + public function sceneEdit() + { + return $this->only(['id', 'approve_id', 'years', 'document_preparation_time']); + } + + + /** + * @notes 删除场景 + * @return CostBudgetAdjustValidate + * @author likeadmin + * @date 2023/12/18 15:17 + */ + public function sceneDelete() + { + return $this->only(['id'])->remove('id', 'checkData'); + } + + + /** + * @notes 详情场景 + * @return CostBudgetAdjustValidate + * @author likeadmin + * @date 2023/12/18 15:17 + */ + public function sceneDetail() + { + return $this->only(['id']); + } + + } \ No newline at end of file diff --git a/app/adminapi/validate/cost/CostBudgetDetailValidate.php b/app/adminapi/validate/cost/CostBudgetDetailValidate.php index 074b698af..957808c28 100644 --- a/app/adminapi/validate/cost/CostBudgetDetailValidate.php +++ b/app/adminapi/validate/cost/CostBudgetDetailValidate.php @@ -11,88 +11,88 @@ // +---------------------------------------------------------------------- // | author: likeadminTeam // +---------------------------------------------------------------------- - -namespace app\adminapi\validate\cost; - - -use app\common\validate\BaseValidate; - - -/** - * CostBudgetDetail验证器 - * Class CostBudgetDetailValidate - * @package app\adminapi\validate\cost - */ -class CostBudgetDetailValidate extends BaseValidate -{ - - /** - * 设置校验规则 - * @var string[] - */ - protected $rule = [ - 'id' => 'require', - 'cost_subject_id' => 'require', - 'gc_cost_budget_id' => 'require', - ]; - - - /** - * 参数描述 - * @var string[] - */ - protected $field = [ - 'id' => 'id', - 'cost_subject_id' => '一级科目id', - 'gc_cost_budget_id' => '费用明细id', - ]; - - - /** - * @notes 添加场景 - * @return CostBudgetDetailValidate - * @author likeadmin - * @date 2023/12/18 11:22 - */ - public function sceneAdd() - { - return $this->only(['cost_subject_id','gc_cost_budget_id']); - } - - - /** - * @notes 编辑场景 - * @return CostBudgetDetailValidate - * @author likeadmin - * @date 2023/12/18 11:22 - */ - public function sceneEdit() - { - return $this->only(['id','cost_subject_id','gc_cost_budget_id']); - } - - - /** - * @notes 删除场景 - * @return CostBudgetDetailValidate - * @author likeadmin - * @date 2023/12/18 11:22 - */ - public function sceneDelete() - { - return $this->only(['id']); - } - - - /** - * @notes 详情场景 - * @return CostBudgetDetailValidate - * @author likeadmin - * @date 2023/12/18 11:22 - */ - public function sceneDetail() - { - return $this->only(['id']); - } - -} \ No newline at end of file + + namespace app\adminapi\validate\cost; + + + use app\common\validate\BaseValidate; + + + /** + * CostBudgetDetail验证器 + * Class CostBudgetDetailValidate + * @package app\adminapi\validate\cost + */ + class CostBudgetDetailValidate extends BaseValidate + { + + /** + * 设置校验规则 + * @var string[] + */ + protected $rule = [ + 'id' => 'require', + 'cost_subject_id' => 'require', + 'gc_cost_budget_id' => 'require', + ]; + + + /** + * 参数描述 + * @var string[] + */ + protected $field = [ + 'id' => 'id', + 'cost_subject_id' => '一级科目id', + 'gc_cost_budget_id' => '费用明细id', + ]; + + + /** + * @notes 添加场景 + * @return CostBudgetDetailValidate + * @author likeadmin + * @date 2023/12/18 11:22 + */ + public function sceneAdd() + { + return $this->only(['cost_subject_id', 'gc_cost_budget_id']); + } + + + /** + * @notes 编辑场景 + * @return CostBudgetDetailValidate + * @author likeadmin + * @date 2023/12/18 11:22 + */ + public function sceneEdit() + { + return $this->only(['id', 'cost_subject_id', 'gc_cost_budget_id']); + } + + + /** + * @notes 删除场景 + * @return CostBudgetDetailValidate + * @author likeadmin + * @date 2023/12/18 11:22 + */ + public function sceneDelete() + { + return $this->only(['id'])->remove('id', 'checkData'); + } + + + /** + * @notes 详情场景 + * @return CostBudgetDetailValidate + * @author likeadmin + * @date 2023/12/18 11:22 + */ + public function sceneDetail() + { + return $this->only(['id']); + } + + } \ No newline at end of file diff --git a/app/adminapi/validate/cost/CostBudgetValidate.php b/app/adminapi/validate/cost/CostBudgetValidate.php index 5070ee4c0..a348dfa5b 100644 --- a/app/adminapi/validate/cost/CostBudgetValidate.php +++ b/app/adminapi/validate/cost/CostBudgetValidate.php @@ -11,105 +11,105 @@ // +---------------------------------------------------------------------- // | author: likeadminTeam // +---------------------------------------------------------------------- - -namespace app\adminapi\validate\cost; - - -use app\common\validate\BaseValidate; - - -/** - * CostBudget验证器 - * Class CostBudgetValidate - * @package app\adminapi\validate\cost - */ -class CostBudgetValidate extends BaseValidate -{ - - /** - * 设置校验规则 - * @var string[] - */ - protected $rule = [ - 'id' => 'require', - 'org_id' => 'require', - 'dept_id' => 'require', - 'approve_id' => 'require', - 'years' => 'require', - 'document_preparation_time' => 'require', - 'detail' => 'array|checkDetail', - ]; - - - /** - * 参数描述 - * @var string[] - */ - protected $field = [ - 'id' => 'id', - 'years' => '年份', - 'document_preparation_time' => '制单时间', - ]; - - - /** - * @notes 添加场景 - * @return CostBudgetValidate - * @author likeadmin - * @date 2023/12/18 11:26 - */ - public function sceneAdd() - { - return $this->only(['approve_id', 'years','document_preparation_time', 'detail']); - } - - - /** - * @notes 编辑场景 - * @return CostBudgetValidate - * @author likeadmin - * @date 2023/12/18 11:26 - */ - public function sceneEdit() - { - return $this->only(['id', 'approve_id', 'years','document_preparation_time', 'detail']); - } - - - /** - * @notes 删除场景 - * @return CostBudgetValidate - * @author likeadmin - * @date 2023/12/18 11:26 - */ - public function sceneDelete() - { - return $this->only(['id']); - } - - - /** - * @notes 详情场景 - * @return CostBudgetValidate - * @author likeadmin - * @date 2023/12/18 11:26 - */ - public function sceneDetail() - { - return $this->only(['id']); - } - - public function checkDetail($value, $rule, $data) - { - $firstData = $value[0] ?? []; - if (empty($firstData)) { - return true; - } else { - if (empty($firstData['cost_subject_id'])) { - return '一级科目不能为空!'; - } - } - return true; - } - -} \ No newline at end of file + + namespace app\adminapi\validate\cost; + + + use app\common\validate\BaseValidate; + + + /** + * CostBudget验证器 + * Class CostBudgetValidate + * @package app\adminapi\validate\cost + */ + class CostBudgetValidate extends BaseValidate + { + + /** + * 设置校验规则 + * @var string[] + */ + protected $rule = [ + 'id' => 'require', + 'org_id' => 'require', + 'dept_id' => 'require', + 'approve_id' => 'require', + 'years' => 'require', + 'document_preparation_time' => 'require', + 'detail' => 'array|checkDetail', + ]; + + + /** + * 参数描述 + * @var string[] + */ + protected $field = [ + 'id' => 'id', + 'years' => '年份', + 'document_preparation_time' => '制单时间', + ]; + + + /** + * @notes 添加场景 + * @return CostBudgetValidate + * @author likeadmin + * @date 2023/12/18 11:26 + */ + public function sceneAdd() + { + return $this->only(['approve_id', 'years', 'document_preparation_time', 'detail']); + } + + + /** + * @notes 编辑场景 + * @return CostBudgetValidate + * @author likeadmin + * @date 2023/12/18 11:26 + */ + public function sceneEdit() + { + return $this->only(['id', 'approve_id', 'years', 'document_preparation_time', 'detail']); + } + + + /** + * @notes 删除场景 + * @return CostBudgetValidate + * @author likeadmin + * @date 2023/12/18 11:26 + */ + public function sceneDelete() + { + return $this->only(['id'])->remove('id', 'checkData'); + } + + + /** + * @notes 详情场景 + * @return CostBudgetValidate + * @author likeadmin + * @date 2023/12/18 11:26 + */ + public function sceneDetail() + { + return $this->only(['id']); + } + + public function checkDetail($value, $rule, $data) + { + $firstData = $value[0] ?? []; + if (empty($firstData)) { + return true; + } else { + if (empty($firstData['cost_subject_id'])) { + return '一级科目不能为空!'; + } + } + return true; + } + + } \ No newline at end of file diff --git a/app/adminapi/validate/cost/CostSubjectValidate.php b/app/adminapi/validate/cost/CostSubjectValidate.php index cf0af2336..585b9fa29 100644 --- a/app/adminapi/validate/cost/CostSubjectValidate.php +++ b/app/adminapi/validate/cost/CostSubjectValidate.php @@ -11,88 +11,88 @@ // +---------------------------------------------------------------------- // | author: likeadminTeam // +---------------------------------------------------------------------- - -namespace app\adminapi\validate\cost; - - -use app\common\validate\BaseValidate; - - -/** - * CostSubject验证器 - * Class CostSubjectValidate - * @package app\adminapi\validate\cost - */ -class CostSubjectValidate extends BaseValidate -{ - - /** - * 设置校验规则 - * @var string[] - */ - protected $rule = [ - 'id' => 'require', - 'sn' => 'require', - 'subject1' => 'require', - ]; - - - /** - * 参数描述 - * @var string[] - */ - protected $field = [ - 'id' => 'id', - 'sn' => '科目编码', - 'subject1' => '一级科目', - ]; - - - /** - * @notes 添加场景 - * @return CostSubjectValidate - * @author likeadmin - * @date 2023/12/18 15:41 - */ - public function sceneAdd() - { - return $this->only(['sn','subject1']); - } - - - /** - * @notes 编辑场景 - * @return CostSubjectValidate - * @author likeadmin - * @date 2023/12/18 15:41 - */ - public function sceneEdit() - { - return $this->only(['id','sn','subject1']); - } - - - /** - * @notes 删除场景 - * @return CostSubjectValidate - * @author likeadmin - * @date 2023/12/18 15:41 - */ - public function sceneDelete() - { - return $this->only(['id']); - } - - - /** - * @notes 详情场景 - * @return CostSubjectValidate - * @author likeadmin - * @date 2023/12/18 15:41 - */ - public function sceneDetail() - { - return $this->only(['id']); - } - -} \ No newline at end of file + + namespace app\adminapi\validate\cost; + + + use app\common\validate\BaseValidate; + + + /** + * CostSubject验证器 + * Class CostSubjectValidate + * @package app\adminapi\validate\cost + */ + class CostSubjectValidate extends BaseValidate + { + + /** + * 设置校验规则 + * @var string[] + */ + protected $rule = [ + 'id' => 'require', + 'sn' => 'require', + 'subject1' => 'require', + ]; + + + /** + * 参数描述 + * @var string[] + */ + protected $field = [ + 'id' => 'id', + 'sn' => '科目编码', + 'subject1' => '一级科目', + ]; + + + /** + * @notes 添加场景 + * @return CostSubjectValidate + * @author likeadmin + * @date 2023/12/18 15:41 + */ + public function sceneAdd() + { + return $this->only(['sn', 'subject1']); + } + + + /** + * @notes 编辑场景 + * @return CostSubjectValidate + * @author likeadmin + * @date 2023/12/18 15:41 + */ + public function sceneEdit() + { + return $this->only(['id', 'sn', 'subject1']); + } + + + /** + * @notes 删除场景 + * @return CostSubjectValidate + * @author likeadmin + * @date 2023/12/18 15:41 + */ + public function sceneDelete() + { + return $this->only(['id'])->remove('id', 'checkData'); + } + + + /** + * @notes 详情场景 + * @return CostSubjectValidate + * @author likeadmin + * @date 2023/12/18 15:41 + */ + public function sceneDetail() + { + return $this->only(['id']); + } + + } \ No newline at end of file diff --git a/app/adminapi/validate/cost_project/CostProjectValidate.php b/app/adminapi/validate/cost_project/CostProjectValidate.php index 6eaa55404..265fa87f2 100644 --- a/app/adminapi/validate/cost_project/CostProjectValidate.php +++ b/app/adminapi/validate/cost_project/CostProjectValidate.php @@ -11,120 +11,120 @@ // +---------------------------------------------------------------------- // | author: likeadminTeam // +---------------------------------------------------------------------- - -namespace app\adminapi\validate\cost_project; - - -use app\common\model\dict\DictData; -use app\common\validate\BaseValidate; - - -/** - * 造价项目台账验证器 - * Class CostProjectValidate - * @package app\adminapi\validate\cost_project - */ -class CostProjectValidate extends BaseValidate -{ - - /** - * 设置校验规则 - * @var string[] - */ - protected $rule = [ - 'id' => 'require', - 'project_name' => 'require', - 'contract_id' => 'require', - 'types' => 'checkTypes', - 'industry' => 'checkIndustry', - 'starting' => 'require|dateFormat:Y-m-d', - 'endtime' => 'require|dateFormat:Y-m-d', - 'jhgq' => 'require', - 'principal' => 'require', - 'person' => 'checkPerson', - 'invest' => 'require', - 'aunit' => 'require', - 'annex' => 'checkAnnex' - ]; - - - /** - * 参数描述 - * @var string[] - */ - protected $field = [ - 'id' => 'id', - 'project_num' => '项目编号', - 'project_name' => '项目名称', - 'contract_id' => '关联合同', - 'starting' => '计划开始日期', - 'endtime' => '计划结束日期', - 'jhgq' => '计划工期(天)', - 'principal' => '项目负责人', - 'invest' => '项目总投资(万元)', - 'aunit' => '委托单位', - ]; - - - /** - * @notes 添加场景 - * @return CostProjectValidate - * @author likeadmin - * @date 2024/02/21 09:23 - */ - public function sceneAdd() - { - return $this->only(['project_num','project_name','contract_id','starting','endtime','jhgq','principal','invest','aunit','annex']); - } - - - /** - * @notes 编辑场景 - * @return CostProjectValidate - * @author likeadmin - * @date 2024/02/21 09:23 - */ - public function sceneEdit() - { - return $this->only(['id','project_num','project_name','contract_id','starting','endtime','jhgq','principal','invest','aunit','annex']); - } - - - /** - * @notes 删除场景 - * @return CostProjectValidate - * @author likeadmin - * @date 2024/02/21 09:23 - */ - public function sceneDelete() - { - return $this->only(['id']); - } - - - /** - * @notes 详情场景 - * @return CostProjectValidate - * @author likeadmin - * @date 2024/02/21 09:23 - */ - public function sceneDetail() - { - return $this->only(['id']); - } - public function checkPerson($value): bool|string + namespace app\adminapi\validate\cost_project; + + + use app\common\model\dict\DictData; + use app\common\validate\BaseValidate; + + + /** + * 造价项目台账验证器 + * Class CostProjectValidate + * @package app\adminapi\validate\cost_project + */ + class CostProjectValidate extends BaseValidate { - if(!empty($value) && $value != '' && !is_array($value)){ - return '项目相关人员格式错误'; + + /** + * 设置校验规则 + * @var string[] + */ + protected $rule = [ + 'id' => 'require', + 'project_name' => 'require', + 'contract_id' => 'require', + 'types' => 'checkTypes', + 'industry' => 'checkIndustry', + 'starting' => 'require|dateFormat:Y-m-d', + 'endtime' => 'require|dateFormat:Y-m-d', + 'jhgq' => 'require', + 'principal' => 'require', + 'person' => 'checkPerson', + 'invest' => 'require', + 'aunit' => 'require', + 'annex' => 'checkAnnex' + ]; + + + /** + * 参数描述 + * @var string[] + */ + protected $field = [ + 'id' => 'id', + 'project_num' => '项目编号', + 'project_name' => '项目名称', + 'contract_id' => '关联合同', + 'starting' => '计划开始日期', + 'endtime' => '计划结束日期', + 'jhgq' => '计划工期(天)', + 'principal' => '项目负责人', + 'invest' => '项目总投资(万元)', + 'aunit' => '委托单位', + ]; + + + /** + * @notes 添加场景 + * @return CostProjectValidate + * @author likeadmin + * @date 2024/02/21 09:23 + */ + public function sceneAdd() + { + return $this->only(['project_num', 'project_name', 'contract_id', 'starting', 'endtime', 'jhgq', 'principal', 'invest', 'aunit', 'annex']); } - return true; - } - - public function checkTypes($value): bool|string - { - $dict = DictData::where('type_value','consultation_type')->column('value'); - return !in_array($value,$dict) ? '咨询类型数据值无效' : true; - } - -} \ No newline at end of file + + + /** + * @notes 编辑场景 + * @return CostProjectValidate + * @author likeadmin + * @date 2024/02/21 09:23 + */ + public function sceneEdit() + { + return $this->only(['id', 'project_num', 'project_name', 'contract_id', 'starting', 'endtime', 'jhgq', 'principal', 'invest', 'aunit', 'annex']); + } + + + /** + * @notes 删除场景 + * @return CostProjectValidate + * @author likeadmin + * @date 2024/02/21 09:23 + */ + public function sceneDelete() + { + return $this->only(['id'])->remove('id', 'checkData'); + } + + + /** + * @notes 详情场景 + * @return CostProjectValidate + * @author likeadmin + * @date 2024/02/21 09:23 + */ + public function sceneDetail() + { + return $this->only(['id']); + } + + public function checkPerson($value): bool|string + { + if (!empty($value) && $value != '' && !is_array($value)) { + return '项目相关人员格式错误'; + } + return true; + } + + public function checkTypes($value): bool|string + { + $dict = DictData::where('type_value', 'consultation_type')->column('value'); + return !in_array($value, $dict) ? '咨询类型数据值无效' : true; + } + + } \ No newline at end of file diff --git a/app/adminapi/validate/crontab/CrontabValidate.php b/app/adminapi/validate/crontab/CrontabValidate.php index e622ef2e3..ef0e26be9 100755 --- a/app/adminapi/validate/crontab/CrontabValidate.php +++ b/app/adminapi/validate/crontab/CrontabValidate.php @@ -11,128 +11,128 @@ // +---------------------------------------------------------------------- // | author: likeadminTeam // +---------------------------------------------------------------------- - -namespace app\adminapi\validate\crontab; - -use app\common\validate\BaseValidate; -use Cron\CronExpression; - -/** - * 定时任务验证器 - * Class CrontabValidate - * @package app\adminapi\validate\crontab - */ -class CrontabValidate extends BaseValidate -{ - protected $rule = [ - 'name' => 'require', - 'type' => 'require|in:1', - 'command' => 'require', - 'status' => 'require|in:1,2,3', - 'expression' => 'require|checkExpression', - 'id' => 'require', - 'operate' => 'require' - ]; - - protected $message = [ - 'name.require' => '请输入定时任务名称', - 'type.require' => '请选择类型', - 'type.in' => '类型值错误', - 'command.require' => '请输入命令', - 'status.require' => '请选择状态', - 'status.in' => '状态值错误', - 'expression.require' => '请输入运行规则', - 'id.require' => '参数缺失', - 'operate.require' => '请选择操作', - ]; - - - /** - * @notes 添加定时任务场景 - * @return CrontabValidate - * @author 段誉 - * @date 2022/3/29 14:39 - */ - public function sceneAdd() - { - return $this->remove('id', 'require')->remove('operate', 'require'); - } - - - /** - * @notes 查看定时任务详情场景 - * @return CrontabValidate - * @author 段誉 - * @date 2022/3/29 14:39 - */ - public function sceneDetail() - { - return $this->only(['id']); - } - - - /** - * @notes 编辑定时任务 - * @return CrontabValidate - * @author 段誉 - * @date 2022/3/29 14:39 - */ - public function sceneEdit() - { - return $this->remove('operate', 'require'); - } - - - /** - * @notes 删除定时任务场景 - * @return CrontabValidate - * @author 段誉 - * @date 2022/3/29 14:40 - */ - public function sceneDelete() - { - return $this->only(['id']); - } - - - /** - * @notes CrontabValidate - * @return CrontabValidate - * @author 段誉 - * @date 2022/3/29 14:40 - */ - public function sceneOperate() - { - return $this->only(['id', 'operate']); - } - - - /** - * @notes 获取规则执行时间场景 - * @return CrontabValidate - * @author 段誉 - * @date 2022/3/29 14:40 - */ - public function sceneExpression() - { - return $this->only(['expression']); - } - - - /** - * @notes 校验运行规则 - * @param $value - * @param $rule - * @param $data - * @return bool|string - * @author 段誉 - * @date 2022/3/29 14:40 - */ - public function checkExpression($value, $rule, $data) - { - if (CronExpression::isValidExpression($value) === false) { - return '定时任务运行规则错误'; - } - return true; - } -} \ No newline at end of file + + namespace app\adminapi\validate\crontab; + + use app\common\validate\BaseValidate; + use Cron\CronExpression; + + /** + * 定时任务验证器 + * Class CrontabValidate + * @package app\adminapi\validate\crontab + */ + class CrontabValidate extends BaseValidate + { + protected $rule = [ + 'name' => 'require', + 'type' => 'require|in:1', + 'command' => 'require', + 'status' => 'require|in:1,2,3', + 'expression' => 'require|checkExpression', + 'id' => 'require', + 'operate' => 'require' + ]; + + protected $message = [ + 'name.require' => '请输入定时任务名称', + 'type.require' => '请选择类型', + 'type.in' => '类型值错误', + 'command.require' => '请输入命令', + 'status.require' => '请选择状态', + 'status.in' => '状态值错误', + 'expression.require' => '请输入运行规则', + 'id.require' => '参数缺失', + 'operate.require' => '请选择操作', + ]; + + + /** + * @notes 添加定时任务场景 + * @return CrontabValidate + * @author 段誉 + * @date 2022/3/29 14:39 + */ + public function sceneAdd() + { + return $this->remove('id', 'require')->remove('operate', 'require'); + } + + + /** + * @notes 查看定时任务详情场景 + * @return CrontabValidate + * @author 段誉 + * @date 2022/3/29 14:39 + */ + public function sceneDetail() + { + return $this->only(['id']); + } + + + /** + * @notes 编辑定时任务 + * @return CrontabValidate + * @author 段誉 + * @date 2022/3/29 14:39 + */ + public function sceneEdit() + { + return $this->remove('operate', 'require'); + } + + + /** + * @notes 删除定时任务场景 + * @return CrontabValidate + * @author 段誉 + * @date 2022/3/29 14:40 + */ + public function sceneDelete() + { + return $this->only(['id'])->remove('id', 'checkData'); + } + + + /** + * @notes CrontabValidate + * @return CrontabValidate + * @author 段誉 + * @date 2022/3/29 14:40 + */ + public function sceneOperate() + { + return $this->only(['id', 'operate']); + } + + + /** + * @notes 获取规则执行时间场景 + * @return CrontabValidate + * @author 段誉 + * @date 2022/3/29 14:40 + */ + public function sceneExpression() + { + return $this->only(['expression']); + } + + + /** + * @notes 校验运行规则 + * @param $value + * @param $rule + * @param $data + * @return bool|string + * @author 段誉 + * @date 2022/3/29 14:40 + */ + public function checkExpression($value, $rule, $data) + { + if (CronExpression::isValidExpression($value) === false) { + return '定时任务运行规则错误'; + } + return true; + } + } \ No newline at end of file diff --git a/app/adminapi/validate/custom/CustomContactsValidate.php b/app/adminapi/validate/custom/CustomContactsValidate.php index 66d4b7c3a..6faf3eeae 100644 --- a/app/adminapi/validate/custom/CustomContactsValidate.php +++ b/app/adminapi/validate/custom/CustomContactsValidate.php @@ -1,92 +1,94 @@ 'require', - 'custom_id' => 'require|checkCustom', - 'name' => 'require', - 'phone' => 'mobile|unique:'.CustomContacts::class, - 'email' => 'email', - 'annex' => 'checkAnnex', - ]; - protected $field = [ - 'id' => '数据id', - 'custom_id' => '客户id', - 'name' => '姓名', - 'phone' => '手机', - 'email' => '邮箱', - ]; - - /** - * @notes 添加场景 - * @return CustomContactsValidate - * @author likeadmin - * @date 2023/11/11 22:56 - */ - public function sceneAdd() - { - return $this->remove('id',true); - } - - - /** - * @notes 编辑场景 - * @return CustomContactsValidate - * @author likeadmin - * @date 2023/11/11 22:56 - */ - public function sceneEdit() - {} - - - /** - * @notes 删除场景 - * @return CustomContactsValidate - * @author likeadmin - * @date 2023/11/11 22:56 - */ - public function sceneDelete() - { - return $this->only(['id']); - } - - - /** - * @notes 详情场景 - * @return CustomContactsValidate - * @author likeadmin - * @date 2023/11/11 22:56 - */ - public function sceneDetail() - { - return $this->only(['id']); - } + namespace app\adminapi\validate\custom; - public function checkCustom($value): bool|string + use app\common\model\custom\Custom; + use app\common\model\custom\CustomContacts; + use app\common\validate\BaseValidate; + + + /** + * CustomContacts验证器 + * Class CustomContactsValidate + * @package app\adminapi\validate\custom + */ + class CustomContactsValidate extends BaseValidate { - $custom = Custom::where('id',$value)->findOrEmpty(); - if($custom->isEmpty()){ - return '客户信息不存在'; + + /** + * 设置校验规则 + * @var string[] + */ + protected $rule = [ + 'id' => 'require', + 'custom_id' => 'require|checkCustom', + 'name' => 'require', + 'phone' => 'mobile|unique:' . CustomContacts::class, + 'email' => 'email', + 'annex' => 'checkAnnex', + ]; + + protected $field = [ + 'id' => '数据id', + 'custom_id' => '客户id', + 'name' => '姓名', + 'phone' => '手机', + 'email' => '邮箱', + ]; + + /** + * @notes 添加场景 + * @return CustomContactsValidate + * @author likeadmin + * @date 2023/11/11 22:56 + */ + public function sceneAdd() + { + return $this->remove('id', true); } - return true; - } - -} \ No newline at end of file + + + /** + * @notes 编辑场景 + * @return CustomContactsValidate + * @author likeadmin + * @date 2023/11/11 22:56 + */ + public function sceneEdit() + { + } + + + /** + * @notes 删除场景 + * @return CustomContactsValidate + * @author likeadmin + * @date 2023/11/11 22:56 + */ + public function sceneDelete() + { + return $this->only(['id'])->remove('id', 'checkData'); + } + + + /** + * @notes 详情场景 + * @return CustomContactsValidate + * @author likeadmin + * @date 2023/11/11 22:56 + */ + public function sceneDetail() + { + return $this->only(['id']); + } + + public function checkCustom($value): bool|string + { + $custom = Custom::where('id', $value)->findOrEmpty(); + if ($custom->isEmpty()) { + return '客户信息不存在'; + } + return true; + } + + } \ No newline at end of file diff --git a/app/adminapi/validate/custom/CustomFollowValidate.php b/app/adminapi/validate/custom/CustomFollowValidate.php index 4403db4f2..cb216c1e8 100644 --- a/app/adminapi/validate/custom/CustomFollowValidate.php +++ b/app/adminapi/validate/custom/CustomFollowValidate.php @@ -1,113 +1,115 @@ 'require', - 'name' => 'require', - 'custom_id' => 'require|checkCustom', - 'date' => 'require|dateFormat:Y-m-d', - 'types' => 'require|checkTypes', - 'next_follow_date' => 'dateFormat:Y-m-d|checkNext', - 'annex' => 'checkAnnex', - ]; - protected $field = [ - 'id' => '数据id', - 'name' => '主题', - 'custom_id' => '客户id', - 'date' => '日期', - 'types' => '类型', - 'next_follow_date' => '下次回访日期', - ]; - - /** - * @notes 添加场景 - * @return CustomFollowValidate - * @author likeadmin - * @date 2023/11/12 13:40 - */ - public function sceneAdd() - { - return $this->remove('id', true); - } - - - /** - * @notes 编辑场景 - * @return CustomFollowValidate - * @author likeadmin - * @date 2023/11/12 13:40 - */ - public function sceneEdit() - {} - - - /** - * @notes 删除场景 - * @return CustomFollowValidate - * @author likeadmin - * @date 2023/11/12 13:40 - */ - public function sceneDelete() - { - return $this->only(['id']); - } - - - /** - * @notes 详情场景 - * @return CustomFollowValidate - * @author likeadmin - * @date 2023/11/12 13:40 - */ - public function sceneDetail() - { - return $this->only(['id']); - } + namespace app\adminapi\validate\custom; - public function checkCustom($value): bool|string + use app\common\model\custom\Custom; + use app\common\model\dict\DictData; + use app\common\validate\BaseValidate; + + + /** + * CustomFollow验证器 + * Class CustomFollowValidate + * @package app\adminapi\validate\custom_follow + */ + class CustomFollowValidate extends BaseValidate { - $custom = Custom::where('id',$value)->findOrEmpty(); - if($custom->isEmpty()){ - return '客户信息不存在'; + + /** + * 设置校验规则 + * @var string[] + */ + protected $rule = [ + 'id' => 'require', + 'name' => 'require', + 'custom_id' => 'require|checkCustom', + 'date' => 'require|dateFormat:Y-m-d', + 'types' => 'require|checkTypes', + 'next_follow_date' => 'dateFormat:Y-m-d|checkNext', + 'annex' => 'checkAnnex', + ]; + + protected $field = [ + 'id' => '数据id', + 'name' => '主题', + 'custom_id' => '客户id', + 'date' => '日期', + 'types' => '类型', + 'next_follow_date' => '下次回访日期', + ]; + + /** + * @notes 添加场景 + * @return CustomFollowValidate + * @author likeadmin + * @date 2023/11/12 13:40 + */ + public function sceneAdd() + { + return $this->remove('id', true); } - return true; - } - - public function checkTypes($value): bool|string - { - $dictData = DictData::where('type_value','custom_follow_type')->column('value'); - if(!in_array($value,$dictData)){ - return '类型无效'; + + + /** + * @notes 编辑场景 + * @return CustomFollowValidate + * @author likeadmin + * @date 2023/11/12 13:40 + */ + public function sceneEdit() + { } - return true; - } - - public function checkNext($value,$rule,$data): bool|string - { - if(!empty($value)){ - if(strtotime($value) - strtotime($data['date']) <=0){ - return '下次回访日期不能小于上面选择的日期'; + + + /** + * @notes 删除场景 + * @return CustomFollowValidate + * @author likeadmin + * @date 2023/11/12 13:40 + */ + public function sceneDelete() + { + return $this->only(['id'])->remove('id', 'checkData'); + } + + + /** + * @notes 详情场景 + * @return CustomFollowValidate + * @author likeadmin + * @date 2023/11/12 13:40 + */ + public function sceneDetail() + { + return $this->only(['id']); + } + + public function checkCustom($value): bool|string + { + $custom = Custom::where('id', $value)->findOrEmpty(); + if ($custom->isEmpty()) { + return '客户信息不存在'; } + return true; } - return true; - } - -} \ No newline at end of file + + public function checkTypes($value): bool|string + { + $dictData = DictData::where('type_value', 'custom_follow_type')->column('value'); + if (!in_array($value, $dictData)) { + return '类型无效'; + } + return true; + } + + public function checkNext($value, $rule, $data): bool|string + { + if (!empty($value)) { + if (strtotime($value) - strtotime($data['date']) <= 0) { + return '下次回访日期不能小于上面选择的日期'; + } + } + return true; + } + + } \ No newline at end of file diff --git a/app/adminapi/validate/custom/CustomServiceValidate.php b/app/adminapi/validate/custom/CustomServiceValidate.php index bcb9dbdfa..5a7b939ac 100644 --- a/app/adminapi/validate/custom/CustomServiceValidate.php +++ b/app/adminapi/validate/custom/CustomServiceValidate.php @@ -1,178 +1,179 @@ 'require', - 'project_id' => 'require|checkProject', - 'contract_id' => 'require|checkContract', - 'date' => 'require|dateFormat:Y-m-d', - 'classification' => 'require|checkClassify', - 'urgency' => 'require|checkUrgency', - 'receiver' => 'require', - 'processed_user' => 'require|checkProUser', - 'name' => 'require', - 'annex' => 'checkAnnex', - 'processing_result' => 'require|checkProRes', - 'processing_hours' => 'require|float|egt:0', - 'done_date' => 'require|dateFormat:Y-m-d', - 'score' => 'require|integer|egt:0', - 'is_solve' => 'require|in:0,1', - ]; - - protected $field = [ - 'id' => '数据id', - 'project_id' => '项目id', - 'contract_id' => '合同id', - 'date' => '日期', - 'classification' => '分类', - 'urgency' => '紧急程度', - 'receiver' => '接待人', - 'processed_user' => '指定处理人', - 'name' => '投诉主题', - 'processing_result' => '处理结果', - 'processing_hours' => '花费工时', - 'done_date' => '完成日期', - 'score' => '客户评分', - 'is_solve' => '是否解决', - ]; - - - /** - * @notes 添加场景 - * @return CustomServiceValidate - * @author likeadmin - * @date 2023/11/12 14:00 - */ - public function sceneAdd() - { - return $this->remove('id',true) - ->remove('processing_result',true) - ->remove('processing_hours',true) - ->remove('done_date',true) - ->remove('score',true)->remove('is_solve',true); - } + + namespace app\adminapi\validate\custom; + + use app\common\model\auth\Admin; + use app\common\model\contract\Contract; + use app\common\model\dict\DictData; + use app\common\model\project\Project; + use app\common\validate\BaseValidate; + /** - * @notes 编辑场景 - * @return CustomServiceValidate - * @author likeadmin - * @date 2023/11/12 14:00 + * CustomService验证器 + * Class CustomServiceValidate + * @package app\adminapi\validate\custom_service */ - public function sceneEdit() + class CustomServiceValidate extends BaseValidate { - return $this->remove('processing_result',true) - ->remove('processing_hours',true) - ->remove('done_date',true) - ->remove('score',true)->remove('is_solve',true); - } - - - /** - * @notes 处理场景 - * @return CustomServiceValidate - * @author likeadmin - * @date 2023/11/12 14:00 - */ - public function sceneCheck() - { - return $this->only(['id','processing_result','processing_hours','done_date','score','is_solve']); - } - - - /** - * @notes 删除场景 - * @return CustomServiceValidate - * @author likeadmin - * @date 2023/11/12 14:00 - */ - public function sceneDelete() - { - return $this->only(['id']); - } - - - /** - * @notes 详情场景 - * @return CustomServiceValidate - * @author likeadmin - * @date 2023/11/12 14:00 - */ - public function sceneDetail() - { - return $this->only(['id']); - } - - public function checkProject($value): bool|string - { - $project = Project::where('id',$value)->findOrEmpty(); - if($project->isEmpty()){ - return '项目不存在'; + + /** + * 设置校验规则 + * @var string[] + */ + protected $rule = [ + 'id' => 'require', + 'project_id' => 'require|checkProject', + 'contract_id' => 'require|checkContract', + 'date' => 'require|dateFormat:Y-m-d', + 'classification' => 'require|checkClassify', + 'urgency' => 'require|checkUrgency', + 'receiver' => 'require', + 'processed_user' => 'require|checkProUser', + 'name' => 'require', + 'annex' => 'checkAnnex', + 'processing_result' => 'require|checkProRes', + 'processing_hours' => 'require|float|egt:0', + 'done_date' => 'require|dateFormat:Y-m-d', + 'score' => 'require|integer|egt:0', + 'is_solve' => 'require|in:0,1', + ]; + + protected $field = [ + 'id' => '数据id', + 'project_id' => '项目id', + 'contract_id' => '合同id', + 'date' => '日期', + 'classification' => '分类', + 'urgency' => '紧急程度', + 'receiver' => '接待人', + 'processed_user' => '指定处理人', + 'name' => '投诉主题', + 'processing_result' => '处理结果', + 'processing_hours' => '花费工时', + 'done_date' => '完成日期', + 'score' => '客户评分', + 'is_solve' => '是否解决', + ]; + + + /** + * @notes 添加场景 + * @return CustomServiceValidate + * @author likeadmin + * @date 2023/11/12 14:00 + */ + public function sceneAdd() + { + return $this->remove('id', true) + ->remove('processing_result', true) + ->remove('processing_hours', true) + ->remove('done_date', true) + ->remove('score', true)->remove('is_solve', true); } - return true; - } - - public function checkContract($value,$rule,$params): bool|string - { - $contract = Contract::where('id',$value)->where('project_id',$params['project_id'])->findOrEmpty(); - if($contract->isEmpty()){ - return '项目合同不存在'; + + /** + * @notes 编辑场景 + * @return CustomServiceValidate + * @author likeadmin + * @date 2023/11/12 14:00 + */ + public function sceneEdit() + { + return $this->remove('processing_result', true) + ->remove('processing_hours', true) + ->remove('done_date', true) + ->remove('score', true)->remove('is_solve', true); } - return true; - } - - public function checkClassify($value): bool|string - { - $dictData = DictData::where('type_value','classification')->column('value'); - if(!in_array($value,$dictData)){ - return '分类无效'; + + + /** + * @notes 处理场景 + * @return CustomServiceValidate + * @author likeadmin + * @date 2023/11/12 14:00 + */ + public function sceneCheck() + { + return $this->only(['id', 'processing_result', 'processing_hours', 'done_date', 'score', 'is_solve']); } - return true; - } - - public function checkUrgency($value): bool|string - { - $dictData = DictData::where('type_value','urgency')->column('value'); - if(!in_array($value,$dictData)){ - return '紧急程度无效'; + + + /** + * @notes 删除场景 + * @return CustomServiceValidate + * @author likeadmin + * @date 2023/11/12 14:00 + */ + public function sceneDelete() + { + return $this->only(['id'])->remove('id', 'checkData'); } - return true; - } - - public function checkProUser($value): bool|string - { - $admin = Admin::where('id',$value)->findOrEmpty(); - if($admin->isEmpty()){ - return '指定处理人不存在'; + + + /** + * @notes 详情场景 + * @return CustomServiceValidate + * @author likeadmin + * @date 2023/11/12 14:00 + */ + public function sceneDetail() + { + return $this->only(['id']); } - return true; - } - - public function checkProRes($value): bool|string - { - $dictData = DictData::where('type_value','custom_service_solve_result')->column('value'); - if(!in_array($value,$dictData)){ - return '处理结果无效'; + + public function checkProject($value): bool|string + { + $project = Project::where('id', $value)->findOrEmpty(); + if ($project->isEmpty()) { + return '项目不存在'; + } + return true; } - return true; - } - -} \ No newline at end of file + + public function checkContract($value, $rule, $params): bool|string + { + $contract = Contract::where('id', $value)->where('project_id', $params['project_id'])->findOrEmpty(); + if ($contract->isEmpty()) { + return '项目合同不存在'; + } + return true; + } + + public function checkClassify($value): bool|string + { + $dictData = DictData::where('type_value', 'classification')->column('value'); + if (!in_array($value, $dictData)) { + return '分类无效'; + } + return true; + } + + public function checkUrgency($value): bool|string + { + $dictData = DictData::where('type_value', 'urgency')->column('value'); + if (!in_array($value, $dictData)) { + return '紧急程度无效'; + } + return true; + } + + public function checkProUser($value): bool|string + { + $admin = Admin::where('id', $value)->findOrEmpty(); + if ($admin->isEmpty()) { + return '指定处理人不存在'; + } + return true; + } + + public function checkProRes($value): bool|string + { + $dictData = DictData::where('type_value', 'custom_service_solve_result')->column('value'); + if (!in_array($value, $dictData)) { + return '处理结果无效'; + } + return true; + } + + } \ No newline at end of file diff --git a/app/adminapi/validate/custom/CustomValidate.php b/app/adminapi/validate/custom/CustomValidate.php index b39eca607..3bad311aa 100644 --- a/app/adminapi/validate/custom/CustomValidate.php +++ b/app/adminapi/validate/custom/CustomValidate.php @@ -1,149 +1,150 @@ 'require', - 'org_id' => 'require|checkOrg', - 'dept_id' => 'require|checkDept', - 'name' => 'require|unique:'.Custom::class, - 'custom_type' => 'require|checkType', - 'phone' => 'require', - 'credit_rating' => 'require|checkRat', - 'master_name' => 'require', - 'master_phone' => 'mobile', - 'master_email' => 'email', - 'other_contacts' => 'checkContacts' - ]; - protected $field = [ - 'id' => '数据id', - 'org_id' => '组织id', - 'dept_id' => '部门id', - 'name' => '客户名称', - 'custom_type' => '客户属性', - 'phone' => '电话', - 'credit_rating' => '信用度', - 'master_name' => '主要负责人姓名', - 'master_phone' => '主要负责人手机', - 'master_email' => '主要负责人邮箱', - ]; + namespace app\adminapi\validate\custom; - /** - * @notes 添加场景 - * @return CustomValidate - * @author likeadmin - * @date 2023/11/11 22:10 - */ - public function sceneAdd() - { - return $this->remove('id', true); - } - - - /** - * @notes 编辑场景 - * @return CustomValidate - * @author likeadmin - * @date 2023/11/11 22:10 - */ - public function sceneEdit() - { - return $this->remove('other_contacts',true); - } - - - /** - * @notes 删除场景 - * @return CustomValidate - * @author likeadmin - * @date 2023/11/11 22:10 - */ - public function sceneDelete() - { - return $this->only(['id']); - } - - - /** - * @notes 详情场景 - * @return CustomValidate - * @author likeadmin - * @date 2023/11/11 22:10 - */ - public function sceneDetail() - { - return $this->only(['id']); - } + use app\common\model\custom\Custom; + use app\common\model\dept\Dept; + use app\common\model\dept\Orgs; + use app\common\model\dict\DictData; + use app\common\validate\BaseValidate; - public function checkOrg($value): bool|string + + /** + * Custom验证器 + * Class CustomValidate + * @package app\adminapi\validate\custom + */ + class CustomValidate extends BaseValidate { - $org = Orgs::where('id',$value)->findOrEmpty(); - if($org->isEmpty()){ - return '组织信息不存在'; + + /** + * 设置校验规则 + * @var string[] + */ + protected $rule = [ + 'id' => 'require', + 'org_id' => 'require|checkOrg', + 'dept_id' => 'require|checkDept', + 'name' => 'require|unique:' . Custom::class, + 'custom_type' => 'require|checkType', + 'phone' => 'require', + 'credit_rating' => 'require|checkRat', + 'master_name' => 'require', + 'master_phone' => 'mobile', + 'master_email' => 'email', + 'other_contacts' => 'checkContacts' + ]; + + protected $field = [ + 'id' => '数据id', + 'org_id' => '组织id', + 'dept_id' => '部门id', + 'name' => '客户名称', + 'custom_type' => '客户属性', + 'phone' => '电话', + 'credit_rating' => '信用度', + 'master_name' => '主要负责人姓名', + 'master_phone' => '主要负责人手机', + 'master_email' => '主要负责人邮箱', + ]; + + /** + * @notes 添加场景 + * @return CustomValidate + * @author likeadmin + * @date 2023/11/11 22:10 + */ + public function sceneAdd() + { + return $this->remove('id', true); } - return true; - } - - public function checkDept($value,$rule,$params): bool|string - { - $dept = Dept::where('id',$value)->where('org_id',$params['org_id'])->findOrEmpty(); - if($dept->isEmpty()){ - return '部门信息不存在'; + + + /** + * @notes 编辑场景 + * @return CustomValidate + * @author likeadmin + * @date 2023/11/11 22:10 + */ + public function sceneEdit() + { + return $this->remove('other_contacts', true); } - return true; - } - - public function checkType($value): bool|string - { - $dictData = DictData::where('type_value','custom_type')->column('value'); - if(!in_array($value,$dictData)){ - return '客户属性无效'; + + + /** + * @notes 删除场景 + * @return CustomValidate + * @author likeadmin + * @date 2023/11/11 22:10 + */ + public function sceneDelete() + { + return $this->only(['id'])->remove('id', 'checkData'); } - return true; - } - - public function checkRat($value): bool|string - { - $dictData = DictData::where('type_value','credit_rating')->column('value'); - if(!in_array($value,$dictData)){ - return '信用度无效'; + + + /** + * @notes 详情场景 + * @return CustomValidate + * @author likeadmin + * @date 2023/11/11 22:10 + */ + public function sceneDetail() + { + return $this->only(['id']); } - return true; - } - - public function checkContacts($value): bool|string - { - if(empty($value) || !is_array($value)){ - return '其他联系人列表数据格式错误'; + + public function checkOrg($value): bool|string + { + $org = Orgs::where('id', $value)->findOrEmpty(); + if ($org->isEmpty()) { + return '组织信息不存在'; + } + return true; } - foreach($value as $k=>$v){ - if(empty($v['name'])) return '其他联系人列表第'.($k+1).'行姓名为空'; - if(isset($v['annex']) && $v['annex'] != ''){ - if(!is_array($v['annex'])){ - return '其他联系人列表第'.($k+1).'行附件格式错误'; + + public function checkDept($value, $rule, $params): bool|string + { + $dept = Dept::where('id', $value)->where('org_id', $params['org_id'])->findOrEmpty(); + if ($dept->isEmpty()) { + return '部门信息不存在'; + } + return true; + } + + public function checkType($value): bool|string + { + $dictData = DictData::where('type_value', 'custom_type')->column('value'); + if (!in_array($value, $dictData)) { + return '客户属性无效'; + } + return true; + } + + public function checkRat($value): bool|string + { + $dictData = DictData::where('type_value', 'credit_rating')->column('value'); + if (!in_array($value, $dictData)) { + return '信用度无效'; + } + return true; + } + + public function checkContacts($value): bool|string + { + if (empty($value) || !is_array($value)) { + return '其他联系人列表数据格式错误'; + } + foreach ($value as $k => $v) { + if (empty($v['name'])) return '其他联系人列表第' . ($k + 1) . '行姓名为空'; + if (isset($v['annex']) && $v['annex'] != '') { + if (!is_array($v['annex'])) { + return '其他联系人列表第' . ($k + 1) . '行附件格式错误'; + } } } + return true; } - return true; - } - -} \ No newline at end of file + + } \ No newline at end of file diff --git a/app/adminapi/validate/custom/CustomerDemandSolutionValidate.php b/app/adminapi/validate/custom/CustomerDemandSolutionValidate.php index c6937eed6..d123c8daa 100644 --- a/app/adminapi/validate/custom/CustomerDemandSolutionValidate.php +++ b/app/adminapi/validate/custom/CustomerDemandSolutionValidate.php @@ -11,110 +11,111 @@ // +---------------------------------------------------------------------- // | author: likeadminTeam // +---------------------------------------------------------------------- - -namespace app\adminapi\validate\custom; - - -use app\common\model\custom\CustomerDemand; -use app\common\model\project\Project; -use app\common\validate\BaseValidate; - - -/** - * 解决方案验证器 - * Class CustomerDemandSolutionValidate - * @package app\adminapi\validate\custom - */ -class CustomerDemandSolutionValidate extends BaseValidate -{ - - /** - * 设置校验规则 - * @var string[] - */ - protected $rule = [ - 'id' => 'require', - 'project_id' => 'require|checkProject', - 'customer_demand_id' => 'require|checkCustomerDemand', - 'theme' => 'require', - 'submission_time' => 'require|dateFormat:Y-m-d', - 'annex' => 'checkAnnex', - ]; - protected $message = [ - 'id.require' => '缺少必要参数', - 'project_id.require' => '请选择项目', - 'customer_demand_id.require' => '请选择客户需求', - 'theme.require' => '请填写需求主题', - 'submission_time.require' => '请选择提交时间', - 'submission_time.dateFormat' => '提交时间数据格式错误', - ]; + namespace app\adminapi\validate\custom; - - /** - * @notes 添加场景 - * @return CustomerDemandSolutionValidate - * @author likeadmin - * @date 2023/11/24 21:32 - */ - public function sceneAdd() - { - return $this->remove('id', true); - } - - - /** - * @notes 编辑场景 - * @return CustomerDemandSolutionValidate - * @author likeadmin - * @date 2023/11/24 21:32 - */ - public function sceneEdit() - {} - - - /** - * @notes 删除场景 - * @return CustomerDemandSolutionValidate - * @author likeadmin - * @date 2023/11/24 21:32 - */ - public function sceneDelete() - { - return $this->only(['id']); - } - - - /** - * @notes 详情场景 - * @return CustomerDemandSolutionValidate - * @author likeadmin - * @date 2023/11/24 21:32 - */ - public function sceneDetail() - { - return $this->only(['id']); - } - public function checkProject($value): bool|string + use app\common\model\custom\CustomerDemand; + use app\common\model\project\Project; + use app\common\validate\BaseValidate; + + + /** + * 解决方案验证器 + * Class CustomerDemandSolutionValidate + * @package app\adminapi\validate\custom + */ + class CustomerDemandSolutionValidate extends BaseValidate { - $project = Project::where('id',$value)->findOrEmpty(); - if($project->isEmpty()){ - return '项目不存在'; + + /** + * 设置校验规则 + * @var string[] + */ + protected $rule = [ + 'id' => 'require', + 'project_id' => 'require|checkProject', + 'customer_demand_id' => 'require|checkCustomerDemand', + 'theme' => 'require', + 'submission_time' => 'require|dateFormat:Y-m-d', + 'annex' => 'checkAnnex', + ]; + + protected $message = [ + 'id.require' => '缺少必要参数', + 'project_id.require' => '请选择项目', + 'customer_demand_id.require' => '请选择客户需求', + 'theme.require' => '请填写需求主题', + 'submission_time.require' => '请选择提交时间', + 'submission_time.dateFormat' => '提交时间数据格式错误', + ]; + + + /** + * @notes 添加场景 + * @return CustomerDemandSolutionValidate + * @author likeadmin + * @date 2023/11/24 21:32 + */ + public function sceneAdd() + { + return $this->remove('id', true); } - return true; - } - - public function checkCustomerDemand($value,$rule,$data): bool|string - { - $customDemand = CustomerDemand::where('id',$value)->findOrEmpty(); - if($customDemand->isEmpty()){ - return '客户需求不存在'; + + + /** + * @notes 编辑场景 + * @return CustomerDemandSolutionValidate + * @author likeadmin + * @date 2023/11/24 21:32 + */ + public function sceneEdit() + { } - if($customDemand['project_id'] != $data['project_id']){ - return '客户需求与项目信息不一致'; + + + /** + * @notes 删除场景 + * @return CustomerDemandSolutionValidate + * @author likeadmin + * @date 2023/11/24 21:32 + */ + public function sceneDelete() + { + return $this->only(['id'])->remove('id', 'checkData'); } - return true; - } - -} \ No newline at end of file + + + /** + * @notes 详情场景 + * @return CustomerDemandSolutionValidate + * @author likeadmin + * @date 2023/11/24 21:32 + */ + public function sceneDetail() + { + return $this->only(['id']); + } + + public function checkProject($value): bool|string + { + $project = Project::where('id', $value)->findOrEmpty(); + if ($project->isEmpty()) { + return '项目不存在'; + } + return true; + } + + public function checkCustomerDemand($value, $rule, $data): bool|string + { + $customDemand = CustomerDemand::where('id', $value)->findOrEmpty(); + if ($customDemand->isEmpty()) { + return '客户需求不存在'; + } + if ($customDemand['project_id'] != $data['project_id']) { + return '客户需求与项目信息不一致'; + } + return true; + } + + } \ No newline at end of file diff --git a/app/adminapi/validate/custom/CustomerDemandValidate.php b/app/adminapi/validate/custom/CustomerDemandValidate.php index 29a90b4fe..10fed5392 100644 --- a/app/adminapi/validate/custom/CustomerDemandValidate.php +++ b/app/adminapi/validate/custom/CustomerDemandValidate.php @@ -11,104 +11,105 @@ // +---------------------------------------------------------------------- // | author: likeadminTeam // +---------------------------------------------------------------------- - -namespace app\adminapi\validate\custom; - -use app\common\model\dict\DictData; -use app\common\model\project\Project; -use app\common\validate\BaseValidate; - - -/** - * 客户需求验证器 - * Class CustomerDemandValidate - * @package app\adminapi\validate\custom - */ -class CustomerDemandValidate extends BaseValidate -{ - - /** - * 设置校验规则 - * @var string[] - */ - protected $rule = [ - 'id' => 'require', - 'project_id' => 'require|checkProject', - 'theme' => 'require', - 'importance' => 'require|checkImportance', - 'recording_time' => 'require|dateFormat:Y-m-d', - 'annex' => 'checkAnnex' - ]; - protected $message = [ - 'id.require' => '缺少必要参数', - 'project_id.require' => '请选择项目', - 'theme.require' => '请填写需求主题', - 'importance.require' => '请选择重要程度', - 'recording_time.require' => '请选择记录时间', - 'recording_time.dateFormat' => '记录时间数据格式错误', - ]; - - /** - * @notes 添加场景 - * @return CustomerDemandValidate - * @author likeadmin - * @date 2023/11/24 21:18 - */ - public function sceneAdd() - { - return $this->remove('id', true); - } - - - /** - * @notes 编辑场景 - * @return CustomerDemandValidate - * @author likeadmin - * @date 2023/11/24 21:18 - */ - public function sceneEdit() - {} - - - /** - * @notes 删除场景 - * @return CustomerDemandValidate - * @author likeadmin - * @date 2023/11/24 21:18 - */ - public function sceneDelete() - { - return $this->only(['id']); - } - - - /** - * @notes 详情场景 - * @return CustomerDemandValidate - * @author likeadmin - * @date 2023/11/24 21:18 - */ - public function sceneDetail() - { - return $this->only(['id']); - } + namespace app\adminapi\validate\custom; - public function checkProject($value): bool|string + use app\common\model\dict\DictData; + use app\common\model\project\Project; + use app\common\validate\BaseValidate; + + + /** + * 客户需求验证器 + * Class CustomerDemandValidate + * @package app\adminapi\validate\custom + */ + class CustomerDemandValidate extends BaseValidate { - $project = Project::where('id',$value)->findOrEmpty(); - if($project->isEmpty()){ - return '项目不存在'; + + /** + * 设置校验规则 + * @var string[] + */ + protected $rule = [ + 'id' => 'require', + 'project_id' => 'require|checkProject', + 'theme' => 'require', + 'importance' => 'require|checkImportance', + 'recording_time' => 'require|dateFormat:Y-m-d', + 'annex' => 'checkAnnex' + ]; + + protected $message = [ + 'id.require' => '缺少必要参数', + 'project_id.require' => '请选择项目', + 'theme.require' => '请填写需求主题', + 'importance.require' => '请选择重要程度', + 'recording_time.require' => '请选择记录时间', + 'recording_time.dateFormat' => '记录时间数据格式错误', + ]; + + /** + * @notes 添加场景 + * @return CustomerDemandValidate + * @author likeadmin + * @date 2023/11/24 21:18 + */ + public function sceneAdd() + { + return $this->remove('id', true); } - return true; - } - - public function checkImportance($value): bool|string - { - $dictData = DictData::where('type_value','importance')->column('value'); - if(!in_array($value,$dictData)){ - return '类型无效'; + + + /** + * @notes 编辑场景 + * @return CustomerDemandValidate + * @author likeadmin + * @date 2023/11/24 21:18 + */ + public function sceneEdit() + { } - return true; - } -} \ No newline at end of file + + + /** + * @notes 删除场景 + * @return CustomerDemandValidate + * @author likeadmin + * @date 2023/11/24 21:18 + */ + public function sceneDelete() + { + return $this->only(['id'])->remove('id', 'checkData'); + } + + + /** + * @notes 详情场景 + * @return CustomerDemandValidate + * @author likeadmin + * @date 2023/11/24 21:18 + */ + public function sceneDetail() + { + return $this->only(['id']); + } + + public function checkProject($value): bool|string + { + $project = Project::where('id', $value)->findOrEmpty(); + if ($project->isEmpty()) { + return '项目不存在'; + } + return true; + } + + public function checkImportance($value): bool|string + { + $dictData = DictData::where('type_value', 'importance')->column('value'); + if (!in_array($value, $dictData)) { + return '类型无效'; + } + return true; + } + } \ No newline at end of file diff --git a/app/adminapi/validate/dept/JobsValidate.php b/app/adminapi/validate/dept/JobsValidate.php index a020685a8..9767783a2 100755 --- a/app/adminapi/validate/dept/JobsValidate.php +++ b/app/adminapi/validate/dept/JobsValidate.php @@ -11,130 +11,128 @@ // +---------------------------------------------------------------------- // | author: likeadminTeam // +---------------------------------------------------------------------- - -namespace app\adminapi\validate\dept; - - -use app\common\model\auth\Admin; -use app\common\model\auth\AdminJobs; -use app\common\model\dept\Dept; -use app\common\model\dept\Jobs; -use app\common\validate\BaseValidate; - - - -/** - * 岗位验证 - * Class JobsValidate - * @package app\adminapi\validate\dept - */ -class JobsValidate extends BaseValidate -{ - protected $rule = [ - 'id' => 'require|checkJobs', - 'dept_id' => 'require|checkDept', - 'name' => 'require|length:1,50', - 'status' => 'require|in:0,1', - 'sort' => 'egt:0', - ]; - - protected $message = [ - 'id.require' => '参数缺失', - 'dept_id.require' => '请选择部门', - 'name.require' => '请填写岗位名称', - 'name.length' => '岗位名称长度须在1-50位字符', - 'status.require' => '请选择岗位状态', - 'status.in' => '岗位状态值错误', - 'sort.egt' => '排序值不正确', - ]; - - - /** - * @notes 添加场景 - * @return JobsValidate - * @author 段誉 - * @date 2022/5/26 9:53 - */ - public function sceneAdd() - { - return $this->remove('id', true)->append('name','checkUniqueByAdd'); - } - - - /** - * @notes 详情场景 - * @return JobsValidate - * @author 段誉 - * @date 2022/5/26 9:53 - */ - public function sceneDetail() - { - return $this->only(['id']); - } - - - public function sceneEdit() - { - return $this->append('name','checkUniqueByEdit'); - } - - - /** - * @notes 删除场景 - * @return JobsValidate - * @author 段誉 - * @date 2022/5/26 9:54 - */ - public function sceneDelete() - { - return $this->only(['id']); - } - //验证部门 - public function checkDept($value): bool|string + namespace app\adminapi\validate\dept; + + + use app\common\model\auth\AdminJobs; + use app\common\model\dept\Dept; + use app\common\model\dept\Jobs; + use app\common\validate\BaseValidate; + + + /** + * 岗位验证 + * Class JobsValidate + * @package app\adminapi\validate\dept + */ + class JobsValidate extends BaseValidate { - $dept = Dept::findOrEmpty($value); - if ($dept->isEmpty()) { - return '部门不存在'; + protected $rule = [ + 'id' => 'require|checkJobs', + 'dept_id' => 'require|checkDept', + 'name' => 'require|length:1,50', + 'status' => 'require|in:0,1', + 'sort' => 'egt:0', + ]; + + protected $message = [ + 'id.require' => '参数缺失', + 'dept_id.require' => '请选择部门', + 'name.require' => '请填写岗位名称', + 'name.length' => '岗位名称长度须在1-50位字符', + 'status.require' => '请选择岗位状态', + 'status.in' => '岗位状态值错误', + 'sort.egt' => '排序值不正确', + ]; + + + /** + * @notes 添加场景 + * @return JobsValidate + * @author 段誉 + * @date 2022/5/26 9:53 + */ + public function sceneAdd() + { + return $this->remove('id', true)->append('name', 'checkUniqueByAdd'); } - return true; - } - - - /** - * @notes 校验岗位 - * @param $value - * @return bool|string - * @author 段誉 - * @date 2022/5/26 9:55 - */ - public function checkJobs($value) - { - $jobs = Jobs::findOrEmpty($value); - if ($jobs->isEmpty()) { - return '岗位不存在'; - } - return true; - } - - //验证唯一 - public function checkUniqueByAdd($value,$rule,$data): bool|string - { - $jobs = Jobs::where('dept_id',$data['dept_id'])->where('name',$data['name'])->findOrEmpty(); - if(!$jobs->isEmpty()){ - return '岗位已存在'; + + + /** + * @notes 详情场景 + * @return JobsValidate + * @author 段誉 + * @date 2022/5/26 9:53 + */ + public function sceneDetail() + { + return $this->only(['id']); } - return true; - } - - public function checkUniqueByEdit($value,$rule,$data): bool|string - { - $jobs = Jobs::where('dept_id',$data['dept_id'])->where('name',$data['name'])->where('id','<>',$data['id'])->findOrEmpty(); - if(!$jobs->isEmpty()){ - return '岗位已存在'; + + + public function sceneEdit() + { + return $this->append('name', 'checkUniqueByEdit'); } - return true; - } - - -} \ No newline at end of file + + + /** + * @notes 删除场景 + * @return JobsValidate + * @author 段誉 + * @date 2022/5/26 9:54 + */ + public function sceneDelete() + { + return $this->only(['id'])->remove('id', 'checkData'); + } + + //验证部门 + public function checkDept($value): bool|string + { + $dept = Dept::findOrEmpty($value); + if ($dept->isEmpty()) { + return '部门不存在'; + } + return true; + } + + + /** + * @notes 校验岗位 + * @param $value + * @return bool|string + * @author 段誉 + * @date 2022/5/26 9:55 + */ + public function checkJobs($value) + { + $jobs = Jobs::findOrEmpty($value); + if ($jobs->isEmpty()) { + return '岗位不存在'; + } + return true; + } + + //验证唯一 + public function checkUniqueByAdd($value, $rule, $data): bool|string + { + $jobs = Jobs::where('dept_id', $data['dept_id'])->where('name', $data['name'])->findOrEmpty(); + if (!$jobs->isEmpty()) { + return '岗位已存在'; + } + return true; + } + + public function checkUniqueByEdit($value, $rule, $data): bool|string + { + $jobs = Jobs::where('dept_id', $data['dept_id'])->where('name', $data['name'])->where('id', '<>', $data['id'])->findOrEmpty(); + if (!$jobs->isEmpty()) { + return '岗位已存在'; + } + return true; + } + + + } \ No newline at end of file diff --git a/app/adminapi/validate/dept/OrgsValidate.php b/app/adminapi/validate/dept/OrgsValidate.php index a22698975..cfac038b3 100644 --- a/app/adminapi/validate/dept/OrgsValidate.php +++ b/app/adminapi/validate/dept/OrgsValidate.php @@ -11,110 +11,110 @@ // +---------------------------------------------------------------------- // | author: likeadminTeam // +---------------------------------------------------------------------- - -namespace app\adminapi\validate\dept; - - -use app\common\model\dept\Orgs; -use app\common\validate\BaseValidate; - - -/** - * Orgs验证器 - * Class OrgsValidate - * @package app\adminapi\validate - */ -class OrgsValidate extends BaseValidate -{ - - /** - * 设置校验规则 - * @var string[] - */ - protected $rule = [ - 'id' => 'require', - 'name' => 'require', - 'master' => 'require', - 'status' => 'require|integer|in:0,1', - ]; - - - /** - * 参数描述 - * @var string[] - */ - protected $field = [ - 'id' => 'id', - 'name' => '组织名称', - 'master' => '组织负责人', - 'status' => '组织状态', - ]; - - - /** - * @notes 添加场景 - * @return OrgsValidate - * @author likeadmin - * @date 2023/12/09 10:55 - */ - public function sceneAdd() - { - return $this->only(['name','master','status'])->append('name','checkUniqueByAdd'); - } - - - /** - * @notes 编辑场景 - * @return OrgsValidate - * @author likeadmin - * @date 2023/12/09 10:55 - */ - public function sceneEdit() - { - return $this->only(['id','name','master','status'])->append('name','checkUniqueByEdit'); - } - - - /** - * @notes 删除场景 - * @return OrgsValidate - * @author likeadmin - * @date 2023/12/09 10:55 - */ - public function sceneDelete() - { - return $this->only(['id']); - } - - - /** - * @notes 详情场景 - * @return OrgsValidate - * @author likeadmin - * @date 2023/12/09 10:55 - */ - public function sceneDetail() - { - return $this->only(['id']); - } - //验证唯一 - public function checkUniqueByAdd($value,$rule,$data): bool|string - { - $org = Orgs::where('name',$data['name'])->findOrEmpty(); - if(!$org->isEmpty()){ - return '组织已存在'; - } - return true; - } + namespace app\adminapi\validate\dept; - public function checkUniqueByEdit($value,$rule,$data): bool|string + + use app\common\model\dept\Orgs; + use app\common\validate\BaseValidate; + + + /** + * Orgs验证器 + * Class OrgsValidate + * @package app\adminapi\validate + */ + class OrgsValidate extends BaseValidate { - $org = Orgs::where('name',$data['name'])->where('id','<>',$data['id'])->findOrEmpty(); - if(!$org->isEmpty()){ - return '组织已存在'; + + /** + * 设置校验规则 + * @var string[] + */ + protected $rule = [ + 'id' => 'require', + 'name' => 'require', + 'master' => 'require', + 'status' => 'require|integer|in:0,1', + ]; + + + /** + * 参数描述 + * @var string[] + */ + protected $field = [ + 'id' => 'id', + 'name' => '组织名称', + 'master' => '组织负责人', + 'status' => '组织状态', + ]; + + + /** + * @notes 添加场景 + * @return OrgsValidate + * @author likeadmin + * @date 2023/12/09 10:55 + */ + public function sceneAdd() + { + return $this->only(['name', 'master', 'status'])->append('name', 'checkUniqueByAdd'); } - return true; - } - -} \ No newline at end of file + + + /** + * @notes 编辑场景 + * @return OrgsValidate + * @author likeadmin + * @date 2023/12/09 10:55 + */ + public function sceneEdit() + { + return $this->only(['id', 'name', 'master', 'status'])->append('name', 'checkUniqueByEdit'); + } + + + /** + * @notes 删除场景 + * @return OrgsValidate + * @author likeadmin + * @date 2023/12/09 10:55 + */ + public function sceneDelete() + { + return $this->only(['id'])->remove('id', 'checkData'); + } + + + /** + * @notes 详情场景 + * @return OrgsValidate + * @author likeadmin + * @date 2023/12/09 10:55 + */ + public function sceneDetail() + { + return $this->only(['id']); + } + + //验证唯一 + public function checkUniqueByAdd($value, $rule, $data): bool|string + { + $org = Orgs::where('name', $data['name'])->findOrEmpty(); + if (!$org->isEmpty()) { + return '组织已存在'; + } + return true; + } + + public function checkUniqueByEdit($value, $rule, $data): bool|string + { + $org = Orgs::where('name', $data['name'])->where('id', '<>', $data['id'])->findOrEmpty(); + if (!$org->isEmpty()) { + return '组织已存在'; + } + return true; + } + + } \ No newline at end of file diff --git a/app/adminapi/validate/expense/ExpenseReimbursementDetailValidate.php b/app/adminapi/validate/expense/ExpenseReimbursementDetailValidate.php index 70dc6bd0b..4c1afc90e 100644 --- a/app/adminapi/validate/expense/ExpenseReimbursementDetailValidate.php +++ b/app/adminapi/validate/expense/ExpenseReimbursementDetailValidate.php @@ -11,90 +11,90 @@ // +---------------------------------------------------------------------- // | author: likeadminTeam // +---------------------------------------------------------------------- - -namespace app\adminapi\validate\expense; - - -use app\common\validate\BaseValidate; - - -/** - * ExpenseReimbursementDetail验证器 - * Class ExpenseReimbursementDetailValidate - * @package app\adminapi\validate\expense - */ -class ExpenseReimbursementDetailValidate extends BaseValidate -{ - - /** - * 设置校验规则 - * @var string[] - */ - protected $rule = [ - 'id' => 'require', - 'expense_id' => 'require', - 'cost_subject_id' => 'require', - 'amount' => 'require', - ]; - - - /** - * 参数描述 - * @var string[] - */ - protected $field = [ - 'id' => 'id', - 'expense_id' => '报销id', - 'cost_subject_id' => '费用科目id', - 'amount' => '金额', - ]; - - - /** - * @notes 添加场景 - * @return ExpenseReimbursementDetailValidate - * @author likeadmin - * @date 2023/12/19 11:10 - */ - public function sceneAdd() - { - return $this->only(['expense_id','cost_subject_id','amount']); - } - - - /** - * @notes 编辑场景 - * @return ExpenseReimbursementDetailValidate - * @author likeadmin - * @date 2023/12/19 11:10 - */ - public function sceneEdit() - { - return $this->only(['id','expense_id','cost_subject_id','amount']); - } - - - /** - * @notes 删除场景 - * @return ExpenseReimbursementDetailValidate - * @author likeadmin - * @date 2023/12/19 11:10 - */ - public function sceneDelete() - { - return $this->only(['id']); - } - - - /** - * @notes 详情场景 - * @return ExpenseReimbursementDetailValidate - * @author likeadmin - * @date 2023/12/19 11:10 - */ - public function sceneDetail() - { - return $this->only(['id']); - } - -} \ No newline at end of file + + namespace app\adminapi\validate\expense; + + + use app\common\validate\BaseValidate; + + + /** + * ExpenseReimbursementDetail验证器 + * Class ExpenseReimbursementDetailValidate + * @package app\adminapi\validate\expense + */ + class ExpenseReimbursementDetailValidate extends BaseValidate + { + + /** + * 设置校验规则 + * @var string[] + */ + protected $rule = [ + 'id' => 'require', + 'expense_id' => 'require', + 'cost_subject_id' => 'require', + 'amount' => 'require', + ]; + + + /** + * 参数描述 + * @var string[] + */ + protected $field = [ + 'id' => 'id', + 'expense_id' => '报销id', + 'cost_subject_id' => '费用科目id', + 'amount' => '金额', + ]; + + + /** + * @notes 添加场景 + * @return ExpenseReimbursementDetailValidate + * @author likeadmin + * @date 2023/12/19 11:10 + */ + public function sceneAdd() + { + return $this->only(['expense_id', 'cost_subject_id', 'amount']); + } + + + /** + * @notes 编辑场景 + * @return ExpenseReimbursementDetailValidate + * @author likeadmin + * @date 2023/12/19 11:10 + */ + public function sceneEdit() + { + return $this->only(['id', 'expense_id', 'cost_subject_id', 'amount']); + } + + + /** + * @notes 删除场景 + * @return ExpenseReimbursementDetailValidate + * @author likeadmin + * @date 2023/12/19 11:10 + */ + public function sceneDelete() + { + return $this->only(['id'])->remove('id', 'checkData'); + } + + + /** + * @notes 详情场景 + * @return ExpenseReimbursementDetailValidate + * @author likeadmin + * @date 2023/12/19 11:10 + */ + public function sceneDetail() + { + return $this->only(['id']); + } + + } \ No newline at end of file diff --git a/app/adminapi/validate/expense/ExpenseReimbursementInvoiceDetailValidate.php b/app/adminapi/validate/expense/ExpenseReimbursementInvoiceDetailValidate.php index 3eb65d239..a5906fe6f 100644 --- a/app/adminapi/validate/expense/ExpenseReimbursementInvoiceDetailValidate.php +++ b/app/adminapi/validate/expense/ExpenseReimbursementInvoiceDetailValidate.php @@ -11,92 +11,92 @@ // +---------------------------------------------------------------------- // | author: likeadminTeam // +---------------------------------------------------------------------- - -namespace app\adminapi\validate\expense; - - -use app\common\validate\BaseValidate; - - -/** - * ExpenseReimbursementInvoiceDetail验证器 - * Class ExpenseReimbursementInvoiceDetailValidate - * @package app\adminapi\validate\expense - */ -class ExpenseReimbursementInvoiceDetailValidate extends BaseValidate -{ - - /** - * 设置校验规则 - * @var string[] - */ - protected $rule = [ - 'id' => 'require', - 'expense_id' => 'require', - 'invoice_type' => 'require', - 'invoice_sn' => 'require', - 'amount' => 'require', - ]; - - - /** - * 参数描述 - * @var string[] - */ - protected $field = [ - 'id' => 'id', - 'expense_id' => '报销id', - 'invoice_type' => '发票类型', - 'invoice_sn' => '发票号', - 'amount' => '发票金额', - ]; - - - /** - * @notes 添加场景 - * @return ExpenseReimbursementInvoiceDetailValidate - * @author likeadmin - * @date 2023/12/19 11:09 - */ - public function sceneAdd() - { - return $this->only(['expense_id','invoice_type','invoice_sn','amount']); - } - - - /** - * @notes 编辑场景 - * @return ExpenseReimbursementInvoiceDetailValidate - * @author likeadmin - * @date 2023/12/19 11:09 - */ - public function sceneEdit() - { - return $this->only(['id','expense_id','invoice_type','invoice_sn','amount']); - } - - - /** - * @notes 删除场景 - * @return ExpenseReimbursementInvoiceDetailValidate - * @author likeadmin - * @date 2023/12/19 11:09 - */ - public function sceneDelete() - { - return $this->only(['id']); - } - - - /** - * @notes 详情场景 - * @return ExpenseReimbursementInvoiceDetailValidate - * @author likeadmin - * @date 2023/12/19 11:09 - */ - public function sceneDetail() - { - return $this->only(['id']); - } - -} \ No newline at end of file + + namespace app\adminapi\validate\expense; + + + use app\common\validate\BaseValidate; + + + /** + * ExpenseReimbursementInvoiceDetail验证器 + * Class ExpenseReimbursementInvoiceDetailValidate + * @package app\adminapi\validate\expense + */ + class ExpenseReimbursementInvoiceDetailValidate extends BaseValidate + { + + /** + * 设置校验规则 + * @var string[] + */ + protected $rule = [ + 'id' => 'require', + 'expense_id' => 'require', + 'invoice_type' => 'require', + 'invoice_sn' => 'require', + 'amount' => 'require', + ]; + + + /** + * 参数描述 + * @var string[] + */ + protected $field = [ + 'id' => 'id', + 'expense_id' => '报销id', + 'invoice_type' => '发票类型', + 'invoice_sn' => '发票号', + 'amount' => '发票金额', + ]; + + + /** + * @notes 添加场景 + * @return ExpenseReimbursementInvoiceDetailValidate + * @author likeadmin + * @date 2023/12/19 11:09 + */ + public function sceneAdd() + { + return $this->only(['expense_id', 'invoice_type', 'invoice_sn', 'amount']); + } + + + /** + * @notes 编辑场景 + * @return ExpenseReimbursementInvoiceDetailValidate + * @author likeadmin + * @date 2023/12/19 11:09 + */ + public function sceneEdit() + { + return $this->only(['id', 'expense_id', 'invoice_type', 'invoice_sn', 'amount']); + } + + + /** + * @notes 删除场景 + * @return ExpenseReimbursementInvoiceDetailValidate + * @author likeadmin + * @date 2023/12/19 11:09 + */ + public function sceneDelete() + { + return $this->only(['id'])->remove('id', 'checkData'); + } + + + /** + * @notes 详情场景 + * @return ExpenseReimbursementInvoiceDetailValidate + * @author likeadmin + * @date 2023/12/19 11:09 + */ + public function sceneDetail() + { + return $this->only(['id']); + } + + } \ No newline at end of file diff --git a/app/adminapi/validate/expense/ExpenseReimbursementValidate.php b/app/adminapi/validate/expense/ExpenseReimbursementValidate.php index a19222adb..1a55ea71e 100644 --- a/app/adminapi/validate/expense/ExpenseReimbursementValidate.php +++ b/app/adminapi/validate/expense/ExpenseReimbursementValidate.php @@ -11,104 +11,104 @@ // +---------------------------------------------------------------------- // | author: likeadminTeam // +---------------------------------------------------------------------- - -namespace app\adminapi\validate\expense; - - -use app\common\validate\BaseValidate; - - -/** - * ExpenseReimbursement验证器 - * Class ExpenseReimbursementValidate - * @package app\adminapi\validate\expense - */ -class ExpenseReimbursementValidate extends BaseValidate -{ - - /** - * 设置校验规则 - * @var string[] - */ - protected $rule = [ - 'id' => 'require', - 'org_id' => 'require', - 'dept_id' => 'require', - 'approve_id' => 'require', - 'reimburser' => 'require', - 'reimbursement_date' => 'require', - 'customer_id' => 'require', - 'pay_type' => 'require', - 'payee_name' => 'require', - 'payee_bank' => 'require', - 'payee_account' => 'require', - ]; - - - /** - * 参数描述 - * @var string[] - */ - protected $field = [ - 'id' => 'id', - 'org_id' => '机构id', - 'dept_id' => '部门id', - 'approve_id' => '审批id', - 'reimburser' => '报销人', - 'reimbursement_date' => '报销日期', - 'customer_id' => '客户id', - 'pay_type' => '付款方式', - 'payee_name' => '收款人姓名', - 'payee_bank' => '收款银行', - 'payee_account' => '收款账号', - ]; - - - /** - * @notes 添加场景 - * @return ExpenseReimbursementValidate - * @author likeadmin - * @date 2023/12/19 11:12 - */ - public function sceneAdd() - { - return $this->only(['org_id','dept_id','approve_id','reimburser','reimbursement_date','customer_id','pay_type','payee_name','payee_bank','payee_account']); - } - - - /** - * @notes 编辑场景 - * @return ExpenseReimbursementValidate - * @author likeadmin - * @date 2023/12/19 11:12 - */ - public function sceneEdit() - { - return $this->only(['id','org_id','dept_id','approve_id','reimburser','reimbursement_date','customer_id','pay_type','payee_name','payee_bank','payee_account']); - } - - - /** - * @notes 删除场景 - * @return ExpenseReimbursementValidate - * @author likeadmin - * @date 2023/12/19 11:12 - */ - public function sceneDelete() - { - return $this->only(['id']); - } - - - /** - * @notes 详情场景 - * @return ExpenseReimbursementValidate - * @author likeadmin - * @date 2023/12/19 11:12 - */ - public function sceneDetail() - { - return $this->only(['id']); - } - -} \ No newline at end of file + + namespace app\adminapi\validate\expense; + + + use app\common\validate\BaseValidate; + + + /** + * ExpenseReimbursement验证器 + * Class ExpenseReimbursementValidate + * @package app\adminapi\validate\expense + */ + class ExpenseReimbursementValidate extends BaseValidate + { + + /** + * 设置校验规则 + * @var string[] + */ + protected $rule = [ + 'id' => 'require', + 'org_id' => 'require', + 'dept_id' => 'require', + 'approve_id' => 'require', + 'reimburser' => 'require', + 'reimbursement_date' => 'require', + 'customer_id' => 'require', + 'pay_type' => 'require', + 'payee_name' => 'require', + 'payee_bank' => 'require', + 'payee_account' => 'require', + ]; + + + /** + * 参数描述 + * @var string[] + */ + protected $field = [ + 'id' => 'id', + 'org_id' => '机构id', + 'dept_id' => '部门id', + 'approve_id' => '审批id', + 'reimburser' => '报销人', + 'reimbursement_date' => '报销日期', + 'customer_id' => '客户id', + 'pay_type' => '付款方式', + 'payee_name' => '收款人姓名', + 'payee_bank' => '收款银行', + 'payee_account' => '收款账号', + ]; + + + /** + * @notes 添加场景 + * @return ExpenseReimbursementValidate + * @author likeadmin + * @date 2023/12/19 11:12 + */ + public function sceneAdd() + { + return $this->only(['org_id', 'dept_id', 'approve_id', 'reimburser', 'reimbursement_date', 'customer_id', 'pay_type', 'payee_name', 'payee_bank', 'payee_account']); + } + + + /** + * @notes 编辑场景 + * @return ExpenseReimbursementValidate + * @author likeadmin + * @date 2023/12/19 11:12 + */ + public function sceneEdit() + { + return $this->only(['id', 'org_id', 'dept_id', 'approve_id', 'reimburser', 'reimbursement_date', 'customer_id', 'pay_type', 'payee_name', 'payee_bank', 'payee_account']); + } + + + /** + * @notes 删除场景 + * @return ExpenseReimbursementValidate + * @author likeadmin + * @date 2023/12/19 11:12 + */ + public function sceneDelete() + { + return $this->only(['id'])->remove('id', 'checkData'); + } + + + /** + * @notes 详情场景 + * @return ExpenseReimbursementValidate + * @author likeadmin + * @date 2023/12/19 11:12 + */ + public function sceneDetail() + { + return $this->only(['id']); + } + + } \ No newline at end of file diff --git a/app/adminapi/validate/material/MaterialClassifyValidate.php b/app/adminapi/validate/material/MaterialClassifyValidate.php index df2efb62b..36698f766 100644 --- a/app/adminapi/validate/material/MaterialClassifyValidate.php +++ b/app/adminapi/validate/material/MaterialClassifyValidate.php @@ -11,92 +11,92 @@ // +---------------------------------------------------------------------- // | author: likeadminTeam // +---------------------------------------------------------------------- - -namespace app\adminapi\validate\material; - - -use app\common\model\material\MaterialClassify; -use app\common\validate\BaseValidate; - - -/** - * 材料分类验证器 - * Class MaterialClassifyValidate - * @package app\adminapi\validate\material - */ -class MaterialClassifyValidate extends BaseValidate -{ - - /** - * 设置校验规则 - * @var string[] - */ - protected $rule = [ - 'id' => 'require', - 'pid' => 'require', - 'name' => 'require|checkName', - ]; - protected $message = [ - 'id.require' => '缺少必要参数', - 'pid.require' => '请选择上级分类', - 'name.require' => '请填写分类名称', - ]; - - /** - * @notes 添加场景 - * @return MaterialClassifyValidate - * @author likeadmin - * @date 2024/01/04 09:47 - */ - public function sceneAdd() - { - return $this->only(['pid','name']); - } - - - /** - * @notes 编辑场景 - * @return MaterialClassifyValidate - * @author likeadmin - * @date 2024/01/04 09:47 - */ - public function sceneEdit() - { - return $this->only(['id','pid','name']); - } - - - /** - * @notes 删除场景 - * @return MaterialClassifyValidate - * @author likeadmin - * @date 2024/01/04 09:47 - */ - public function sceneDelete() - { - return $this->only(['id']); - } - - - /** - * @notes 详情场景 - * @return MaterialClassifyValidate - * @author likeadmin - * @date 2024/01/04 09:47 - */ - public function sceneDetail() - { - return $this->only(['id']); - } + namespace app\adminapi\validate\material; - public function checkName($value,$rule,$data): bool|string + + use app\common\model\material\MaterialClassify; + use app\common\validate\BaseValidate; + + + /** + * 材料分类验证器 + * Class MaterialClassifyValidate + * @package app\adminapi\validate\material + */ + class MaterialClassifyValidate extends BaseValidate { - $data = MaterialClassify::where('pid',$data['pid'])->where('name',$value)->findOrEmpty(); - if(!$data->isEmpty()){ - return '该分类名称已存在'; + + /** + * 设置校验规则 + * @var string[] + */ + protected $rule = [ + 'id' => 'require', + 'pid' => 'require', + 'name' => 'require|checkName', + ]; + + protected $message = [ + 'id.require' => '缺少必要参数', + 'pid.require' => '请选择上级分类', + 'name.require' => '请填写分类名称', + ]; + + /** + * @notes 添加场景 + * @return MaterialClassifyValidate + * @author likeadmin + * @date 2024/01/04 09:47 + */ + public function sceneAdd() + { + return $this->only(['pid', 'name']); } - return true; - } - -} \ No newline at end of file + + + /** + * @notes 编辑场景 + * @return MaterialClassifyValidate + * @author likeadmin + * @date 2024/01/04 09:47 + */ + public function sceneEdit() + { + return $this->only(['id', 'pid', 'name']); + } + + + /** + * @notes 删除场景 + * @return MaterialClassifyValidate + * @author likeadmin + * @date 2024/01/04 09:47 + */ + public function sceneDelete() + { + return $this->only(['id'])->remove('id', 'checkData'); + } + + + /** + * @notes 详情场景 + * @return MaterialClassifyValidate + * @author likeadmin + * @date 2024/01/04 09:47 + */ + public function sceneDetail() + { + return $this->only(['id']); + } + + public function checkName($value, $rule, $data): bool|string + { + $data = MaterialClassify::where('pid', $data['pid'])->where('name', $value)->findOrEmpty(); + if (!$data->isEmpty()) { + return '该分类名称已存在'; + } + return true; + } + + } \ No newline at end of file diff --git a/app/adminapi/validate/material/MaterialPurchaseRequestDetailValidate.php b/app/adminapi/validate/material/MaterialPurchaseRequestDetailValidate.php index 1b6499935..9325421ed 100644 --- a/app/adminapi/validate/material/MaterialPurchaseRequestDetailValidate.php +++ b/app/adminapi/validate/material/MaterialPurchaseRequestDetailValidate.php @@ -11,106 +11,107 @@ // +---------------------------------------------------------------------- // | author: likeadminTeam // +---------------------------------------------------------------------- - -namespace app\adminapi\validate\material; - - -use app\common\model\material\MaterialPurchaseRequestDetail; -use app\common\model\project\ProjectMaterialBudgetDetail; -use app\common\validate\BaseValidate; - - -/** - * 材料采购申请明细验证器 - * Class MaterialPurchaseRequestDetailValidate - * @package app\adminapi\validate\material - */ -class MaterialPurchaseRequestDetailValidate extends BaseValidate -{ - - /** - * 设置校验规则 - * @var string[] - */ - protected $rule = [ - 'id' => 'require|checkId', - 'num' => 'require|integer|gt:0|checkNum', - ]; - - protected $message = [ - 'id.require' => '缺少必要参数', - 'num.require' => '请填写申请采购数量', - 'num.integer' => '申请采购数量值必须是整数', - 'num.gt' => '申请采购数量之必须大于0', - - ]; - - - /** - * @notes 添加场景 - * @return MaterialPurchaseRequestDetailValidate - * @author likeadmin - * @date 2024/01/09 13:47 - */ - public function sceneAdd() - { - return $this->remove('id',true); - } - - - /** - * @notes 编辑场景 - * @return MaterialPurchaseRequestDetailValidate - * @author likeadmin - * @date 2024/01/09 13:47 - */ - public function sceneEdit() - { - return $this->only(['id','num']); - } - /** - * @notes 删除场景 - * @return MaterialPurchaseRequestDetailValidate - * @author likeadmin - * @date 2024/01/09 13:47 - */ - public function sceneDelete() - { - return $this->only(['id']); - } - - - /** - * @notes 详情场景 - * @return MaterialPurchaseRequestDetailValidate - * @author likeadmin - * @date 2024/01/09 13:47 - */ - public function sceneDetail() - { - return $this->only(['id']); - } + namespace app\adminapi\validate\material; - public function checkId($value): bool|string + + use app\common\model\material\MaterialPurchaseRequestDetail; + use app\common\model\project\ProjectMaterialBudgetDetail; + use app\common\validate\BaseValidate; + + + /** + * 材料采购申请明细验证器 + * Class MaterialPurchaseRequestDetailValidate + * @package app\adminapi\validate\material + */ + class MaterialPurchaseRequestDetailValidate extends BaseValidate { - $data = MaterialPurchaseRequestDetail::where('id',$value)->findOrEmpty(); - if($data->isEmpty()){ - return '数据不存在'; + + /** + * 设置校验规则 + * @var string[] + */ + protected $rule = [ + 'id' => 'require|checkId', + 'num' => 'require|integer|gt:0|checkNum', + ]; + + protected $message = [ + 'id.require' => '缺少必要参数', + 'num.require' => '请填写申请采购数量', + 'num.integer' => '申请采购数量值必须是整数', + 'num.gt' => '申请采购数量之必须大于0', + + ]; + + + /** + * @notes 添加场景 + * @return MaterialPurchaseRequestDetailValidate + * @author likeadmin + * @date 2024/01/09 13:47 + */ + public function sceneAdd() + { + return $this->remove('id', true); } - return true; - } - - public function checkNum($value,$rule,$data){ - //总预算数量 - 已申购数量 + 当前数据申购数量 - $MaterialPurchaseRequestDetail = MaterialPurchaseRequestDetail::where('id',$data['id'])->findOrEmpty(); - $project_material_budget_detail = ProjectMaterialBudgetDetail::where('id',$MaterialPurchaseRequestDetail['project_material_budget_detail_id'])->findOrEmpty(); - //已经申购的数量 - $PurchaseRequestNum = MaterialPurchaseRequestDetail::where('project_material_budget_detail_id',$MaterialPurchaseRequestDetail['project_material_budget_detail_id'])->sum('num'); - if($value > ($project_material_budget_detail['num'] - $PurchaseRequestNum + $MaterialPurchaseRequestDetail['num'])){ - return '申请采购数量不能大于剩余预算数量'; + + + /** + * @notes 编辑场景 + * @return MaterialPurchaseRequestDetailValidate + * @author likeadmin + * @date 2024/01/09 13:47 + */ + public function sceneEdit() + { + return $this->only(['id', 'num']); } - return true; - } - -} \ No newline at end of file + + /** + * @notes 删除场景 + * @return MaterialPurchaseRequestDetailValidate + * @author likeadmin + * @date 2024/01/09 13:47 + */ + public function sceneDelete() + { + return $this->only(['id'])->remove('id', 'checkData'); + } + + + /** + * @notes 详情场景 + * @return MaterialPurchaseRequestDetailValidate + * @author likeadmin + * @date 2024/01/09 13:47 + */ + public function sceneDetail() + { + return $this->only(['id']); + } + + public function checkId($value): bool|string + { + $data = MaterialPurchaseRequestDetail::where('id', $value)->findOrEmpty(); + if ($data->isEmpty()) { + return '数据不存在'; + } + return true; + } + + public function checkNum($value, $rule, $data) + { + //总预算数量 - 已申购数量 + 当前数据申购数量 + $MaterialPurchaseRequestDetail = MaterialPurchaseRequestDetail::where('id', $data['id'])->findOrEmpty(); + $project_material_budget_detail = ProjectMaterialBudgetDetail::where('id', $MaterialPurchaseRequestDetail['project_material_budget_detail_id'])->findOrEmpty(); + //已经申购的数量 + $PurchaseRequestNum = MaterialPurchaseRequestDetail::where('project_material_budget_detail_id', $MaterialPurchaseRequestDetail['project_material_budget_detail_id'])->sum('num'); + if ($value > ($project_material_budget_detail['num'] - $PurchaseRequestNum + $MaterialPurchaseRequestDetail['num'])) { + return '申请采购数量不能大于剩余预算数量'; + } + return true; + } + + } \ No newline at end of file diff --git a/app/adminapi/validate/material/MaterialPurchaseRequestValidate.php b/app/adminapi/validate/material/MaterialPurchaseRequestValidate.php index 3040e50c6..7e574e71a 100644 --- a/app/adminapi/validate/material/MaterialPurchaseRequestValidate.php +++ b/app/adminapi/validate/material/MaterialPurchaseRequestValidate.php @@ -11,186 +11,186 @@ // +---------------------------------------------------------------------- // | author: likeadminTeam // +---------------------------------------------------------------------- - -namespace app\adminapi\validate\material; - - -use app\common\model\dept\Dept; -use app\common\model\dept\Orgs; -use app\common\model\material\MaterialPurchaseRequest; -use app\common\model\material\MaterialPurchaseRequestDetail; -use app\common\model\project\Project; -use app\common\model\project\ProjectMaterialBudgetDetail; -use app\common\validate\BaseValidate; - - -/** - * 材料采购申请验证器 - * Class MaterialPurchaseRequestValidate - * @package app\adminapi\validate\material - */ -class MaterialPurchaseRequestValidate extends BaseValidate -{ - - /** - * 设置校验规则 - * @var string[] - */ - protected $rule = [ - 'id' => 'require|checkData', - 'org_id' => 'require|checkOrg', - 'dept_id' => 'require|checkDept', - 'project_id' => 'require|checkProject', - 'apply_date' => 'require|dateFormat:Y-m-d', - 'arrival_date' => 'require|dateFormat:Y-m-d', - 'annex' => 'checkAnnex', - 'purchase_request_detail' => 'require|checkPurchaseRequestDetail', - 'flow_id' => 'require|checkFlow', - 'path' => 'require', - ]; - protected $message = [ - 'id.require' => '缺少必要参数', - 'org_id.require' => '请选择组织', - 'dept_id.require' => '请选择部门', - 'project_id.require' => '请选择项目', - 'apply_date.require' => '请选择申请日期', - 'apply_date.dateFormat' => '申请日期数据格式错误', - 'arrival_date.require' => '请选择希望到货日期', - 'arrival_date.dateFormat' => '希望到货日期数据格式错误', - 'purchase_request_detail.require' => '申购明细内容不能为空', - ]; - - - /** - * @notes 添加场景 - * @return MaterialPurchaseRequestValidate - * @author likeadmin - * @date 2024/01/09 13:47 - */ - public function sceneAdd() - { - return $this->remove('id',true)->remove('flow_id',true)->remove('path',true); - } - - - /** - * @notes 编辑场景 - * @return MaterialPurchaseRequestValidate - * @author likeadmin - * @date 2024/01/09 13:47 - */ - public function sceneEdit() - { - return $this->remove('flow_id',true)->remove('path',true)->remove('purchase_request_detail',true); - } - - - /** - * @notes 删除场景 - * @return MaterialPurchaseRequestValidate - * @author likeadmin - * @date 2024/01/09 13:47 - */ - public function sceneDelete() - { - return $this->only(['id']); - } - - - /** - * @notes 详情场景 - * @return MaterialPurchaseRequestValidate - * @author likeadmin - * @date 2024/01/09 13:47 - */ - public function sceneDetail() - { - return $this->only(['id']); - } + namespace app\adminapi\validate\material; - public function sceneApprove() + + use app\common\model\dept\Dept; + use app\common\model\dept\Orgs; + use app\common\model\material\MaterialPurchaseRequest; + use app\common\model\material\MaterialPurchaseRequestDetail; + use app\common\model\project\Project; + use app\common\model\project\ProjectMaterialBudgetDetail; + use app\common\validate\BaseValidate; + + + /** + * 材料采购申请验证器 + * Class MaterialPurchaseRequestValidate + * @package app\adminapi\validate\material + */ + class MaterialPurchaseRequestValidate extends BaseValidate { - return $this->only(['id','flow_id','path']); - } - - public function checkData($value): bool|string - { - $data = MaterialPurchaseRequest::where('id',$value)->findOrEmpty(); - if($data->isEmpty()){ - return '数据不存在'; + + /** + * 设置校验规则 + * @var string[] + */ + protected $rule = [ + 'id' => 'require|checkData', + 'org_id' => 'require|checkOrg', + 'dept_id' => 'require|checkDept', + 'project_id' => 'require|checkProject', + 'apply_date' => 'require|dateFormat:Y-m-d', + 'arrival_date' => 'require|dateFormat:Y-m-d', + 'annex' => 'checkAnnex', + 'purchase_request_detail' => 'require|checkPurchaseRequestDetail', + 'flow_id' => 'require|checkFlow', + 'path' => 'require', + ]; + + protected $message = [ + 'id.require' => '缺少必要参数', + 'org_id.require' => '请选择组织', + 'dept_id.require' => '请选择部门', + 'project_id.require' => '请选择项目', + 'apply_date.require' => '请选择申请日期', + 'apply_date.dateFormat' => '申请日期数据格式错误', + 'arrival_date.require' => '请选择希望到货日期', + 'arrival_date.dateFormat' => '希望到货日期数据格式错误', + 'purchase_request_detail.require' => '申购明细内容不能为空', + ]; + + + /** + * @notes 添加场景 + * @return MaterialPurchaseRequestValidate + * @author likeadmin + * @date 2024/01/09 13:47 + */ + public function sceneAdd() + { + return $this->remove('id', true)->remove('flow_id', true)->remove('path', true); } - return true; - } - - public function checkOrg($value): bool|string - { - $org = Orgs::where('id',$value)->findOrEmpty(); - if($org->isEmpty()) { - return '组织不存在'; + + + /** + * @notes 编辑场景 + * @return MaterialPurchaseRequestValidate + * @author likeadmin + * @date 2024/01/09 13:47 + */ + public function sceneEdit() + { + return $this->remove('flow_id', true)->remove('path', true)->remove('purchase_request_detail', true); } - return true; - } - - public function checkDept($value,$rule,$data): bool|string - { - $dept = Dept::where('id',$value)->findOrEmpty(); - if($dept->isEmpty()){ - return '部门不存在'; + + + /** + * @notes 删除场景 + * @return MaterialPurchaseRequestValidate + * @author likeadmin + * @date 2024/01/09 13:47 + */ + public function sceneDelete() + { + return $this->only(['id'])->remove('id', 'checkData'); } - if($dept['org_id'] != $data['org_id']){ - return '当前部门不属于所选择的组织'; + + + /** + * @notes 详情场景 + * @return MaterialPurchaseRequestValidate + * @author likeadmin + * @date 2024/01/09 13:47 + */ + public function sceneDetail() + { + return $this->only(['id']); } - return true; - } - - public function checkProject($value): bool|string - { - $project = Project::where('id',$value)->findOrEmpty(); - if($project->isEmpty()){ - return '项目不存在'; + + public function sceneApprove() + { + return $this->only(['id', 'flow_id', 'path']); } - return true; - } - - public function checkAnnex($value): bool|string - { - if(!empty($value) && $value != ''){ - if(!is_array($value)){ - return '附件格式错误'; + + public function checkData($value): bool|string + { + $data = MaterialPurchaseRequest::where('id', $value)->findOrEmpty(); + if ($data->isEmpty()) { + return '数据不存在'; } + return true; } - return true; - } - - public function checkPurchaseRequestDetail($value): bool|string - { - $detail = $value;//json_decode($value,true); - if(empty($detail) || !is_array($detail)){ - return '申购明细数据格式错误'; + + public function checkOrg($value): bool|string + { + $org = Orgs::where('id', $value)->findOrEmpty(); + if ($org->isEmpty()) { + return '组织不存在'; + } + return true; } - foreach($detail as $v) { - $project_material_budget_detail = ProjectMaterialBudgetDetail::where('id',$v['project_material_budget_detail_id'])->findOrEmpty(); - if(empty($v['project_material_budget_detail_id'])){ - return '请选择材料预算明细'; - }else{ - if($project_material_budget_detail->isEmpty()){ - return '材料预算明细信息不存在'; + + public function checkDept($value, $rule, $data): bool|string + { + $dept = Dept::where('id', $value)->findOrEmpty(); + if ($dept->isEmpty()) { + return '部门不存在'; + } + if ($dept['org_id'] != $data['org_id']) { + return '当前部门不属于所选择的组织'; + } + return true; + } + + public function checkProject($value): bool|string + { + $project = Project::where('id', $value)->findOrEmpty(); + if ($project->isEmpty()) { + return '项目不存在'; + } + return true; + } + + public function checkAnnex($value): bool|string + { + if (!empty($value) && $value != '') { + if (!is_array($value)) { + return '附件格式错误'; } } - if(empty($v['num'])){ - return '数量不能为空'; - }else{ - if(!is_numeric($v['num']) || $v['num'] < 0){ - return '数量必须是大于0的数字'; + return true; + } + + public function checkPurchaseRequestDetail($value): bool|string + { + $detail = $value;//json_decode($value,true); + if (empty($detail) || !is_array($detail)) { + return '申购明细数据格式错误'; + } + foreach ($detail as $v) { + $project_material_budget_detail = ProjectMaterialBudgetDetail::where('id', $v['project_material_budget_detail_id'])->findOrEmpty(); + if (empty($v['project_material_budget_detail_id'])) { + return '请选择材料预算明细'; + } else { + if ($project_material_budget_detail->isEmpty()) { + return '材料预算明细信息不存在'; + } } - $PurchaseRequestNum = MaterialPurchaseRequestDetail::where('project_material_budget_detail_id',$v['project_material_budget_detail_id'])->sum('num'); - if($v['num'] > ($project_material_budget_detail['num'] - $PurchaseRequestNum)){ - return '申请采购数量不能大于剩余预算数量'; + if (empty($v['num'])) { + return '数量不能为空'; + } else { + if (!is_numeric($v['num']) || $v['num'] < 0) { + return '数量必须是大于0的数字'; + } + $PurchaseRequestNum = MaterialPurchaseRequestDetail::where('project_material_budget_detail_id', $v['project_material_budget_detail_id'])->sum('num'); + if ($v['num'] > ($project_material_budget_detail['num'] - $PurchaseRequestNum)) { + return '申请采购数量不能大于剩余预算数量'; + } } } + return true; } - return true; - } - -} \ No newline at end of file + + } \ No newline at end of file diff --git a/app/adminapi/validate/material/MaterialValidate.php b/app/adminapi/validate/material/MaterialValidate.php index c543585cc..5628becf7 100644 --- a/app/adminapi/validate/material/MaterialValidate.php +++ b/app/adminapi/validate/material/MaterialValidate.php @@ -11,136 +11,137 @@ // +---------------------------------------------------------------------- // | author: likeadminTeam // +---------------------------------------------------------------------- - -namespace app\adminapi\validate\material; - - -use app\common\model\material\MaterialClassify; -use app\common\validate\BaseValidate; - - -/** - * 自购材料验证器 - * Class MaterialValidate - * @package app\adminapi\validate\material - */ -class MaterialValidate extends BaseValidate -{ - - /** - * 设置校验规则 - * @var string[] - */ - protected $rule = [ - 'id' => 'require', - 'first_level' => 'require|checkFirstLevel', - 'second_level' => 'checkSecondLevel', - 'three_level' => 'checkThreeLevel', - 'code' => 'require', - 'name' => 'require', - 'specs' => 'require', - 'unit' => 'require', - 'inventory' => 'integer|egt:0', - 'sales_price' => 'float|egt:0', - 'cost_price' => 'float|egt:0', - 'annex' => 'checkAnnex' - ]; - protected $message = [ - 'id.require' => '缺少必要参数', - 'first_level.require' => '请选择材料大类', - 'code.require' => '请填写材料编码', - 'name.require' => '请填写材料名称', - 'specs.require' => '请填写规格型号', - 'unit.require' => '请填写单位', - 'inventory.integer' => '安全库存量值必须是整数', - 'inventory.egt' => '安全库存量值必须大于等于0', - 'sales_price.float' => '销售指导价值必须是数字', - 'sales_price.egt' => '销售指导价值必须大于等于0', - 'cost_price.float' => '预算成本价值必须是数字', - 'cost_price.egt' => '预算成本价值必须大于等于0', - ]; + namespace app\adminapi\validate\material; - /** - * @notes 添加场景 - * @return MaterialValidate - * @author likeadmin - * @date 2024/01/04 10:59 - */ - public function sceneAdd() - { - return $this->remove('id',true); - } - - - /** - * @notes 编辑场景 - * @return MaterialValidate - * @author likeadmin - * @date 2024/01/04 10:59 - */ - public function sceneEdit() - {} - - - /** - * @notes 删除场景 - * @return MaterialValidate - * @author likeadmin - * @date 2024/01/04 10:59 - */ - public function sceneDelete() - { - return $this->only(['id']); - } - - - /** - * @notes 详情场景 - * @return MaterialValidate - * @author likeadmin - * @date 2024/01/04 10:59 - */ - public function sceneDetail() - { - return $this->only(['id']); - } - public function checkFirstLevel($value): bool|string + use app\common\model\material\MaterialClassify; + use app\common\validate\BaseValidate; + + + /** + * 自购材料验证器 + * Class MaterialValidate + * @package app\adminapi\validate\material + */ + class MaterialValidate extends BaseValidate { - $classify = MaterialClassify::where('id',$value)->where('pid',0)->findOrEmpty(); - if($classify->isEmpty()){ - return '材料大类不存在'; + + /** + * 设置校验规则 + * @var string[] + */ + protected $rule = [ + 'id' => 'require', + 'first_level' => 'require|checkFirstLevel', + 'second_level' => 'checkSecondLevel', + 'three_level' => 'checkThreeLevel', + 'code' => 'require', + 'name' => 'require', + 'specs' => 'require', + 'unit' => 'require', + 'inventory' => 'integer|egt:0', + 'sales_price' => 'float|egt:0', + 'cost_price' => 'float|egt:0', + 'annex' => 'checkAnnex' + ]; + + protected $message = [ + 'id.require' => '缺少必要参数', + 'first_level.require' => '请选择材料大类', + 'code.require' => '请填写材料编码', + 'name.require' => '请填写材料名称', + 'specs.require' => '请填写规格型号', + 'unit.require' => '请填写单位', + 'inventory.integer' => '安全库存量值必须是整数', + 'inventory.egt' => '安全库存量值必须大于等于0', + 'sales_price.float' => '销售指导价值必须是数字', + 'sales_price.egt' => '销售指导价值必须大于等于0', + 'cost_price.float' => '预算成本价值必须是数字', + 'cost_price.egt' => '预算成本价值必须大于等于0', + ]; + + /** + * @notes 添加场景 + * @return MaterialValidate + * @author likeadmin + * @date 2024/01/04 10:59 + */ + public function sceneAdd() + { + return $this->remove('id', true); } - return true; - } - - public function checkSecondLevel($value,$rule,$data): bool|string - { - $classify = MaterialClassify::where('id',$value)->where('pid',$data['first_level'])->findOrEmpty(); - if($classify->isEmpty()){ - return '材料中类不存在'; + + + /** + * @notes 编辑场景 + * @return MaterialValidate + * @author likeadmin + * @date 2024/01/04 10:59 + */ + public function sceneEdit() + { } - return true; - } - - public function checkThreeLevel($value,$rule,$data): bool|string - { - $classify = MaterialClassify::where('id',$value)->where('pid',$data['second_level'])->findOrEmpty(); - if($classify->isEmpty()){ - return '材料小类不存在'; + + + /** + * @notes 删除场景 + * @return MaterialValidate + * @author likeadmin + * @date 2024/01/04 10:59 + */ + public function sceneDelete() + { + return $this->only(['id'])->remove('id', 'checkData'); } - return true; - } - - public function checkAnnex($value): bool|string - { - if(!empty($value) && $value != ''){ - if(!is_array($value)){ - return '附件格式错误'; + + + /** + * @notes 详情场景 + * @return MaterialValidate + * @author likeadmin + * @date 2024/01/04 10:59 + */ + public function sceneDetail() + { + return $this->only(['id']); + } + + public function checkFirstLevel($value): bool|string + { + $classify = MaterialClassify::where('id', $value)->where('pid', 0)->findOrEmpty(); + if ($classify->isEmpty()) { + return '材料大类不存在'; } + return true; } - return true; - } - -} \ No newline at end of file + + public function checkSecondLevel($value, $rule, $data): bool|string + { + $classify = MaterialClassify::where('id', $value)->where('pid', $data['first_level'])->findOrEmpty(); + if ($classify->isEmpty()) { + return '材料中类不存在'; + } + return true; + } + + public function checkThreeLevel($value, $rule, $data): bool|string + { + $classify = MaterialClassify::where('id', $value)->where('pid', $data['second_level'])->findOrEmpty(); + if ($classify->isEmpty()) { + return '材料小类不存在'; + } + return true; + } + + public function checkAnnex($value): bool|string + { + if (!empty($value) && $value != '') { + if (!is_array($value)) { + return '附件格式错误'; + } + } + return true; + } + + } \ No newline at end of file diff --git a/app/adminapi/validate/material/MaterialWarehouseValidate.php b/app/adminapi/validate/material/MaterialWarehouseValidate.php index 26bc9620d..576887fcf 100644 --- a/app/adminapi/validate/material/MaterialWarehouseValidate.php +++ b/app/adminapi/validate/material/MaterialWarehouseValidate.php @@ -11,144 +11,145 @@ // +---------------------------------------------------------------------- // | author: likeadminTeam // +---------------------------------------------------------------------- - -namespace app\adminapi\validate\material; - - -use app\common\model\auth\Admin; -use app\common\model\dept\Dept; -use app\common\model\dept\Orgs; -use app\common\model\project\Project; -use app\common\validate\BaseValidate; - - -/** - * 仓库管理验证器 - * Class MaterialWarehouseValidate - * @package app\adminapi\validate\material - */ -class MaterialWarehouseValidate extends BaseValidate -{ - - /** - * 设置校验规则 - * @var string[] - */ - protected $rule = [ - 'id' => 'require', - 'org_id' => 'require|checkOrg', - 'dept_id' => 'require|checkDept', - 'project_id' => 'require|checkProject', - 'name' => 'require', - 'is_mrp' => 'require|in:0,1', - 'head_user' => 'require|checkUser', - 'annex' => 'checkAnnex' - ]; - protected $message = [ - 'id.require' => '缺少必要参数', - 'org_id.require' => '请选择组织', - 'dept_id.require' => '请选择部门', - 'project_id.require' => '请选择项目', - 'name.require' => '请填写仓库名称', - 'is_mrp.require' => '请选择是否是MRP仓库', - 'is_mrp.in' => '是否是MRP仓库选项值无效', - 'head_user.require' => '请选择负责人', - ]; - - - /** - * @notes 添加场景 - * @return MaterialWarehouseValidate - * @author likeadmin - * @date 2024/01/04 14:23 - */ - public function sceneAdd() - { - return $this->remove('id',true); - } - - - /** - * @notes 编辑场景 - * @return MaterialWarehouseValidate - * @author likeadmin - * @date 2024/01/04 14:23 - */ - public function sceneEdit() - {} - - - /** - * @notes 删除场景 - * @return MaterialWarehouseValidate - * @author likeadmin - * @date 2024/01/04 14:23 - */ - public function sceneDelete() - { - return $this->only(['id']); - } - - - /** - * @notes 详情场景 - * @return MaterialWarehouseValidate - * @author likeadmin - * @date 2024/01/04 14:23 - */ - public function sceneDetail() - { - return $this->only(['id']); - } + namespace app\adminapi\validate\material; - public function checkOrg($value): bool|string + + use app\common\model\auth\Admin; + use app\common\model\dept\Dept; + use app\common\model\dept\Orgs; + use app\common\model\project\Project; + use app\common\validate\BaseValidate; + + + /** + * 仓库管理验证器 + * Class MaterialWarehouseValidate + * @package app\adminapi\validate\material + */ + class MaterialWarehouseValidate extends BaseValidate { - $org = Orgs::where('id',$value)->findOrEmpty(); - if($org->isEmpty()) { - return '组织不存在'; + + /** + * 设置校验规则 + * @var string[] + */ + protected $rule = [ + 'id' => 'require', + 'org_id' => 'require|checkOrg', + 'dept_id' => 'require|checkDept', + 'project_id' => 'require|checkProject', + 'name' => 'require', + 'is_mrp' => 'require|in:0,1', + 'head_user' => 'require|checkUser', + 'annex' => 'checkAnnex' + ]; + + protected $message = [ + 'id.require' => '缺少必要参数', + 'org_id.require' => '请选择组织', + 'dept_id.require' => '请选择部门', + 'project_id.require' => '请选择项目', + 'name.require' => '请填写仓库名称', + 'is_mrp.require' => '请选择是否是MRP仓库', + 'is_mrp.in' => '是否是MRP仓库选项值无效', + 'head_user.require' => '请选择负责人', + ]; + + + /** + * @notes 添加场景 + * @return MaterialWarehouseValidate + * @author likeadmin + * @date 2024/01/04 14:23 + */ + public function sceneAdd() + { + return $this->remove('id', true); } - return true; - } - - public function checkDept($value,$rule,$data): bool|string - { - $dept = Dept::where('id',$value)->findOrEmpty(); - if($dept->isEmpty()){ - return '部门不存在'; + + + /** + * @notes 编辑场景 + * @return MaterialWarehouseValidate + * @author likeadmin + * @date 2024/01/04 14:23 + */ + public function sceneEdit() + { } - if($dept['org_id'] != $data['org_id']){ - return '当前部门不属于所选择的组织'; + + + /** + * @notes 删除场景 + * @return MaterialWarehouseValidate + * @author likeadmin + * @date 2024/01/04 14:23 + */ + public function sceneDelete() + { + return $this->only(['id'])->remove('id', 'checkData'); } - return true; - } - - public function checkProject($value): bool|string - { - $project = Project::where('id',$value)->findOrEmpty(); - if($project->isEmpty()){ - return '项目不存在'; + + + /** + * @notes 详情场景 + * @return MaterialWarehouseValidate + * @author likeadmin + * @date 2024/01/04 14:23 + */ + public function sceneDetail() + { + return $this->only(['id']); } - return true; - } - - public function checkUser($value): bool|string - { - $user = Admin::where('id',$value)->findOrEmpty(); - if($user->isEmpty()){ - return '负责人信息不存在'; - } - return true; - } - - public function checkAnnex($value): bool|string - { - if(!empty($value) && $value != ''){ - if(!is_array($value)){ - return '附件格式错误'; + + public function checkOrg($value): bool|string + { + $org = Orgs::where('id', $value)->findOrEmpty(); + if ($org->isEmpty()) { + return '组织不存在'; } + return true; } - return true; - } - -} \ No newline at end of file + + public function checkDept($value, $rule, $data): bool|string + { + $dept = Dept::where('id', $value)->findOrEmpty(); + if ($dept->isEmpty()) { + return '部门不存在'; + } + if ($dept['org_id'] != $data['org_id']) { + return '当前部门不属于所选择的组织'; + } + return true; + } + + public function checkProject($value): bool|string + { + $project = Project::where('id', $value)->findOrEmpty(); + if ($project->isEmpty()) { + return '项目不存在'; + } + return true; + } + + public function checkUser($value): bool|string + { + $user = Admin::where('id', $value)->findOrEmpty(); + if ($user->isEmpty()) { + return '负责人信息不存在'; + } + return true; + } + + public function checkAnnex($value): bool|string + { + if (!empty($value) && $value != '') { + if (!is_array($value)) { + return '附件格式错误'; + } + } + return true; + } + + } \ No newline at end of file diff --git a/app/adminapi/validate/oa/FlowRecordValidate.php b/app/adminapi/validate/oa/FlowRecordValidate.php index 937ec4198..ccff79df4 100644 --- a/app/adminapi/validate/oa/FlowRecordValidate.php +++ b/app/adminapi/validate/oa/FlowRecordValidate.php @@ -1,108 +1,110 @@ - 'require', - 'approve_id' => 'require', - 'step_id' => 'require', - 'check_user_id' => 'require', - 'check_time' => 'require', - 'status' => 'require', - 'content' => 'require', - 'is_invalid' => 'require', - ]; - - - /** - * 参数描述 - * @var string[] - */ - protected $field = [ - 'id' => 'id', - 'approve_id' => '审批内容ID', - 'step_id' => '审批步骤ID', - 'check_user_id' => '审批人ID', - 'check_time' => '审批时间', - 'status' => '审批状态 0发起审批1审核通过2审核拒绝3撤销', - 'content' => '审核意见', - 'is_invalid' => '审批失效(1标记为无效)', - ]; - - - /** - * @notes 添加场景 - * @return FlowRecordValidate - * @author likeadmin - * @date 2024/02/01 11:26 - */ - public function sceneAdd() - { - return $this->only(['approve_id','step_id','check_user_id','check_time','status','content','is_invalid']); - } - - - /** - * @notes 编辑场景 - * @return FlowRecordValidate - * @author likeadmin - * @date 2024/02/01 11:26 - */ - public function sceneEdit() - { - return $this->only(['id','approve_id','step_id','check_user_id','check_time','status','content','is_invalid']); - } - - - /** - * @notes 删除场景 - * @return FlowRecordValidate - * @author likeadmin - * @date 2024/02/01 11:26 - */ - public function sceneDelete() - { - return $this->only(['id']); - } - - - /** - * @notes 详情场景 - * @return FlowRecordValidate - * @author likeadmin - * @date 2024/02/01 11:26 - */ - public function sceneDetail() - { - return $this->only(['id']); - } - -} \ No newline at end of file + 'require', + 'approve_id' => 'require', + 'step_id' => 'require', + 'check_user_id' => 'require', + 'check_time' => 'require', + 'status' => 'require', + 'content' => 'require', + 'is_invalid' => 'require', + + ]; + + + /** + * 参数描述 + * @var string[] + */ + protected $field = [ + 'id' => 'id', + 'approve_id' => '审批内容ID', + 'step_id' => '审批步骤ID', + 'check_user_id' => '审批人ID', + 'check_time' => '审批时间', + 'status' => '审批状态 0发起审批1审核通过2审核拒绝3撤销', + 'content' => '审核意见', + 'is_invalid' => '审批失效(1标记为无效)', + + ]; + + + /** + * @notes 添加场景 + * @return FlowRecordValidate + * @author likeadmin + * @date 2024/02/01 11:26 + */ + public function sceneAdd() + { + return $this->only(['approve_id', 'step_id', 'check_user_id', 'check_time', 'status', 'content', 'is_invalid']); + } + + + /** + * @notes 编辑场景 + * @return FlowRecordValidate + * @author likeadmin + * @date 2024/02/01 11:26 + */ + public function sceneEdit() + { + return $this->only(['id', 'approve_id', 'step_id', 'check_user_id', 'check_time', 'status', 'content', 'is_invalid']); + } + + + /** + * @notes 删除场景 + * @return FlowRecordValidate + * @author likeadmin + * @date 2024/02/01 11:26 + */ + public function sceneDelete() + { + return $this->only(['id'])->remove('id', 'checkData'); + } + + + /** + * @notes 详情场景 + * @return FlowRecordValidate + * @author likeadmin + * @date 2024/02/01 11:26 + */ + public function sceneDetail() + { + return $this->only(['id']); + } + + } \ No newline at end of file diff --git a/app/adminapi/validate/oa/FlowStepValidate.php b/app/adminapi/validate/oa/FlowStepValidate.php index 4ceeb8e23..b4f43c876 100644 --- a/app/adminapi/validate/oa/FlowStepValidate.php +++ b/app/adminapi/validate/oa/FlowStepValidate.php @@ -1,104 +1,106 @@ - 'require', - 'approve_id' => 'require', - 'flow_name' => 'require', - 'flow_step' => 'require', - 'flow_user' => 'require', - 'sort' => 'require', - ]; - - - /** - * 参数描述 - * @var string[] - */ - protected $field = [ - 'id' => 'id', - 'approve_id' => '审批内容ID', - 'flow_name' => '流程名称', - 'flow_step' => '流程步骤', - 'flow_user' => '审批人', - 'sort' => '排序ID', - ]; - - - /** - * @notes 添加场景 - * @return FlowStepValidate - * @author likeadmin - * @date 2024/02/01 11:26 - */ - public function sceneAdd() - { - return $this->only(['approve_id','flow_name','flow_step','flow_user','sort']); - } - - - /** - * @notes 编辑场景 - * @return FlowStepValidate - * @author likeadmin - * @date 2024/02/01 11:26 - */ - public function sceneEdit() - { - return $this->only(['id','approve_id','flow_name','flow_step','flow_user','sort']); - } - - - /** - * @notes 删除场景 - * @return FlowStepValidate - * @author likeadmin - * @date 2024/02/01 11:26 - */ - public function sceneDelete() - { - return $this->only(['id']); - } - - - /** - * @notes 详情场景 - * @return FlowStepValidate - * @author likeadmin - * @date 2024/02/01 11:26 - */ - public function sceneDetail() - { - return $this->only(['id']); - } - -} \ No newline at end of file + 'require', + 'approve_id' => 'require', + 'flow_name' => 'require', + 'flow_step' => 'require', + 'flow_user' => 'require', + 'sort' => 'require', + + ]; + + + /** + * 参数描述 + * @var string[] + */ + protected $field = [ + 'id' => 'id', + 'approve_id' => '审批内容ID', + 'flow_name' => '流程名称', + 'flow_step' => '流程步骤', + 'flow_user' => '审批人', + 'sort' => '排序ID', + + ]; + + + /** + * @notes 添加场景 + * @return FlowStepValidate + * @author likeadmin + * @date 2024/02/01 11:26 + */ + public function sceneAdd() + { + return $this->only(['approve_id', 'flow_name', 'flow_step', 'flow_user', 'sort']); + } + + + /** + * @notes 编辑场景 + * @return FlowStepValidate + * @author likeadmin + * @date 2024/02/01 11:26 + */ + public function sceneEdit() + { + return $this->only(['id', 'approve_id', 'flow_name', 'flow_step', 'flow_user', 'sort']); + } + + + /** + * @notes 删除场景 + * @return FlowStepValidate + * @author likeadmin + * @date 2024/02/01 11:26 + */ + public function sceneDelete() + { + return $this->only(['id'])->remove('id', 'checkData'); + } + + + /** + * @notes 详情场景 + * @return FlowStepValidate + * @author likeadmin + * @date 2024/02/01 11:26 + */ + public function sceneDetail() + { + return $this->only(['id']); + } + + } \ No newline at end of file diff --git a/app/adminapi/validate/oa/FlowTypeValidate.php b/app/adminapi/validate/oa/FlowTypeValidate.php index f127dfdba..bad572f8f 100644 --- a/app/adminapi/validate/oa/FlowTypeValidate.php +++ b/app/adminapi/validate/oa/FlowTypeValidate.php @@ -11,143 +11,143 @@ // +---------------------------------------------------------------------- // | author: likeadminTeam // +---------------------------------------------------------------------- - -namespace app\adminapi\validate\oa; - - -use app\common\model\dept\Dept; -use app\common\model\dept\Orgs; -use app\common\model\dict\DictData; -use app\common\validate\BaseValidate; - - -/** - * 审批类型验证器 - * Class FlowTypeValidate - * @package app\adminapi\validate\oa - */ -class FlowTypeValidate extends BaseValidate -{ - - /** - * 设置校验规则 - * @var string[] - */ - protected $rule = [ - 'id' => 'require', - 'type' => 'require|checkType', - 'title' => 'require', - 'name' => 'require', - 'org_id' => 'require|checkOrg', - 'department_ids' => 'require|checkDepartmentIds', - 'status' => 'require|checkStatus', - ]; - - - /** - * 参数描述 - * @var string[] - */ - protected $field = [ - 'id' => 'id', - 'type' => '所属分类', - 'title' => '名称', - 'name' => '标识', - 'org_id' => '应用组织', - 'department_ids' => '应用部门', - 'status' => '状态', - ]; - - - /** - * @notes 添加场景 - * @return FlowTypeValidate - * @author likeadmin - * @date 2024/01/31 10:48 - */ - public function sceneAdd() - { - return $this->remove('id',true)->remove('status',true); - } - - - /** - * @notes 编辑场景 - * @return FlowTypeValidate - * @author likeadmin - * @date 2024/01/31 10:48 - */ - public function sceneEdit() - { - return $this->only(['id','type','title','name','org_id','department_ids','status']); - } - - - /** - * @notes 删除场景 - * @return FlowTypeValidate - * @author likeadmin - * @date 2024/01/31 10:48 - */ - public function sceneDelete() - { - return $this->only(['id']); - } - - - /** - * @notes 详情场景 - * @return FlowTypeValidate - * @author likeadmin - * @date 2024/01/31 10:48 - */ - public function sceneDetail() - { - return $this->only(['id']); - } - public function checkType($value): bool|string - { - $dict = DictData::where('type_value','flow_type')->column('value'); - if(!in_array($value,$dict)){ - return '所属分类无效'; - } - return true; - } + namespace app\adminapi\validate\oa; - public function checkOrg($value): bool|string - { - $data = Orgs::where('id',$value)->findOrEmpty(); - if($data->isEmpty()){ - return '组织不存在'; - } - return true; - } - public function checkDepartmentIds($value,$rule,$data): bool|string + use app\common\model\dept\Dept; + use app\common\model\dept\Orgs; + use app\common\model\dict\DictData; + use app\common\validate\BaseValidate; + + + /** + * 审批类型验证器 + * Class FlowTypeValidate + * @package app\adminapi\validate\oa + */ + class FlowTypeValidate extends BaseValidate { - if(!is_array($value)){ - return '应用部门数据格式错误'; + + /** + * 设置校验规则 + * @var string[] + */ + protected $rule = [ + 'id' => 'require', + 'type' => 'require|checkType', + 'title' => 'require', + 'name' => 'require', + 'org_id' => 'require|checkOrg', + 'department_ids' => 'require|checkDepartmentIds', + 'status' => 'require|checkStatus', + ]; + + + /** + * 参数描述 + * @var string[] + */ + protected $field = [ + 'id' => 'id', + 'type' => '所属分类', + 'title' => '名称', + 'name' => '标识', + 'org_id' => '应用组织', + 'department_ids' => '应用部门', + 'status' => '状态', + ]; + + + /** + * @notes 添加场景 + * @return FlowTypeValidate + * @author likeadmin + * @date 2024/01/31 10:48 + */ + public function sceneAdd() + { + return $this->remove('id', true)->remove('status', true); } - foreach($value as $k=>$v){ - $dept = Dept::where('id',$v)->findOrEmpty(); - if($dept->isEmpty()){ - return '第'.($k+1).'个部门信息不存在'; + + + /** + * @notes 编辑场景 + * @return FlowTypeValidate + * @author likeadmin + * @date 2024/01/31 10:48 + */ + public function sceneEdit() + { + return $this->only(['id', 'type', 'title', 'name', 'org_id', 'department_ids', 'status']); + } + + + /** + * @notes 删除场景 + * @return FlowTypeValidate + * @author likeadmin + * @date 2024/01/31 10:48 + */ + public function sceneDelete() + { + return $this->only(['id'])->remove('id', 'checkData'); + } + + + /** + * @notes 详情场景 + * @return FlowTypeValidate + * @author likeadmin + * @date 2024/01/31 10:48 + */ + public function sceneDetail() + { + return $this->only(['id']); + } + + public function checkType($value): bool|string + { + $dict = DictData::where('type_value', 'flow_type')->column('value'); + if (!in_array($value, $dict)) { + return '所属分类无效'; } - if($dept['org_id'] != $data['org_id']) { - return '第'.($k+1).'个部门不属于当前所选择的组织'; + return true; + } + + public function checkOrg($value): bool|string + { + $data = Orgs::where('id', $value)->findOrEmpty(); + if ($data->isEmpty()) { + return '组织不存在'; } + return true; } - return true; - } - - public function checkStatus($value): bool|string - { - $dict = DictData::where('type_value','flow_type_status')->column('value'); - if(!in_array($value,$dict)){ - return '状态值无效'; + + public function checkDepartmentIds($value, $rule, $data): bool|string + { + if (!is_array($value)) { + return '应用部门数据格式错误'; + } + foreach ($value as $k => $v) { + $dept = Dept::where('id', $v)->findOrEmpty(); + if ($dept->isEmpty()) { + return '第' . ($k + 1) . '个部门信息不存在'; + } + if ($dept['org_id'] != $data['org_id']) { + return '第' . ($k + 1) . '个部门不属于当前所选择的组织'; + } + } + return true; } - return true; - } - -} \ No newline at end of file + + public function checkStatus($value): bool|string + { + $dict = DictData::where('type_value', 'flow_type_status')->column('value'); + if (!in_array($value, $dict)) { + return '状态值无效'; + } + return true; + } + + } \ No newline at end of file diff --git a/app/adminapi/validate/oa/FlowValidate.php b/app/adminapi/validate/oa/FlowValidate.php index 874c559d2..f68d68727 100644 --- a/app/adminapi/validate/oa/FlowValidate.php +++ b/app/adminapi/validate/oa/FlowValidate.php @@ -11,193 +11,194 @@ // +---------------------------------------------------------------------- // | author: likeadminTeam // +---------------------------------------------------------------------- - -namespace app\adminapi\validate\oa; - - -use app\common\model\auth\Admin; -use app\common\model\dict\DictData; -use app\common\model\oa\FlowType; -use app\common\validate\BaseValidate; - - -/** - * 审批流程验证器 - * Class FlowValidate - * @package app\adminapi\validate\oa - */ -class FlowValidate extends BaseValidate -{ - - /** - * 设置校验规则 - * @var string[] - */ - protected $rule = [ - 'id' => 'require', - 'name' => 'require', - 'flow_cate' => 'require|checkFlowCate', - 'check_type' => 'require|checkCheckType', - 'flow_list' => 'require|checkFlowList', - 'status' => 'require|checkStatus', - 'copy_uids' => 'array|checkCopyUids', - ]; - - - /** - * 参数描述 - * @var string[] - */ - protected $field = [ - 'id' => 'id', - 'name' => '审批流名称', - 'flow_cate' => '审批类型', - 'check_type' => '审批流类型', - 'flow_list' => '审批流程', - 'status' => '状态', - 'copy_uids' => '抄送人', - ]; - - - /** - * @notes 添加场景 - * @return FlowValidate - * @author likeadmin - * @date 2024/01/31 14:44 - */ - public function sceneAdd() - { - return $this->remove('id',true)->remove('status',true); - } - - - /** - * @notes 编辑场景 - * @return FlowValidate - * @author likeadmin - * @date 2024/01/31 14:44 - */ - public function sceneEdit() - { - return $this->only(['id','name','flow_cate','check_type','flow_list','status','copy_uids']); - } - - - /** - * @notes 删除场景 - * @return FlowValidate - * @author likeadmin - * @date 2024/01/31 14:44 - */ - public function sceneDelete() - { - return $this->only(['id']); - } - - - /** - * @notes 详情场景 - * @return FlowValidate - * @author likeadmin - * @date 2024/01/31 14:44 - */ - public function sceneDetail() - { - return $this->only(['id']); - } - public function checkFlowCate($value): bool|string - { - $data = FlowType::where('id',$value)->findOrEmpty(); - if($data->isEmpty()){ - return '审批类型信息不存在'; - } - if($data['status'] != 2){ - return '该审批类型已被禁用'; - } - return true; - } + namespace app\adminapi\validate\oa; - public function checkCheckType($value): bool|string - { - $dict = DictData::where('type_value','flow_check_type')->column('value'); - if(!in_array($value,$dict)){ - return '审批流类型值无效'; - } - return true; - } - public function checkFlowList($value,$rule,$data): bool|string + use app\common\model\auth\Admin; + use app\common\model\dict\DictData; + use app\common\model\oa\FlowType; + use app\common\validate\BaseValidate; + + + /** + * 审批流程验证器 + * Class FlowValidate + * @package app\adminapi\validate\oa + */ + class FlowValidate extends BaseValidate { - if(!is_array($value)){ - return '审批流程数据格式错误'; + + /** + * 设置校验规则 + * @var string[] + */ + protected $rule = [ + 'id' => 'require', + 'name' => 'require', + 'flow_cate' => 'require|checkFlowCate', + 'check_type' => 'require|checkCheckType', + 'flow_list' => 'require|checkFlowList', + 'status' => 'require|checkStatus', + 'copy_uids' => 'array|checkCopyUids', + ]; + + + /** + * 参数描述 + * @var string[] + */ + protected $field = [ + 'id' => 'id', + 'name' => '审批流名称', + 'flow_cate' => '审批类型', + 'check_type' => '审批流类型', + 'flow_list' => '审批流程', + 'status' => '状态', + 'copy_uids' => '抄送人', + ]; + + + /** + * @notes 添加场景 + * @return FlowValidate + * @author likeadmin + * @date 2024/01/31 14:44 + */ + public function sceneAdd() + { + return $this->remove('id', true)->remove('status', true); } - //固定审批 - if($data['check_type'] == 1){ - $dict = DictData::where('type_value','flow_step_flow_type')->column('value'); - foreach($value as $k=>$v){ - if(empty($v['flow_step'])){ - return '请选择审批步骤类型'; - }else{ - if(!in_array($v['flow_step'],$dict)){ - return '审批步骤类型值无效'; + + + /** + * @notes 编辑场景 + * @return FlowValidate + * @author likeadmin + * @date 2024/01/31 14:44 + */ + public function sceneEdit() + { + return $this->only(['id', 'name', 'flow_cate', 'check_type', 'flow_list', 'status', 'copy_uids']); + } + + + /** + * @notes 删除场景 + * @return FlowValidate + * @author likeadmin + * @date 2024/01/31 14:44 + */ + public function sceneDelete() + { + return $this->only(['id'])->remove('id', 'checkData'); + } + + + /** + * @notes 详情场景 + * @return FlowValidate + * @author likeadmin + * @date 2024/01/31 14:44 + */ + public function sceneDetail() + { + return $this->only(['id']); + } + + public function checkFlowCate($value): bool|string + { + $data = FlowType::where('id', $value)->findOrEmpty(); + if ($data->isEmpty()) { + return '审批类型信息不存在'; + } + if ($data['status'] != 2) { + return '该审批类型已被禁用'; + } + return true; + } + + public function checkCheckType($value): bool|string + { + $dict = DictData::where('type_value', 'flow_check_type')->column('value'); + if (!in_array($value, $dict)) { + return '审批流类型值无效'; + } + return true; + } + + public function checkFlowList($value, $rule, $data): bool|string + { + if (!is_array($value)) { + return '审批流程数据格式错误'; + } + //固定审批 + if ($data['check_type'] == 1) { + $dict = DictData::where('type_value', 'flow_step_flow_type')->column('value'); + foreach ($value as $k => $v) { + if (empty($v['flow_step'])) { + return '请选择审批步骤类型'; + } else { + if (!in_array($v['flow_step'], $dict)) { + return '审批步骤类型值无效'; + } } - } - if($v['flow_step'] == 2 || $v['flow_step'] == 3){ - if(empty($v['flow_user'])){ - return '审批流程第'.($k+1).'行的指定人未选择'; - } - if(!is_array($v['flow_user'])){ - return '审批流程第'.($k+1).'行的指定人数据格式错误'; - } - foreach($v['flow_user'] as $k2 => $v2){ - $admin = Admin::where('id',$v2)->findOrEmpty(); - if($admin->isEmpty()){ - return '审批流程第'.($k+1).'行的第'.($k2+1).'个指定人信息不存在'; + if ($v['flow_step'] == 2 || $v['flow_step'] == 3) { + if (empty($v['flow_user'])) { + return '审批流程第' . ($k + 1) . '行的指定人未选择'; + } + if (!is_array($v['flow_user'])) { + return '审批流程第' . ($k + 1) . '行的指定人数据格式错误'; + } + foreach ($v['flow_user'] as $k2 => $v2) { + $admin = Admin::where('id', $v2)->findOrEmpty(); + if ($admin->isEmpty()) { + return '审批流程第' . ($k + 1) . '行的第' . ($k2 + 1) . '个指定人信息不存在'; + } } } } } - } - if($data['check_type'] == 2){ - foreach($value as $k=>$v){ - if(empty($v['flow_step'])){ - return '请填写审批步骤名称'; - } - if(empty($v['flow_user'])){ - return '审批流程第'.($k+1).'行的指定人未选择'; - } - if(!is_array($v['flow_user'])){ - return '审批流程第'.($k+1).'行的指定人数据格式错误'; - } - foreach($v['flow_user'] as $k2 => $v2){ - $admin = Admin::where('id',$v2)->findOrEmpty(); - if($admin->isEmpty()){ - return '审批流程第'.($k+1).'行的第'.($k2+1).'个指定人信息不存在'; + if ($data['check_type'] == 2) { + foreach ($value as $k => $v) { + if (empty($v['flow_step'])) { + return '请填写审批步骤名称'; + } + if (empty($v['flow_user'])) { + return '审批流程第' . ($k + 1) . '行的指定人未选择'; + } + if (!is_array($v['flow_user'])) { + return '审批流程第' . ($k + 1) . '行的指定人数据格式错误'; + } + foreach ($v['flow_user'] as $k2 => $v2) { + $admin = Admin::where('id', $v2)->findOrEmpty(); + if ($admin->isEmpty()) { + return '审批流程第' . ($k + 1) . '行的第' . ($k2 + 1) . '个指定人信息不存在'; + } } } } + return true; } - return true; - } - - public function checkCopyUids($value): bool|string - { - foreach($value as $k=>$v){ - $admin = Admin::where('id',$v)->findOrEmpty(); - if($admin->isEmpty()){ - return '第'.($k+1).'个抄送人信息不存在'; + + public function checkCopyUids($value): bool|string + { + foreach ($value as $k => $v) { + $admin = Admin::where('id', $v)->findOrEmpty(); + if ($admin->isEmpty()) { + return '第' . ($k + 1) . '个抄送人信息不存在'; + } } + return true; } - return true; - } - - public function checkStatus($value){ - $dict = DictData::where('type_value','flow_type_status')->column('value'); - if(!in_array($value,$dict)){ - return '状态值无效'; + + public function checkStatus($value) + { + $dict = DictData::where('type_value', 'flow_type_status')->column('value'); + if (!in_array($value, $dict)) { + return '状态值无效'; + } + return true; } - return true; - } - -} \ No newline at end of file + + } \ No newline at end of file diff --git a/app/adminapi/validate/project/CompetitorValidate.php b/app/adminapi/validate/project/CompetitorValidate.php index d3702c7a4..7c177d76f 100644 --- a/app/adminapi/validate/project/CompetitorValidate.php +++ b/app/adminapi/validate/project/CompetitorValidate.php @@ -11,109 +11,110 @@ // +---------------------------------------------------------------------- // | author: likeadminTeam // +---------------------------------------------------------------------- - -namespace app\adminapi\validate\project; - - -use app\common\model\custom\CustomerDemand; -use app\common\model\project\Project; -use app\common\validate\BaseValidate; - - -/** - * 竞争对手验证器 - * Class CompetitorValidate - * @package app\adminapi\validate\project - */ -class CompetitorValidate extends BaseValidate -{ - - /** - * 设置校验规则 - * @var string[] - */ - protected $rule = [ - 'id' => 'require', - 'project_id' => 'require|checkProject', - 'customer_demand_id' => 'require|checkCustomerDemand', - 'competitor_name' => 'require', - 'competitor_contacts_phone' =>'mobile', - 'annex' => 'checkAnnex', - ]; - protected $message = [ - 'id.require' => '缺少必要参数', - 'project_id.require' => '请选择项目', - 'customer_demand_id.require' => '请选择客户需求', - 'competitor_name.require' => '请填写竞争对手名称', - 'competitor_contacts_phone.mobile' => '联系电话格式错误' - ]; - - - /** - * @notes 添加场景 - * @return CompetitorValidate - * @author likeadmin - * @date 2023/11/24 22:01 - */ - public function sceneAdd() - { - return $this->remove('id', true); - } - - - /** - * @notes 编辑场景 - * @return CompetitorValidate - * @author likeadmin - * @date 2023/11/24 22:01 - */ - public function sceneEdit() - {} - - - /** - * @notes 删除场景 - * @return CompetitorValidate - * @author likeadmin - * @date 2023/11/24 22:01 - */ - public function sceneDelete() - { - return $this->only(['id']); - } - - - /** - * @notes 详情场景 - * @return CompetitorValidate - * @author likeadmin - * @date 2023/11/24 22:01 - */ - public function sceneDetail() - { - return $this->only(['id']); - } + namespace app\adminapi\validate\project; - public function checkProject($value): bool|string + + use app\common\model\custom\CustomerDemand; + use app\common\model\project\Project; + use app\common\validate\BaseValidate; + + + /** + * 竞争对手验证器 + * Class CompetitorValidate + * @package app\adminapi\validate\project + */ + class CompetitorValidate extends BaseValidate { - $project = Project::where('id',$value)->findOrEmpty(); - if($project->isEmpty()){ - return '项目不存在'; + + /** + * 设置校验规则 + * @var string[] + */ + protected $rule = [ + 'id' => 'require', + 'project_id' => 'require|checkProject', + 'customer_demand_id' => 'require|checkCustomerDemand', + 'competitor_name' => 'require', + 'competitor_contacts_phone' => 'mobile', + 'annex' => 'checkAnnex', + ]; + + protected $message = [ + 'id.require' => '缺少必要参数', + 'project_id.require' => '请选择项目', + 'customer_demand_id.require' => '请选择客户需求', + 'competitor_name.require' => '请填写竞争对手名称', + 'competitor_contacts_phone.mobile' => '联系电话格式错误' + ]; + + + /** + * @notes 添加场景 + * @return CompetitorValidate + * @author likeadmin + * @date 2023/11/24 22:01 + */ + public function sceneAdd() + { + return $this->remove('id', true); } - return true; - } - - public function checkCustomerDemand($value,$rule,$data): bool|string - { - $customDemand = CustomerDemand::where('id',$value)->findOrEmpty(); - if($customDemand->isEmpty()){ - return '客户需求不存在'; + + + /** + * @notes 编辑场景 + * @return CompetitorValidate + * @author likeadmin + * @date 2023/11/24 22:01 + */ + public function sceneEdit() + { } - if($customDemand['project_id'] != $data['project_id']){ - return '客户需求与项目信息不一致'; + + + /** + * @notes 删除场景 + * @return CompetitorValidate + * @author likeadmin + * @date 2023/11/24 22:01 + */ + public function sceneDelete() + { + return $this->only(['id'])->remove('id', 'checkData'); } - return true; - } - -} \ No newline at end of file + + + /** + * @notes 详情场景 + * @return CompetitorValidate + * @author likeadmin + * @date 2023/11/24 22:01 + */ + public function sceneDetail() + { + return $this->only(['id']); + } + + public function checkProject($value): bool|string + { + $project = Project::where('id', $value)->findOrEmpty(); + if ($project->isEmpty()) { + return '项目不存在'; + } + return true; + } + + public function checkCustomerDemand($value, $rule, $data): bool|string + { + $customDemand = CustomerDemand::where('id', $value)->findOrEmpty(); + if ($customDemand->isEmpty()) { + return '客户需求不存在'; + } + if ($customDemand['project_id'] != $data['project_id']) { + return '客户需求与项目信息不一致'; + } + return true; + } + + } \ No newline at end of file diff --git a/app/adminapi/validate/project/ProjectAlarmSetValidate.php b/app/adminapi/validate/project/ProjectAlarmSetValidate.php index cf6b5f8be..ed91d22f1 100644 --- a/app/adminapi/validate/project/ProjectAlarmSetValidate.php +++ b/app/adminapi/validate/project/ProjectAlarmSetValidate.php @@ -11,120 +11,121 @@ // +---------------------------------------------------------------------- // | author: likeadminTeam // +---------------------------------------------------------------------- - -namespace app\adminapi\validate\project; - - -use app\common\model\project\Project; -use app\common\model\project\ProjectAlarmSet; -use app\common\validate\BaseValidate; - - -/** - * 项目预警设置验证器 - * Class ProjectAlarmSetValidate - * @package app\adminapi\validate\project - */ -class ProjectAlarmSetValidate extends BaseValidate -{ - - /** - * 设置校验规则 - * @var string[] - */ - protected $rule = [ - 'id' => 'require|checkData', - 'project_id' => 'require|checkProject', - 'material_budget_expenditure_ratio' => 'float|egt:0', - 'labour_budget_expenditure_ratio' => 'float|egt:0', - 'cost_budget_expenditure_ratio' => 'float|egt:0', - 'subcontract_budget_expenditure_ratio' => 'float|egt:0', - ]; - - protected $message = [ - 'project_id.require' => '请选择项目', - 'material_budget_expenditure_ratio.float' => '材料预算花费比例必须是数字', - 'material_budget_expenditure_ratio.egt' => '材料预算花费比例必须大于等于0', - 'labour_budget_expenditure_ratio.float' => '人工预算花费比例必须是数字', - 'labour_budget_expenditure_ratio.egt' => '人工预算花费比例必须大于等于0', - 'cost_budget_expenditure_ratio.float' => '费用预算花费比例必须是数字', - 'cost_budget_expenditure_ratio.egt' => '费用预算花费比例必须大于等于0', - 'subcontract_budget_expenditure_ratio.float' => '分包预算花费比例必须是数字', - 'subcontract_budget_expenditure_ratio.egt' => '分包预算花费比例必须大于等于0', - ]; - - /** - * 参数描述 - * @var string[] - */ - protected $field = [ - 'id' => 'id', - 'project_id' => '项目id', - - ]; - - - /** - * @notes 添加场景 - * @return ProjectAlarmSetValidate - * @author likeadmin - * @date 2023/12/14 16:24 - */ - public function sceneAdd() - { - return $this->remove('id',true); - } - - - /** - * @notes 编辑场景 - * @return ProjectAlarmSetValidate - * @author likeadmin - * @date 2023/12/14 16:24 - */ - public function sceneEdit() - {} - - - /** - * @notes 删除场景 - * @return ProjectAlarmSetValidate - * @author likeadmin - * @date 2023/12/14 16:24 - */ - public function sceneDelete() - { - return $this->only(['id']); - } - - - /** - * @notes 详情场景 - * @return ProjectAlarmSetValidate - * @author likeadmin - * @date 2023/12/14 16:24 - */ - public function sceneDetail() - { - return $this->only(['id']); - } - public function checkData($value): bool|string - { - $data = ProjectAlarmSet::where('id',$value)->findOrEmpty(); - if($data->isEmpty()){ - return '数据不存在'; - } - return true; - } + namespace app\adminapi\validate\project; - public function checkProject($value): bool|string + + use app\common\model\project\Project; + use app\common\model\project\ProjectAlarmSet; + use app\common\validate\BaseValidate; + + + /** + * 项目预警设置验证器 + * Class ProjectAlarmSetValidate + * @package app\adminapi\validate\project + */ + class ProjectAlarmSetValidate extends BaseValidate { - $data = Project::where('id',$value)->findOrEmpty(); - if($data->isEmpty()){ - return '项目不存在'; + + /** + * 设置校验规则 + * @var string[] + */ + protected $rule = [ + 'id' => 'require|checkData', + 'project_id' => 'require|checkProject', + 'material_budget_expenditure_ratio' => 'float|egt:0', + 'labour_budget_expenditure_ratio' => 'float|egt:0', + 'cost_budget_expenditure_ratio' => 'float|egt:0', + 'subcontract_budget_expenditure_ratio' => 'float|egt:0', + ]; + + protected $message = [ + 'project_id.require' => '请选择项目', + 'material_budget_expenditure_ratio.float' => '材料预算花费比例必须是数字', + 'material_budget_expenditure_ratio.egt' => '材料预算花费比例必须大于等于0', + 'labour_budget_expenditure_ratio.float' => '人工预算花费比例必须是数字', + 'labour_budget_expenditure_ratio.egt' => '人工预算花费比例必须大于等于0', + 'cost_budget_expenditure_ratio.float' => '费用预算花费比例必须是数字', + 'cost_budget_expenditure_ratio.egt' => '费用预算花费比例必须大于等于0', + 'subcontract_budget_expenditure_ratio.float' => '分包预算花费比例必须是数字', + 'subcontract_budget_expenditure_ratio.egt' => '分包预算花费比例必须大于等于0', + ]; + + /** + * 参数描述 + * @var string[] + */ + protected $field = [ + 'id' => 'id', + 'project_id' => '项目id', + + ]; + + + /** + * @notes 添加场景 + * @return ProjectAlarmSetValidate + * @author likeadmin + * @date 2023/12/14 16:24 + */ + public function sceneAdd() + { + return $this->remove('id', true); } - return true; - } - -} \ No newline at end of file + + + /** + * @notes 编辑场景 + * @return ProjectAlarmSetValidate + * @author likeadmin + * @date 2023/12/14 16:24 + */ + public function sceneEdit() + { + } + + + /** + * @notes 删除场景 + * @return ProjectAlarmSetValidate + * @author likeadmin + * @date 2023/12/14 16:24 + */ + public function sceneDelete() + { + return $this->only(['id'])->remove('id', 'checkData'); + } + + + /** + * @notes 详情场景 + * @return ProjectAlarmSetValidate + * @author likeadmin + * @date 2023/12/14 16:24 + */ + public function sceneDetail() + { + return $this->only(['id']); + } + + public function checkData($value): bool|string + { + $data = ProjectAlarmSet::where('id', $value)->findOrEmpty(); + if ($data->isEmpty()) { + return '数据不存在'; + } + return true; + } + + public function checkProject($value): bool|string + { + $data = Project::where('id', $value)->findOrEmpty(); + if ($data->isEmpty()) { + return '项目不存在'; + } + return true; + } + + } \ No newline at end of file diff --git a/app/adminapi/validate/project/ProjectAttendanceDetailValidate.php b/app/adminapi/validate/project/ProjectAttendanceDetailValidate.php index 9a1f1bba6..c2cda8d3d 100644 --- a/app/adminapi/validate/project/ProjectAttendanceDetailValidate.php +++ b/app/adminapi/validate/project/ProjectAttendanceDetailValidate.php @@ -11,152 +11,152 @@ // +---------------------------------------------------------------------- // | author: likeadminTeam // +---------------------------------------------------------------------- - -namespace app\adminapi\validate\project; - - -use app\common\model\project\Project; -use app\common\model\project\ProjectPersonnel; -use app\common\validate\BaseValidate; - - -/** - * 考勤明细验证器 - * Class ProjectAttendanceDetailValidate - * @package app\adminapi\validate\project - */ -class ProjectAttendanceDetailValidate extends BaseValidate -{ - - /** - * 设置校验规则 - * @var string[] - */ - protected $rule = [ - 'id' => 'require', - 'project_id' => 'require|checkProject', - 'person_id' => 'require|checkPerson', - 'attendance_date' => 'require|dateFormat:Y-m-d', - 'work_start_time' => 'checkWorkStartTime', - 'work_end_time' => 'checkWorkEndTime', - 'work_record_num' => 'require|float|gt:0', - 'daily_salary' => 'require|float|gt:0', - 'daily_living' => 'require|float|gt:0', - 'daily_subsidy' => 'require|float|egt:0', - 'daily_other' => 'require|float|egt:0', - 'daily_income' => 'require|float|gt:0', - ]; - protected $message = [ - 'id.require' => '缺少必要参数', - 'project_id.require' => '请选择项目', - 'person_id.require' => '请选择项目人员', - 'attendance_date.require' => '请选择考勤日期', - 'attendance_date.dateFormat' => '考勤日期格式错误', - 'work_record_num.require' => '请填写记工数量', - 'work_record_num.float' => '记工数量值必须是数字', - 'work_record_num.gt' => '记工数量值必须大于0', - 'daily_salary.require' => '请填写日工资', - 'daily_salary.float' => '日工资值必须是数字', - 'daily_salary.gt' => '日工资值必须大于0', - 'daily_living.require' => '请填写日生活费', - 'daily_living.float' => '日生活费值必须是数字', - 'daily_living.gt' => '日生活费值必须大于0', - 'daily_subsidy.require' => '请填写日补贴', - 'daily_subsidy.float' => '日补贴值必须是数字', - 'daily_subsidy.egt' => '日补贴值必须大于等于0', - 'daily_other.require' => '请填写日其它', - 'daily_other.float' => '日其它值必须是数字', - 'daily_other.egt' => '日其它值必须大于等于0', - 'daily_income.require' => '请填写日收入', - 'daily_income.float' => '日收入必须是数字', - 'daily_income.gt' => '日收入值必须大于0', - ]; + namespace app\adminapi\validate\project; - /** - * @notes 添加场景 - * @return ProjectAttendanceDetailValidate - * @author likeadmin - * @date 2023/12/26 10:54 - */ - public function sceneAdd() - { - return $this->remove('id',true); - } - /** - * @notes 编辑场景 - * @return ProjectAttendanceDetailValidate - * @author likeadmin - * @date 2023/12/26 10:54 - */ - public function sceneEdit() - { - return $this->only(['id','attendance_date','work_start_time','work_end_time','work_record_num','daily_salary','daily_living','daily_subsidy','daily_other','daily_income']); - } + use app\common\model\project\Project; + use app\common\model\project\ProjectPersonnel; + use app\common\validate\BaseValidate; - /** - * @notes 删除场景 - * @return ProjectAttendanceDetailValidate - * @author likeadmin - * @date 2023/12/26 10:54 - */ - public function sceneDelete() - { - return $this->only(['id']); - } - - - /** - * @notes 详情场景 - * @return ProjectAttendanceDetailValidate - * @author likeadmin - * @date 2023/12/26 10:54 - */ - public function sceneDetail() - { - return $this->only(['id']); - } - public function checkProject($value): bool|string + /** + * 考勤明细验证器 + * Class ProjectAttendanceDetailValidate + * @package app\adminapi\validate\project + */ + class ProjectAttendanceDetailValidate extends BaseValidate { - $data = Project::where('id',$value)->findOrEmpty(); - if($data->isEmpty()){ - return '项目不存在'; + + /** + * 设置校验规则 + * @var string[] + */ + protected $rule = [ + 'id' => 'require', + 'project_id' => 'require|checkProject', + 'person_id' => 'require|checkPerson', + 'attendance_date' => 'require|dateFormat:Y-m-d', + 'work_start_time' => 'checkWorkStartTime', + 'work_end_time' => 'checkWorkEndTime', + 'work_record_num' => 'require|float|gt:0', + 'daily_salary' => 'require|float|gt:0', + 'daily_living' => 'require|float|gt:0', + 'daily_subsidy' => 'require|float|egt:0', + 'daily_other' => 'require|float|egt:0', + 'daily_income' => 'require|float|gt:0', + ]; + + protected $message = [ + 'id.require' => '缺少必要参数', + 'project_id.require' => '请选择项目', + 'person_id.require' => '请选择项目人员', + 'attendance_date.require' => '请选择考勤日期', + 'attendance_date.dateFormat' => '考勤日期格式错误', + 'work_record_num.require' => '请填写记工数量', + 'work_record_num.float' => '记工数量值必须是数字', + 'work_record_num.gt' => '记工数量值必须大于0', + 'daily_salary.require' => '请填写日工资', + 'daily_salary.float' => '日工资值必须是数字', + 'daily_salary.gt' => '日工资值必须大于0', + 'daily_living.require' => '请填写日生活费', + 'daily_living.float' => '日生活费值必须是数字', + 'daily_living.gt' => '日生活费值必须大于0', + 'daily_subsidy.require' => '请填写日补贴', + 'daily_subsidy.float' => '日补贴值必须是数字', + 'daily_subsidy.egt' => '日补贴值必须大于等于0', + 'daily_other.require' => '请填写日其它', + 'daily_other.float' => '日其它值必须是数字', + 'daily_other.egt' => '日其它值必须大于等于0', + 'daily_income.require' => '请填写日收入', + 'daily_income.float' => '日收入必须是数字', + 'daily_income.gt' => '日收入值必须大于0', + ]; + + /** + * @notes 添加场景 + * @return ProjectAttendanceDetailValidate + * @author likeadmin + * @date 2023/12/26 10:54 + */ + public function sceneAdd() + { + return $this->remove('id', true); } - return true; - } - - public function checkPerson($value,$rule,$data): bool|string - { - $person = ProjectPersonnel::where('id',$value)->findOrEmpty(); - if($person->isEmpty() || $person['project_id'] != $data['project_id']){ - return '项目人员不存在'; + + /** + * @notes 编辑场景 + * @return ProjectAttendanceDetailValidate + * @author likeadmin + * @date 2023/12/26 10:54 + */ + public function sceneEdit() + { + return $this->only(['id', 'attendance_date', 'work_start_time', 'work_end_time', 'work_record_num', 'daily_salary', 'daily_living', 'daily_subsidy', 'daily_other', 'daily_income']); } - return true; - } - - public function checkWorkStartTime($value): bool|string - { - if($value != ''){ - if(date('Y-m-d H:i',strtotime($value)) != $value){ - return '上班时间格式错误'; + + /** + * @notes 删除场景 + * @return ProjectAttendanceDetailValidate + * @author likeadmin + * @date 2023/12/26 10:54 + */ + public function sceneDelete() + { + return $this->only(['id'])->remove('id', 'checkData'); + } + + + /** + * @notes 详情场景 + * @return ProjectAttendanceDetailValidate + * @author likeadmin + * @date 2023/12/26 10:54 + */ + public function sceneDetail() + { + return $this->only(['id']); + } + + public function checkProject($value): bool|string + { + $data = Project::where('id', $value)->findOrEmpty(); + if ($data->isEmpty()) { + return '项目不存在'; } + return true; } - return true; - } - - public function checkWorkEndTime($value,$rule,$data): bool|string - { - if($value != ''){ - if(date('Y-m-d H:i',strtotime($value)) != $value){ - return '下班时间格式错误'; - } - if(strtotime($value) - strtotime($data['work_start_time']) <= 0){ - return '下班时间不能小于上班时间'; + + public function checkPerson($value, $rule, $data): bool|string + { + $person = ProjectPersonnel::where('id', $value)->findOrEmpty(); + if ($person->isEmpty() || $person['project_id'] != $data['project_id']) { + return '项目人员不存在'; } + return true; } - return true; - } - -} \ No newline at end of file + + public function checkWorkStartTime($value): bool|string + { + if ($value != '') { + if (date('Y-m-d H:i', strtotime($value)) != $value) { + return '上班时间格式错误'; + } + } + return true; + } + + public function checkWorkEndTime($value, $rule, $data): bool|string + { + if ($value != '') { + if (date('Y-m-d H:i', strtotime($value)) != $value) { + return '下班时间格式错误'; + } + if (strtotime($value) - strtotime($data['work_start_time']) <= 0) { + return '下班时间不能小于上班时间'; + } + } + return true; + } + + } \ No newline at end of file diff --git a/app/adminapi/validate/project/ProjectAttendanceRecordValidate.php b/app/adminapi/validate/project/ProjectAttendanceRecordValidate.php index d54d6eb06..1523efa63 100644 --- a/app/adminapi/validate/project/ProjectAttendanceRecordValidate.php +++ b/app/adminapi/validate/project/ProjectAttendanceRecordValidate.php @@ -11,181 +11,177 @@ // +---------------------------------------------------------------------- // | author: likeadminTeam // +---------------------------------------------------------------------- - -namespace app\adminapi\validate\project; - - -use app\common\model\auth\Admin; -use app\common\model\dept\Orgs; -use app\common\model\dict\DictData; -use app\common\model\project\Project; -use app\common\model\project\ProjectPersonnel; -use app\common\validate\BaseValidate; - - -/** - * 考勤记录验证器 - * Class ProjectAttendanceRecordValidate - * @package app\adminapi\validate\project - */ -class ProjectAttendanceRecordValidate extends BaseValidate -{ - - /** - * 设置校验规则 - * @var string[] - */ - protected $rule = [ - 'id' => 'require', - 'project_id' => 'require|checkProject', - 'attendance_date' => 'require|dateFormat:Y-m-d', - 'attendance_detail' => 'require|checkAttendanceDetail', - 'file' => 'checkFile', - ]; - protected $message = [ - 'id.require' => '缺少必要参数', - 'project_id.require' => '请选择项目', - 'attendance_date.require' => '请选择考勤日期', - 'attendance_date.dateFormat' => '考勤日期格式错误', - 'attendance_detail.require' => '考勤记录清单信息不能为空', - ]; + namespace app\adminapi\validate\project; - - - /** - * @notes 添加场景 - * @return ProjectAttendanceRecordValidate - * @author likeadmin - * @date 2023/12/26 09:44 - */ - public function sceneAdd() - { - return $this->remove('id',true); - } - - - /** - * @notes 编辑场景 - * @return ProjectAttendanceRecordValidate - * @author likeadmin - * @date 2023/12/26 09:44 - */ - public function sceneEdit() - { - return $this->only(['id','attendance_date']); - } - - - /** - * @notes 删除场景 - * @return ProjectAttendanceRecordValidate - * @author likeadmin - * @date 2023/12/26 09:44 - */ - public function sceneDelete() - { - return $this->only(['id']); - } - - - /** - * @notes 详情场景 - * @return ProjectAttendanceRecordValidate - * @author likeadmin - * @date 2023/12/26 09:44 - */ - public function sceneDetail() - { - return $this->only(['id']); - } - public function checkProject($value): bool|string + use app\common\model\project\Project; + use app\common\model\project\ProjectPersonnel; + use app\common\validate\BaseValidate; + + + /** + * 考勤记录验证器 + * Class ProjectAttendanceRecordValidate + * @package app\adminapi\validate\project + */ + class ProjectAttendanceRecordValidate extends BaseValidate { - $data = Project::where('id',$value)->findOrEmpty(); - if($data->isEmpty()){ - return '项目不存在'; + + /** + * 设置校验规则 + * @var string[] + */ + protected $rule = [ + 'id' => 'require', + 'project_id' => 'require|checkProject', + 'attendance_date' => 'require|dateFormat:Y-m-d', + 'attendance_detail' => 'require|checkAttendanceDetail', + 'file' => 'checkFile', + ]; + + protected $message = [ + 'id.require' => '缺少必要参数', + 'project_id.require' => '请选择项目', + 'attendance_date.require' => '请选择考勤日期', + 'attendance_date.dateFormat' => '考勤日期格式错误', + 'attendance_detail.require' => '考勤记录清单信息不能为空', + ]; + + + /** + * @notes 添加场景 + * @return ProjectAttendanceRecordValidate + * @author likeadmin + * @date 2023/12/26 09:44 + */ + public function sceneAdd() + { + return $this->remove('id', true); } - return true; - } - - public function checkFile($value): bool|string - { - if(!empty($value) && $value != ''){ - if(!is_array($value)){ - return '附件必须是json数组'; - } + + + /** + * @notes 编辑场景 + * @return ProjectAttendanceRecordValidate + * @author likeadmin + * @date 2023/12/26 09:44 + */ + public function sceneEdit() + { + return $this->only(['id', 'attendance_date']); } - return true; - } - - public function checkAttendanceDetail($value,$rule,$data): bool|string - { - $attendance_detail = $value;//json_decode($value,true); - if(empty($attendance_detail) || !is_array($attendance_detail)){ - return '考勤记录清单数据格式错误'; + + + /** + * @notes 删除场景 + * @return ProjectAttendanceRecordValidate + * @author likeadmin + * @date 2023/12/26 09:44 + */ + public function sceneDelete() + { + return $this->only(['id'])->remove('id', 'checkData'); } - foreach($attendance_detail as $v) { - if(empty($v['person_id'])){ - return '请选择项目人员'; - }else{ - $person = ProjectPersonnel::where('id',$v['person_id'])->findOrEmpty(); - if($person->isEmpty() || $person['project_id'] != $data['project_id']){ - return '项目人员不存在'; - } - } - if(isset($v['work_start_time']) && $v['work_start_time'] != ''){ - if(date('Y-m-d H:i',strtotime($v['work_start_time'])) != $v['work_start_time']){ - return '上班时间格式错误'; - } - } - if(isset($v['work_end_time']) && $v['work_end_time'] != ''){ - if(date('Y-m-d H:i',strtotime($v['work_end_time'])) != $v['work_end_time']){ - return '下班时间格式错误'; - } - if(strtotime($v['work_end_time']) - strtotime($v['work_start_time']) < 0){ - return '下班时间不能小于上班时间'; - } - } - if(empty($v['work_record_num'])){ - return '记工数量不能为空'; - }else{ - if(!is_numeric($v['work_record_num']) || $v['work_record_num'] < 0){ - return '记工数量必须是大于0的数字'; - } - } - if(empty($v['daily_salary'])){ - return '日工资不能为空'; - }else{ - if(!is_numeric($v['daily_salary']) || $v['daily_salary'] < 0){ - return '日工资必须是大于0的数字'; - } - } - if(empty($v['daily_living'])){ - return '日生活费不能为空'; - }else{ - if(!is_numeric($v['daily_living']) || $v['daily_living'] < 0){ - return '日生活费必须是大于0的数字'; - } - } - if(isset($v['daily_subsidy']) && $v['daily_subsidy'] != ''){ - if(!is_numeric($v['daily_subsidy']) || $v['daily_subsidy'] < 0){ - return '日补贴必须是大于等于0的数字'; - } - } - if(isset($v['daily_other']) && $v['daily_other'] != ''){ - if(!is_numeric($v['daily_other']) || $v['daily_other'] < 0){ - return '日其它必须是大于等于0的数字'; - } - } - if(empty($v['daily_income'])){ - return '日收入不能为空'; - }else{ - if(!is_numeric($v['daily_income']) || $v['daily_income'] < 0){ - return '日收入必须是大于0的数字'; - } - } + + + /** + * @notes 详情场景 + * @return ProjectAttendanceRecordValidate + * @author likeadmin + * @date 2023/12/26 09:44 + */ + public function sceneDetail() + { + return $this->only(['id']); } - return true; - } -} \ No newline at end of file + + public function checkProject($value): bool|string + { + $data = Project::where('id', $value)->findOrEmpty(); + if ($data->isEmpty()) { + return '项目不存在'; + } + return true; + } + + public function checkFile($value): bool|string + { + if (!empty($value) && $value != '') { + if (!is_array($value)) { + return '附件必须是json数组'; + } + } + return true; + } + + public function checkAttendanceDetail($value, $rule, $data): bool|string + { + $attendance_detail = $value;//json_decode($value,true); + if (empty($attendance_detail) || !is_array($attendance_detail)) { + return '考勤记录清单数据格式错误'; + } + foreach ($attendance_detail as $v) { + if (empty($v['person_id'])) { + return '请选择项目人员'; + } else { + $person = ProjectPersonnel::where('id', $v['person_id'])->findOrEmpty(); + if ($person->isEmpty() || $person['project_id'] != $data['project_id']) { + return '项目人员不存在'; + } + } + if (isset($v['work_start_time']) && $v['work_start_time'] != '') { + if (date('Y-m-d H:i', strtotime($v['work_start_time'])) != $v['work_start_time']) { + return '上班时间格式错误'; + } + } + if (isset($v['work_end_time']) && $v['work_end_time'] != '') { + if (date('Y-m-d H:i', strtotime($v['work_end_time'])) != $v['work_end_time']) { + return '下班时间格式错误'; + } + if (strtotime($v['work_end_time']) - strtotime($v['work_start_time']) < 0) { + return '下班时间不能小于上班时间'; + } + } + if (empty($v['work_record_num'])) { + return '记工数量不能为空'; + } else { + if (!is_numeric($v['work_record_num']) || $v['work_record_num'] < 0) { + return '记工数量必须是大于0的数字'; + } + } + if (empty($v['daily_salary'])) { + return '日工资不能为空'; + } else { + if (!is_numeric($v['daily_salary']) || $v['daily_salary'] < 0) { + return '日工资必须是大于0的数字'; + } + } + if (empty($v['daily_living'])) { + return '日生活费不能为空'; + } else { + if (!is_numeric($v['daily_living']) || $v['daily_living'] < 0) { + return '日生活费必须是大于0的数字'; + } + } + if (isset($v['daily_subsidy']) && $v['daily_subsidy'] != '') { + if (!is_numeric($v['daily_subsidy']) || $v['daily_subsidy'] < 0) { + return '日补贴必须是大于等于0的数字'; + } + } + if (isset($v['daily_other']) && $v['daily_other'] != '') { + if (!is_numeric($v['daily_other']) || $v['daily_other'] < 0) { + return '日其它必须是大于等于0的数字'; + } + } + if (empty($v['daily_income'])) { + return '日收入不能为空'; + } else { + if (!is_numeric($v['daily_income']) || $v['daily_income'] < 0) { + return '日收入必须是大于0的数字'; + } + } + } + return true; + } + } \ No newline at end of file diff --git a/app/adminapi/validate/project/ProjectCostAdjustmentValidate.php b/app/adminapi/validate/project/ProjectCostAdjustmentValidate.php index a9761ccb0..8851d2849 100644 --- a/app/adminapi/validate/project/ProjectCostAdjustmentValidate.php +++ b/app/adminapi/validate/project/ProjectCostAdjustmentValidate.php @@ -11,128 +11,128 @@ // +---------------------------------------------------------------------- // | author: likeadminTeam // +---------------------------------------------------------------------- - -namespace app\adminapi\validate\project; - - -use app\common\model\project\Project; -use app\common\model\project\ProjectCostAdjustment; -use app\common\validate\BaseValidate; - - -/** - * 成本调整验证器 - * Class ProjectCostAdjustmentValidate - * @package app\adminapi\validate\project - */ -class ProjectCostAdjustmentValidate extends BaseValidate -{ - - /** - * 设置校验规则 - * @var string[] - */ - protected $rule = [ - 'id' => 'require|checkData', - 'project_id' => 'require|checkProject', - 'adjust_date' => 'require|dateFormat:Y-m-d', - 'adjust_amount' => 'require|float|gt:0', - 'annex' => 'checkAnnex', - 'flow_id' => 'require|checkFlow', - 'path' => 'require', - ]; - - - /** - * 参数描述 - * @var string[] - */ - protected $field = [ - 'id' => 'id', - 'project_id' => '项目id', - 'adjust_date' => '调整日期', - 'adjust_amount' => '调整金额', - ]; - - - /** - * @notes 添加场景 - * @return ProjectCostAdjustmentValidate - * @author likeadmin - * @date 2024/01/17 13:43 - */ - public function sceneAdd() - { - return $this->remove('id',true)->remove('flow_id',true)->remove('path',true); - } - - - /** - * @notes 编辑场景 - * @return ProjectCostAdjustmentValidate - * @author likeadmin - * @date 2024/01/17 13:43 - */ - public function sceneEdit() - { - return $this->remove('flow_id',true)->remove('path',true); - } - - - /** - * @notes 删除场景 - * @return ProjectCostAdjustmentValidate - * @author likeadmin - * @date 2024/01/17 13:43 - */ - public function sceneDelete() - { - return $this->only(['id']); - } - - - /** - * @notes 详情场景 - * @return ProjectCostAdjustmentValidate - * @author likeadmin - * @date 2024/01/17 13:43 - */ - public function sceneDetail() - { - return $this->only(['id']); - } - public function sceneApprove() - { - return $this->only(['id','flow_id','path']); - } + namespace app\adminapi\validate\project; - public function checkData($value): bool|string + + use app\common\model\project\Project; + use app\common\model\project\ProjectCostAdjustment; + use app\common\validate\BaseValidate; + + + /** + * 成本调整验证器 + * Class ProjectCostAdjustmentValidate + * @package app\adminapi\validate\project + */ + class ProjectCostAdjustmentValidate extends BaseValidate { - $data = ProjectCostAdjustment::where('id',$value)->findOrEmpty(); - if($data->isEmpty()){ - return '数据不存在'; + + /** + * 设置校验规则 + * @var string[] + */ + protected $rule = [ + 'id' => 'require|checkData', + 'project_id' => 'require|checkProject', + 'adjust_date' => 'require|dateFormat:Y-m-d', + 'adjust_amount' => 'require|float|gt:0', + 'annex' => 'checkAnnex', + 'flow_id' => 'require|checkFlow', + 'path' => 'require', + ]; + + + /** + * 参数描述 + * @var string[] + */ + protected $field = [ + 'id' => 'id', + 'project_id' => '项目id', + 'adjust_date' => '调整日期', + 'adjust_amount' => '调整金额', + ]; + + + /** + * @notes 添加场景 + * @return ProjectCostAdjustmentValidate + * @author likeadmin + * @date 2024/01/17 13:43 + */ + public function sceneAdd() + { + return $this->remove('id', true)->remove('flow_id', true)->remove('path', true); } - return true; - } - - public function checkProject($value): bool|string - { - $data = Project::where('id',$value)->findOrEmpty(); - if($data->isEmpty()){ - return '项目信息不存在'; + + + /** + * @notes 编辑场景 + * @return ProjectCostAdjustmentValidate + * @author likeadmin + * @date 2024/01/17 13:43 + */ + public function sceneEdit() + { + return $this->remove('flow_id', true)->remove('path', true); } - return true; - } - - public function checkAnnex($value): bool|string - { - if(!empty($value) && $value != ''){ - if(!is_array($value)){ - return '附件格式错误'; + + + /** + * @notes 删除场景 + * @return ProjectCostAdjustmentValidate + * @author likeadmin + * @date 2024/01/17 13:43 + */ + public function sceneDelete() + { + return $this->only(['id'])->remove('id', 'checkData'); + } + + + /** + * @notes 详情场景 + * @return ProjectCostAdjustmentValidate + * @author likeadmin + * @date 2024/01/17 13:43 + */ + public function sceneDetail() + { + return $this->only(['id']); + } + + public function sceneApprove() + { + return $this->only(['id', 'flow_id', 'path']); + } + + public function checkData($value): bool|string + { + $data = ProjectCostAdjustment::where('id', $value)->findOrEmpty(); + if ($data->isEmpty()) { + return '数据不存在'; } + return true; } - return true; - } - -} \ No newline at end of file + + public function checkProject($value): bool|string + { + $data = Project::where('id', $value)->findOrEmpty(); + if ($data->isEmpty()) { + return '项目信息不存在'; + } + return true; + } + + public function checkAnnex($value): bool|string + { + if (!empty($value) && $value != '') { + if (!is_array($value)) { + return '附件格式错误'; + } + } + return true; + } + + } \ No newline at end of file diff --git a/app/adminapi/validate/project/ProjectCostBudgetDetailValidate.php b/app/adminapi/validate/project/ProjectCostBudgetDetailValidate.php index bf41676f9..7835d0504 100644 --- a/app/adminapi/validate/project/ProjectCostBudgetDetailValidate.php +++ b/app/adminapi/validate/project/ProjectCostBudgetDetailValidate.php @@ -11,110 +11,111 @@ // +---------------------------------------------------------------------- // | author: likeadminTeam // +---------------------------------------------------------------------- - -namespace app\adminapi\validate\project; - - -use app\common\model\project\ProjectCostBudget; -use app\common\model\project\ProjectCostTempSet; -use app\common\validate\BaseValidate; - - -/** - * 费用预算明细验证器 - * Class ProjectCostBudgetDetailValidate - * @package app\adminapi\validate\project - */ -class ProjectCostBudgetDetailValidate extends BaseValidate -{ - - /** - * 设置校验规则 - * @var string[] - */ - protected $rule = [ - 'id' => 'require', - 'cost_budget_id' => 'require|checkCostBudget', - 'project_cost_temp_id' => 'require|checkProjectCostTemp', - 'unit' => 'require', - 'amount' => 'require|float|gt:0', - ]; - - - /** - * 参数描述 - * @var string[] - */ - protected $field = [ - 'id' => 'id', - 'cost_budget_id' => '费用预算id', - 'project_cost_temp_id' => '项目费用模板id', - 'unit' => '单位', - 'amount' => '预算金额', - ]; - - - /** - * @notes 添加场景 - * @return ProjectCostBudgetDetailValidate - * @author likeadmin - * @date 2024/01/16 14:32 - */ - public function sceneAdd() - { - return $this->remove('id',true); - } - - - /** - * @notes 编辑场景 - * @return ProjectCostBudgetDetailValidate - * @author likeadmin - * @date 2024/01/16 14:32 - */ - public function sceneEdit() - {} - - - /** - * @notes 删除场景 - * @return ProjectCostBudgetDetailValidate - * @author likeadmin - * @date 2024/01/16 14:32 - */ - public function sceneDelete() - { - return $this->only(['id']); - } - - - /** - * @notes 详情场景 - * @return ProjectCostBudgetDetailValidate - * @author likeadmin - * @date 2024/01/16 14:32 - */ - public function sceneDetail() - { - return $this->only(['id']); - } - public function checkCostBudget($value): bool|string - { - $data = ProjectCostBudget::where('id',$value)->findOrEmpty(); - if($data->isEmpty()){ - return '费用预算信息不存在'; - } - return true; - } + namespace app\adminapi\validate\project; - public function checkProjectCostTemp($value): bool|string + + use app\common\model\project\ProjectCostBudget; + use app\common\model\project\ProjectCostTempSet; + use app\common\validate\BaseValidate; + + + /** + * 费用预算明细验证器 + * Class ProjectCostBudgetDetailValidate + * @package app\adminapi\validate\project + */ + class ProjectCostBudgetDetailValidate extends BaseValidate { - $data = ProjectCostTempSet::where('id',$value)->findOrEmpty(); - if($data->isEmpty()){ - return '项目费用模板信息不存在'; + + /** + * 设置校验规则 + * @var string[] + */ + protected $rule = [ + 'id' => 'require', + 'cost_budget_id' => 'require|checkCostBudget', + 'project_cost_temp_id' => 'require|checkProjectCostTemp', + 'unit' => 'require', + 'amount' => 'require|float|gt:0', + ]; + + + /** + * 参数描述 + * @var string[] + */ + protected $field = [ + 'id' => 'id', + 'cost_budget_id' => '费用预算id', + 'project_cost_temp_id' => '项目费用模板id', + 'unit' => '单位', + 'amount' => '预算金额', + ]; + + + /** + * @notes 添加场景 + * @return ProjectCostBudgetDetailValidate + * @author likeadmin + * @date 2024/01/16 14:32 + */ + public function sceneAdd() + { + return $this->remove('id', true); } - return true; - } - -} \ No newline at end of file + + + /** + * @notes 编辑场景 + * @return ProjectCostBudgetDetailValidate + * @author likeadmin + * @date 2024/01/16 14:32 + */ + public function sceneEdit() + { + } + + + /** + * @notes 删除场景 + * @return ProjectCostBudgetDetailValidate + * @author likeadmin + * @date 2024/01/16 14:32 + */ + public function sceneDelete() + { + return $this->only(['id'])->remove('id', 'checkData'); + } + + + /** + * @notes 详情场景 + * @return ProjectCostBudgetDetailValidate + * @author likeadmin + * @date 2024/01/16 14:32 + */ + public function sceneDetail() + { + return $this->only(['id']); + } + + public function checkCostBudget($value): bool|string + { + $data = ProjectCostBudget::where('id', $value)->findOrEmpty(); + if ($data->isEmpty()) { + return '费用预算信息不存在'; + } + return true; + } + + public function checkProjectCostTemp($value): bool|string + { + $data = ProjectCostTempSet::where('id', $value)->findOrEmpty(); + if ($data->isEmpty()) { + return '项目费用模板信息不存在'; + } + return true; + } + + } \ No newline at end of file diff --git a/app/adminapi/validate/project/ProjectCostBudgetValidate.php b/app/adminapi/validate/project/ProjectCostBudgetValidate.php index e0b262e74..f491ef440 100644 --- a/app/adminapi/validate/project/ProjectCostBudgetValidate.php +++ b/app/adminapi/validate/project/ProjectCostBudgetValidate.php @@ -11,184 +11,184 @@ // +---------------------------------------------------------------------- // | author: likeadminTeam // +---------------------------------------------------------------------- - -namespace app\adminapi\validate\project; - - -use app\common\model\dept\Dept; -use app\common\model\dept\Orgs; -use app\common\model\project\Project; -use app\common\model\project\ProjectCostBudget; -use app\common\model\project\ProjectCostBudgetDetail; -use app\common\model\project\ProjectCostTempSet; -use app\common\validate\BaseValidate; - - -/** - * 费用预算验证器 - * Class ProjectCostBudgetValidate - * @package app\adminapi\validate\project - */ -class ProjectCostBudgetValidate extends BaseValidate -{ - - /** - * 设置校验规则 - * @var string[] - */ - protected $rule = [ - 'id' => 'require|checkData', - 'org_id' => 'require|checkOrg', - 'dept_id' => 'require|checkDept', - 'project_id' => 'require|checkProject', - 'annex' => 'checkAnnex', - 'cost_budget_detail' => 'require|checkCostBudgetDetail', - 'flow_id' => 'require|checkFlow', - 'path' => 'require', - ]; - protected $message = [ - 'id.require' => '缺少必要参数', - 'org_id.require' => '请选择组织', - 'dept_id.require' => '请选择部门', - 'project_id.require' => '请选择项目', - 'cost_budget_detail.require' => '请填写费用预算清单', - ]; - - - /** - * @notes 添加场景 - * @return ProjectCostBudgetValidate - * @author likeadmin - * @date 2024/01/16 14:32 - */ - public function sceneAdd() - { - return $this->remove('id',true)->remove('flow_id',true)->remove('path',true); - } - - - /** - * @notes 编辑场景 - * @return ProjectCostBudgetValidate - * @author likeadmin - * @date 2024/01/16 14:32 - */ - public function sceneEdit() - { - return $this->remove('flow_id',true)->remove('path',true); - } - - - /** - * @notes 删除场景 - * @return ProjectCostBudgetValidate - * @author likeadmin - * @date 2024/01/16 14:32 - */ - public function sceneDelete() - { - return $this->only(['id']); - } - - - /** - * @notes 详情场景 - * @return ProjectCostBudgetValidate - * @author likeadmin - * @date 2024/01/16 14:32 - */ - public function sceneDetail() - { - return $this->only(['id']); - } + namespace app\adminapi\validate\project; - public function sceneApprove() + + use app\common\model\dept\Dept; + use app\common\model\dept\Orgs; + use app\common\model\project\Project; + use app\common\model\project\ProjectCostBudget; + use app\common\model\project\ProjectCostBudgetDetail; + use app\common\model\project\ProjectCostTempSet; + use app\common\validate\BaseValidate; + + + /** + * 费用预算验证器 + * Class ProjectCostBudgetValidate + * @package app\adminapi\validate\project + */ + class ProjectCostBudgetValidate extends BaseValidate { - return $this->only(['id','flow_id','path']); - } - - public function checkData($value): bool|string - { - $data = ProjectCostBudget::where('id',$value)->findOrEmpty(); - if($data->isEmpty()){ - return '数据不存在'; + + /** + * 设置校验规则 + * @var string[] + */ + protected $rule = [ + 'id' => 'require|checkData', + 'org_id' => 'require|checkOrg', + 'dept_id' => 'require|checkDept', + 'project_id' => 'require|checkProject', + 'annex' => 'checkAnnex', + 'cost_budget_detail' => 'require|checkCostBudgetDetail', + 'flow_id' => 'require|checkFlow', + 'path' => 'require', + ]; + + protected $message = [ + 'id.require' => '缺少必要参数', + 'org_id.require' => '请选择组织', + 'dept_id.require' => '请选择部门', + 'project_id.require' => '请选择项目', + 'cost_budget_detail.require' => '请填写费用预算清单', + ]; + + + /** + * @notes 添加场景 + * @return ProjectCostBudgetValidate + * @author likeadmin + * @date 2024/01/16 14:32 + */ + public function sceneAdd() + { + return $this->remove('id', true)->remove('flow_id', true)->remove('path', true); } - return true; - } - - public function checkOrg($value): bool|string - { - $org = Orgs::where('id',$value)->findOrEmpty(); - if($org->isEmpty()){ - return '组织不存在'; + + + /** + * @notes 编辑场景 + * @return ProjectCostBudgetValidate + * @author likeadmin + * @date 2024/01/16 14:32 + */ + public function sceneEdit() + { + return $this->remove('flow_id', true)->remove('path', true); } - return true; - } - - public function checkDept($value,$rule,$data): bool|string - { - $dept = Dept::where('id',$value)->findOrEmpty(); - if($dept->isEmpty()){ - return '部门不存在'; + + + /** + * @notes 删除场景 + * @return ProjectCostBudgetValidate + * @author likeadmin + * @date 2024/01/16 14:32 + */ + public function sceneDelete() + { + return $this->only(['id'])->remove('id', 'checkData'); } - if($dept['org_id'] != $data['org_id']){ - return '部门无效'; + + + /** + * @notes 详情场景 + * @return ProjectCostBudgetValidate + * @author likeadmin + * @date 2024/01/16 14:32 + */ + public function sceneDetail() + { + return $this->only(['id']); } - return true; - } - - public function checkProject($value): bool|string - { - $project = Project::where('id',$value)->findOrEmpty(); - if($project->isEmpty()){ - return '项目信息不存在'; + + public function sceneApprove() + { + return $this->only(['id', 'flow_id', 'path']); } - if($project['is_budget'] != 1){ - return '该项目没有编制总预算,不能添加材料预算'; - } - return true; - } - - public function checkAnnex($value): bool|string - { - if(!empty($value) && $value != ''){ - if(!is_array($value)){ - return '附件格式错误'; + + public function checkData($value): bool|string + { + $data = ProjectCostBudget::where('id', $value)->findOrEmpty(); + if ($data->isEmpty()) { + return '数据不存在'; } + return true; } - return true; - } - - public function checkCostBudgetDetail($value): bool|string - { - if(empty($value) || !is_array($value)){ - return '费用预算清单数据格式错误'; + + public function checkOrg($value): bool|string + { + $org = Orgs::where('id', $value)->findOrEmpty(); + if ($org->isEmpty()) { + return '组织不存在'; + } + return true; } - foreach($value as $v) { - if(isset($v['id']) && $v['id'] != ''){ - $data = ProjectCostBudgetDetail::where('id',$v['id'])->findOrEmpty(); - if($data->isEmpty()){ - return '费用预算明细信息不存在'; - } - } - if(empty($v['project_cost_temp_id'])){ - return '科目模板不能为空'; - }else{ - $temp = ProjectCostTempSet::where('id',$v['project_cost_temp_id'])->findOrEmpty(); - if($temp->isEmpty()){ - return '科目模板不存在'; - } - } - if(empty($v['amount'])){ - return '预算金额不能为空'; - }else{ - if(!is_numeric($v['amount']) || $v['amount'] < 0){ - return '预算金额必须是大于0的数字'; + + public function checkDept($value, $rule, $data): bool|string + { + $dept = Dept::where('id', $value)->findOrEmpty(); + if ($dept->isEmpty()) { + return '部门不存在'; + } + if ($dept['org_id'] != $data['org_id']) { + return '部门无效'; + } + return true; + } + + public function checkProject($value): bool|string + { + $project = Project::where('id', $value)->findOrEmpty(); + if ($project->isEmpty()) { + return '项目信息不存在'; + } + if ($project['is_budget'] != 1) { + return '该项目没有编制总预算,不能添加材料预算'; + } + return true; + } + + public function checkAnnex($value): bool|string + { + if (!empty($value) && $value != '') { + if (!is_array($value)) { + return '附件格式错误'; } } + return true; } - return true; - } - -} \ No newline at end of file + + public function checkCostBudgetDetail($value): bool|string + { + if (empty($value) || !is_array($value)) { + return '费用预算清单数据格式错误'; + } + foreach ($value as $v) { + if (isset($v['id']) && $v['id'] != '') { + $data = ProjectCostBudgetDetail::where('id', $v['id'])->findOrEmpty(); + if ($data->isEmpty()) { + return '费用预算明细信息不存在'; + } + } + if (empty($v['project_cost_temp_id'])) { + return '科目模板不能为空'; + } else { + $temp = ProjectCostTempSet::where('id', $v['project_cost_temp_id'])->findOrEmpty(); + if ($temp->isEmpty()) { + return '科目模板不存在'; + } + } + if (empty($v['amount'])) { + return '预算金额不能为空'; + } else { + if (!is_numeric($v['amount']) || $v['amount'] < 0) { + return '预算金额必须是大于0的数字'; + } + } + } + return true; + } + + } \ No newline at end of file diff --git a/app/adminapi/validate/project/ProjectCostTempSetValidate.php b/app/adminapi/validate/project/ProjectCostTempSetValidate.php index 439fce0e8..db656a749 100644 --- a/app/adminapi/validate/project/ProjectCostTempSetValidate.php +++ b/app/adminapi/validate/project/ProjectCostTempSetValidate.php @@ -11,110 +11,111 @@ // +---------------------------------------------------------------------- // | author: likeadminTeam // +---------------------------------------------------------------------- - -namespace app\adminapi\validate\project; - - -use app\common\model\project\ProjectCostTempSet; -use app\common\model\project\ProjectTypeSet; -use app\common\validate\BaseValidate; - - -/** - * 项目费用模板验证器 - * Class ProjectCostTempSetValidate - * @package app\adminapi\validate\project - */ -class ProjectCostTempSetValidate extends BaseValidate -{ - - /** - * 设置校验规则 - * @var string[] - */ - protected $rule = [ - 'id' => 'require', - 'project_type_id' => 'require|checkProjectType', - 'subject_code' => 'require|unique:'.ProjectCostTempSet::class, - 'first_level_subject' => 'require', - 'is_travel' => 'require|integer|in:1,2', - ]; - protected $message = [ - 'id.require' => '缺少你要参数', - 'project_type_id.require' => '请选择项目类型', - 'subject_code.require' => '请填写科目编码', - 'subject_code.unique' => '科目编码不能重复', - 'first_level_subject' => '请填写一级科目', - 'is_travel.require' => '请选择是否是差旅科目', - 'is_travel.integer' => '差旅科目数据格式错误', - 'is_travel.in' => '差旅科目数据值错误' - ]; + namespace app\adminapi\validate\project; - /** - * 参数描述 - * @var string[] - */ - protected $field = [ - 'id' => 'id', - 'project_type_id' => '项目类型id', - 'subject_code' => '科目编码', - 'first_level_subject' => '一级科目', - 'is_travel' => '是否是差旅科目 1-是 2-否', - ]; - /** - * @notes 添加场景 - * @return ProjectCostTempSetValidate - * @author likeadmin - * @date 2023/12/14 11:54 - */ - public function sceneAdd() - { - return $this->remove('id',true); - } - - - /** - * @notes 编辑场景 - * @return ProjectCostTempSetValidate - * @author likeadmin - * @date 2023/12/14 11:54 - */ - public function sceneEdit() - {} - - - /** - * @notes 删除场景 - * @return ProjectCostTempSetValidate - * @author likeadmin - * @date 2023/12/14 11:54 - */ - public function sceneDelete() - { - return $this->only(['id']); - } - - - /** - * @notes 详情场景 - * @return ProjectCostTempSetValidate - * @author likeadmin - * @date 2023/12/14 11:54 - */ - public function sceneDetail() - { - return $this->only(['id']); - } + use app\common\model\project\ProjectCostTempSet; + use app\common\model\project\ProjectTypeSet; + use app\common\validate\BaseValidate; - public function checkProjectType($value): bool|string + + /** + * 项目费用模板验证器 + * Class ProjectCostTempSetValidate + * @package app\adminapi\validate\project + */ + class ProjectCostTempSetValidate extends BaseValidate { - $data = ProjectTypeSet::where('id',$value)->findOrEmpty(); - if($data->isEmpty()){ - return '项目类型不存在'; + + /** + * 设置校验规则 + * @var string[] + */ + protected $rule = [ + 'id' => 'require', + 'project_type_id' => 'require|checkProjectType', + 'subject_code' => 'require|unique:' . ProjectCostTempSet::class, + 'first_level_subject' => 'require', + 'is_travel' => 'require|integer|in:1,2', + ]; + + protected $message = [ + 'id.require' => '缺少你要参数', + 'project_type_id.require' => '请选择项目类型', + 'subject_code.require' => '请填写科目编码', + 'subject_code.unique' => '科目编码不能重复', + 'first_level_subject' => '请填写一级科目', + 'is_travel.require' => '请选择是否是差旅科目', + 'is_travel.integer' => '差旅科目数据格式错误', + 'is_travel.in' => '差旅科目数据值错误' + ]; + + /** + * 参数描述 + * @var string[] + */ + protected $field = [ + 'id' => 'id', + 'project_type_id' => '项目类型id', + 'subject_code' => '科目编码', + 'first_level_subject' => '一级科目', + 'is_travel' => '是否是差旅科目 1-是 2-否', + ]; + + /** + * @notes 添加场景 + * @return ProjectCostTempSetValidate + * @author likeadmin + * @date 2023/12/14 11:54 + */ + public function sceneAdd() + { + return $this->remove('id', true); } - return true; - } - -} \ No newline at end of file + + + /** + * @notes 编辑场景 + * @return ProjectCostTempSetValidate + * @author likeadmin + * @date 2023/12/14 11:54 + */ + public function sceneEdit() + { + } + + + /** + * @notes 删除场景 + * @return ProjectCostTempSetValidate + * @author likeadmin + * @date 2023/12/14 11:54 + */ + public function sceneDelete() + { + return $this->only(['id'])->remove('id', 'checkData'); + } + + + /** + * @notes 详情场景 + * @return ProjectCostTempSetValidate + * @author likeadmin + * @date 2023/12/14 11:54 + */ + public function sceneDetail() + { + return $this->only(['id']); + } + + public function checkProjectType($value): bool|string + { + $data = ProjectTypeSet::where('id', $value)->findOrEmpty(); + if ($data->isEmpty()) { + return '项目类型不存在'; + } + return true; + } + + } \ No newline at end of file diff --git a/app/adminapi/validate/project/ProjectDocumentSetValidate.php b/app/adminapi/validate/project/ProjectDocumentSetValidate.php index 4bdcd1ef4..0f641b0c5 100644 --- a/app/adminapi/validate/project/ProjectDocumentSetValidate.php +++ b/app/adminapi/validate/project/ProjectDocumentSetValidate.php @@ -11,127 +11,128 @@ // +---------------------------------------------------------------------- // | author: likeadminTeam // +---------------------------------------------------------------------- - -namespace app\adminapi\validate\project; - - -use app\common\model\project\ProjectDocumentSet; -use app\common\model\project\ProjectTypeSet; -use app\common\validate\BaseValidate; - - -/** - * 项目文档设置验证器 - * Class ProjectDocumentSetValidate - * @package app\adminapi\validate\project - */ -class ProjectDocumentSetValidate extends BaseValidate -{ - - /** - * 设置校验规则 - * @var string[] - */ - protected $rule = [ - 'id' => 'require|checkProjectDoc', - 'project_type_id' => 'require|checkProjectType', - 'large_category' => 'require', - 'middle_category' => 'require', - 'name' => 'require', - 'is_upload' => 'require|in:1,2', - 'sort' => 'require|integer', - ]; - protected $message = [ - 'id.require' => '缺少必要参数', - 'project_type_id.require' => '请选择项目类型', - 'large_category.require' => '请填写文档大类', - 'middle_category.require' => '请填写文档中类', - 'name.require' => '请填写文档名称', - 'is_upload.require' => '请选择是否必传', - 'is_upload.in' => '是否必传选项数据值错误', - 'sort.require' => '请填写排序码', - 'sort.integer' => '排序码数据格式错误', - ]; - - - /** - * 参数描述 - * @var string[] - */ - protected $field = [ - 'id' => 'id', - 'project_type_id' => '项目类型id', - 'large_category' => '文档大类', - 'middle_category' => '文档中类', - 'name' => '文档名称', - 'is_upload' => '必传 1-是 2-否', - 'sort' => '排序号', - - ]; - - - /** - * @notes 添加场景 - * @return ProjectDocumentSetValidate - * @author likeadmin - * @date 2023/12/14 14:26 - */ - public function sceneAdd() - { - return $this->remove('id',true); - } - - - /** - * @notes 编辑场景 - * @return ProjectDocumentSetValidate - * @author likeadmin - * @date 2023/12/14 14:26 - */ - public function sceneEdit() - {} - - - /** - * @notes 删除场景 - * @return ProjectDocumentSetValidate - * @author likeadmin - * @date 2023/12/14 14:26 - */ - public function sceneDelete() - { - return $this->only(['id']); - } - - - /** - * @notes 详情场景 - * @return ProjectDocumentSetValidate - * @author likeadmin - * @date 2023/12/14 14:26 - */ - public function sceneDetail() - { - return $this->only(['id']); - } + namespace app\adminapi\validate\project; - public function checkProjectDoc($value): bool|string + + use app\common\model\project\ProjectDocumentSet; + use app\common\model\project\ProjectTypeSet; + use app\common\validate\BaseValidate; + + + /** + * 项目文档设置验证器 + * Class ProjectDocumentSetValidate + * @package app\adminapi\validate\project + */ + class ProjectDocumentSetValidate extends BaseValidate { - $data = ProjectDocumentSet::where('id',$value)->findOrEmpty(); - if($data->isEmpty()){ - return '数据不存在'; + + /** + * 设置校验规则 + * @var string[] + */ + protected $rule = [ + 'id' => 'require|checkProjectDoc', + 'project_type_id' => 'require|checkProjectType', + 'large_category' => 'require', + 'middle_category' => 'require', + 'name' => 'require', + 'is_upload' => 'require|in:1,2', + 'sort' => 'require|integer', + ]; + + protected $message = [ + 'id.require' => '缺少必要参数', + 'project_type_id.require' => '请选择项目类型', + 'large_category.require' => '请填写文档大类', + 'middle_category.require' => '请填写文档中类', + 'name.require' => '请填写文档名称', + 'is_upload.require' => '请选择是否必传', + 'is_upload.in' => '是否必传选项数据值错误', + 'sort.require' => '请填写排序码', + 'sort.integer' => '排序码数据格式错误', + ]; + + + /** + * 参数描述 + * @var string[] + */ + protected $field = [ + 'id' => 'id', + 'project_type_id' => '项目类型id', + 'large_category' => '文档大类', + 'middle_category' => '文档中类', + 'name' => '文档名称', + 'is_upload' => '必传 1-是 2-否', + 'sort' => '排序号', + + ]; + + + /** + * @notes 添加场景 + * @return ProjectDocumentSetValidate + * @author likeadmin + * @date 2023/12/14 14:26 + */ + public function sceneAdd() + { + return $this->remove('id', true); } - return true; - } - - public function checkProjectType($value): bool|string - { - $data = ProjectTypeSet::where('id',$value)->findOrEmpty(); - if($data->isEmpty()){ - return '项目类型不存在'; + + + /** + * @notes 编辑场景 + * @return ProjectDocumentSetValidate + * @author likeadmin + * @date 2023/12/14 14:26 + */ + public function sceneEdit() + { } - return true; - } - -} \ No newline at end of file + + + /** + * @notes 删除场景 + * @return ProjectDocumentSetValidate + * @author likeadmin + * @date 2023/12/14 14:26 + */ + public function sceneDelete() + { + return $this->only(['id'])->remove('id', 'checkData'); + } + + + /** + * @notes 详情场景 + * @return ProjectDocumentSetValidate + * @author likeadmin + * @date 2023/12/14 14:26 + */ + public function sceneDetail() + { + return $this->only(['id']); + } + + public function checkProjectDoc($value): bool|string + { + $data = ProjectDocumentSet::where('id', $value)->findOrEmpty(); + if ($data->isEmpty()) { + return '数据不存在'; + } + return true; + } + + public function checkProjectType($value): bool|string + { + $data = ProjectTypeSet::where('id', $value)->findOrEmpty(); + if ($data->isEmpty()) { + return '项目类型不存在'; + } + return true; + } + + } \ No newline at end of file diff --git a/app/adminapi/validate/project/ProjectDocumentValidate.php b/app/adminapi/validate/project/ProjectDocumentValidate.php index bac7468f5..2a327081f 100644 --- a/app/adminapi/validate/project/ProjectDocumentValidate.php +++ b/app/adminapi/validate/project/ProjectDocumentValidate.php @@ -11,118 +11,118 @@ // +---------------------------------------------------------------------- // | author: likeadminTeam // +---------------------------------------------------------------------- - -namespace app\adminapi\validate\project; - - -use app\common\model\project\Project; -use app\common\model\project\ProjectDocumentSet; -use app\common\validate\BaseValidate; - - -/** - * 项目文档验证器 - * Class ProjectDocumentValidate - * @package app\adminapi\validate\project - */ -class ProjectDocumentValidate extends BaseValidate -{ - - /** - * 设置校验规则 - * @var string[] - */ - protected $rule = [ - 'id' => 'require', - 'project_id' => 'require|checkProject', - 'classify_id' => 'require|checkClassify', - 'name' => 'require', - ]; - protected $message = [ - 'id.require' => '缺少必要参数', - 'project_id.require' => '请选择项目', - 'classify_id.require' => '请选择文档大类', - 'name.require' => '请填写文档名称', - ]; - - - /** - * 参数描述 - * @var string[] - */ - protected $field = [ - 'id' => 'id', - 'project_id' => '项目id', - 'classify_id' => '文档分类id', - 'code' => '文档编号', - 'name' => '文档名称', - ]; - - - /** - * @notes 添加场景 - * @return ProjectDocumentValidate - * @author likeadmin - * @date 2023/12/18 15:42 - */ - public function sceneAdd() - { - return $this->only(['project_id','classify_id','name','describe','version','annex']); - } - - - /** - * @notes 编辑场景 - * @return ProjectDocumentValidate - * @author likeadmin - * @date 2023/12/18 15:42 - */ - public function sceneEdit() - { - return $this->only(['id','project_id','classify_id','name','describe','version','annex']); - } - - - /** - * @notes 删除场景 - * @return ProjectDocumentValidate - * @author likeadmin - * @date 2023/12/18 15:42 - */ - public function sceneDelete() - { - return $this->only(['id']); - } - - - /** - * @notes 详情场景 - * @return ProjectDocumentValidate - * @author likeadmin - * @date 2023/12/18 15:42 - */ - public function sceneDetail() - { - return $this->only(['id']); - } + namespace app\adminapi\validate\project; - public function checkProject($value): bool|string + + use app\common\model\project\Project; + use app\common\model\project\ProjectDocumentSet; + use app\common\validate\BaseValidate; + + + /** + * 项目文档验证器 + * Class ProjectDocumentValidate + * @package app\adminapi\validate\project + */ + class ProjectDocumentValidate extends BaseValidate { - $data = Project::where('id',$value)->findOrEmpty(); - if($data->isEmpty()){ - return '项目不存在'; + + /** + * 设置校验规则 + * @var string[] + */ + protected $rule = [ + 'id' => 'require', + 'project_id' => 'require|checkProject', + 'classify_id' => 'require|checkClassify', + 'name' => 'require', + ]; + + protected $message = [ + 'id.require' => '缺少必要参数', + 'project_id.require' => '请选择项目', + 'classify_id.require' => '请选择文档大类', + 'name.require' => '请填写文档名称', + ]; + + + /** + * 参数描述 + * @var string[] + */ + protected $field = [ + 'id' => 'id', + 'project_id' => '项目id', + 'classify_id' => '文档分类id', + 'code' => '文档编号', + 'name' => '文档名称', + ]; + + + /** + * @notes 添加场景 + * @return ProjectDocumentValidate + * @author likeadmin + * @date 2023/12/18 15:42 + */ + public function sceneAdd() + { + return $this->only(['project_id', 'classify_id', 'name', 'describe', 'version', 'annex']); } - return true; - } - - public function checkClassify($value): bool|string - { - $data = ProjectDocumentSet::where('id',$value)->findOrEmpty(); - if($data->isEmpty()){ - return '文档分类不存在'; + + + /** + * @notes 编辑场景 + * @return ProjectDocumentValidate + * @author likeadmin + * @date 2023/12/18 15:42 + */ + public function sceneEdit() + { + return $this->only(['id', 'project_id', 'classify_id', 'name', 'describe', 'version', 'annex']); } - return true; - } - -} \ No newline at end of file + + + /** + * @notes 删除场景 + * @return ProjectDocumentValidate + * @author likeadmin + * @date 2023/12/18 15:42 + */ + public function sceneDelete() + { + return $this->only(['id'])->remove('id', 'checkData'); + } + + + /** + * @notes 详情场景 + * @return ProjectDocumentValidate + * @author likeadmin + * @date 2023/12/18 15:42 + */ + public function sceneDetail() + { + return $this->only(['id']); + } + + public function checkProject($value): bool|string + { + $data = Project::where('id', $value)->findOrEmpty(); + if ($data->isEmpty()) { + return '项目不存在'; + } + return true; + } + + public function checkClassify($value): bool|string + { + $data = ProjectDocumentSet::where('id', $value)->findOrEmpty(); + if ($data->isEmpty()) { + return '文档分类不存在'; + } + return true; + } + + } \ No newline at end of file diff --git a/app/adminapi/validate/project/ProjectEquipmentBudgetDetailValidate.php b/app/adminapi/validate/project/ProjectEquipmentBudgetDetailValidate.php index ce700683a..dbc128a5c 100644 --- a/app/adminapi/validate/project/ProjectEquipmentBudgetDetailValidate.php +++ b/app/adminapi/validate/project/ProjectEquipmentBudgetDetailValidate.php @@ -11,104 +11,105 @@ // +---------------------------------------------------------------------- // | author: likeadminTeam // +---------------------------------------------------------------------- - -namespace app\adminapi\validate\project; - - -use app\common\model\project\ProjectEquipmentBudget; -use app\common\validate\BaseValidate; - - -/** - * 机具预算明细验证器 - * Class ProjectEquipmentBudgetDetailValidate - * @package app\adminapi\validate\project - */ -class ProjectEquipmentBudgetDetailValidate extends BaseValidate -{ - - /** - * 设置校验规则 - * @var string[] - */ - protected $rule = [ - 'id' => 'require', - 'equipment_budget_id' => 'require|checkEquipmentBudget', - 'type' => 'require', - 'name' => 'require', - 'unit' => 'require', - 'num' => 'require|float|gt:0', - 'price' => 'require|float|gt:0', - ]; - - - /** - * 参数描述 - * @var string[] - */ - protected $field = [ - 'id' => 'id', - 'equipment_budget_id' => '机具预算id', - 'type' => '机具类别', - 'name' => '机具名称', - 'unit' => '单位', - 'num' => '数量', - 'price' => '单价', - ]; - - - /** - * @notes 添加场景 - * @return ProjectEquipmentBudgetDetailValidate - * @author likeadmin - * @date 2024/01/16 11:40 - */ - public function sceneAdd() - { - return $this->remove('id',true); - } - - - /** - * @notes 编辑场景 - * @return ProjectEquipmentBudgetDetailValidate - * @author likeadmin - * @date 2024/01/16 11:40 - */ - public function sceneEdit() - {} - - - /** - * @notes 删除场景 - * @return ProjectEquipmentBudgetDetailValidate - * @author likeadmin - * @date 2024/01/16 11:40 - */ - public function sceneDelete() - { - return $this->only(['id']); - } - - - /** - * @notes 详情场景 - * @return ProjectEquipmentBudgetDetailValidate - * @author likeadmin - * @date 2024/01/16 11:40 - */ - public function sceneDetail() - { - return $this->only(['id']); - } - public function checkEquipmentBudget($value): bool|string + namespace app\adminapi\validate\project; + + + use app\common\model\project\ProjectEquipmentBudget; + use app\common\validate\BaseValidate; + + + /** + * 机具预算明细验证器 + * Class ProjectEquipmentBudgetDetailValidate + * @package app\adminapi\validate\project + */ + class ProjectEquipmentBudgetDetailValidate extends BaseValidate { - $data = ProjectEquipmentBudget::where('id',$value)->findOrEmpty(); - if($data->isEmpty()){ - return '机具预算信息不存在'; + + /** + * 设置校验规则 + * @var string[] + */ + protected $rule = [ + 'id' => 'require', + 'equipment_budget_id' => 'require|checkEquipmentBudget', + 'type' => 'require', + 'name' => 'require', + 'unit' => 'require', + 'num' => 'require|float|gt:0', + 'price' => 'require|float|gt:0', + ]; + + + /** + * 参数描述 + * @var string[] + */ + protected $field = [ + 'id' => 'id', + 'equipment_budget_id' => '机具预算id', + 'type' => '机具类别', + 'name' => '机具名称', + 'unit' => '单位', + 'num' => '数量', + 'price' => '单价', + ]; + + + /** + * @notes 添加场景 + * @return ProjectEquipmentBudgetDetailValidate + * @author likeadmin + * @date 2024/01/16 11:40 + */ + public function sceneAdd() + { + return $this->remove('id', true); } - return true; - } - -} \ No newline at end of file + + + /** + * @notes 编辑场景 + * @return ProjectEquipmentBudgetDetailValidate + * @author likeadmin + * @date 2024/01/16 11:40 + */ + public function sceneEdit() + { + } + + + /** + * @notes 删除场景 + * @return ProjectEquipmentBudgetDetailValidate + * @author likeadmin + * @date 2024/01/16 11:40 + */ + public function sceneDelete() + { + return $this->only(['id'])->remove('id', 'checkData'); + } + + + /** + * @notes 详情场景 + * @return ProjectEquipmentBudgetDetailValidate + * @author likeadmin + * @date 2024/01/16 11:40 + */ + public function sceneDetail() + { + return $this->only(['id']); + } + + public function checkEquipmentBudget($value): bool|string + { + $data = ProjectEquipmentBudget::where('id', $value)->findOrEmpty(); + if ($data->isEmpty()) { + return '机具预算信息不存在'; + } + return true; + } + + } \ No newline at end of file diff --git a/app/adminapi/validate/project/ProjectEquipmentBudgetValidate.php b/app/adminapi/validate/project/ProjectEquipmentBudgetValidate.php index 7805855fc..c2258f560 100644 --- a/app/adminapi/validate/project/ProjectEquipmentBudgetValidate.php +++ b/app/adminapi/validate/project/ProjectEquipmentBudgetValidate.php @@ -11,191 +11,191 @@ // +---------------------------------------------------------------------- // | author: likeadminTeam // +---------------------------------------------------------------------- - -namespace app\adminapi\validate\project; - - -use app\common\model\dept\Dept; -use app\common\model\dept\Orgs; -use app\common\model\project\Project; -use app\common\model\project\ProjectEquipmentBudget; -use app\common\model\project\ProjectEquipmentBudgetDetail; -use app\common\validate\BaseValidate; - - -/** - * 机具预算验证器 - * Class ProjectEquipmentBudgetValidate - * @package app\adminapi\validate\project - */ -class ProjectEquipmentBudgetValidate extends BaseValidate -{ - - /** - * 设置校验规则 - * @var string[] - */ - protected $rule = [ - 'id' => 'require|checkData', - 'org_id' => 'require|checkOrg', - 'dept_id' => 'require|checkDept', - 'project_id' => 'require|checkProject', - 'annex' => 'checkAnnex', - 'equipment_budget_detail' => 'require|checkEquipmentBudgetDetail', - 'flow_id' => 'require|checkFlow', - 'path' => 'require', - ]; - protected $message = [ - 'id.require' => '缺少必要参数', - 'org_id.require' => '请选择组织', - 'dept_id.require' => '请选择部门', - 'project_id.require' => '请选择项目', - 'equipment_budget_detail.require' => '请填机具预算清单', - ]; - - - /** - * @notes 添加场景 - * @return ProjectEquipmentBudgetValidate - * @author likeadmin - * @date 2024/01/16 11:40 - */ - public function sceneAdd() - { - return $this->remove('id',true)->remove('flow_id',true)->remove('path',true); - } - - - /** - * @notes 编辑场景 - * @return ProjectEquipmentBudgetValidate - * @author likeadmin - * @date 2024/01/16 11:40 - */ - public function sceneEdit() - { - return $this->remove('flow_id',true)->remove('path',true); - } - - - /** - * @notes 删除场景 - * @return ProjectEquipmentBudgetValidate - * @author likeadmin - * @date 2024/01/16 11:40 - */ - public function sceneDelete() - { - return $this->only(['id']); - } - - - /** - * @notes 详情场景 - * @return ProjectEquipmentBudgetValidate - * @author likeadmin - * @date 2024/01/16 11:40 - */ - public function sceneDetail() - { - return $this->only(['id']); - } + namespace app\adminapi\validate\project; - public function sceneApprove() + + use app\common\model\dept\Dept; + use app\common\model\dept\Orgs; + use app\common\model\project\Project; + use app\common\model\project\ProjectEquipmentBudget; + use app\common\model\project\ProjectEquipmentBudgetDetail; + use app\common\validate\BaseValidate; + + + /** + * 机具预算验证器 + * Class ProjectEquipmentBudgetValidate + * @package app\adminapi\validate\project + */ + class ProjectEquipmentBudgetValidate extends BaseValidate { - return $this->only(['id','flow_id','path']); - } - - public function checkData($value): bool|string - { - $data = ProjectEquipmentBudget::where('id',$value)->findOrEmpty(); - if($data->isEmpty()){ - return '数据不存在'; + + /** + * 设置校验规则 + * @var string[] + */ + protected $rule = [ + 'id' => 'require|checkData', + 'org_id' => 'require|checkOrg', + 'dept_id' => 'require|checkDept', + 'project_id' => 'require|checkProject', + 'annex' => 'checkAnnex', + 'equipment_budget_detail' => 'require|checkEquipmentBudgetDetail', + 'flow_id' => 'require|checkFlow', + 'path' => 'require', + ]; + + protected $message = [ + 'id.require' => '缺少必要参数', + 'org_id.require' => '请选择组织', + 'dept_id.require' => '请选择部门', + 'project_id.require' => '请选择项目', + 'equipment_budget_detail.require' => '请填机具预算清单', + ]; + + + /** + * @notes 添加场景 + * @return ProjectEquipmentBudgetValidate + * @author likeadmin + * @date 2024/01/16 11:40 + */ + public function sceneAdd() + { + return $this->remove('id', true)->remove('flow_id', true)->remove('path', true); } - return true; - } - - public function checkOrg($value): bool|string - { - $org = Orgs::where('id',$value)->findOrEmpty(); - if($org->isEmpty()){ - return '组织不存在'; + + + /** + * @notes 编辑场景 + * @return ProjectEquipmentBudgetValidate + * @author likeadmin + * @date 2024/01/16 11:40 + */ + public function sceneEdit() + { + return $this->remove('flow_id', true)->remove('path', true); } - return true; - } - - public function checkDept($value,$rule,$data): bool|string - { - $dept = Dept::where('id',$value)->findOrEmpty(); - if($dept->isEmpty()){ - return '部门不存在'; + + + /** + * @notes 删除场景 + * @return ProjectEquipmentBudgetValidate + * @author likeadmin + * @date 2024/01/16 11:40 + */ + public function sceneDelete() + { + return $this->only(['id'])->remove('id', 'checkData'); } - if($dept['org_id'] != $data['org_id']){ - return '部门无效'; + + + /** + * @notes 详情场景 + * @return ProjectEquipmentBudgetValidate + * @author likeadmin + * @date 2024/01/16 11:40 + */ + public function sceneDetail() + { + return $this->only(['id']); } - return true; - } - - public function checkProject($value): bool|string - { - $project = Project::where('id',$value)->findOrEmpty(); - if($project->isEmpty()){ - return '项目信息不存在'; + + public function sceneApprove() + { + return $this->only(['id', 'flow_id', 'path']); } - if($project['is_budget'] != 1){ - return '该项目没有编制总预算,不能添加材料预算'; - } - return true; - } - - public function checkAnnex($value): bool|string - { - if(!empty($value) && $value != ''){ - if(!is_array($value)){ - return '附件格式错误'; + + public function checkData($value): bool|string + { + $data = ProjectEquipmentBudget::where('id', $value)->findOrEmpty(); + if ($data->isEmpty()) { + return '数据不存在'; } + return true; } - return true; - } - - public function checkEquipmentBudgetDetail($value): bool|string - { - if(empty($value) || !is_array($value)){ - return '机具预算清单数据格式错误'; + + public function checkOrg($value): bool|string + { + $org = Orgs::where('id', $value)->findOrEmpty(); + if ($org->isEmpty()) { + return '组织不存在'; + } + return true; } - foreach($value as $v) { - if(isset($v['id']) && $v['id'] != ''){ - $data = ProjectEquipmentBudgetDetail::where('id',$v['id'])->findOrEmpty(); - if($data->isEmpty()){ - return '机具预算明细信息不存在'; - } - } - if(empty($v['type'])){ - return '机具类别不能为空'; - } - if(empty($v['name'])){ - return '机具名称不能为空'; - } - if(empty($v['unit'])){ - return '单位不能为空'; - } - if(empty($v['num'])){ - return '数量不能为空'; - }else{ - if(!is_numeric($v['num']) || $v['num'] < 0){ - return '数量必须是大于0的数字'; - } - } - if(empty($v['price'])){ - return '单价不能为空'; - }else{ - if(!is_numeric($v['price']) || $v['price'] < 0){ - return '单价必须是大于0的数字'; + + public function checkDept($value, $rule, $data): bool|string + { + $dept = Dept::where('id', $value)->findOrEmpty(); + if ($dept->isEmpty()) { + return '部门不存在'; + } + if ($dept['org_id'] != $data['org_id']) { + return '部门无效'; + } + return true; + } + + public function checkProject($value): bool|string + { + $project = Project::where('id', $value)->findOrEmpty(); + if ($project->isEmpty()) { + return '项目信息不存在'; + } + if ($project['is_budget'] != 1) { + return '该项目没有编制总预算,不能添加材料预算'; + } + return true; + } + + public function checkAnnex($value): bool|string + { + if (!empty($value) && $value != '') { + if (!is_array($value)) { + return '附件格式错误'; } } + return true; } - return true; - } - -} \ No newline at end of file + + public function checkEquipmentBudgetDetail($value): bool|string + { + if (empty($value) || !is_array($value)) { + return '机具预算清单数据格式错误'; + } + foreach ($value as $v) { + if (isset($v['id']) && $v['id'] != '') { + $data = ProjectEquipmentBudgetDetail::where('id', $v['id'])->findOrEmpty(); + if ($data->isEmpty()) { + return '机具预算明细信息不存在'; + } + } + if (empty($v['type'])) { + return '机具类别不能为空'; + } + if (empty($v['name'])) { + return '机具名称不能为空'; + } + if (empty($v['unit'])) { + return '单位不能为空'; + } + if (empty($v['num'])) { + return '数量不能为空'; + } else { + if (!is_numeric($v['num']) || $v['num'] < 0) { + return '数量必须是大于0的数字'; + } + } + if (empty($v['price'])) { + return '单价不能为空'; + } else { + if (!is_numeric($v['price']) || $v['price'] < 0) { + return '单价必须是大于0的数字'; + } + } + } + return true; + } + + } \ No newline at end of file diff --git a/app/adminapi/validate/project/ProjectEstimateValidate.php b/app/adminapi/validate/project/ProjectEstimateValidate.php index 4c4ca966d..ff391be12 100644 --- a/app/adminapi/validate/project/ProjectEstimateValidate.php +++ b/app/adminapi/validate/project/ProjectEstimateValidate.php @@ -11,160 +11,161 @@ // +---------------------------------------------------------------------- // | author: likeadminTeam // +---------------------------------------------------------------------- - -namespace app\adminapi\validate\project; - - -use app\common\model\auth\Admin; -use app\common\model\custom\CustomContacts; -use app\common\model\custom\CustomerDemand; -use app\common\model\dict\DictData; -use app\common\model\project\Project; -use app\common\validate\BaseValidate; - - -/** - * 项目概算验证器 - * Class ProjectEstimateValidate - * @package app\adminapi\validate\project - */ -class ProjectEstimateValidate extends BaseValidate -{ - - /** - * 设置校验规则 - * @var string[] - */ - protected $rule = [ - 'id' => 'require', - 'project_id' => 'require|checkProject', - 'customer_demand_id' => 'require|checkCustomerDemand', - 'estimate_source' => 'require|checkEstimateSource', - 'contact_id' => 'require|checkContact', - 'quotation_date' => 'require|dateFormat:Y-m-d', - 'invoice_type' => 'checkInvoiceType', - 'technician' => 'checkTechnician', - 'estimate_amount' => 'float|egt:0', - 'annex' => 'checkAnnex', - ]; - protected $message = [ - 'id.require' => '缺少必要参数', - 'project_id.require' => '请选择项目', - 'customer_demand_id.require' => '请选择客户需求', - 'contact_id.require' => '请选择联系人', - 'estimate_source.require' => '请选择概算来源', - 'quotation_date.require' => '请选择报价日期', - 'quotation_date.dateFormat' => '报价日期格式错误', - 'estimate_amount.float' => '概算金额值必须是数字', - 'estimate_amount.egt' => '概算金额值必须大于等于0', - ]; - - - /** - * @notes 添加场景 - * @return ProjectEstimateValidate - * @author likeadmin - * @date 2023/11/24 21:42 - */ - public function sceneAdd() - { - return $this->remove('id', true); - } - - - /** - * @notes 编辑场景 - * @return ProjectEstimateValidate - * @author likeadmin - * @date 2023/11/24 21:42 - */ - public function sceneEdit() - {} - - - /** - * @notes 删除场景 - * @return ProjectEstimateValidate - * @author likeadmin - * @date 2023/11/24 21:42 - */ - public function sceneDelete() - { - return $this->only(['id']); - } - - - /** - * @notes 详情场景 - * @return ProjectEstimateValidate - * @author likeadmin - * @date 2023/11/24 21:42 - */ - public function sceneDetail() - { - return $this->only(['id']); - } + namespace app\adminapi\validate\project; - public function checkProject($value): bool|string + + use app\common\model\auth\Admin; + use app\common\model\custom\CustomContacts; + use app\common\model\custom\CustomerDemand; + use app\common\model\dict\DictData; + use app\common\model\project\Project; + use app\common\validate\BaseValidate; + + + /** + * 项目概算验证器 + * Class ProjectEstimateValidate + * @package app\adminapi\validate\project + */ + class ProjectEstimateValidate extends BaseValidate { - $project = Project::where('id',$value)->findOrEmpty(); - if($project->isEmpty()){ - return '项目不存在'; + + /** + * 设置校验规则 + * @var string[] + */ + protected $rule = [ + 'id' => 'require', + 'project_id' => 'require|checkProject', + 'customer_demand_id' => 'require|checkCustomerDemand', + 'estimate_source' => 'require|checkEstimateSource', + 'contact_id' => 'require|checkContact', + 'quotation_date' => 'require|dateFormat:Y-m-d', + 'invoice_type' => 'checkInvoiceType', + 'technician' => 'checkTechnician', + 'estimate_amount' => 'float|egt:0', + 'annex' => 'checkAnnex', + ]; + + protected $message = [ + 'id.require' => '缺少必要参数', + 'project_id.require' => '请选择项目', + 'customer_demand_id.require' => '请选择客户需求', + 'contact_id.require' => '请选择联系人', + 'estimate_source.require' => '请选择概算来源', + 'quotation_date.require' => '请选择报价日期', + 'quotation_date.dateFormat' => '报价日期格式错误', + 'estimate_amount.float' => '概算金额值必须是数字', + 'estimate_amount.egt' => '概算金额值必须大于等于0', + ]; + + + /** + * @notes 添加场景 + * @return ProjectEstimateValidate + * @author likeadmin + * @date 2023/11/24 21:42 + */ + public function sceneAdd() + { + return $this->remove('id', true); } - return true; - } - - public function checkCustomerDemand($value,$rule,$data): bool|string - { - $customDemand = CustomerDemand::where('id',$value)->findOrEmpty(); - if($customDemand->isEmpty()){ - return '客户需求不存在'; + + + /** + * @notes 编辑场景 + * @return ProjectEstimateValidate + * @author likeadmin + * @date 2023/11/24 21:42 + */ + public function sceneEdit() + { } - if($customDemand['project_id'] != $data['project_id']){ - return '客户需求与项目信息不一致'; + + + /** + * @notes 删除场景 + * @return ProjectEstimateValidate + * @author likeadmin + * @date 2023/11/24 21:42 + */ + public function sceneDelete() + { + return $this->only(['id'])->remove('id', 'checkData'); } - return true; - } - - public function checkEstimateSource($value): bool|string - { - $dictDate = DictData::where('type_value','estimate_source')->column('value'); - if(!in_array($value,$dictDate)){ - return '概算来源数据值错误'; + + + /** + * @notes 详情场景 + * @return ProjectEstimateValidate + * @author likeadmin + * @date 2023/11/24 21:42 + */ + public function sceneDetail() + { + return $this->only(['id']); } - return true; - } - - public function checkContact($value,$rule,$data): bool|string - { - $customContract = CustomContacts::where('id',$value)->findOrEmpty(); - if($customContract->isEmpty()){ - return '联系人不存在'; + + public function checkProject($value): bool|string + { + $project = Project::where('id', $value)->findOrEmpty(); + if ($project->isEmpty()) { + return '项目不存在'; + } + return true; } - $project = Project::field('custom_id')->where('id',$data['project_id'])->findOrEmpty(); - if($customContract['custom_id'] != $project['custom_id']){ - return '联系人不是当前客户的联系人'; + + public function checkCustomerDemand($value, $rule, $data): bool|string + { + $customDemand = CustomerDemand::where('id', $value)->findOrEmpty(); + if ($customDemand->isEmpty()) { + return '客户需求不存在'; + } + if ($customDemand['project_id'] != $data['project_id']) { + return '客户需求与项目信息不一致'; + } + return true; } - return true; - } - - function checkInvoiceType($value): bool|string - { - $dictDate = DictData::where('type_value','invoice_type')->column('value'); - if(!in_array($value,$dictDate)){ - return '发票类型数据值错误'; + + public function checkEstimateSource($value): bool|string + { + $dictDate = DictData::where('type_value', 'estimate_source')->column('value'); + if (!in_array($value, $dictDate)) { + return '概算来源数据值错误'; + } + return true; } - return true; - } - - public function checkTechnician($value): bool|string - { - $admin = Admin::where('id',$value)->findOrEmpty(); - if($admin->isEmpty()){ - return '技术人员不存在'; + + public function checkContact($value, $rule, $data): bool|string + { + $customContract = CustomContacts::where('id', $value)->findOrEmpty(); + if ($customContract->isEmpty()) { + return '联系人不存在'; + } + $project = Project::field('custom_id')->where('id', $data['project_id'])->findOrEmpty(); + if ($customContract['custom_id'] != $project['custom_id']) { + return '联系人不是当前客户的联系人'; + } + return true; } - return true; - } - -} \ No newline at end of file + + function checkInvoiceType($value): bool|string + { + $dictDate = DictData::where('type_value', 'invoice_type')->column('value'); + if (!in_array($value, $dictDate)) { + return '发票类型数据值错误'; + } + return true; + } + + public function checkTechnician($value): bool|string + { + $admin = Admin::where('id', $value)->findOrEmpty(); + if ($admin->isEmpty()) { + return '技术人员不存在'; + } + return true; + } + + } \ No newline at end of file diff --git a/app/adminapi/validate/project/ProjectExpenseReimbursementDetailValidate.php b/app/adminapi/validate/project/ProjectExpenseReimbursementDetailValidate.php index f54ad327a..63d7adb66 100644 --- a/app/adminapi/validate/project/ProjectExpenseReimbursementDetailValidate.php +++ b/app/adminapi/validate/project/ProjectExpenseReimbursementDetailValidate.php @@ -11,110 +11,110 @@ // +---------------------------------------------------------------------- // | author: likeadminTeam // +---------------------------------------------------------------------- - -namespace app\adminapi\validate\project; - - -use app\common\model\project\ProjectCostTempSet; -use app\common\model\project\ProjectExpenseReimbursement; -use app\common\validate\BaseValidate; - - -/** - * 报销明细验证器 - * Class ProjectExpenseReimbursementDetailValidate - * @package app\adminapi\validate\project - */ -class ProjectExpenseReimbursementDetailValidate extends BaseValidate -{ - - /** - * 设置校验规则 - * @var string[] - */ - protected $rule = [ - 'id' => 'require', - 'expense_reimbursement_id' => 'require|checkExpenseReimbursement', - 'project_cost_temp_id' => 'require|checkProjectCostTemp', - 'amount' => 'require|float|gt:0', - ]; - - - /** - * 参数描述 - * @var string[] - */ - protected $field = [ - 'id' => 'id', - 'expense_reimbursement_id' => '费用报销单id', - 'project_cost_temp_id' => '项目费用模板id', - 'amount' => '金额', - ]; - - - /** - * @notes 添加场景 - * @return ProjectExpenseReimbursementDetailValidate - * @author likeadmin - * @date 2024/01/19 13:44 - */ - public function sceneAdd() - { - return $this->remove('id',true); - } - - - /** - * @notes 编辑场景 - * @return ProjectExpenseReimbursementDetailValidate - * @author likeadmin - * @date 2024/01/19 13:44 - */ - public function sceneEdit() - { - return $this->only(['id','expense_reimbursement_id','project_cost_temp_id','amount']); - } - - - /** - * @notes 删除场景 - * @return ProjectExpenseReimbursementDetailValidate - * @author likeadmin - * @date 2024/01/19 13:44 - */ - public function sceneDelete() - { - return $this->only(['id']); - } - - - /** - * @notes 详情场景 - * @return ProjectExpenseReimbursementDetailValidate - * @author likeadmin - * @date 2024/01/19 13:44 - */ - public function sceneDetail() - { - return $this->only(['id']); - } - public function checkExpenseReimbursement($value): bool|string - { - $data = ProjectExpenseReimbursement::where('id',$value)->findOrEmpty(); - if($data->isEmpty()){ - return '费用报销信息不存在'; - } - return true; - } + namespace app\adminapi\validate\project; - public function checkProjectCostTemp($value): bool|string + + use app\common\model\project\ProjectCostTempSet; + use app\common\model\project\ProjectExpenseReimbursement; + use app\common\validate\BaseValidate; + + + /** + * 报销明细验证器 + * Class ProjectExpenseReimbursementDetailValidate + * @package app\adminapi\validate\project + */ + class ProjectExpenseReimbursementDetailValidate extends BaseValidate { - $data = ProjectCostTempSet::where('id',$value)->findOrEmpty(); - if($data->isEmpty()){ - return '项目费用模板信息不存在'; + + /** + * 设置校验规则 + * @var string[] + */ + protected $rule = [ + 'id' => 'require', + 'expense_reimbursement_id' => 'require|checkExpenseReimbursement', + 'project_cost_temp_id' => 'require|checkProjectCostTemp', + 'amount' => 'require|float|gt:0', + ]; + + + /** + * 参数描述 + * @var string[] + */ + protected $field = [ + 'id' => 'id', + 'expense_reimbursement_id' => '费用报销单id', + 'project_cost_temp_id' => '项目费用模板id', + 'amount' => '金额', + ]; + + + /** + * @notes 添加场景 + * @return ProjectExpenseReimbursementDetailValidate + * @author likeadmin + * @date 2024/01/19 13:44 + */ + public function sceneAdd() + { + return $this->remove('id', true); } - return true; - } - -} \ No newline at end of file + + + /** + * @notes 编辑场景 + * @return ProjectExpenseReimbursementDetailValidate + * @author likeadmin + * @date 2024/01/19 13:44 + */ + public function sceneEdit() + { + return $this->only(['id', 'expense_reimbursement_id', 'project_cost_temp_id', 'amount']); + } + + + /** + * @notes 删除场景 + * @return ProjectExpenseReimbursementDetailValidate + * @author likeadmin + * @date 2024/01/19 13:44 + */ + public function sceneDelete() + { + return $this->only(['id'])->remove('id', 'checkData'); + } + + + /** + * @notes 详情场景 + * @return ProjectExpenseReimbursementDetailValidate + * @author likeadmin + * @date 2024/01/19 13:44 + */ + public function sceneDetail() + { + return $this->only(['id']); + } + + public function checkExpenseReimbursement($value): bool|string + { + $data = ProjectExpenseReimbursement::where('id', $value)->findOrEmpty(); + if ($data->isEmpty()) { + return '费用报销信息不存在'; + } + return true; + } + + public function checkProjectCostTemp($value): bool|string + { + $data = ProjectCostTempSet::where('id', $value)->findOrEmpty(); + if ($data->isEmpty()) { + return '项目费用模板信息不存在'; + } + return true; + } + + } \ No newline at end of file diff --git a/app/adminapi/validate/project/ProjectExpenseReimbursementInvoiceDetailValidate.php b/app/adminapi/validate/project/ProjectExpenseReimbursementInvoiceDetailValidate.php index ba9c5f9d2..c1a4d3e55 100644 --- a/app/adminapi/validate/project/ProjectExpenseReimbursementInvoiceDetailValidate.php +++ b/app/adminapi/validate/project/ProjectExpenseReimbursementInvoiceDetailValidate.php @@ -11,142 +11,144 @@ // +---------------------------------------------------------------------- // | author: likeadminTeam // +---------------------------------------------------------------------- - -namespace app\adminapi\validate\project; - - -use app\common\model\dict\DictData; -use app\common\model\project\ProjectExpenseReimbursement; -use app\common\validate\BaseValidate; - - -/** - * 发票明细验证器 - * Class ProjectExpenseReimbursementInvoiceDetailValidate - * @package app\adminapi\validate\project - */ -class ProjectExpenseReimbursementInvoiceDetailValidate extends BaseValidate -{ - - /** - * 设置校验规则 - * @var string[] - */ - protected $rule = [ - 'id' => 'require', - 'expense_reimbursement_id' => 'require|checkExpenseReimbursement', - 'invoice_type' => 'require|checkInvoiceType', - 'invoice_sn' => 'require', - 'tax_rate' => 'require|checkTaxRate', - 'invoice_form' => 'require|checkInvoiceForm', - 'invoice_amount' => 'require|float|gt:0', - 'annex' => 'checkAnnex' - ]; - - - /** - * 参数描述 - * @var string[] - */ - protected $field = [ - 'id' => 'id', - 'expense_reimbursement_id' => '费用报销单id', - 'invoice_type' => '发票类型', - 'invoice_sn' => '发票号', - 'tax_rate' => '发票税率', - 'invoice_form' => '发票形式', - 'invoice_amount' => '发票金额', - ]; - - - /** - * @notes 添加场景 - * @return ProjectExpenseReimbursementInvoiceDetailValidate - * @author likeadmin - * @date 2024/01/19 13:44 - */ - public function sceneAdd() - { - return $this->remove('id',true); - } - - - /** - * @notes 编辑场景 - * @return ProjectExpenseReimbursementInvoiceDetailValidate - * @author likeadmin - * @date 2024/01/19 13:44 - */ - public function sceneEdit() - {} - - - /** - * @notes 删除场景 - * @return ProjectExpenseReimbursementInvoiceDetailValidate - * @author likeadmin - * @date 2024/01/19 13:44 - */ - public function sceneDelete() - { - return $this->only(['id']); - } - - - /** - * @notes 详情场景 - * @return ProjectExpenseReimbursementInvoiceDetailValidate - * @author likeadmin - * @date 2024/01/19 13:44 - */ - public function sceneDetail() - { - return $this->only(['id']); - } - public function checkExpenseReimbursement($value): bool|string + namespace app\adminapi\validate\project; + + + use app\common\model\dict\DictData; + use app\common\model\project\ProjectExpenseReimbursement; + use app\common\validate\BaseValidate; + + + /** + * 发票明细验证器 + * Class ProjectExpenseReimbursementInvoiceDetailValidate + * @package app\adminapi\validate\project + */ + class ProjectExpenseReimbursementInvoiceDetailValidate extends BaseValidate { - $data = ProjectExpenseReimbursement::where('id',$value)->findOrEmpty(); - if($data->isEmpty()){ - return '费用报销信息不存在'; + + /** + * 设置校验规则 + * @var string[] + */ + protected $rule = [ + 'id' => 'require', + 'expense_reimbursement_id' => 'require|checkExpenseReimbursement', + 'invoice_type' => 'require|checkInvoiceType', + 'invoice_sn' => 'require', + 'tax_rate' => 'require|checkTaxRate', + 'invoice_form' => 'require|checkInvoiceForm', + 'invoice_amount' => 'require|float|gt:0', + 'annex' => 'checkAnnex' + ]; + + + /** + * 参数描述 + * @var string[] + */ + protected $field = [ + 'id' => 'id', + 'expense_reimbursement_id' => '费用报销单id', + 'invoice_type' => '发票类型', + 'invoice_sn' => '发票号', + 'tax_rate' => '发票税率', + 'invoice_form' => '发票形式', + 'invoice_amount' => '发票金额', + ]; + + + /** + * @notes 添加场景 + * @return ProjectExpenseReimbursementInvoiceDetailValidate + * @author likeadmin + * @date 2024/01/19 13:44 + */ + public function sceneAdd() + { + return $this->remove('id', true); } - return true; - } - - public function checkInvoiceType($value): bool|string - { - $dict = DictData::where('type_value','invoice_type')->column('value'); - if(!in_array($value,$dict)){ - return '发票类型数据值无效'; + + + /** + * @notes 编辑场景 + * @return ProjectExpenseReimbursementInvoiceDetailValidate + * @author likeadmin + * @date 2024/01/19 13:44 + */ + public function sceneEdit() + { } - return true; - } - - public function checkTaxRate($value): bool|string - { - $dict = DictData::where('type_value','tax_rate')->column('value'); - if(!in_array($value,$dict)){ - return '发票税率数据值无效'; + + + /** + * @notes 删除场景 + * @return ProjectExpenseReimbursementInvoiceDetailValidate + * @author likeadmin + * @date 2024/01/19 13:44 + */ + public function sceneDelete() + { + return $this->only(['id'])->remove('id', 'checkData'); } - return true; - } - - public function checkInvoiceForm($value){ - $dict = DictData::where('type_value','invoice_form')->column('value'); - if(!in_array($value,$dict)){ - return '发票形式数据值无效'; + + + /** + * @notes 详情场景 + * @return ProjectExpenseReimbursementInvoiceDetailValidate + * @author likeadmin + * @date 2024/01/19 13:44 + */ + public function sceneDetail() + { + return $this->only(['id']); } - return true; - } - - public function checkAnnex($value): bool|string - { - if(!empty($value) && $value != ''){ - if(!is_array($value)){ - return '附件格式错误'; + + public function checkExpenseReimbursement($value): bool|string + { + $data = ProjectExpenseReimbursement::where('id', $value)->findOrEmpty(); + if ($data->isEmpty()) { + return '费用报销信息不存在'; } + return true; } - return true; - } - -} \ No newline at end of file + + public function checkInvoiceType($value): bool|string + { + $dict = DictData::where('type_value', 'invoice_type')->column('value'); + if (!in_array($value, $dict)) { + return '发票类型数据值无效'; + } + return true; + } + + public function checkTaxRate($value): bool|string + { + $dict = DictData::where('type_value', 'tax_rate')->column('value'); + if (!in_array($value, $dict)) { + return '发票税率数据值无效'; + } + return true; + } + + public function checkInvoiceForm($value) + { + $dict = DictData::where('type_value', 'invoice_form')->column('value'); + if (!in_array($value, $dict)) { + return '发票形式数据值无效'; + } + return true; + } + + public function checkAnnex($value): bool|string + { + if (!empty($value) && $value != '') { + if (!is_array($value)) { + return '附件格式错误'; + } + } + return true; + } + + } \ No newline at end of file diff --git a/app/adminapi/validate/project/ProjectExpenseReimbursementValidate.php b/app/adminapi/validate/project/ProjectExpenseReimbursementValidate.php index aa6ff256c..79d235070 100644 --- a/app/adminapi/validate/project/ProjectExpenseReimbursementValidate.php +++ b/app/adminapi/validate/project/ProjectExpenseReimbursementValidate.php @@ -11,277 +11,277 @@ // +---------------------------------------------------------------------- // | author: likeadminTeam // +---------------------------------------------------------------------- - -namespace app\adminapi\validate\project; - - -use app\common\model\bank\BankAccount; -use app\common\model\dict\DictData; -use app\common\model\project\Project; -use app\common\model\project\ProjectCostTempSet; -use app\common\model\project\ProjectExpenseReimbursement; -use app\common\model\project\ProjectExpenseReimbursementDetail; -use app\common\model\project\ProjectExpenseReimbursementInvoiceDetail; -use app\common\model\project\ProjectLoanApply; -use app\common\validate\BaseValidate; - - -/** - * 费用报销验证器 - * Class ProjectExpenseReimbursementValidate - * @package app\adminapi\validate\project - */ -class ProjectExpenseReimbursementValidate extends BaseValidate -{ - - /** - * 设置校验规则 - * @var string[] - */ - protected $rule = [ - 'id' => 'require|checkData', - 'project_id' => 'require|checkProject', - 'apply_user' => 'require', - 'apply_date' => 'require|dateFormat:Y-m-d', - 'reimbursement_type' => 'require|checkReimbursementType', - 'loan_apply_id' => 'requireCallback:check_require|checkLoanApply', - 'offset_loan_amount' => 'requireCallback:check_require|float|egt:0', - 'payee_name' => 'require', - 'payee_bank' => 'require', - 'payee_account' => 'require', - 'annex' => 'checkAnnex', - 'bank_account_id' => 'require|checkBankAccount', - 'reimbursement_detail' => 'require|checkReimbursementDetail', - 'invoice_detail' => 'require|checkInvoiceDetail', - 'flow_id' => 'require|checkFlow', - 'path' => 'require', - ]; - - - /** - * 参数描述 - * @var string[] - */ - protected $field = [ - 'id' => 'id', - 'project_id' => '项目id', - 'apply_user' => '报销人', - 'apply_date' => '报销日期', - 'reimbursement_type' => '报销类型', - 'loan_apply_id' => '借款申请id', - 'offset_loan_amount' => '冲抵借款金额', - 'payee_name' => '收款人姓名', - 'payee_bank' => '收款银行', - 'payee_account' => '收款账号', - 'bank_account_id' => '付款银行账户id', - 'reimbursement_detail' => '报销明细', - 'invoice_detail' => '发票明细', - ]; - - - /** - * @notes 添加场景 - * @return ProjectExpenseReimbursementValidate - * @author likeadmin - * @date 2024/01/19 13:44 - */ - public function sceneAdd() - { - return $this->remove('id',true)->remove('flow_id',true)->remove('path',true); - } - - - /** - * @notes 编辑场景 - * @return ProjectExpenseReimbursementValidate - * @author likeadmin - * @date 2024/01/19 13:44 - */ - public function sceneEdit() - { - return $this->remove('flow_id',true)->remove('path',true); - } - - - /** - * @notes 删除场景 - * @return ProjectExpenseReimbursementValidate - * @author likeadmin - * @date 2024/01/19 13:44 - */ - public function sceneDelete() - { - return $this->only(['id']); - } - - - /** - * @notes 详情场景 - * @return ProjectExpenseReimbursementValidate - * @author likeadmin - * @date 2024/01/19 13:44 - */ - public function sceneDetail() - { - return $this->only(['id']); - } - public function sceneApprove() - { - return $this->only(['id','flow_id','path']); - } + namespace app\adminapi\validate\project; - public function checkData($value): bool|string + + use app\common\model\bank\BankAccount; + use app\common\model\dict\DictData; + use app\common\model\project\Project; + use app\common\model\project\ProjectCostTempSet; + use app\common\model\project\ProjectExpenseReimbursement; + use app\common\model\project\ProjectExpenseReimbursementDetail; + use app\common\model\project\ProjectExpenseReimbursementInvoiceDetail; + use app\common\model\project\ProjectLoanApply; + use app\common\validate\BaseValidate; + + + /** + * 费用报销验证器 + * Class ProjectExpenseReimbursementValidate + * @package app\adminapi\validate\project + */ + class ProjectExpenseReimbursementValidate extends BaseValidate { - $data = ProjectExpenseReimbursement::where('id',$value)->findOrEmpty(); - if($data->isEmpty()){ - return '数据不存在'; + + /** + * 设置校验规则 + * @var string[] + */ + protected $rule = [ + 'id' => 'require|checkData', + 'project_id' => 'require|checkProject', + 'apply_user' => 'require', + 'apply_date' => 'require|dateFormat:Y-m-d', + 'reimbursement_type' => 'require|checkReimbursementType', + 'loan_apply_id' => 'requireCallback:check_require|checkLoanApply', + 'offset_loan_amount' => 'requireCallback:check_require|float|egt:0', + 'payee_name' => 'require', + 'payee_bank' => 'require', + 'payee_account' => 'require', + 'annex' => 'checkAnnex', + 'bank_account_id' => 'require|checkBankAccount', + 'reimbursement_detail' => 'require|checkReimbursementDetail', + 'invoice_detail' => 'require|checkInvoiceDetail', + 'flow_id' => 'require|checkFlow', + 'path' => 'require', + ]; + + + /** + * 参数描述 + * @var string[] + */ + protected $field = [ + 'id' => 'id', + 'project_id' => '项目id', + 'apply_user' => '报销人', + 'apply_date' => '报销日期', + 'reimbursement_type' => '报销类型', + 'loan_apply_id' => '借款申请id', + 'offset_loan_amount' => '冲抵借款金额', + 'payee_name' => '收款人姓名', + 'payee_bank' => '收款银行', + 'payee_account' => '收款账号', + 'bank_account_id' => '付款银行账户id', + 'reimbursement_detail' => '报销明细', + 'invoice_detail' => '发票明细', + ]; + + + /** + * @notes 添加场景 + * @return ProjectExpenseReimbursementValidate + * @author likeadmin + * @date 2024/01/19 13:44 + */ + public function sceneAdd() + { + return $this->remove('id', true)->remove('flow_id', true)->remove('path', true); } - return true; - } - - public function checkProject($value): bool|string - { - $data = Project::where('id',$value)->findOrEmpty(); - if($data->isEmpty()){ - return '项目信息不存在'; + + + /** + * @notes 编辑场景 + * @return ProjectExpenseReimbursementValidate + * @author likeadmin + * @date 2024/01/19 13:44 + */ + public function sceneEdit() + { + return $this->remove('flow_id', true)->remove('path', true); } - return true; - } - - public function checkReimbursementType($value): bool|string - { - $data = explode(',',$value); - if(empty($data)){ - return '报销类型数据格式错误'; + + + /** + * @notes 删除场景 + * @return ProjectExpenseReimbursementValidate + * @author likeadmin + * @date 2024/01/19 13:44 + */ + public function sceneDelete() + { + return $this->only(['id'])->remove('id', 'checkData'); } - foreach ($data as $v) { - $dict = DictData::where('type_value','reimbursement_type')->column('value'); - if(!in_array($v,$dict)){ - return '报销类型数据无效'; + + + /** + * @notes 详情场景 + * @return ProjectExpenseReimbursementValidate + * @author likeadmin + * @date 2024/01/19 13:44 + */ + public function sceneDetail() + { + return $this->only(['id']); + } + + public function sceneApprove() + { + return $this->only(['id', 'flow_id', 'path']); + } + + public function checkData($value): bool|string + { + $data = ProjectExpenseReimbursement::where('id', $value)->findOrEmpty(); + if ($data->isEmpty()) { + return '数据不存在'; } + return true; } - return true; - } - - function check_require($value,$data): bool - { - $reimbursement_type = explode(',',$data['reimbursement_type']); - return in_array(1,$reimbursement_type); - } - - public function checkLoanApply($value): bool|string - { - $loan_apply_data = ProjectLoanApply::where('id',$value)->findOrEmpty(); - if($loan_apply_data->isEmpty()){ - return '借款单信息不存在'; - } - return true; - } - - public function checkAnnex($value): bool|string - { - if(!empty($value) && $value != ''){ - if(!is_array($value)){ - return '附件格式错误'; + + public function checkProject($value): bool|string + { + $data = Project::where('id', $value)->findOrEmpty(); + if ($data->isEmpty()) { + return '项目信息不存在'; } + return true; } - return true; - } - - public function checkBankAccount($value): bool|string - { - $data = BankAccount::where('id',$value)->findOrEmpty(); - if($data->isEmpty()){ - return '付款银行账户信息不存在'; - } - return true; - } - - public function checkReimbursementDetail($value): bool|string - { - if(empty($value) || !is_array($value)){ - return '报销明细数据格式错误'; - } - foreach($value as $v){ - if(isset($v['id']) && $v['id'] != ''){ - $reimbursement_detail = ProjectExpenseReimbursementDetail::where('id',$v['id'])->findOrEmpty(); - if($reimbursement_detail->isEmpty()){ - return '报销明细信息不存在'; - } - } - if(empty($v['project_cost_temp_id'])){ - return '请选择项目费用模板'; - }else{ - $project_cost_temp = ProjectCostTempSet::where('id',$v['project_cost_temp_id'])->findOrEmpty(); - if($project_cost_temp->isEmpty()){ - return '项目费用模板信息不存在'; - } - } - if(empty($v['amount'])){ - return '请填写报销明细金额'; - }else{ - if(!is_numeric($v['amount']) || $v['amount'] < 0){ - return '报销明细金额必须是大于0数字'; + + public function checkReimbursementType($value): bool|string + { + $data = explode(',', $value); + if (empty($data)) { + return '报销类型数据格式错误'; + } + foreach ($data as $v) { + $dict = DictData::where('type_value', 'reimbursement_type')->column('value'); + if (!in_array($v, $dict)) { + return '报销类型数据无效'; } } + return true; } - return true; - } - - public function checkInvoiceDetail($value): bool|string - { - if(empty($value) || !is_array($value)){ - return '发票明细数据格式错误'; + + function check_require($value, $data): bool + { + $reimbursement_type = explode(',', $data['reimbursement_type']); + return in_array(1, $reimbursement_type); } - foreach($value as $v){ - if(isset($v['id']) && $v['id'] != ''){ - $invoice_detail = ProjectExpenseReimbursementInvoiceDetail::where('id',$v['id'])->findOrEmpty(); - if($invoice_detail->isEmpty()){ - return '发票明细信息不存在'; - } - } - if(empty($v['invoice_type'])){ - return '请选择发票类型'; - }else{ - $invoice_type_dict = DictData::where('type_value','invoice_type')->column('value'); - if(!in_array($v['invoice_type'],$invoice_type_dict)){ - return '发票类型数据值无效'; - } - } - if(empty($v['invoice_sn'])){ - return '请填写发票号'; - } - if(empty($v['tax_rate'])){ - return '请选择发票税率'; - }else{ - $tax_rate_dict = DictData::where('type_value','tax_rate')->column('value'); - if(!in_array($v['tax_rate'],$tax_rate_dict)){ - return '发票税率数据值无效'; - } - } - if(empty($v['invoice_form'])){ - return '请选择发票形式'; - }else{ - $invoice_form_dict = DictData::where('type_value','invoice_form')->column('value'); - if(!in_array($v['invoice_form'],$invoice_form_dict)){ - return '发票形式数据值无效'; - } - } - if(empty($v['invoice_amount'])){ - return '请填写发票金额'; - }else{ - if(!is_numeric($v['invoice_amount']) || $v['invoice_amount'] < 0){ - return '发票金额必须是大于0的数字'; - } - } - if(isset($v['annex']) && $v['annex'] != ''){ - if(!is_array($v['annex'])){ - return '发票附件格式错误'; - } + + public function checkLoanApply($value): bool|string + { + $loan_apply_data = ProjectLoanApply::where('id', $value)->findOrEmpty(); + if ($loan_apply_data->isEmpty()) { + return '借款单信息不存在'; } + return true; } - return true; - } - -} \ No newline at end of file + + public function checkAnnex($value): bool|string + { + if (!empty($value) && $value != '') { + if (!is_array($value)) { + return '附件格式错误'; + } + } + return true; + } + + public function checkBankAccount($value): bool|string + { + $data = BankAccount::where('id', $value)->findOrEmpty(); + if ($data->isEmpty()) { + return '付款银行账户信息不存在'; + } + return true; + } + + public function checkReimbursementDetail($value): bool|string + { + if (empty($value) || !is_array($value)) { + return '报销明细数据格式错误'; + } + foreach ($value as $v) { + if (isset($v['id']) && $v['id'] != '') { + $reimbursement_detail = ProjectExpenseReimbursementDetail::where('id', $v['id'])->findOrEmpty(); + if ($reimbursement_detail->isEmpty()) { + return '报销明细信息不存在'; + } + } + if (empty($v['project_cost_temp_id'])) { + return '请选择项目费用模板'; + } else { + $project_cost_temp = ProjectCostTempSet::where('id', $v['project_cost_temp_id'])->findOrEmpty(); + if ($project_cost_temp->isEmpty()) { + return '项目费用模板信息不存在'; + } + } + if (empty($v['amount'])) { + return '请填写报销明细金额'; + } else { + if (!is_numeric($v['amount']) || $v['amount'] < 0) { + return '报销明细金额必须是大于0数字'; + } + } + } + return true; + } + + public function checkInvoiceDetail($value): bool|string + { + if (empty($value) || !is_array($value)) { + return '发票明细数据格式错误'; + } + foreach ($value as $v) { + if (isset($v['id']) && $v['id'] != '') { + $invoice_detail = ProjectExpenseReimbursementInvoiceDetail::where('id', $v['id'])->findOrEmpty(); + if ($invoice_detail->isEmpty()) { + return '发票明细信息不存在'; + } + } + if (empty($v['invoice_type'])) { + return '请选择发票类型'; + } else { + $invoice_type_dict = DictData::where('type_value', 'invoice_type')->column('value'); + if (!in_array($v['invoice_type'], $invoice_type_dict)) { + return '发票类型数据值无效'; + } + } + if (empty($v['invoice_sn'])) { + return '请填写发票号'; + } + if (empty($v['tax_rate'])) { + return '请选择发票税率'; + } else { + $tax_rate_dict = DictData::where('type_value', 'tax_rate')->column('value'); + if (!in_array($v['tax_rate'], $tax_rate_dict)) { + return '发票税率数据值无效'; + } + } + if (empty($v['invoice_form'])) { + return '请选择发票形式'; + } else { + $invoice_form_dict = DictData::where('type_value', 'invoice_form')->column('value'); + if (!in_array($v['invoice_form'], $invoice_form_dict)) { + return '发票形式数据值无效'; + } + } + if (empty($v['invoice_amount'])) { + return '请填写发票金额'; + } else { + if (!is_numeric($v['invoice_amount']) || $v['invoice_amount'] < 0) { + return '发票金额必须是大于0的数字'; + } + } + if (isset($v['annex']) && $v['annex'] != '') { + if (!is_array($v['annex'])) { + return '发票附件格式错误'; + } + } + } + return true; + } + + } \ No newline at end of file diff --git a/app/adminapi/validate/project/ProjectFollowUpValidate.php b/app/adminapi/validate/project/ProjectFollowUpValidate.php index 83ade5130..6303ff1cd 100644 --- a/app/adminapi/validate/project/ProjectFollowUpValidate.php +++ b/app/adminapi/validate/project/ProjectFollowUpValidate.php @@ -11,148 +11,152 @@ // +---------------------------------------------------------------------- // | author: likeadminTeam // +---------------------------------------------------------------------- - -namespace app\adminapi\validate\project; - - -use app\common\model\auth\Admin; -use app\common\model\dict\DictData; -use app\common\model\project\Project; -use app\common\validate\BaseValidate; - - -/** - * ProjectFollowUp验证器 - * Class ProjectFollowUpValidate - * @package app\adminapi\validate\project - */ -class ProjectFollowUpValidate extends BaseValidate -{ - - /** - * 设置校验规则 - * @var string[] - */ - protected $rule = [ - 'id' => 'require', - 'project_id' => 'require|checkProject', - 'theme' => 'require', - 'follow_date' => 'require|dateFormat:Y-m-d', - 'follow_type' => 'require|checkType', - 'project_assurance' => 'require|checkAssurance', - 'follow_status' => 'require|checkStatus', - 'follow_stage' => 'require|checkStage', - 'next_follow_up_date' => 'date|dateFormat:Y-m-d|checkNextFollowUpDate', - 'annex' => 'checkAnnex', - ]; - protected $message = [ - 'id.require' => '缺少必要参数', - 'project_id.require' => '请选择项目', - 'theme.require' => '请填写主题', - 'follow_date.require' => '请选择日期', - 'follow_date.dateFormat' => '日期格式错误', - 'follow_type.require' => '请选择类型', - 'project_assurance.require' => '请选择项目把握度', - 'follow_status.require' => '请选择状态', - 'follow_stage.require' => '请选择阶段', - 'next_follow_up_date.dateFormat' => '下次回访日期格式错误' - ]; - - /** - * @notes 添加场景 - * @return ProjectFollowUpValidate - * @author likeadmin - * @date 2023/11/14 10:49 - */ - public function sceneAdd() - { - return $this->remove('id', true); - } - - - /** - * @notes 编辑场景 - * @return ProjectFollowUpValidate - * @author likeadmin - * @date 2023/11/14 10:49 - */ - public function sceneEdit() - {} - - - /** - * @notes 删除场景 - * @return ProjectFollowUpValidate - * @author likeadmin - * @date 2023/11/14 10:49 - */ - public function sceneDelete() - { - return $this->only(['id']); - } - - - /** - * @notes 详情场景 - * @return ProjectFollowUpValidate - * @author likeadmin - * @date 2023/11/14 10:49 - */ - public function sceneDetail() - { - return $this->only(['id']); - } + namespace app\adminapi\validate\project; - public function checkProject($value): bool|string - { - $project = Project::where('id',$value)->findOrEmpty(); - if($project->isEmpty()){ - return '项目不存在'; - } - return true; - } - public function checkType($value): bool|string - { - $dictData = DictData::where('type_value','follow_type')->column('value'); - if(!in_array($value,$dictData)){ - return '类型值错误'; - } - return true; - } - public function checkAssurance($value): bool|string - { - $dictData = DictData::where('type_value','project_assurance')->column('value'); - if(!in_array($value,$dictData)){ - return '项目把握度值错误'; - } - return true; - } - public function checkStatus($value): bool|string - { - $dictData = DictData::where('type_value','follow_status')->column('value'); - if(!in_array($value,$dictData)){ - return '状态值错误'; - } - return true; - } - public function checkStage($value): bool|string - { - $dictData = DictData::where('type_value','follow_stage')->column('value'); - if(!in_array($value,$dictData)){ - return '阶段值错误'; - } - return true; - } - public function checkNextFollowUpDate($value,$rule,$data): bool|string + use app\common\model\dict\DictData; + use app\common\model\project\Project; + use app\common\validate\BaseValidate; + + + /** + * ProjectFollowUp验证器 + * Class ProjectFollowUpValidate + * @package app\adminapi\validate\project + */ + class ProjectFollowUpValidate extends BaseValidate { - if(!empty($value)){ - if(strtotime($value) < strtotime($data['follow_date'])){ - return '下次回访日期不能小于项目跟进日期'; + + /** + * 设置校验规则 + * @var string[] + */ + protected $rule = [ + 'id' => 'require', + 'project_id' => 'require|checkProject', + 'theme' => 'require', + 'follow_date' => 'require|dateFormat:Y-m-d', + 'follow_type' => 'require|checkType', + 'project_assurance' => 'require|checkAssurance', + 'follow_status' => 'require|checkStatus', + 'follow_stage' => 'require|checkStage', + 'next_follow_up_date' => 'date|dateFormat:Y-m-d|checkNextFollowUpDate', + 'annex' => 'checkAnnex', + ]; + + protected $message = [ + 'id.require' => '缺少必要参数', + 'project_id.require' => '请选择项目', + 'theme.require' => '请填写主题', + 'follow_date.require' => '请选择日期', + 'follow_date.dateFormat' => '日期格式错误', + 'follow_type.require' => '请选择类型', + 'project_assurance.require' => '请选择项目把握度', + 'follow_status.require' => '请选择状态', + 'follow_stage.require' => '请选择阶段', + 'next_follow_up_date.dateFormat' => '下次回访日期格式错误' + ]; + + /** + * @notes 添加场景 + * @return ProjectFollowUpValidate + * @author likeadmin + * @date 2023/11/14 10:49 + */ + public function sceneAdd() + { + return $this->remove('id', true); + } + + + /** + * @notes 编辑场景 + * @return ProjectFollowUpValidate + * @author likeadmin + * @date 2023/11/14 10:49 + */ + public function sceneEdit() + { + } + + + /** + * @notes 删除场景 + * @return ProjectFollowUpValidate + * @author likeadmin + * @date 2023/11/14 10:49 + */ + public function sceneDelete() + { + return $this->only(['id'])->remove('id', 'checkData'); + } + + + /** + * @notes 详情场景 + * @return ProjectFollowUpValidate + * @author likeadmin + * @date 2023/11/14 10:49 + */ + public function sceneDetail() + { + return $this->only(['id']); + } + + public function checkProject($value): bool|string + { + $project = Project::where('id', $value)->findOrEmpty(); + if ($project->isEmpty()) { + return '项目不存在'; } + return true; } - return true; - } - -} \ No newline at end of file + + public function checkType($value): bool|string + { + $dictData = DictData::where('type_value', 'follow_type')->column('value'); + if (!in_array($value, $dictData)) { + return '类型值错误'; + } + return true; + } + + public function checkAssurance($value): bool|string + { + $dictData = DictData::where('type_value', 'project_assurance')->column('value'); + if (!in_array($value, $dictData)) { + return '项目把握度值错误'; + } + return true; + } + + public function checkStatus($value): bool|string + { + $dictData = DictData::where('type_value', 'follow_status')->column('value'); + if (!in_array($value, $dictData)) { + return '状态值错误'; + } + return true; + } + + public function checkStage($value): bool|string + { + $dictData = DictData::where('type_value', 'follow_stage')->column('value'); + if (!in_array($value, $dictData)) { + return '阶段值错误'; + } + return true; + } + + public function checkNextFollowUpDate($value, $rule, $data): bool|string + { + if (!empty($value)) { + if (strtotime($value) < strtotime($data['follow_date'])) { + return '下次回访日期不能小于项目跟进日期'; + } + } + return true; + } + + } \ No newline at end of file diff --git a/app/adminapi/validate/project/ProjectInsuranceManagementValidate.php b/app/adminapi/validate/project/ProjectInsuranceManagementValidate.php index 44c73fb4e..495102596 100644 --- a/app/adminapi/validate/project/ProjectInsuranceManagementValidate.php +++ b/app/adminapi/validate/project/ProjectInsuranceManagementValidate.php @@ -11,120 +11,121 @@ // +---------------------------------------------------------------------- // | author: likeadminTeam // +---------------------------------------------------------------------- - -namespace app\adminapi\validate\project; - - -use app\common\model\project\Project; -use app\common\model\project\ProjectPersonnel; -use app\common\validate\BaseValidate; - - -/** - * 保险管理验证器 - * Class ProjectInsuranceManagementValidate - * @package app\adminapi\validate\project - */ -class ProjectInsuranceManagementValidate extends BaseValidate -{ - - /** - * 设置校验规则 - * @var string[] - */ - protected $rule = [ - 'id' => 'require', - 'project_id' => 'require|checkProject', - 'project_person_id' => 'require|checkProjectPerson', - 'insurance_date' => 'require|dateFormat:Y-m-d', - 'due_date' => 'require|dateFormat:Y-m-d', - 'annex' => 'checkAnnex', - ]; - protected $message = [ - 'id.require' => '缺少必要参数', - 'project_id.require' => '请选择项目', - 'project_person_id.require' => '请选择项目人员', - 'insurance_date.require' => '请选择投保日期', - 'insurance_date.dateFormat' => '投保日期格式错误', - 'due_date.require' => '请选择到期日期', - 'due_date.dateFormat' => '到期日期格式错误', - ]; + namespace app\adminapi\validate\project; - - /** - * @notes 添加场景 - * @return ProjectInsuranceManagementValidate - * @author likeadmin - * @date 2023/12/25 15:58 - */ - public function sceneAdd() - { - return $this->remove('id',true); - } - - - /** - * @notes 编辑场景 - * @return ProjectInsuranceManagementValidate - * @author likeadmin - * @date 2023/12/25 15:58 - */ - public function sceneEdit() - {} - - - /** - * @notes 删除场景 - * @return ProjectInsuranceManagementValidate - * @author likeadmin - * @date 2023/12/25 15:58 - */ - public function sceneDelete() - { - return $this->only(['id']); - } - - - /** - * @notes 详情场景 - * @return ProjectInsuranceManagementValidate - * @author likeadmin - * @date 2023/12/25 15:58 - */ - public function sceneDetail() - { - return $this->only(['id']); - } - public function checkProject($value): bool|string + use app\common\model\project\Project; + use app\common\model\project\ProjectPersonnel; + use app\common\validate\BaseValidate; + + + /** + * 保险管理验证器 + * Class ProjectInsuranceManagementValidate + * @package app\adminapi\validate\project + */ + class ProjectInsuranceManagementValidate extends BaseValidate { - $data = Project::where('id',$value)->findOrEmpty(); - if($data->isEmpty()){ - return '项目不存在'; + + /** + * 设置校验规则 + * @var string[] + */ + protected $rule = [ + 'id' => 'require', + 'project_id' => 'require|checkProject', + 'project_person_id' => 'require|checkProjectPerson', + 'insurance_date' => 'require|dateFormat:Y-m-d', + 'due_date' => 'require|dateFormat:Y-m-d', + 'annex' => 'checkAnnex', + ]; + + protected $message = [ + 'id.require' => '缺少必要参数', + 'project_id.require' => '请选择项目', + 'project_person_id.require' => '请选择项目人员', + 'insurance_date.require' => '请选择投保日期', + 'insurance_date.dateFormat' => '投保日期格式错误', + 'due_date.require' => '请选择到期日期', + 'due_date.dateFormat' => '到期日期格式错误', + ]; + + + /** + * @notes 添加场景 + * @return ProjectInsuranceManagementValidate + * @author likeadmin + * @date 2023/12/25 15:58 + */ + public function sceneAdd() + { + return $this->remove('id', true); } - return true; - } - - public function checkProjectPerson($value,$rule,$data): bool|string - { - $person = ProjectPersonnel::where('id',$value)->findOrEmpty(); - if($person->isEmpty()){ - return '项目人员不存在'; + + + /** + * @notes 编辑场景 + * @return ProjectInsuranceManagementValidate + * @author likeadmin + * @date 2023/12/25 15:58 + */ + public function sceneEdit() + { } - if($person['project_id'] != $data['project_id']){ - return '项目人员无效'; + + + /** + * @notes 删除场景 + * @return ProjectInsuranceManagementValidate + * @author likeadmin + * @date 2023/12/25 15:58 + */ + public function sceneDelete() + { + return $this->only(['id'])->remove('id', 'checkData'); } - return true; - } - - public function checkAnnex($value): bool|string - { - if(!empty($value) && $value != ''){ - if(!is_array($value)){ - return '附件格式错误'; + + + /** + * @notes 详情场景 + * @return ProjectInsuranceManagementValidate + * @author likeadmin + * @date 2023/12/25 15:58 + */ + public function sceneDetail() + { + return $this->only(['id']); + } + + public function checkProject($value): bool|string + { + $data = Project::where('id', $value)->findOrEmpty(); + if ($data->isEmpty()) { + return '项目不存在'; } + return true; } - return true; - } -} \ No newline at end of file + + public function checkProjectPerson($value, $rule, $data): bool|string + { + $person = ProjectPersonnel::where('id', $value)->findOrEmpty(); + if ($person->isEmpty()) { + return '项目人员不存在'; + } + if ($person['project_id'] != $data['project_id']) { + return '项目人员无效'; + } + return true; + } + + public function checkAnnex($value): bool|string + { + if (!empty($value) && $value != '') { + if (!is_array($value)) { + return '附件格式错误'; + } + } + return true; + } + } \ No newline at end of file diff --git a/app/adminapi/validate/project/ProjectJobTypeValidate.php b/app/adminapi/validate/project/ProjectJobTypeValidate.php index d65321572..f763c5d92 100644 --- a/app/adminapi/validate/project/ProjectJobTypeValidate.php +++ b/app/adminapi/validate/project/ProjectJobTypeValidate.php @@ -11,101 +11,101 @@ // +---------------------------------------------------------------------- // | author: likeadminTeam // +---------------------------------------------------------------------- - -namespace app\adminapi\validate\project; - - -use app\common\model\project\ProjectJobType; -use app\common\validate\BaseValidate; - - -/** - * 工种设置验证器 - * Class ProjectJobTypeValidate - * @package app\adminapi\validate\project - */ -class ProjectJobTypeValidate extends BaseValidate -{ - - /** - * 设置校验规则 - * @var string[] - */ - protected $rule = [ - 'id' => 'require', - 'type_name' => 'require|unique:'.ProjectJobType::class, - 'type_unit_price' => 'require|float|egt:0', - 'per_daily_living' => 'require|float|egt:0', - ]; - protected $message = [ - 'id.require' => '缺少必要参数', - 'type_name.require' => '请填写工种名称', - 'type_name.unique' => '工种名称已存在', - 'type_unit_price.require' => '请填写工种单价', - 'type_unit_price.float' => '工种单价必须是数字', - 'type_unit_price.egt' => '工种单价必须大于等于0', - 'per_daily_living.require' => '请填写每日生活费', - 'per_daily_living.float' => '每日生活费必须是数字', - 'per_daily_living.egt' => '每日生活费必须大于等于0', - ]; + namespace app\adminapi\validate\project; - /** - * 参数描述 - * @var string[] - */ - protected $field = [ - 'id' => 'id', - 'type_name' => '工种名称', - 'type_unit_price' => '工种单价', - 'per_daily_living' => '每日生活费', - ]; - /** - * @notes 添加场景 - * @return ProjectJobTypeValidate - * @author likeadmin - * @date 2023/12/25 13:50 - */ - public function sceneAdd() - { - return $this->only(['type_name','type_unit_price','per_daily_living']); - } - - - /** - * @notes 编辑场景 - * @return ProjectJobTypeValidate - * @author likeadmin - * @date 2023/12/25 13:50 - */ - public function sceneEdit() - { - return $this->only(['id','type_name','type_unit_price','per_daily_living']); - } - - - /** - * @notes 删除场景 - * @return ProjectJobTypeValidate - * @author likeadmin - * @date 2023/12/25 13:50 - */ - public function sceneDelete() - { - return $this->only(['id']); - } - - - /** - * @notes 详情场景 - * @return ProjectJobTypeValidate - * @author likeadmin - * @date 2023/12/25 13:50 - */ - public function sceneDetail() - { - return $this->only(['id']); - } - -} \ No newline at end of file + use app\common\model\project\ProjectJobType; + use app\common\validate\BaseValidate; + + + /** + * 工种设置验证器 + * Class ProjectJobTypeValidate + * @package app\adminapi\validate\project + */ + class ProjectJobTypeValidate extends BaseValidate + { + + /** + * 设置校验规则 + * @var string[] + */ + protected $rule = [ + 'id' => 'require', + 'type_name' => 'require|unique:' . ProjectJobType::class, + 'type_unit_price' => 'require|float|egt:0', + 'per_daily_living' => 'require|float|egt:0', + ]; + + protected $message = [ + 'id.require' => '缺少必要参数', + 'type_name.require' => '请填写工种名称', + 'type_name.unique' => '工种名称已存在', + 'type_unit_price.require' => '请填写工种单价', + 'type_unit_price.float' => '工种单价必须是数字', + 'type_unit_price.egt' => '工种单价必须大于等于0', + 'per_daily_living.require' => '请填写每日生活费', + 'per_daily_living.float' => '每日生活费必须是数字', + 'per_daily_living.egt' => '每日生活费必须大于等于0', + ]; + + /** + * 参数描述 + * @var string[] + */ + protected $field = [ + 'id' => 'id', + 'type_name' => '工种名称', + 'type_unit_price' => '工种单价', + 'per_daily_living' => '每日生活费', + ]; + + /** + * @notes 添加场景 + * @return ProjectJobTypeValidate + * @author likeadmin + * @date 2023/12/25 13:50 + */ + public function sceneAdd() + { + return $this->only(['type_name', 'type_unit_price', 'per_daily_living']); + } + + + /** + * @notes 编辑场景 + * @return ProjectJobTypeValidate + * @author likeadmin + * @date 2023/12/25 13:50 + */ + public function sceneEdit() + { + return $this->only(['id', 'type_name', 'type_unit_price', 'per_daily_living']); + } + + + /** + * @notes 删除场景 + * @return ProjectJobTypeValidate + * @author likeadmin + * @date 2023/12/25 13:50 + */ + public function sceneDelete() + { + return $this->only(['id'])->remove('id', 'checkData'); + } + + + /** + * @notes 详情场景 + * @return ProjectJobTypeValidate + * @author likeadmin + * @date 2023/12/25 13:50 + */ + public function sceneDetail() + { + return $this->only(['id']); + } + + } \ No newline at end of file diff --git a/app/adminapi/validate/project/ProjectLaborBudgetDetailValidate.php b/app/adminapi/validate/project/ProjectLaborBudgetDetailValidate.php index f9af67ab9..b8133810e 100644 --- a/app/adminapi/validate/project/ProjectLaborBudgetDetailValidate.php +++ b/app/adminapi/validate/project/ProjectLaborBudgetDetailValidate.php @@ -11,110 +11,111 @@ // +---------------------------------------------------------------------- // | author: likeadminTeam // +---------------------------------------------------------------------- - -namespace app\adminapi\validate\project; - - -use app\common\model\project\ProjectJobType; -use app\common\model\project\ProjectLaborBudget; -use app\common\validate\BaseValidate; - - -/** - * 人工预算明细验证器 - * Class ProjectLaborBudgetDetailValidate - * @package app\adminapi\validate\project - */ -class ProjectLaborBudgetDetailValidate extends BaseValidate -{ - - /** - * 设置校验规则 - * @var string[] - */ - protected $rule = [ - 'id' => 'require', - 'labor_budget_id' => 'require|checkLaborBudget', - 'job_type_id' => 'require|checkJobType', - 'num' => 'require|float|gt:0', - 'price' => 'require|float|egt:0', - ]; - - - /** - * 参数描述 - * @var string[] - */ - protected $field = [ - 'id' => 'id', - 'labor_budget_id' => '人工预算id', - 'job_type_id' => '工种id', - 'num' => '数量', - 'price' => '单价', - ]; - - - /** - * @notes 添加场景 - * @return ProjectLaborBudgetDetailValidate - * @author likeadmin - * @date 2024/01/16 09:26 - */ - public function sceneAdd() - { - return $this->remove('id',true); - } - - - /** - * @notes 编辑场景 - * @return ProjectLaborBudgetDetailValidate - * @author likeadmin - * @date 2024/01/16 09:26 - */ - public function sceneEdit() - {} - - - /** - * @notes 删除场景 - * @return ProjectLaborBudgetDetailValidate - * @author likeadmin - * @date 2024/01/16 09:26 - */ - public function sceneDelete() - { - return $this->only(['id']); - } - - - /** - * @notes 详情场景 - * @return ProjectLaborBudgetDetailValidate - * @author likeadmin - * @date 2024/01/16 09:26 - */ - public function sceneDetail() - { - return $this->only(['id']); - } - public function checkLaborBudget($value): bool|string - { - $data = ProjectLaborBudget::where('id',$value)->findOrEmpty(); - if($data->isEmpty()){ - return '人工预算信息不存在'; - } - return true; - } + namespace app\adminapi\validate\project; - public function checkJobType($value): bool|string + + use app\common\model\project\ProjectJobType; + use app\common\model\project\ProjectLaborBudget; + use app\common\validate\BaseValidate; + + + /** + * 人工预算明细验证器 + * Class ProjectLaborBudgetDetailValidate + * @package app\adminapi\validate\project + */ + class ProjectLaborBudgetDetailValidate extends BaseValidate { - $data = ProjectJobType::where('id',$value)->findOrEmpty(); - if($data->isEmpty()){ - return '工种信息不存在'; + + /** + * 设置校验规则 + * @var string[] + */ + protected $rule = [ + 'id' => 'require', + 'labor_budget_id' => 'require|checkLaborBudget', + 'job_type_id' => 'require|checkJobType', + 'num' => 'require|float|gt:0', + 'price' => 'require|float|egt:0', + ]; + + + /** + * 参数描述 + * @var string[] + */ + protected $field = [ + 'id' => 'id', + 'labor_budget_id' => '人工预算id', + 'job_type_id' => '工种id', + 'num' => '数量', + 'price' => '单价', + ]; + + + /** + * @notes 添加场景 + * @return ProjectLaborBudgetDetailValidate + * @author likeadmin + * @date 2024/01/16 09:26 + */ + public function sceneAdd() + { + return $this->remove('id', true); } - return true; - } - -} \ No newline at end of file + + + /** + * @notes 编辑场景 + * @return ProjectLaborBudgetDetailValidate + * @author likeadmin + * @date 2024/01/16 09:26 + */ + public function sceneEdit() + { + } + + + /** + * @notes 删除场景 + * @return ProjectLaborBudgetDetailValidate + * @author likeadmin + * @date 2024/01/16 09:26 + */ + public function sceneDelete() + { + return $this->only(['id'])->remove('id', 'checkData'); + } + + + /** + * @notes 详情场景 + * @return ProjectLaborBudgetDetailValidate + * @author likeadmin + * @date 2024/01/16 09:26 + */ + public function sceneDetail() + { + return $this->only(['id']); + } + + public function checkLaborBudget($value): bool|string + { + $data = ProjectLaborBudget::where('id', $value)->findOrEmpty(); + if ($data->isEmpty()) { + return '人工预算信息不存在'; + } + return true; + } + + public function checkJobType($value): bool|string + { + $data = ProjectJobType::where('id', $value)->findOrEmpty(); + if ($data->isEmpty()) { + return '工种信息不存在'; + } + return true; + } + + } \ No newline at end of file diff --git a/app/adminapi/validate/project/ProjectLaborBudgetValidate.php b/app/adminapi/validate/project/ProjectLaborBudgetValidate.php index 66eb53643..f0f1f0a1d 100644 --- a/app/adminapi/validate/project/ProjectLaborBudgetValidate.php +++ b/app/adminapi/validate/project/ProjectLaborBudgetValidate.php @@ -11,192 +11,192 @@ // +---------------------------------------------------------------------- // | author: likeadminTeam // +---------------------------------------------------------------------- - -namespace app\adminapi\validate\project; - - -use app\common\model\dept\Dept; -use app\common\model\dept\Orgs; -use app\common\model\project\Project; -use app\common\model\project\ProjectJobType; -use app\common\model\project\ProjectLaborBudget; -use app\common\model\project\ProjectLaborBudgetDetail; -use app\common\validate\BaseValidate; - - -/** - * 人工预算验证器 - * Class ProjectLaborBudgetValidate - * @package app\adminapi\validate\project - */ -class ProjectLaborBudgetValidate extends BaseValidate -{ - - /** - * 设置校验规则 - * @var string[] - */ - protected $rule = [ - 'id' => 'require|checkData', - 'org_id' => 'require|checkOrg', - 'dept_id' => 'require|checkDept', - 'project_id' => 'require|checkProject', - 'annex' => 'checkAnnex', - 'labor_budget_detail' => 'require|checkLaborBudgetDetail', - 'flow_id' => 'require|checkFlow', - 'path' => 'require', - ]; + + namespace app\adminapi\validate\project; - protected $message = [ - 'id.require' => '缺少必要参数', - 'org_id.require' => '请选择组织', - 'dept_id.require' => '请选择部门', - 'project_id.require' => '请选择项目', - 'labor_budget_detail.require' => '请填写人工预算清单', - ]; - - - /** - * @notes 添加场景 - * @return ProjectLaborBudgetValidate - * @author likeadmin - * @date 2024/01/16 09:26 - */ - public function sceneAdd() - { - return $this->remove('id',true)->remove('flow_id',true)->remove('path',true); - } - - - /** - * @notes 编辑场景 - * @return ProjectLaborBudgetValidate - * @author likeadmin - * @date 2024/01/16 09:26 - */ - public function sceneEdit() - { - return $this->remove('flow_id',true)->remove('path',true); - } - - - /** - * @notes 删除场景 - * @return ProjectLaborBudgetValidate - * @author likeadmin - * @date 2024/01/16 09:26 - */ - public function sceneDelete() - { - return $this->only(['id']); - } - - - /** - * @notes 详情场景 - * @return ProjectLaborBudgetValidate - * @author likeadmin - * @date 2024/01/16 09:26 - */ - public function sceneDetail() - { - return $this->only(['id']); - } + use app\common\model\dept\Dept; + use app\common\model\dept\Orgs; + use app\common\model\project\Project; + use app\common\model\project\ProjectJobType; + use app\common\model\project\ProjectLaborBudget; + use app\common\model\project\ProjectLaborBudgetDetail; + use app\common\validate\BaseValidate; - public function sceneApprove() + + /** + * 人工预算验证器 + * Class ProjectLaborBudgetValidate + * @package app\adminapi\validate\project + */ + class ProjectLaborBudgetValidate extends BaseValidate { - return $this->only(['id','flow_id','path']); - } - - public function checkData($value): bool|string - { - $data = ProjectLaborBudget::where('id',$value)->findOrEmpty(); - if($data->isEmpty()){ - return '数据不存在'; + + /** + * 设置校验规则 + * @var string[] + */ + protected $rule = [ + 'id' => 'require|checkData', + 'org_id' => 'require|checkOrg', + 'dept_id' => 'require|checkDept', + 'project_id' => 'require|checkProject', + 'annex' => 'checkAnnex', + 'labor_budget_detail' => 'require|checkLaborBudgetDetail', + 'flow_id' => 'require|checkFlow', + 'path' => 'require', + ]; + + + protected $message = [ + 'id.require' => '缺少必要参数', + 'org_id.require' => '请选择组织', + 'dept_id.require' => '请选择部门', + 'project_id.require' => '请选择项目', + 'labor_budget_detail.require' => '请填写人工预算清单', + ]; + + + /** + * @notes 添加场景 + * @return ProjectLaborBudgetValidate + * @author likeadmin + * @date 2024/01/16 09:26 + */ + public function sceneAdd() + { + return $this->remove('id', true)->remove('flow_id', true)->remove('path', true); } - return true; - } - - public function checkOrg($value): bool|string - { - $org = Orgs::where('id',$value)->findOrEmpty(); - if($org->isEmpty()){ - return '组织不存在'; + + + /** + * @notes 编辑场景 + * @return ProjectLaborBudgetValidate + * @author likeadmin + * @date 2024/01/16 09:26 + */ + public function sceneEdit() + { + return $this->remove('flow_id', true)->remove('path', true); } - return true; - } - - public function checkDept($value,$rule,$data): bool|string - { - $dept = Dept::where('id',$value)->findOrEmpty(); - if($dept->isEmpty()){ - return '部门不存在'; + + + /** + * @notes 删除场景 + * @return ProjectLaborBudgetValidate + * @author likeadmin + * @date 2024/01/16 09:26 + */ + public function sceneDelete() + { + return $this->only(['id'])->remove('id', 'checkData'); } - if($dept['org_id'] != $data['org_id']){ - return '部门无效'; + + + /** + * @notes 详情场景 + * @return ProjectLaborBudgetValidate + * @author likeadmin + * @date 2024/01/16 09:26 + */ + public function sceneDetail() + { + return $this->only(['id']); } - return true; - } - - public function checkProject($value): bool|string - { - $project = Project::where('id',$value)->findOrEmpty(); - if($project->isEmpty()){ - return '项目信息不存在'; + + public function sceneApprove() + { + return $this->only(['id', 'flow_id', 'path']); } - if($project['is_budget'] != 1){ - return '该项目没有编制总预算,不能添加材料预算'; - } - return true; - } - - public function checkAnnex($value): bool|string - { - if(!empty($value) && $value != ''){ - if(!is_array($value)){ - return '附件格式错误'; + + public function checkData($value): bool|string + { + $data = ProjectLaborBudget::where('id', $value)->findOrEmpty(); + if ($data->isEmpty()) { + return '数据不存在'; } + return true; } - return true; - } - - public function checkLaborBudgetDetail($value): bool|string - { - if(empty($value) || !is_array($value)){ - return '人工预算清单数据格式错误'; + + public function checkOrg($value): bool|string + { + $org = Orgs::where('id', $value)->findOrEmpty(); + if ($org->isEmpty()) { + return '组织不存在'; + } + return true; } - foreach($value as $v) { - if(isset($v['id']) && $v['id'] != ''){ - $data = ProjectLaborBudgetDetail::where('id',$v['id'])->findOrEmpty(); - if($data->isEmpty()){ - return '人工预算明细信息不存在'; - } - } - if(empty($v['job_type_id'])){ - return '请选择工种'; - }else{ - $job_type = ProjectJobType::where('id',$v['job_type_id'])->findOrEmpty(); - if($job_type->isEmpty()){ - return '工种信息不存在'; - } - } - if(empty($v['num'])){ - return '数量不能为空'; - }else{ - if(!is_numeric($v['num']) || $v['num'] < 0){ - return '数量必须是大于0的数字'; - } - } - if(empty($v['price'])){ - return '单价不能为空'; - }else{ - if(!is_numeric($v['price']) || $v['price'] < 0){ - return '单价必须是大于0的数字'; + + public function checkDept($value, $rule, $data): bool|string + { + $dept = Dept::where('id', $value)->findOrEmpty(); + if ($dept->isEmpty()) { + return '部门不存在'; + } + if ($dept['org_id'] != $data['org_id']) { + return '部门无效'; + } + return true; + } + + public function checkProject($value): bool|string + { + $project = Project::where('id', $value)->findOrEmpty(); + if ($project->isEmpty()) { + return '项目信息不存在'; + } + if ($project['is_budget'] != 1) { + return '该项目没有编制总预算,不能添加材料预算'; + } + return true; + } + + public function checkAnnex($value): bool|string + { + if (!empty($value) && $value != '') { + if (!is_array($value)) { + return '附件格式错误'; } } + return true; } - return true; - } - -} \ No newline at end of file + + public function checkLaborBudgetDetail($value): bool|string + { + if (empty($value) || !is_array($value)) { + return '人工预算清单数据格式错误'; + } + foreach ($value as $v) { + if (isset($v['id']) && $v['id'] != '') { + $data = ProjectLaborBudgetDetail::where('id', $v['id'])->findOrEmpty(); + if ($data->isEmpty()) { + return '人工预算明细信息不存在'; + } + } + if (empty($v['job_type_id'])) { + return '请选择工种'; + } else { + $job_type = ProjectJobType::where('id', $v['job_type_id'])->findOrEmpty(); + if ($job_type->isEmpty()) { + return '工种信息不存在'; + } + } + if (empty($v['num'])) { + return '数量不能为空'; + } else { + if (!is_numeric($v['num']) || $v['num'] < 0) { + return '数量必须是大于0的数字'; + } + } + if (empty($v['price'])) { + return '单价不能为空'; + } else { + if (!is_numeric($v['price']) || $v['price'] < 0) { + return '单价必须是大于0的数字'; + } + } + } + return true; + } + + } \ No newline at end of file diff --git a/app/adminapi/validate/project/ProjectLaborContractValidate.php b/app/adminapi/validate/project/ProjectLaborContractValidate.php index 61679dd4b..ec57f4a85 100644 --- a/app/adminapi/validate/project/ProjectLaborContractValidate.php +++ b/app/adminapi/validate/project/ProjectLaborContractValidate.php @@ -11,163 +11,164 @@ // +---------------------------------------------------------------------- // | author: likeadminTeam // +---------------------------------------------------------------------- - -namespace app\adminapi\validate\project; - - -use app\common\model\dict\DictData; -use app\common\model\project\Project; -use app\common\model\project\ProjectPersonnel; -use app\common\validate\BaseValidate; - - -/** - * 劳动合同验证器 - * Class ProjectLaborContractValidate - * @package app\adminapi\validate\project - */ -class ProjectLaborContractValidate extends BaseValidate -{ - - /** - * 设置校验规则 - * @var string[] - */ - protected $rule = [ - 'id' => 'require', - 'project_id' => 'require|checkProject', - 'project_person_id' => 'require|checkProjectPerson', - 'contract_status' => 'require|checkContractStatus', - 'contract_type' => 'require|checkContractType', - 'contract_title' => 'require|checkContractTitle', - 'signing_date' => 'require|dateFormat:Y-m-d', - 'start_date' => 'require|dateFormat:Y-m-d', - 'end_date' => 'require|dateFormat:Y-m-d', - 'trial_start_date' => 'dateFormat:Y-m-d', - 'trial_end_date' => 'dateFormat:Y-m-d', - 'release_time' => 'dateFormat:Y-m-d', - 'annex' => 'checkAnnex', - ]; - protected $message = [ - 'id.require' => '缺少必要参数', - 'project_id.require' => '请选择项目', - 'project_person_id.require' => '请选择项目人员', - 'contract_status.require' => '请选择合同状态', - 'contract_type.require' => '请选择合同类别', - 'contract_title.require' => '请选择合同名称', - 'signing_date.require' => '请选择合同签定日期', - 'signing_date.dateFormat' => '合同签定日期格式错误', - 'start_date.require' => '请选择起始时间', - 'start_date.dateFormat' => '起始时间格式错误', - 'end_date.require' => '请选择终止时间', - 'end_date.dateFormat' => '终止时间格式错误', - 'trial_start_date.dateFormat' => '试用期起始日期格式错误', - 'trial_end_date.dateFormat' => '试用期结束日期格式错误', - 'release_time.dateFormat' => '解除时间格式错误', - ]; + namespace app\adminapi\validate\project; - /** - * @notes 添加场景 - * @return ProjectLaborContractValidate - * @author likeadmin - * @date 2023/12/25 14:35 - */ - public function sceneAdd() - { - return $this->remove('id',true); - } - - - /** - * @notes 编辑场景 - * @return ProjectLaborContractValidate - * @author likeadmin - * @date 2023/12/25 14:35 - */ - public function sceneEdit() - {} - - - /** - * @notes 删除场景 - * @return ProjectLaborContractValidate - * @author likeadmin - * @date 2023/12/25 14:35 - */ - public function sceneDelete() - { - return $this->only(['id']); - } - - - /** - * @notes 详情场景 - * @return ProjectLaborContractValidate - * @author likeadmin - * @date 2023/12/25 14:35 - */ - public function sceneDetail() - { - return $this->only(['id']); - } - public function checkProject($value): bool|string + use app\common\model\dict\DictData; + use app\common\model\project\Project; + use app\common\model\project\ProjectPersonnel; + use app\common\validate\BaseValidate; + + + /** + * 劳动合同验证器 + * Class ProjectLaborContractValidate + * @package app\adminapi\validate\project + */ + class ProjectLaborContractValidate extends BaseValidate { - $data = Project::where('id',$value)->findOrEmpty(); - if($data->isEmpty()){ - return '项目不存在'; + + /** + * 设置校验规则 + * @var string[] + */ + protected $rule = [ + 'id' => 'require', + 'project_id' => 'require|checkProject', + 'project_person_id' => 'require|checkProjectPerson', + 'contract_status' => 'require|checkContractStatus', + 'contract_type' => 'require|checkContractType', + 'contract_title' => 'require|checkContractTitle', + 'signing_date' => 'require|dateFormat:Y-m-d', + 'start_date' => 'require|dateFormat:Y-m-d', + 'end_date' => 'require|dateFormat:Y-m-d', + 'trial_start_date' => 'dateFormat:Y-m-d', + 'trial_end_date' => 'dateFormat:Y-m-d', + 'release_time' => 'dateFormat:Y-m-d', + 'annex' => 'checkAnnex', + ]; + + protected $message = [ + 'id.require' => '缺少必要参数', + 'project_id.require' => '请选择项目', + 'project_person_id.require' => '请选择项目人员', + 'contract_status.require' => '请选择合同状态', + 'contract_type.require' => '请选择合同类别', + 'contract_title.require' => '请选择合同名称', + 'signing_date.require' => '请选择合同签定日期', + 'signing_date.dateFormat' => '合同签定日期格式错误', + 'start_date.require' => '请选择起始时间', + 'start_date.dateFormat' => '起始时间格式错误', + 'end_date.require' => '请选择终止时间', + 'end_date.dateFormat' => '终止时间格式错误', + 'trial_start_date.dateFormat' => '试用期起始日期格式错误', + 'trial_end_date.dateFormat' => '试用期结束日期格式错误', + 'release_time.dateFormat' => '解除时间格式错误', + ]; + + /** + * @notes 添加场景 + * @return ProjectLaborContractValidate + * @author likeadmin + * @date 2023/12/25 14:35 + */ + public function sceneAdd() + { + return $this->remove('id', true); } - return true; - } - - public function checkProjectPerson($value,$rule,$data): bool|string - { - $person = ProjectPersonnel::where('id',$value)->findOrEmpty(); - if($person->isEmpty()){ - return '项目人员不存在'; + + + /** + * @notes 编辑场景 + * @return ProjectLaborContractValidate + * @author likeadmin + * @date 2023/12/25 14:35 + */ + public function sceneEdit() + { } - if($person['project_id'] != $data['project_id']){ - return '项目人员无效'; + + + /** + * @notes 删除场景 + * @return ProjectLaborContractValidate + * @author likeadmin + * @date 2023/12/25 14:35 + */ + public function sceneDelete() + { + return $this->only(['id'])->remove('id', 'checkData'); } - return true; - } - - public function checkContractStatus($value): bool|string - { - $dictData = DictData::where('type_value','labor_contract_status')->column('value'); - if(!in_array($value,$dictData)){ - return '合同状态无效'; + + + /** + * @notes 详情场景 + * @return ProjectLaborContractValidate + * @author likeadmin + * @date 2023/12/25 14:35 + */ + public function sceneDetail() + { + return $this->only(['id']); } - return true; - } - - public function checkContractType($value): bool|string - { - $dictData = DictData::where('type_value','labor_contract_type')->column('value'); - if(!in_array($value,$dictData)){ - return '合同类别无效'; - } - return true; - } - - public function checkContractTitle($value): bool|string - { - $dictData = DictData::where('type_value','labor_contract_name')->column('value'); - if(!in_array($value,$dictData)){ - return '合同名称无效'; - } - return true; - } - - public function checkAnnex($value): bool|string - { - if(!empty($value) && $value != ''){ - if(!is_array($value)){ - return '附件必须是json数组'; + + public function checkProject($value): bool|string + { + $data = Project::where('id', $value)->findOrEmpty(); + if ($data->isEmpty()) { + return '项目不存在'; } + return true; } - return true; - } - -} \ No newline at end of file + + public function checkProjectPerson($value, $rule, $data): bool|string + { + $person = ProjectPersonnel::where('id', $value)->findOrEmpty(); + if ($person->isEmpty()) { + return '项目人员不存在'; + } + if ($person['project_id'] != $data['project_id']) { + return '项目人员无效'; + } + return true; + } + + public function checkContractStatus($value): bool|string + { + $dictData = DictData::where('type_value', 'labor_contract_status')->column('value'); + if (!in_array($value, $dictData)) { + return '合同状态无效'; + } + return true; + } + + public function checkContractType($value): bool|string + { + $dictData = DictData::where('type_value', 'labor_contract_type')->column('value'); + if (!in_array($value, $dictData)) { + return '合同类别无效'; + } + return true; + } + + public function checkContractTitle($value): bool|string + { + $dictData = DictData::where('type_value', 'labor_contract_name')->column('value'); + if (!in_array($value, $dictData)) { + return '合同名称无效'; + } + return true; + } + + public function checkAnnex($value): bool|string + { + if (!empty($value) && $value != '') { + if (!is_array($value)) { + return '附件必须是json数组'; + } + } + return true; + } + + } \ No newline at end of file diff --git a/app/adminapi/validate/project/ProjectLoanApplyValidate.php b/app/adminapi/validate/project/ProjectLoanApplyValidate.php index 95f6a7001..fb13e2cea 100644 --- a/app/adminapi/validate/project/ProjectLoanApplyValidate.php +++ b/app/adminapi/validate/project/ProjectLoanApplyValidate.php @@ -11,148 +11,148 @@ // +---------------------------------------------------------------------- // | author: likeadminTeam // +---------------------------------------------------------------------- - -namespace app\adminapi\validate\project; - - -use app\common\model\bank\BankAccount; -use app\common\model\project\Project; -use app\common\model\project\ProjectLoanApply; -use app\common\validate\BaseValidate; - - -/** - * 借款申请验证器 - * Class ProjectLoanApplyValidate - * @package app\adminapi\validate\project - */ -class ProjectLoanApplyValidate extends BaseValidate -{ - - /** - * 设置校验规则 - * @var string[] - */ - protected $rule = [ - 'id' => 'require|checkData', - 'project_id' => 'require|checkProject', - 'apply_user' => 'require', - 'loan_date' => 'require|dateFormat:Y-m-d', - 'loan_amount' => 'require|float|gt:0', - 'payee_name' => 'require', - 'payee_bank' => 'require', - 'payee_account' => 'require', - 'annex' => 'checkAnnex', - 'bank_account_id' => 'require|checkBankAccount', - 'flow_id' => 'require|checkFlow', - 'path' => 'require', - ]; - - - /** - * 参数描述 - * @var string[] - */ - protected $field = [ - 'id' => 'id', - 'project_id' => '项目id', - 'apply_user' => '借款人', - 'loan_date' => '借款申请日期', - 'loan_amount' => '借款金额', - 'payee_name' => '收款人姓名', - 'payee_bank' => '收款银行', - 'payee_account' => '收款账号', - 'bank_account_id' => '付款银行账户id', - ]; - - - /** - * @notes 添加场景 - * @return ProjectLoanApplyValidate - * @author likeadmin - * @date 2024/01/17 11:05 - */ - public function sceneAdd() - { - return $this->remove('id',true)->remove('flow_id',true)->remove('path',true); - } - - - /** - * @notes 编辑场景 - * @return ProjectLoanApplyValidate - * @author likeadmin - * @date 2024/01/17 11:05 - */ - public function sceneEdit() - { - return $this->remove('flow_id',true)->remove('path',true); - } - - - /** - * @notes 删除场景 - * @return ProjectLoanApplyValidate - * @author likeadmin - * @date 2024/01/17 11:05 - */ - public function sceneDelete() - { - return $this->only(['id']); - } - - - /** - * @notes 详情场景 - * @return ProjectLoanApplyValidate - * @author likeadmin - * @date 2024/01/17 11:05 - */ - public function sceneDetail() - { - return $this->only(['id']); - } - public function sceneApprove() - { - return $this->only(['id','flow_id','path']); - } + namespace app\adminapi\validate\project; - public function checkData($value): bool|string + + use app\common\model\bank\BankAccount; + use app\common\model\project\Project; + use app\common\model\project\ProjectLoanApply; + use app\common\validate\BaseValidate; + + + /** + * 借款申请验证器 + * Class ProjectLoanApplyValidate + * @package app\adminapi\validate\project + */ + class ProjectLoanApplyValidate extends BaseValidate { - $data = ProjectLoanApply::where('id',$value)->findOrEmpty(); - if($data->isEmpty()){ - return '数据不存在'; + + /** + * 设置校验规则 + * @var string[] + */ + protected $rule = [ + 'id' => 'require|checkData', + 'project_id' => 'require|checkProject', + 'apply_user' => 'require', + 'loan_date' => 'require|dateFormat:Y-m-d', + 'loan_amount' => 'require|float|gt:0', + 'payee_name' => 'require', + 'payee_bank' => 'require', + 'payee_account' => 'require', + 'annex' => 'checkAnnex', + 'bank_account_id' => 'require|checkBankAccount', + 'flow_id' => 'require|checkFlow', + 'path' => 'require', + ]; + + + /** + * 参数描述 + * @var string[] + */ + protected $field = [ + 'id' => 'id', + 'project_id' => '项目id', + 'apply_user' => '借款人', + 'loan_date' => '借款申请日期', + 'loan_amount' => '借款金额', + 'payee_name' => '收款人姓名', + 'payee_bank' => '收款银行', + 'payee_account' => '收款账号', + 'bank_account_id' => '付款银行账户id', + ]; + + + /** + * @notes 添加场景 + * @return ProjectLoanApplyValidate + * @author likeadmin + * @date 2024/01/17 11:05 + */ + public function sceneAdd() + { + return $this->remove('id', true)->remove('flow_id', true)->remove('path', true); } - return true; - } - - public function checkProject($value): bool|string - { - $data = Project::where('id',$value)->findOrEmpty(); - if($data->isEmpty()){ - return '项目信息不存在'; + + + /** + * @notes 编辑场景 + * @return ProjectLoanApplyValidate + * @author likeadmin + * @date 2024/01/17 11:05 + */ + public function sceneEdit() + { + return $this->remove('flow_id', true)->remove('path', true); } - return true; - } - - public function checkAnnex($value): bool|string - { - if(!empty($value) && $value != ''){ - if(!is_array($value)){ - return '附件格式错误'; + + + /** + * @notes 删除场景 + * @return ProjectLoanApplyValidate + * @author likeadmin + * @date 2024/01/17 11:05 + */ + public function sceneDelete() + { + return $this->only(['id'])->remove('id', 'checkData'); + } + + + /** + * @notes 详情场景 + * @return ProjectLoanApplyValidate + * @author likeadmin + * @date 2024/01/17 11:05 + */ + public function sceneDetail() + { + return $this->only(['id']); + } + + public function sceneApprove() + { + return $this->only(['id', 'flow_id', 'path']); + } + + public function checkData($value): bool|string + { + $data = ProjectLoanApply::where('id', $value)->findOrEmpty(); + if ($data->isEmpty()) { + return '数据不存在'; } + return true; } - return true; - } - - public function checkBankAccount($value): bool|string - { - $data = BankAccount::where('id',$value)->findOrEmpty(); - if($data->isEmpty()){ - return '付款银行账户信息不存在'; + + public function checkProject($value): bool|string + { + $data = Project::where('id', $value)->findOrEmpty(); + if ($data->isEmpty()) { + return '项目信息不存在'; + } + return true; } - return true; - } - -} \ No newline at end of file + + public function checkAnnex($value): bool|string + { + if (!empty($value) && $value != '') { + if (!is_array($value)) { + return '附件格式错误'; + } + } + return true; + } + + public function checkBankAccount($value): bool|string + { + $data = BankAccount::where('id', $value)->findOrEmpty(); + if ($data->isEmpty()) { + return '付款银行账户信息不存在'; + } + return true; + } + + } \ No newline at end of file diff --git a/app/adminapi/validate/project/ProjectLogsValidate.php b/app/adminapi/validate/project/ProjectLogsValidate.php index 2b72de671..c35ea21a9 100644 --- a/app/adminapi/validate/project/ProjectLogsValidate.php +++ b/app/adminapi/validate/project/ProjectLogsValidate.php @@ -11,140 +11,141 @@ // +---------------------------------------------------------------------- // | author: likeadminTeam // +---------------------------------------------------------------------- - -namespace app\adminapi\validate\project; - - -use app\common\model\dict\DictData; -use app\common\model\project\Project; -use app\common\model\project\ProjectLogs; -use app\common\validate\BaseValidate; - - -/** - * 项目日志管理验证器 - * Class ProjectLogsValidate - * @package app\adminapi\validate\project - */ -class ProjectLogsValidate extends BaseValidate -{ - - /** - * 设置校验规则 - * @var string[] - */ - protected $rule = [ - 'id' => 'require|checkLog', - 'project_id' => 'require|checkProject', - 'theme' => 'require', - 'date' => 'require|date', - 'follow_type' => 'require|checkFollowType', - 'next_follow_up_date' => 'date|checkNextFollowUpDate', - ]; - protected $message = [ - 'id.require' => '缺少必要参数', - 'project_id.require' => '请选择项目', - 'theme.require' => '主题不能为空', - 'date.require' => '日期不能为空', - 'date.date' => '日期格式不正确', - 'follow_type.require' => '请选择类型', - 'next_follow_up_date.date' => '下次跟进时间格式不正确', - ]; - - - /** - * 参数描述 - * @var string[] - */ - protected $field = [ - 'id' => 'id', - 'project_id' => '项目名称', - 'theme' => '主题', - 'date' => '日期', - ]; - - - /** - * @notes 添加场景 - * @return ProjectLogsValidate - * @author likeadmin - * @date 2023/12/14 09:17 - */ - public function sceneAdd() - { - return $this->remove('id',true); - } - - - /** - * @notes 编辑场景 - * @return ProjectLogsValidate - * @author likeadmin - * @date 2023/12/14 09:17 - */ - public function sceneEdit() - {} - - - /** - * @notes 删除场景 - * @return ProjectLogsValidate - * @author likeadmin - * @date 2023/12/14 09:17 - */ - public function sceneDelete() - { - return $this->only(['id']); - } - - - /** - * @notes 详情场景 - * @return ProjectLogsValidate - * @author likeadmin - * @date 2023/12/14 09:17 - */ - public function sceneDetail() - { - return $this->only(['id']); - } + namespace app\adminapi\validate\project; - public function checkLog($value): bool|string + + use app\common\model\dict\DictData; + use app\common\model\project\Project; + use app\common\model\project\ProjectLogs; + use app\common\validate\BaseValidate; + + + /** + * 项目日志管理验证器 + * Class ProjectLogsValidate + * @package app\adminapi\validate\project + */ + class ProjectLogsValidate extends BaseValidate { - $data = ProjectLogs::where('id',$value)->findOrEmpty(); - if($data->isEmpty()){ - return '数据不存在'; + + /** + * 设置校验规则 + * @var string[] + */ + protected $rule = [ + 'id' => 'require|checkLog', + 'project_id' => 'require|checkProject', + 'theme' => 'require', + 'date' => 'require|date', + 'follow_type' => 'require|checkFollowType', + 'next_follow_up_date' => 'date|checkNextFollowUpDate', + ]; + + protected $message = [ + 'id.require' => '缺少必要参数', + 'project_id.require' => '请选择项目', + 'theme.require' => '主题不能为空', + 'date.require' => '日期不能为空', + 'date.date' => '日期格式不正确', + 'follow_type.require' => '请选择类型', + 'next_follow_up_date.date' => '下次跟进时间格式不正确', + ]; + + + /** + * 参数描述 + * @var string[] + */ + protected $field = [ + 'id' => 'id', + 'project_id' => '项目名称', + 'theme' => '主题', + 'date' => '日期', + ]; + + + /** + * @notes 添加场景 + * @return ProjectLogsValidate + * @author likeadmin + * @date 2023/12/14 09:17 + */ + public function sceneAdd() + { + return $this->remove('id', true); } - return true; - } - - public function checkProject($value): bool|string - { - $project = Project::where('id',$value)->findOrEmpty(); - if($project->isEmpty()){ - return '项目不存在'; + + + /** + * @notes 编辑场景 + * @return ProjectLogsValidate + * @author likeadmin + * @date 2023/12/14 09:17 + */ + public function sceneEdit() + { } - return true; - } - - public function checkFollowType($value): bool|string - { - $dictDate = DictData::where('type_value','follow_type')->column('value'); - if(!in_array($value,$dictDate)){ - return '类型不存在'; + + + /** + * @notes 删除场景 + * @return ProjectLogsValidate + * @author likeadmin + * @date 2023/12/14 09:17 + */ + public function sceneDelete() + { + return $this->only(['id'])->remove('id', 'checkData'); } - return true; - } - - public function checkNextFollowUpDate($value,$rule,$data): bool|string - { - $a = strtotime($value); - $b = strtotime($data['date']); - if($a < $b){ - return '下次跟进时间不能小于日志日期'; + + + /** + * @notes 详情场景 + * @return ProjectLogsValidate + * @author likeadmin + * @date 2023/12/14 09:17 + */ + public function sceneDetail() + { + return $this->only(['id']); } - return true; - } - -} \ No newline at end of file + + public function checkLog($value): bool|string + { + $data = ProjectLogs::where('id', $value)->findOrEmpty(); + if ($data->isEmpty()) { + return '数据不存在'; + } + return true; + } + + public function checkProject($value): bool|string + { + $project = Project::where('id', $value)->findOrEmpty(); + if ($project->isEmpty()) { + return '项目不存在'; + } + return true; + } + + public function checkFollowType($value): bool|string + { + $dictDate = DictData::where('type_value', 'follow_type')->column('value'); + if (!in_array($value, $dictDate)) { + return '类型不存在'; + } + return true; + } + + public function checkNextFollowUpDate($value, $rule, $data): bool|string + { + $a = strtotime($value); + $b = strtotime($data['date']); + if ($a < $b) { + return '下次跟进时间不能小于日志日期'; + } + return true; + } + + } \ No newline at end of file diff --git a/app/adminapi/validate/project/ProjectManagerAppointmentValidate.php b/app/adminapi/validate/project/ProjectManagerAppointmentValidate.php index edd7d970a..7d70c8f00 100644 --- a/app/adminapi/validate/project/ProjectManagerAppointmentValidate.php +++ b/app/adminapi/validate/project/ProjectManagerAppointmentValidate.php @@ -11,198 +11,197 @@ // +---------------------------------------------------------------------- // | author: likeadminTeam // +---------------------------------------------------------------------- - -namespace app\adminapi\validate\project; - - -use app\common\model\auth\Admin; -use app\common\model\contract\Contract; -use app\common\model\dept\Dept; -use app\common\model\dept\Orgs; -use app\common\model\dict\DictData; -use app\common\model\project\Project; -use app\common\model\project\ProjectManagerAppointment; -use app\common\model\project\ProjectTypeSet; -use app\common\validate\BaseValidate; - - -/** - * 项目经理委任验证器 - * Class ProjectManagerAppointmentValidate - * @package app\adminapi\validate\project - */ -class ProjectManagerAppointmentValidate extends BaseValidate -{ - - /** - * 设置校验规则 - * @var string[] - */ - protected $rule = [ - 'id' => 'require|checkData', - 'org_id' => 'require|checkOrg', - 'dept_id' => 'require|checkDept', - 'project_id' => 'require|checkProject', - 'contract_id' => 'require|checkContract', - 'project_type_id' => 'require|checkProjectType', - 'project_manager' => 'require|checkUser', - 'amount' => 'require|float|egt:0', - 'project_approval_date' => 'require|date', - 'start_date' => 'require|date', - 'delivery_date' => 'require|date', - ]; - protected $message = [ - 'id.require' => '缺少必要参数', - 'org_id.require' => '请选择组织', - 'dept_id.require' => '请选择部门', - 'project_id.require' => '请选择项目', - 'contract_id.require' => '请选择合同', - 'project_type_id.require' => '请选择项目类型', - 'project_manager.require' => '请选择项目经理', - 'amount.require' => '请填写项目金额', - 'amount.float' => '项目金额必须是数字', - 'amount.egt' => '项目金额必须大于等于0', - 'project_approval_date.require' => '请选择立项日期', - 'project_approval_date.date' => '立项日期格式错误', - 'start_date.require' => '请选择项目开始日期', - 'start_date.date' => '项目开始日期格式错误', - 'delivery_date.require' => '请选择项目交付日期', - 'delivery_date.date' => '项目交付日期格式错误', - ]; - - - /** - * 参数描述 - * @var string[] - */ - protected $field = [ - 'id' => 'id', - 'project_id' => '项目id', - 'contract_id' => '合同id', - 'org_id' => '组织id', - 'dept_id' => '部门id', - 'project_type_id' => '项目类型', - 'project_manager' => '项目经理', - 'amount' => '项目金额', - 'project_approval_date' => '立项日期', - 'start_date' => '项目开始日期', - 'delivery_date' => '项目交付日期', - - ]; - - - /** - * @notes 添加场景 - * @return ProjectManagerAppointmentValidate - * @author likeadmin - * @date 2023/12/15 15:22 - */ - public function sceneAdd() - { - return $this->remove('id',true); - } - - - /** - * @notes 编辑场景 - * @return ProjectManagerAppointmentValidate - * @author likeadmin - * @date 2023/12/15 15:22 - */ - public function sceneEdit() - { - return $this->only(['id','project_id','contract_id','project_type_id','project_manager','amount','project_approval_date','start_date','delivery_date','remark','annex']); - } - - - /** - * @notes 删除场景 - * @return ProjectManagerAppointmentValidate - * @author likeadmin - * @date 2023/12/15 15:22 - */ - public function sceneDelete() - { - return $this->only(['id']); - } - - - /** - * @notes 详情场景 - * @return ProjectManagerAppointmentValidate - * @author likeadmin - * @date 2023/12/15 15:22 - */ - public function sceneDetail() - { - return $this->only(['id']); - } + namespace app\adminapi\validate\project; - public function checkData($value): bool|string + + use app\common\model\auth\Admin; + use app\common\model\contract\Contract; + use app\common\model\dept\Dept; + use app\common\model\dept\Orgs; + use app\common\model\project\Project; + use app\common\model\project\ProjectManagerAppointment; + use app\common\model\project\ProjectTypeSet; + use app\common\validate\BaseValidate; + + + /** + * 项目经理委任验证器 + * Class ProjectManagerAppointmentValidate + * @package app\adminapi\validate\project + */ + class ProjectManagerAppointmentValidate extends BaseValidate { - $data = ProjectManagerAppointment::where('id',$value)->findOrEmpty(); - if($data->isEmpty()){ - return '数据不存在'; + + /** + * 设置校验规则 + * @var string[] + */ + protected $rule = [ + 'id' => 'require|checkData', + 'org_id' => 'require|checkOrg', + 'dept_id' => 'require|checkDept', + 'project_id' => 'require|checkProject', + 'contract_id' => 'require|checkContract', + 'project_type_id' => 'require|checkProjectType', + 'project_manager' => 'require|checkUser', + 'amount' => 'require|float|egt:0', + 'project_approval_date' => 'require|date', + 'start_date' => 'require|date', + 'delivery_date' => 'require|date', + ]; + + protected $message = [ + 'id.require' => '缺少必要参数', + 'org_id.require' => '请选择组织', + 'dept_id.require' => '请选择部门', + 'project_id.require' => '请选择项目', + 'contract_id.require' => '请选择合同', + 'project_type_id.require' => '请选择项目类型', + 'project_manager.require' => '请选择项目经理', + 'amount.require' => '请填写项目金额', + 'amount.float' => '项目金额必须是数字', + 'amount.egt' => '项目金额必须大于等于0', + 'project_approval_date.require' => '请选择立项日期', + 'project_approval_date.date' => '立项日期格式错误', + 'start_date.require' => '请选择项目开始日期', + 'start_date.date' => '项目开始日期格式错误', + 'delivery_date.require' => '请选择项目交付日期', + 'delivery_date.date' => '项目交付日期格式错误', + ]; + + + /** + * 参数描述 + * @var string[] + */ + protected $field = [ + 'id' => 'id', + 'project_id' => '项目id', + 'contract_id' => '合同id', + 'org_id' => '组织id', + 'dept_id' => '部门id', + 'project_type_id' => '项目类型', + 'project_manager' => '项目经理', + 'amount' => '项目金额', + 'project_approval_date' => '立项日期', + 'start_date' => '项目开始日期', + 'delivery_date' => '项目交付日期', + + ]; + + + /** + * @notes 添加场景 + * @return ProjectManagerAppointmentValidate + * @author likeadmin + * @date 2023/12/15 15:22 + */ + public function sceneAdd() + { + return $this->remove('id', true); } - return true; - } - - public function checkOrg($value): bool|string - { - $data = Orgs::where('id',$value)->findOrEmpty(); - if($data->isEmpty()){ - return '组织不存在'; + + + /** + * @notes 编辑场景 + * @return ProjectManagerAppointmentValidate + * @author likeadmin + * @date 2023/12/15 15:22 + */ + public function sceneEdit() + { + return $this->only(['id', 'project_id', 'contract_id', 'project_type_id', 'project_manager', 'amount', 'project_approval_date', 'start_date', 'delivery_date', 'remark', 'annex']); } - return true; - } - - public function checkDept($value,$rule,$data): bool|string - { - $dept = Dept::where('id',$value)->findOrEmpty(); - if($dept->isEmpty()){ - return '部门不存在'; + + + /** + * @notes 删除场景 + * @return ProjectManagerAppointmentValidate + * @author likeadmin + * @date 2023/12/15 15:22 + */ + public function sceneDelete() + { + return $this->only(['id'])->remove('id', 'checkData'); } - if($data['org_id'] != $dept['org_id']){ - return '部门不属于当前选择的组织'; + + + /** + * @notes 详情场景 + * @return ProjectManagerAppointmentValidate + * @author likeadmin + * @date 2023/12/15 15:22 + */ + public function sceneDetail() + { + return $this->only(['id']); } - return true; - } - - public function checkProject($value): bool|string - { - $data = Project::where('id',$value)->findOrEmpty(); - if($data->isEmpty()){ - return '项目不存在'; + + public function checkData($value): bool|string + { + $data = ProjectManagerAppointment::where('id', $value)->findOrEmpty(); + if ($data->isEmpty()) { + return '数据不存在'; + } + return true; } - return true; - } - - public function checkContract($value): bool|string - { - $data = Contract::where('id',$value)->findOrEmpty(); - if($data->isEmpty()){ - return '合同不存在'; + + public function checkOrg($value): bool|string + { + $data = Orgs::where('id', $value)->findOrEmpty(); + if ($data->isEmpty()) { + return '组织不存在'; + } + return true; } - return true; - } - - public function checkProjectType($value): bool|string - { - $data = ProjectTypeSet::where('id',$value)->findOrEmpty(); - if($data->isEmpty()){ - return '项目类型不存在'; + + public function checkDept($value, $rule, $data): bool|string + { + $dept = Dept::where('id', $value)->findOrEmpty(); + if ($dept->isEmpty()) { + return '部门不存在'; + } + if ($data['org_id'] != $dept['org_id']) { + return '部门不属于当前选择的组织'; + } + return true; } - return true; - } - - public function checkUser($value): bool|string - { - $data = Admin::where('id',$value)->findOrEmpty(); - if($data->isEmpty()){ - return '用户不存在'; + + public function checkProject($value): bool|string + { + $data = Project::where('id', $value)->findOrEmpty(); + if ($data->isEmpty()) { + return '项目不存在'; + } + return true; } - return true; - } - -} \ No newline at end of file + + public function checkContract($value): bool|string + { + $data = Contract::where('id', $value)->findOrEmpty(); + if ($data->isEmpty()) { + return '合同不存在'; + } + return true; + } + + public function checkProjectType($value): bool|string + { + $data = ProjectTypeSet::where('id', $value)->findOrEmpty(); + if ($data->isEmpty()) { + return '项目类型不存在'; + } + return true; + } + + public function checkUser($value): bool|string + { + $data = Admin::where('id', $value)->findOrEmpty(); + if ($data->isEmpty()) { + return '用户不存在'; + } + return true; + } + + } \ No newline at end of file diff --git a/app/adminapi/validate/project/ProjectMaterialBudgetDetailValidate.php b/app/adminapi/validate/project/ProjectMaterialBudgetDetailValidate.php index 312b00263..8fcf60faa 100644 --- a/app/adminapi/validate/project/ProjectMaterialBudgetDetailValidate.php +++ b/app/adminapi/validate/project/ProjectMaterialBudgetDetailValidate.php @@ -11,126 +11,127 @@ // +---------------------------------------------------------------------- // | author: likeadminTeam // +---------------------------------------------------------------------- - -namespace app\adminapi\validate\project; - - -use app\common\model\dict\DictData; -use app\common\model\material\Material; -use app\common\model\project\ProjectMaterialBudget; -use app\common\validate\BaseValidate; - - -/** - * 材料预算明细验证器 - * Class ProjectMaterialBudgetDetailValidate - * @package app\adminapi\validate\project - */ -class ProjectMaterialBudgetDetailValidate extends BaseValidate -{ - - /** - * 设置校验规则 - * @var string[] - */ - protected $rule = [ - 'id' => 'require', - 'material_budget_id' => 'require|checkMaterialBudget', - 'material_id' => 'require|checkMaterial', - 'budget_type' => 'require|checkBudgetType', - 'price' => 'require|float|egt:0', - 'num' => 'require|integer|gt:0', - ]; - - - /** - * 参数描述 - * @var string[] - */ - protected $message = [ - 'id.require' => '缺少必要参数', - 'material_budget_id.require' => '请选择材料预算', - 'material_id.require' => '请选择材料', - 'budget_type.require' => '请选择类型', - 'price.require' => '请填写单价', - 'price.float' => '单价值必须是数字', - 'price.egt' => '单价值必须大于等于0', - 'num.require' => '请填写数量', - 'num.integer' => '数量值必须时整数', - 'num.gt' => '数量值必须大于0', - ]; - - - /** - * @notes 添加场景 - * @return ProjectMaterialBudgetDetailValidate - * @author likeadmin - * @date 2024/01/08 21:52 - */ - public function sceneAdd() - { - return $this->remove('id',true); - } - - - /** - * @notes 编辑场景 - * @return ProjectMaterialBudgetDetailValidate - * @author likeadmin - * @date 2024/01/08 21:52 - */ - public function sceneEdit() - {} - - - /** - * @notes 删除场景 - * @return ProjectMaterialBudgetDetailValidate - * @author likeadmin - * @date 2024/01/08 21:52 - */ - public function sceneDelete() - { - return $this->only(['id']); - } - - - /** - * @notes 详情场景 - * @return ProjectMaterialBudgetDetailValidate - * @author likeadmin - * @date 2024/01/08 21:52 - */ - public function sceneDetail() - { - return $this->only(['id']); - } - public function checkMaterialBudget($value): bool|string - { - $material_budget = ProjectMaterialBudget::where('id',$value)->findOrEmpty(); - if($material_budget->isEmpty()){ - return '材料预算信息不存在'; - } - return true; - } + namespace app\adminapi\validate\project; - public function checkMaterial($value): bool|string - { - $material = Material::where('id',$value)->findOrEmpty(); - if($material->isEmpty()){ - return '材料信息不存在'; - } - return true; - } - public function checkBudgetType($value): bool|string + use app\common\model\dict\DictData; + use app\common\model\material\Material; + use app\common\model\project\ProjectMaterialBudget; + use app\common\validate\BaseValidate; + + + /** + * 材料预算明细验证器 + * Class ProjectMaterialBudgetDetailValidate + * @package app\adminapi\validate\project + */ + class ProjectMaterialBudgetDetailValidate extends BaseValidate { - $dict = DictData::where('type_value','budget_type')->column('value'); - if(!in_array($value,$dict)){ - return '类型值无效'; + + /** + * 设置校验规则 + * @var string[] + */ + protected $rule = [ + 'id' => 'require', + 'material_budget_id' => 'require|checkMaterialBudget', + 'material_id' => 'require|checkMaterial', + 'budget_type' => 'require|checkBudgetType', + 'price' => 'require|float|egt:0', + 'num' => 'require|integer|gt:0', + ]; + + + /** + * 参数描述 + * @var string[] + */ + protected $message = [ + 'id.require' => '缺少必要参数', + 'material_budget_id.require' => '请选择材料预算', + 'material_id.require' => '请选择材料', + 'budget_type.require' => '请选择类型', + 'price.require' => '请填写单价', + 'price.float' => '单价值必须是数字', + 'price.egt' => '单价值必须大于等于0', + 'num.require' => '请填写数量', + 'num.integer' => '数量值必须时整数', + 'num.gt' => '数量值必须大于0', + ]; + + + /** + * @notes 添加场景 + * @return ProjectMaterialBudgetDetailValidate + * @author likeadmin + * @date 2024/01/08 21:52 + */ + public function sceneAdd() + { + return $this->remove('id', true); } - return true; - } - -} \ No newline at end of file + + + /** + * @notes 编辑场景 + * @return ProjectMaterialBudgetDetailValidate + * @author likeadmin + * @date 2024/01/08 21:52 + */ + public function sceneEdit() + { + } + + + /** + * @notes 删除场景 + * @return ProjectMaterialBudgetDetailValidate + * @author likeadmin + * @date 2024/01/08 21:52 + */ + public function sceneDelete() + { + return $this->only(['id'])->remove('id', 'checkData'); + } + + + /** + * @notes 详情场景 + * @return ProjectMaterialBudgetDetailValidate + * @author likeadmin + * @date 2024/01/08 21:52 + */ + public function sceneDetail() + { + return $this->only(['id']); + } + + public function checkMaterialBudget($value): bool|string + { + $material_budget = ProjectMaterialBudget::where('id', $value)->findOrEmpty(); + if ($material_budget->isEmpty()) { + return '材料预算信息不存在'; + } + return true; + } + + public function checkMaterial($value): bool|string + { + $material = Material::where('id', $value)->findOrEmpty(); + if ($material->isEmpty()) { + return '材料信息不存在'; + } + return true; + } + + public function checkBudgetType($value): bool|string + { + $dict = DictData::where('type_value', 'budget_type')->column('value'); + if (!in_array($value, $dict)) { + return '类型值无效'; + } + return true; + } + + } \ No newline at end of file diff --git a/app/adminapi/validate/project/ProjectMaterialBudgetValidate.php b/app/adminapi/validate/project/ProjectMaterialBudgetValidate.php index eb776b447..5d081bf92 100644 --- a/app/adminapi/validate/project/ProjectMaterialBudgetValidate.php +++ b/app/adminapi/validate/project/ProjectMaterialBudgetValidate.php @@ -11,191 +11,191 @@ // +---------------------------------------------------------------------- // | author: likeadminTeam // +---------------------------------------------------------------------- - -namespace app\adminapi\validate\project; - -use app\common\model\dept\Dept; -use app\common\model\dept\Orgs; -use app\common\model\material\Material; -use app\common\model\project\Project; -use app\common\model\project\ProjectMaterialBudgetDetail; -use app\common\validate\BaseValidate; - - -/** - * 材料预算验证器 - * Class ProjectMaterialBudgetValidate - * @package app\adminapi\validate\project - */ -class ProjectMaterialBudgetValidate extends BaseValidate -{ - - /** - * 设置校验规则 - * @var string[] - */ - protected $rule = [ - 'id' => 'require|checkData', - 'org_id' => 'require|checkOrg', - 'dept_id' => 'require|checkDept', - 'project_id' => 'require|checkProject', - 'annex' => 'checkAnnex', - 'material_budget_detail' => 'require|checkMaterialBudgetDetail', - 'flow_id' => 'require|checkFlow', - 'path' => 'require', - ]; - - protected $message = [ - 'id.require' => '缺少必要参数', - 'org_id.require' => '请选择组织', - 'dept_id.require' => '请选择部门', - 'project_id.require' => '请选择项目', - 'material_budget_detail.require' => '请填写材料预算清单', - ]; - - - /** - * @notes 添加场景 - * @return ProjectMaterialBudgetValidate - * @author likeadmin - * @date 2024/01/08 16:30 - */ - public function sceneAdd() - { - return $this->remove('id',true)->remove('flow_id',true)->remove('path',true); - } - - - /** - * @notes 编辑场景 - * @return ProjectMaterialBudgetValidate - * @author likeadmin - * @date 2024/01/08 16:30 - */ - public function sceneEdit() - { - return $this->remove('flow_id',true)->remove('path',true); - } - - - /** - * @notes 删除场景 - * @return ProjectMaterialBudgetValidate - * @author likeadmin - * @date 2024/01/08 16:30 - */ - public function sceneDelete() - { - return $this->only(['id']); - } - - - /** - * @notes 详情场景 - * @return ProjectMaterialBudgetValidate - * @author likeadmin - * @date 2024/01/08 16:30 - */ - public function sceneDetail() - { - return $this->only(['id']); - } - public function sceneApprove() - { - return $this->only(['id','flow_id','path']); - } + namespace app\adminapi\validate\project; - public function checkData($value): bool|string - { - $data = ProjectMaterialBudgetDetail::where('id',$value)->findOrEmpty(); - if($data->isEmpty()){ - return '数据不存在'; - } - return true; - } + use app\common\model\dept\Dept; + use app\common\model\dept\Orgs; + use app\common\model\material\Material; + use app\common\model\project\Project; + use app\common\model\project\ProjectMaterialBudgetDetail; + use app\common\validate\BaseValidate; - public function checkOrg($value): bool|string - { - $org = Orgs::where('id',$value)->findOrEmpty(); - if($org->isEmpty()){ - return '组织不存在'; - } - return true; - } - public function checkDept($value,$rule,$data): bool|string + /** + * 材料预算验证器 + * Class ProjectMaterialBudgetValidate + * @package app\adminapi\validate\project + */ + class ProjectMaterialBudgetValidate extends BaseValidate { - $dept = Dept::where('id',$value)->findOrEmpty(); - if($dept->isEmpty()){ - return '部门不存在'; + + /** + * 设置校验规则 + * @var string[] + */ + protected $rule = [ + 'id' => 'require|checkData', + 'org_id' => 'require|checkOrg', + 'dept_id' => 'require|checkDept', + 'project_id' => 'require|checkProject', + 'annex' => 'checkAnnex', + 'material_budget_detail' => 'require|checkMaterialBudgetDetail', + 'flow_id' => 'require|checkFlow', + 'path' => 'require', + ]; + + protected $message = [ + 'id.require' => '缺少必要参数', + 'org_id.require' => '请选择组织', + 'dept_id.require' => '请选择部门', + 'project_id.require' => '请选择项目', + 'material_budget_detail.require' => '请填写材料预算清单', + ]; + + + /** + * @notes 添加场景 + * @return ProjectMaterialBudgetValidate + * @author likeadmin + * @date 2024/01/08 16:30 + */ + public function sceneAdd() + { + return $this->remove('id', true)->remove('flow_id', true)->remove('path', true); } - if($dept['org_id'] != $data['org_id']){ - return '部门无效'; + + + /** + * @notes 编辑场景 + * @return ProjectMaterialBudgetValidate + * @author likeadmin + * @date 2024/01/08 16:30 + */ + public function sceneEdit() + { + return $this->remove('flow_id', true)->remove('path', true); } - return true; - } - - public function checkProject($value): bool|string - { - $project = Project::where('id',$value)->findOrEmpty(); - if($project->isEmpty()){ - return '项目信息不存在'; + + + /** + * @notes 删除场景 + * @return ProjectMaterialBudgetValidate + * @author likeadmin + * @date 2024/01/08 16:30 + */ + public function sceneDelete() + { + return $this->only(['id'])->remove('id', 'checkData'); } - if($project['is_budget'] != 1){ - return '该项目没有编制总预算,不能添加材料预算'; + + + /** + * @notes 详情场景 + * @return ProjectMaterialBudgetValidate + * @author likeadmin + * @date 2024/01/08 16:30 + */ + public function sceneDetail() + { + return $this->only(['id']); } - return true; - } - - public function checkAnnex($value): bool|string - { - if(!empty($value) && $value != ''){ - if(!is_array($value)){ - return '附件格式错误'; + + public function sceneApprove() + { + return $this->only(['id', 'flow_id', 'path']); + } + + public function checkData($value): bool|string + { + $data = ProjectMaterialBudgetDetail::where('id', $value)->findOrEmpty(); + if ($data->isEmpty()) { + return '数据不存在'; } + return true; } - return true; - } - - - public function checkMaterialBudgetDetail($value): bool|string - { - $detail = $value;//json_decode($value,true); - if(empty($detail) || !is_array($detail)){ - return '材料预算清单数据格式错误'; + + public function checkOrg($value): bool|string + { + $org = Orgs::where('id', $value)->findOrEmpty(); + if ($org->isEmpty()) { + return '组织不存在'; + } + return true; } - foreach($detail as $v) { - if(isset($v['id']) && $v['id'] != ''){ - $data_detail = ProjectMaterialBudgetDetail::where('id',$v['id'])->findOrEmpty(); - if($data_detail->isEmpty()){ - return '材料预算明细信息不存在'; - } - } - if(empty($v['material_id'])){ - return '请选择材料'; - }else{ - $product = Material::where('id',$v['material_id'])->findOrEmpty(); - if($product->isEmpty()){ - return '材料信息不存在'; - } - } - if(empty($v['num'])){ - return '数量不能为空'; - }else{ - if(!is_numeric($v['num']) || $v['num'] < 0){ - return '数量必须是大于0的数字'; - } - } - if(empty($v['price'])){ - return '单价不能为空'; - }else{ - if(!is_numeric($v['price']) || $v['price'] < 0){ - return '单价必须是大于0的数字'; + + public function checkDept($value, $rule, $data): bool|string + { + $dept = Dept::where('id', $value)->findOrEmpty(); + if ($dept->isEmpty()) { + return '部门不存在'; + } + if ($dept['org_id'] != $data['org_id']) { + return '部门无效'; + } + return true; + } + + public function checkProject($value): bool|string + { + $project = Project::where('id', $value)->findOrEmpty(); + if ($project->isEmpty()) { + return '项目信息不存在'; + } + if ($project['is_budget'] != 1) { + return '该项目没有编制总预算,不能添加材料预算'; + } + return true; + } + + public function checkAnnex($value): bool|string + { + if (!empty($value) && $value != '') { + if (!is_array($value)) { + return '附件格式错误'; } } + return true; } - return true; - } - -} \ No newline at end of file + + + public function checkMaterialBudgetDetail($value): bool|string + { + $detail = $value;//json_decode($value,true); + if (empty($detail) || !is_array($detail)) { + return '材料预算清单数据格式错误'; + } + foreach ($detail as $v) { + if (isset($v['id']) && $v['id'] != '') { + $data_detail = ProjectMaterialBudgetDetail::where('id', $v['id'])->findOrEmpty(); + if ($data_detail->isEmpty()) { + return '材料预算明细信息不存在'; + } + } + if (empty($v['material_id'])) { + return '请选择材料'; + } else { + $product = Material::where('id', $v['material_id'])->findOrEmpty(); + if ($product->isEmpty()) { + return '材料信息不存在'; + } + } + if (empty($v['num'])) { + return '数量不能为空'; + } else { + if (!is_numeric($v['num']) || $v['num'] < 0) { + return '数量必须是大于0的数字'; + } + } + if (empty($v['price'])) { + return '单价不能为空'; + } else { + if (!is_numeric($v['price']) || $v['price'] < 0) { + return '单价必须是大于0的数字'; + } + } + } + return true; + } + + } \ No newline at end of file diff --git a/app/adminapi/validate/project/ProjectMemberValidate.php b/app/adminapi/validate/project/ProjectMemberValidate.php index 84b9ec46d..6ae368751 100644 --- a/app/adminapi/validate/project/ProjectMemberValidate.php +++ b/app/adminapi/validate/project/ProjectMemberValidate.php @@ -11,140 +11,141 @@ // +---------------------------------------------------------------------- // | author: likeadminTeam // +---------------------------------------------------------------------- - -namespace app\adminapi\validate\project; - - -use app\common\model\auth\Admin; -use app\common\model\project\Project; -use app\common\model\project\ProjectMember; -use app\common\model\project\ProjectRoleSet; -use app\common\validate\BaseValidate; - - -/** - * 项目成员验证器 - * Class ProjectMemberValidate - * @package app\adminapi\validate\project - */ -class ProjectMemberValidate extends BaseValidate -{ - - /** - * 设置校验规则 - * @var string[] - */ - protected $rule = [ - 'id' => 'require|checkData', - 'project_id' => 'require|checkProject', - 'project_role_id' => 'require|checkProjectRole', - 'admin_id' => 'require|checkAdmin', - 'working_unit_price' => 'require|float|egt:0', - ]; - protected $message = [ - 'id.require' => '缺少必要参数', - 'project_id.require' => '请选择项目', - 'project_role_id.require' => '请选择项目角色', - 'admin_id.require' => '请选择人员', - 'working_unit_price.require' => '请填写工时单价', - 'working_unit_price.float' => '工时单价必须是数字', - 'working_unit_price.egt' => '工时单价必须大于等于0', - ]; - - - /** - * 参数描述 - * @var string[] - */ - protected $field = [ - 'id' => 'id', - 'project_id' => '项目id', - 'project_role_id' => '角色名称', - 'admin_id' => '人员id', - 'working_unit_price' => '工时单价', - ]; - - - /** - * @notes 添加场景 - * @return ProjectMemberValidate - * @author likeadmin - * @date 2023/12/15 09:59 - */ - public function sceneAdd() - { - return $this->remove('id',true); - } - - - /** - * @notes 编辑场景 - * @return ProjectMemberValidate - * @author likeadmin - * @date 2023/12/15 09:59 - */ - public function sceneEdit() - {} - - - /** - * @notes 删除场景 - * @return ProjectMemberValidate - * @author likeadmin - * @date 2023/12/15 09:59 - */ - public function sceneDelete() - { - return $this->only(['id']); - } - - - /** - * @notes 详情场景 - * @return ProjectMemberValidate - * @author likeadmin - * @date 2023/12/15 09:59 - */ - public function sceneDetail() - { - return $this->only(['id']); - } + namespace app\adminapi\validate\project; - public function checkData($value): bool|string + + use app\common\model\auth\Admin; + use app\common\model\project\Project; + use app\common\model\project\ProjectMember; + use app\common\model\project\ProjectRoleSet; + use app\common\validate\BaseValidate; + + + /** + * 项目成员验证器 + * Class ProjectMemberValidate + * @package app\adminapi\validate\project + */ + class ProjectMemberValidate extends BaseValidate { - $data = ProjectMember::where('id',$value)->findOrEmpty(); - if($data->isEmpty()){ - return '数据不存在'; + + /** + * 设置校验规则 + * @var string[] + */ + protected $rule = [ + 'id' => 'require|checkData', + 'project_id' => 'require|checkProject', + 'project_role_id' => 'require|checkProjectRole', + 'admin_id' => 'require|checkAdmin', + 'working_unit_price' => 'require|float|egt:0', + ]; + + protected $message = [ + 'id.require' => '缺少必要参数', + 'project_id.require' => '请选择项目', + 'project_role_id.require' => '请选择项目角色', + 'admin_id.require' => '请选择人员', + 'working_unit_price.require' => '请填写工时单价', + 'working_unit_price.float' => '工时单价必须是数字', + 'working_unit_price.egt' => '工时单价必须大于等于0', + ]; + + + /** + * 参数描述 + * @var string[] + */ + protected $field = [ + 'id' => 'id', + 'project_id' => '项目id', + 'project_role_id' => '角色名称', + 'admin_id' => '人员id', + 'working_unit_price' => '工时单价', + ]; + + + /** + * @notes 添加场景 + * @return ProjectMemberValidate + * @author likeadmin + * @date 2023/12/15 09:59 + */ + public function sceneAdd() + { + return $this->remove('id', true); } - return true; - } - - public function checkProject($value): bool|string - { - $data = Project::where('id',$value)->findOrEmpty(); - if($data->isEmpty()){ - return '项目不存在'; + + + /** + * @notes 编辑场景 + * @return ProjectMemberValidate + * @author likeadmin + * @date 2023/12/15 09:59 + */ + public function sceneEdit() + { } - return true; - } - - public function checkProjectRole($value): bool|string - { - $data = ProjectRoleSet::where('id',$value)->findOrEmpty(); - if($data->isEmpty()){ - return '项目角色不存在'; + + + /** + * @notes 删除场景 + * @return ProjectMemberValidate + * @author likeadmin + * @date 2023/12/15 09:59 + */ + public function sceneDelete() + { + return $this->only(['id'])->remove('id', 'checkData'); } - return true; - } - - public function checkAdmin($value): bool|string - { - $data = Admin::where('id',$value)->findOrEmpty(); - if($data->isEmpty()){ - return '人员不存在'; + + + /** + * @notes 详情场景 + * @return ProjectMemberValidate + * @author likeadmin + * @date 2023/12/15 09:59 + */ + public function sceneDetail() + { + return $this->only(['id']); } - return true; - } - -} \ No newline at end of file + + public function checkData($value): bool|string + { + $data = ProjectMember::where('id', $value)->findOrEmpty(); + if ($data->isEmpty()) { + return '数据不存在'; + } + return true; + } + + public function checkProject($value): bool|string + { + $data = Project::where('id', $value)->findOrEmpty(); + if ($data->isEmpty()) { + return '项目不存在'; + } + return true; + } + + public function checkProjectRole($value): bool|string + { + $data = ProjectRoleSet::where('id', $value)->findOrEmpty(); + if ($data->isEmpty()) { + return '项目角色不存在'; + } + return true; + } + + public function checkAdmin($value): bool|string + { + $data = Admin::where('id', $value)->findOrEmpty(); + if ($data->isEmpty()) { + return '人员不存在'; + } + return true; + } + + } \ No newline at end of file diff --git a/app/adminapi/validate/project/ProjectMilestonesValidate.php b/app/adminapi/validate/project/ProjectMilestonesValidate.php index eb256e788..b49049403 100644 --- a/app/adminapi/validate/project/ProjectMilestonesValidate.php +++ b/app/adminapi/validate/project/ProjectMilestonesValidate.php @@ -11,105 +11,105 @@ // +---------------------------------------------------------------------- // | author: likeadminTeam // +---------------------------------------------------------------------- - -namespace app\adminapi\validate\project; - - -use app\common\model\dict\DictData; -use app\common\model\project\Project; -use app\common\validate\BaseValidate; - - -/** - * 项目里程碑验证器 - * Class ProjectMilestonesValidate - * @package app\adminapi\validate\project - */ -class ProjectMilestonesValidate extends BaseValidate -{ - - /** - * 设置校验规则 - * @var string[] - */ - protected $rule = [ - 'id' => 'require', - 'project_id' => 'require|checkProject', - 'project_milestones' => 'require|checkMilestones', - 'project_milestones_date' => 'require|date', - ]; - protected $message = [ - 'id.require' => '缺少必要参数', - 'project_id.require' => '请选择项目', - 'project_milestones.require' => '请填写里程碑', - 'project_milestones_date.require' => '请选择日期', - 'project_milestones_date.date' => '日期格式错误', - ]; + namespace app\adminapi\validate\project; - /** - * @notes 添加场景 - * @return ProjectMilestonesValidate - * @author likeadmin - * @date 2023/12/18 14:41 - */ - public function sceneAdd() - { - return $this->remove('id', true); - } - - - /** - * @notes 编辑场景 - * @return ProjectMilestonesValidate - * @author likeadmin - * @date 2023/12/18 14:41 - */ - public function sceneEdit() - { - return $this->only(['id','project_id','project_milestones','project_milestones_date']); - } - - - /** - * @notes 删除场景 - * @return ProjectMilestonesValidate - * @author likeadmin - * @date 2023/12/18 14:41 - */ - public function sceneDelete() - { - return $this->only(['id']); - } - - - /** - * @notes 详情场景 - * @return ProjectMilestonesValidate - * @author likeadmin - * @date 2023/12/18 14:41 - */ - public function sceneDetail() - { - return $this->only(['id']); - } - public function checkProject($value): bool|string + use app\common\model\dict\DictData; + use app\common\model\project\Project; + use app\common\validate\BaseValidate; + + + /** + * 项目里程碑验证器 + * Class ProjectMilestonesValidate + * @package app\adminapi\validate\project + */ + class ProjectMilestonesValidate extends BaseValidate { - $data = Project::where('id',$value)->findOrEmpty(); - if($data->isEmpty()){ - return '项目不存在'; + + /** + * 设置校验规则 + * @var string[] + */ + protected $rule = [ + 'id' => 'require', + 'project_id' => 'require|checkProject', + 'project_milestones' => 'require|checkMilestones', + 'project_milestones_date' => 'require|date', + ]; + + protected $message = [ + 'id.require' => '缺少必要参数', + 'project_id.require' => '请选择项目', + 'project_milestones.require' => '请填写里程碑', + 'project_milestones_date.require' => '请选择日期', + 'project_milestones_date.date' => '日期格式错误', + ]; + + /** + * @notes 添加场景 + * @return ProjectMilestonesValidate + * @author likeadmin + * @date 2023/12/18 14:41 + */ + public function sceneAdd() + { + return $this->remove('id', true); } - return true; - } - - public function checkMilestones($value): bool|string - { - $dictDate = DictData::where('type_value','project_milestones')->column('value'); - if(!in_array($value,$dictDate)){ - return '里程碑值错误'; + + + /** + * @notes 编辑场景 + * @return ProjectMilestonesValidate + * @author likeadmin + * @date 2023/12/18 14:41 + */ + public function sceneEdit() + { + return $this->only(['id', 'project_id', 'project_milestones', 'project_milestones_date']); } - return true; - } - -} \ No newline at end of file + + + /** + * @notes 删除场景 + * @return ProjectMilestonesValidate + * @author likeadmin + * @date 2023/12/18 14:41 + */ + public function sceneDelete() + { + return $this->only(['id'])->remove('id', 'checkData'); + } + + + /** + * @notes 详情场景 + * @return ProjectMilestonesValidate + * @author likeadmin + * @date 2023/12/18 14:41 + */ + public function sceneDetail() + { + return $this->only(['id']); + } + + public function checkProject($value): bool|string + { + $data = Project::where('id', $value)->findOrEmpty(); + if ($data->isEmpty()) { + return '项目不存在'; + } + return true; + } + + public function checkMilestones($value): bool|string + { + $dictDate = DictData::where('type_value', 'project_milestones')->column('value'); + if (!in_array($value, $dictDate)) { + return '里程碑值错误'; + } + return true; + } + + } \ No newline at end of file diff --git a/app/adminapi/validate/project/ProjectPersonnelValidate.php b/app/adminapi/validate/project/ProjectPersonnelValidate.php index 30470b2f6..77ab2cc6f 100644 --- a/app/adminapi/validate/project/ProjectPersonnelValidate.php +++ b/app/adminapi/validate/project/ProjectPersonnelValidate.php @@ -11,136 +11,136 @@ // +---------------------------------------------------------------------- // | author: likeadminTeam // +---------------------------------------------------------------------- - -namespace app\adminapi\validate\project; - - -use app\common\model\dict\DictData; -use app\common\model\project\Project; -use app\common\model\project\ProjectJobType; -use app\common\validate\BaseValidate; - - -/** - * 项目人员验证器 - * Class ProjectPersonnelValidate - * @package app\adminapi\validate\project - */ -class ProjectPersonnelValidate extends BaseValidate -{ - - /** - * 设置校验规则 - * @var string[] - */ - protected $rule = [ - 'id' => 'require', - 'project_id' => 'require|checkProject', - 'name' => 'require', - 'idcard' => 'require|idCard', - 'mobile' => 'require|mobile', - 'work_type' => 'require|checkWorkType', - 'unit_price' => 'require|float|egt:0', - 'daily_living_expenses' => 'require|float|egt:0', - ]; - protected $message = [ - 'id.require' => '缺少必要参数', - 'project_id.require' => '请选择项目', - 'name.require' => '请填写姓名', - 'idcard.require' => '请填身份证号', - 'idcard.idCard' => '身份证号格式错误', - 'mobile.require' => '请填写手机号', - 'mobile.mobile' => '手机号格式错误', - 'work_type.require' => '请选择工种', - 'unit_price.require' => '请填写人工单价', - 'unit_price.float' => '人工单价值必须是数字', - 'unit_price.egt' => '人工单价值必须大于等于0', - 'daily_living_expenses.require' => '请填每日生活费', - 'daily_living_expenses.float' => '每日生活费值必须是数字', - 'daily_living_expenses.egt' => '每日生活费值必须大于等于0', - ]; - - - /** - * 参数描述 - * @var string[] - */ - protected $field = [ - 'id' => 'id', - 'project_id' => '项目id', - 'name' => '姓名', - 'idcard' => '身份证号', - 'mobile' => '手机号', - 'work_type' => '工种', - 'unit_price' => '人工单价价', - 'daily_living_expenses' => '每日生活费', - 'add_user' => '添加人', - 'update_user' => '更新人', - ]; - - - /** - * @notes 添加场景 - * @return ProjectPersonnelValidate - * @author likeadmin - * @date 2023/12/22 14:38 - */ - public function sceneAdd() - { - return $this->remove('id',true); - } - - - /** - * @notes 编辑场景 - * @return ProjectPersonnelValidate - * @author likeadmin - * @date 2023/12/22 14:38 - */ - public function sceneEdit() - {} - - - /** - * @notes 删除场景 - * @return ProjectPersonnelValidate - * @author likeadmin - * @date 2023/12/22 14:38 - */ - public function sceneDelete() - { - return $this->only(['id']); - } - - - /** - * @notes 详情场景 - * @return ProjectPersonnelValidate - * @author likeadmin - * @date 2023/12/22 14:38 - */ - public function sceneDetail() - { - return $this->only(['id']); - } + namespace app\adminapi\validate\project; - public function checkProject($value): bool|string + + use app\common\model\project\Project; + use app\common\model\project\ProjectJobType; + use app\common\validate\BaseValidate; + + + /** + * 项目人员验证器 + * Class ProjectPersonnelValidate + * @package app\adminapi\validate\project + */ + class ProjectPersonnelValidate extends BaseValidate { - $data = Project::where('id',$value)->findOrEmpty(); - if($data->isEmpty()){ - return '项目不存在'; + + /** + * 设置校验规则 + * @var string[] + */ + protected $rule = [ + 'id' => 'require', + 'project_id' => 'require|checkProject', + 'name' => 'require', + 'idcard' => 'require|idCard', + 'mobile' => 'require|mobile', + 'work_type' => 'require|checkWorkType', + 'unit_price' => 'require|float|egt:0', + 'daily_living_expenses' => 'require|float|egt:0', + ]; + + protected $message = [ + 'id.require' => '缺少必要参数', + 'project_id.require' => '请选择项目', + 'name.require' => '请填写姓名', + 'idcard.require' => '请填身份证号', + 'idcard.idCard' => '身份证号格式错误', + 'mobile.require' => '请填写手机号', + 'mobile.mobile' => '手机号格式错误', + 'work_type.require' => '请选择工种', + 'unit_price.require' => '请填写人工单价', + 'unit_price.float' => '人工单价值必须是数字', + 'unit_price.egt' => '人工单价值必须大于等于0', + 'daily_living_expenses.require' => '请填每日生活费', + 'daily_living_expenses.float' => '每日生活费值必须是数字', + 'daily_living_expenses.egt' => '每日生活费值必须大于等于0', + ]; + + + /** + * 参数描述 + * @var string[] + */ + protected $field = [ + 'id' => 'id', + 'project_id' => '项目id', + 'name' => '姓名', + 'idcard' => '身份证号', + 'mobile' => '手机号', + 'work_type' => '工种', + 'unit_price' => '人工单价价', + 'daily_living_expenses' => '每日生活费', + 'add_user' => '添加人', + 'update_user' => '更新人', + ]; + + + /** + * @notes 添加场景 + * @return ProjectPersonnelValidate + * @author likeadmin + * @date 2023/12/22 14:38 + */ + public function sceneAdd() + { + return $this->remove('id', true); } - return true; - } - - public function checkWorkType($value): bool|string - { - $data = ProjectJobType::where('id',$value)->findOrEmpty(); - if($data->isEmpty()){ - return '工作无效'; + + + /** + * @notes 编辑场景 + * @return ProjectPersonnelValidate + * @author likeadmin + * @date 2023/12/22 14:38 + */ + public function sceneEdit() + { } - return true; - } - -} \ No newline at end of file + + + /** + * @notes 删除场景 + * @return ProjectPersonnelValidate + * @author likeadmin + * @date 2023/12/22 14:38 + */ + public function sceneDelete() + { + return $this->only(['id'])->remove('id', 'checkData'); + } + + + /** + * @notes 详情场景 + * @return ProjectPersonnelValidate + * @author likeadmin + * @date 2023/12/22 14:38 + */ + public function sceneDetail() + { + return $this->only(['id']); + } + + public function checkProject($value): bool|string + { + $data = Project::where('id', $value)->findOrEmpty(); + if ($data->isEmpty()) { + return '项目不存在'; + } + return true; + } + + public function checkWorkType($value): bool|string + { + $data = ProjectJobType::where('id', $value)->findOrEmpty(); + if ($data->isEmpty()) { + return '工作无效'; + } + return true; + } + + } \ No newline at end of file diff --git a/app/adminapi/validate/project/ProjectPlanValidate.php b/app/adminapi/validate/project/ProjectPlanValidate.php index 69b261eed..2d7ce8bbd 100644 --- a/app/adminapi/validate/project/ProjectPlanValidate.php +++ b/app/adminapi/validate/project/ProjectPlanValidate.php @@ -11,156 +11,155 @@ // +---------------------------------------------------------------------- // | author: likeadminTeam // +---------------------------------------------------------------------- - -namespace app\adminapi\validate\project; - - -use app\common\model\auth\Admin; -use app\common\model\dept\Dept; -use app\common\model\dept\Orgs; -use app\common\model\dict\DictData; -use app\common\model\project\Project; -use app\common\validate\BaseValidate; - - -/** - * 项目计划验证器 - * Class ProjectPlanValidate - * @package app\adminapi\validate\project - */ -class ProjectPlanValidate extends BaseValidate -{ - - /** - * 设置校验规则 - * @var string[] - */ - protected $rule = [ - 'id' => 'require', - 'org_id' => 'require|checkOrg', - 'dept_id' => 'require|checkDept', - 'project_id' => 'require|checkProject', - 'project_manage' => 'require|checkUser', - 'start_time' => 'require|date', - 'deliver_time' => 'require|date', - 'declare_time' => 'require|date', - ]; - protected $message = [ - 'id.require' => '缺少必要参数', - 'org_id.require' => '请选择组织', - 'dept_id.require' => '请选择部门', - 'project_id.require' => '请选择项目', - 'project_manage.require' => '请选择项目经理', - 'start_time.require' => '请选择项目开始日期', - 'start_time.date' => '项目开始日期格式错误', - 'deliver_time.require' => '请选择项目交付日期', - 'deliver_time.date' => '项目交付日期格式错误', - 'declare_time.require' => '请选择填报日期', - 'declare_time.date' => '填报日期格式错误', - ]; - - - /** - * 参数描述 - * @var string[] - */ - protected $field = [ - 'id' => 'id', - 'org_id' => '组织id', - 'dept_id' => '部门id', - 'project_id' => '项目id', - 'project_manage' => '项目经理', - 'start_time' => '项目开始日期', - 'deliver_time' => '项目交付日期', - 'declare_time' => '填报日期', - 'add_user' => '添加人', - ]; - - - /** - * @notes 添加场景 - * @return ProjectPlanValidate - * @author likeadmin - * @date 2023/12/18 11:40 - */ - public function sceneAdd() - { - return $this->remove('id',true); - } - - - /** - * @notes 编辑场景 - * @return ProjectPlanValidate - * @author likeadmin - * @date 2023/12/18 11:40 - */ - public function sceneEdit() - { - return $this->only(['id','project_id','project_manage','start_time','deliver_time','declare_time','remark','annex']); - } + namespace app\adminapi\validate\project; - /** - * @notes 删除场景 - * @return ProjectPlanValidate - * @author likeadmin - * @date 2023/12/18 11:40 - */ - public function sceneDelete() - { - return $this->only(['id']); - } - - - /** - * @notes 详情场景 - * @return ProjectPlanValidate - * @author likeadmin - * @date 2023/12/18 11:40 - */ - public function sceneDetail() - { - return $this->only(['id']); - } - public function checkOrg($value): bool|string + use app\common\model\auth\Admin; + use app\common\model\dept\Dept; + use app\common\model\dept\Orgs; + use app\common\model\project\Project; + use app\common\validate\BaseValidate; + + + /** + * 项目计划验证器 + * Class ProjectPlanValidate + * @package app\adminapi\validate\project + */ + class ProjectPlanValidate extends BaseValidate { - $data = Orgs::where('id',$value)->findOrEmpty(); - if($data->isEmpty()){ - return '组织不存在'; + + /** + * 设置校验规则 + * @var string[] + */ + protected $rule = [ + 'id' => 'require', + 'org_id' => 'require|checkOrg', + 'dept_id' => 'require|checkDept', + 'project_id' => 'require|checkProject', + 'project_manage' => 'require|checkUser', + 'start_time' => 'require|date', + 'deliver_time' => 'require|date', + 'declare_time' => 'require|date', + ]; + + protected $message = [ + 'id.require' => '缺少必要参数', + 'org_id.require' => '请选择组织', + 'dept_id.require' => '请选择部门', + 'project_id.require' => '请选择项目', + 'project_manage.require' => '请选择项目经理', + 'start_time.require' => '请选择项目开始日期', + 'start_time.date' => '项目开始日期格式错误', + 'deliver_time.require' => '请选择项目交付日期', + 'deliver_time.date' => '项目交付日期格式错误', + 'declare_time.require' => '请选择填报日期', + 'declare_time.date' => '填报日期格式错误', + ]; + + + /** + * 参数描述 + * @var string[] + */ + protected $field = [ + 'id' => 'id', + 'org_id' => '组织id', + 'dept_id' => '部门id', + 'project_id' => '项目id', + 'project_manage' => '项目经理', + 'start_time' => '项目开始日期', + 'deliver_time' => '项目交付日期', + 'declare_time' => '填报日期', + 'add_user' => '添加人', + ]; + + + /** + * @notes 添加场景 + * @return ProjectPlanValidate + * @author likeadmin + * @date 2023/12/18 11:40 + */ + public function sceneAdd() + { + return $this->remove('id', true); } - return true; - } - - public function checkDept($value,$rule,$data): bool|string - { - $dept = Dept::where('id',$value)->findOrEmpty(); - if($dept->isEmpty()){ - return '部门不存在'; + + + /** + * @notes 编辑场景 + * @return ProjectPlanValidate + * @author likeadmin + * @date 2023/12/18 11:40 + */ + public function sceneEdit() + { + return $this->only(['id', 'project_id', 'project_manage', 'start_time', 'deliver_time', 'declare_time', 'remark', 'annex']); } - if($data['org_id'] != $dept['org_id']){ - return '部门不属于当前选择的组织'; + + /** + * @notes 删除场景 + * @return ProjectPlanValidate + * @author likeadmin + * @date 2023/12/18 11:40 + */ + public function sceneDelete() + { + return $this->only(['id'])->remove('id', 'checkData'); } - return true; - } - - public function checkProject($value): bool|string - { - $data = Project::where('id',$value)->findOrEmpty(); - if($data->isEmpty()){ - return '项目不存在'; + + + /** + * @notes 详情场景 + * @return ProjectPlanValidate + * @author likeadmin + * @date 2023/12/18 11:40 + */ + public function sceneDetail() + { + return $this->only(['id']); } - return true; - } - - public function checkUser($value): bool|string - { - $data = Admin::where('id',$value)->findOrEmpty(); - if($data->isEmpty()){ - return '用户不存在'; + + public function checkOrg($value): bool|string + { + $data = Orgs::where('id', $value)->findOrEmpty(); + if ($data->isEmpty()) { + return '组织不存在'; + } + return true; } - return true; - } - -} \ No newline at end of file + + public function checkDept($value, $rule, $data): bool|string + { + $dept = Dept::where('id', $value)->findOrEmpty(); + if ($dept->isEmpty()) { + return '部门不存在'; + } + if ($data['org_id'] != $dept['org_id']) { + return '部门不属于当前选择的组织'; + } + return true; + } + + public function checkProject($value): bool|string + { + $data = Project::where('id', $value)->findOrEmpty(); + if ($data->isEmpty()) { + return '项目不存在'; + } + return true; + } + + public function checkUser($value): bool|string + { + $data = Admin::where('id', $value)->findOrEmpty(); + if ($data->isEmpty()) { + return '用户不存在'; + } + return true; + } + + } \ No newline at end of file diff --git a/app/adminapi/validate/project/ProjectPreSalesMembersValidate.php b/app/adminapi/validate/project/ProjectPreSalesMembersValidate.php index 01815d8e6..1a2450624 100644 --- a/app/adminapi/validate/project/ProjectPreSalesMembersValidate.php +++ b/app/adminapi/validate/project/ProjectPreSalesMembersValidate.php @@ -11,120 +11,120 @@ // +---------------------------------------------------------------------- // | author: likeadminTeam // +---------------------------------------------------------------------- - -namespace app\adminapi\validate\project; - - -use app\common\model\auth\Admin; -use app\common\model\project\Project; -use app\common\validate\BaseValidate; - - -/** - * ProjectPreSalesMembers验证器 - * Class ProjectPreSalesMembersValidate - * @package app\adminapi\validate\project - */ -class ProjectPreSalesMembersValidate extends BaseValidate -{ - - /** - * 设置校验规则 - * @var string[] - */ - protected $rule = [ - 'id' => 'require', - 'project_id' => 'require|checkProject', - 'technician_ids' => 'require|checkUser', - 'business_people_ids' => 'require|checkUser', - 'cross_departmental_personnel_ids' => 'checkUser' - ]; - protected $message = [ - 'id.require' => '缺少必要参数', - 'project_id.require' => '请选择项目', - 'technician_ids.require' => '请选择技术人员', - 'business_people_ids.require' => '请选择商务人员', - ]; - - - /** - * 参数描述 - * @var string[] - */ - protected $field = [ - 'id' => 'id', - ]; - - - /** - * @notes 添加场景 - * @return ProjectPreSalesMembersValidate - * @author likeadmin - * @date 2023/11/14 10:15 - */ - public function sceneAdd() - { - return $this->remove('id', true); - } - - - /** - * @notes 编辑场景 - * @return ProjectPreSalesMembersValidate - * @author likeadmin - * @date 2023/11/14 10:15 - */ - public function sceneEdit() - { - return $this->only(['id','project_id','technician_ids','business_people_ids']); - } - - - /** - * @notes 删除场景 - * @return ProjectPreSalesMembersValidate - * @author likeadmin - * @date 2023/11/14 10:15 - */ - public function sceneDelete() - { - return $this->only(['id']); - } - - - /** - * @notes 详情场景 - * @return ProjectPreSalesMembersValidate - * @author likeadmin - * @date 2023/11/14 10:15 - */ - public function sceneDetail() - { - return $this->only(['id']); - } + namespace app\adminapi\validate\project; - public function checkProject($value): bool|string + + use app\common\model\auth\Admin; + use app\common\model\project\Project; + use app\common\validate\BaseValidate; + + + /** + * ProjectPreSalesMembers验证器 + * Class ProjectPreSalesMembersValidate + * @package app\adminapi\validate\project + */ + class ProjectPreSalesMembersValidate extends BaseValidate { - $project = Project::where('id',$value)->findOrEmpty(); - if($project->isEmpty()){ - return '项目不存在'; + + /** + * 设置校验规则 + * @var string[] + */ + protected $rule = [ + 'id' => 'require', + 'project_id' => 'require|checkProject', + 'technician_ids' => 'require|checkUser', + 'business_people_ids' => 'require|checkUser', + 'cross_departmental_personnel_ids' => 'checkUser' + ]; + + protected $message = [ + 'id.require' => '缺少必要参数', + 'project_id.require' => '请选择项目', + 'technician_ids.require' => '请选择技术人员', + 'business_people_ids.require' => '请选择商务人员', + ]; + + + /** + * 参数描述 + * @var string[] + */ + protected $field = [ + 'id' => 'id', + ]; + + + /** + * @notes 添加场景 + * @return ProjectPreSalesMembersValidate + * @author likeadmin + * @date 2023/11/14 10:15 + */ + public function sceneAdd() + { + return $this->remove('id', true); } - return true; - } - - public function checkUser($value): bool|string - { - $ids = explode(',',trim($value,',')); - if(empty($ids)){ - return '请选择人员'; + + + /** + * @notes 编辑场景 + * @return ProjectPreSalesMembersValidate + * @author likeadmin + * @date 2023/11/14 10:15 + */ + public function sceneEdit() + { + return $this->only(['id', 'project_id', 'technician_ids', 'business_people_ids']); } - foreach ($ids as $v) { - $admin = Admin::field('id')->where('id',$v)->findOrEmpty(); - if($admin->isEmpty()){ - return '人员不存在'; + + + /** + * @notes 删除场景 + * @return ProjectPreSalesMembersValidate + * @author likeadmin + * @date 2023/11/14 10:15 + */ + public function sceneDelete() + { + return $this->only(['id'])->remove('id', 'checkData'); + } + + + /** + * @notes 详情场景 + * @return ProjectPreSalesMembersValidate + * @author likeadmin + * @date 2023/11/14 10:15 + */ + public function sceneDetail() + { + return $this->only(['id']); + } + + public function checkProject($value): bool|string + { + $project = Project::where('id', $value)->findOrEmpty(); + if ($project->isEmpty()) { + return '项目不存在'; } + return true; } - return true; - } -} \ No newline at end of file + + public function checkUser($value): bool|string + { + $ids = explode(',', trim($value, ',')); + if (empty($ids)) { + return '请选择人员'; + } + foreach ($ids as $v) { + $admin = Admin::field('id')->where('id', $v)->findOrEmpty(); + if ($admin->isEmpty()) { + return '人员不存在'; + } + } + return true; + } + } \ No newline at end of file diff --git a/app/adminapi/validate/project/ProjectProfitSetValidate.php b/app/adminapi/validate/project/ProjectProfitSetValidate.php index bc09c806e..3ee126d73 100644 --- a/app/adminapi/validate/project/ProjectProfitSetValidate.php +++ b/app/adminapi/validate/project/ProjectProfitSetValidate.php @@ -11,114 +11,115 @@ // +---------------------------------------------------------------------- // | author: likeadminTeam // +---------------------------------------------------------------------- - -namespace app\adminapi\validate\project; - - -use app\common\model\project\ProjectProfitSet; -use app\common\model\project\ProjectTypeSet; -use app\common\validate\BaseValidate; - - -/** - * 项目利润设置验证器 - * Class ProjectProfitSetValidate - * @package app\adminapi\validate\project - */ -class ProjectProfitSetValidate extends BaseValidate -{ - - /** - * 设置校验规则 - * @var string[] - */ - protected $rule = [ - 'id' => 'require|checkData', - 'project_type_id' => 'require|checkProjectType', - 'profit_rate' => 'require|float|egt:0', - ]; - protected $message = [ - 'id.require' => '缺少必要参数', - 'project_type_id.require' => '请选择项目类型', - 'profit_rate.require' => '请填写最低利润率', - 'profit_rate.float' => '最低利润率必须是数字', - 'profit_rate.egt' => '最低利润率必须大于等于0', - ]; - - - /** - * 参数描述 - * @var string[] - */ - protected $field = [ - 'id' => 'id', - 'project_type_id' => '项目类型id', - 'profit_rate' => '最低利润率', - ]; - - - /** - * @notes 添加场景 - * @return ProjectProfitSetValidate - * @author likeadmin - * @date 2023/12/14 15:39 - */ - public function sceneAdd() - { - return $this->remove('id',true); - } - - - /** - * @notes 编辑场景 - * @return ProjectProfitSetValidate - * @author likeadmin - * @date 2023/12/14 15:39 - */ - public function sceneEdit() - {} - - - /** - * @notes 删除场景 - * @return ProjectProfitSetValidate - * @author likeadmin - * @date 2023/12/14 15:39 - */ - public function sceneDelete() - { - return $this->only(['id']); - } - - - /** - * @notes 详情场景 - * @return ProjectProfitSetValidate - * @author likeadmin - * @date 2023/12/14 15:39 - */ - public function sceneDetail() - { - return $this->only(['id']); - } + namespace app\adminapi\validate\project; - public function checkData($value): bool|string + + use app\common\model\project\ProjectProfitSet; + use app\common\model\project\ProjectTypeSet; + use app\common\validate\BaseValidate; + + + /** + * 项目利润设置验证器 + * Class ProjectProfitSetValidate + * @package app\adminapi\validate\project + */ + class ProjectProfitSetValidate extends BaseValidate { - $data = ProjectProfitSet::where('id',$value)->findOrEmpty(); - if($data->isEmpty()){ - return '数据不存在'; + + /** + * 设置校验规则 + * @var string[] + */ + protected $rule = [ + 'id' => 'require|checkData', + 'project_type_id' => 'require|checkProjectType', + 'profit_rate' => 'require|float|egt:0', + ]; + + protected $message = [ + 'id.require' => '缺少必要参数', + 'project_type_id.require' => '请选择项目类型', + 'profit_rate.require' => '请填写最低利润率', + 'profit_rate.float' => '最低利润率必须是数字', + 'profit_rate.egt' => '最低利润率必须大于等于0', + ]; + + + /** + * 参数描述 + * @var string[] + */ + protected $field = [ + 'id' => 'id', + 'project_type_id' => '项目类型id', + 'profit_rate' => '最低利润率', + ]; + + + /** + * @notes 添加场景 + * @return ProjectProfitSetValidate + * @author likeadmin + * @date 2023/12/14 15:39 + */ + public function sceneAdd() + { + return $this->remove('id', true); } - return true; - } - - public function checkProjectType($value): bool|string - { - $data = ProjectTypeSet::where('id',$value)->findOrEmpty(); - if($data->isEmpty()){ - return '项目类型不存在'; + + + /** + * @notes 编辑场景 + * @return ProjectProfitSetValidate + * @author likeadmin + * @date 2023/12/14 15:39 + */ + public function sceneEdit() + { } - return true; - } - -} \ No newline at end of file + + + /** + * @notes 删除场景 + * @return ProjectProfitSetValidate + * @author likeadmin + * @date 2023/12/14 15:39 + */ + public function sceneDelete() + { + return $this->only(['id'])->remove('id', 'checkData'); + } + + + /** + * @notes 详情场景 + * @return ProjectProfitSetValidate + * @author likeadmin + * @date 2023/12/14 15:39 + */ + public function sceneDetail() + { + return $this->only(['id']); + } + + public function checkData($value): bool|string + { + $data = ProjectProfitSet::where('id', $value)->findOrEmpty(); + if ($data->isEmpty()) { + return '数据不存在'; + } + return true; + } + + public function checkProjectType($value): bool|string + { + $data = ProjectTypeSet::where('id', $value)->findOrEmpty(); + if ($data->isEmpty()) { + return '项目类型不存在'; + } + return true; + } + + } \ No newline at end of file diff --git a/app/adminapi/validate/project/ProjectRoleSetValidate.php b/app/adminapi/validate/project/ProjectRoleSetValidate.php index 87c3cec0a..e21614943 100644 --- a/app/adminapi/validate/project/ProjectRoleSetValidate.php +++ b/app/adminapi/validate/project/ProjectRoleSetValidate.php @@ -11,95 +11,96 @@ // +---------------------------------------------------------------------- // | author: likeadminTeam // +---------------------------------------------------------------------- - -namespace app\adminapi\validate\project; - - -use app\common\model\project\ProjectRoleSet; -use app\common\validate\BaseValidate; - - -/** - * 项目角色设置验证器 - * Class ProjectRoleSetValidate - * @package app\adminapi\validate\project - */ -class ProjectRoleSetValidate extends BaseValidate -{ - - /** - * 设置校验规则 - * @var string[] - */ - protected $rule = [ - 'id' => 'require', - 'name' => 'require|unique:'.ProjectRoleSet::class, - 'sort' => 'require|integer', - ]; - protected $message = [ - 'id.require' => '缺少必要参数', - 'name.require' => '角色名称不能为空', - 'name.unique' => '角色名称已存在', - 'sort.require' => '排序号不能为空', - 'sort.integer' => '排序号必须为整数', - ]; - - - /** - * 参数描述 - * @var string[] - */ - protected $field = [ - 'id' => 'id', - 'name' => '角色名称', - 'sort' => '排序号', - ]; - - - /** - * @notes 添加场景 - * @return ProjectRoleSetValidate - * @author likeadmin - * @date 2023/12/13 14:23 - */ - public function sceneAdd() - { - return $this->remove('id',true); - } - - - /** - * @notes 编辑场景 - * @return ProjectRoleSetValidate - * @author likeadmin - * @date 2023/12/13 14:23 - */ - public function sceneEdit() - {} - - - /** - * @notes 删除场景 - * @return ProjectRoleSetValidate - * @author likeadmin - * @date 2023/12/13 14:23 - */ - public function sceneDelete() - { - return $this->only(['id']); - } - - - /** - * @notes 详情场景 - * @return ProjectRoleSetValidate - * @author likeadmin - * @date 2023/12/13 14:23 - */ - public function sceneDetail() - { - return $this->only(['id']); - } - -} \ No newline at end of file + namespace app\adminapi\validate\project; + + + use app\common\model\project\ProjectRoleSet; + use app\common\validate\BaseValidate; + + + /** + * 项目角色设置验证器 + * Class ProjectRoleSetValidate + * @package app\adminapi\validate\project + */ + class ProjectRoleSetValidate extends BaseValidate + { + + /** + * 设置校验规则 + * @var string[] + */ + protected $rule = [ + 'id' => 'require', + 'name' => 'require|unique:' . ProjectRoleSet::class, + 'sort' => 'require|integer', + ]; + + protected $message = [ + 'id.require' => '缺少必要参数', + 'name.require' => '角色名称不能为空', + 'name.unique' => '角色名称已存在', + 'sort.require' => '排序号不能为空', + 'sort.integer' => '排序号必须为整数', + ]; + + + /** + * 参数描述 + * @var string[] + */ + protected $field = [ + 'id' => 'id', + 'name' => '角色名称', + 'sort' => '排序号', + ]; + + + /** + * @notes 添加场景 + * @return ProjectRoleSetValidate + * @author likeadmin + * @date 2023/12/13 14:23 + */ + public function sceneAdd() + { + return $this->remove('id', true); + } + + + /** + * @notes 编辑场景 + * @return ProjectRoleSetValidate + * @author likeadmin + * @date 2023/12/13 14:23 + */ + public function sceneEdit() + { + } + + + /** + * @notes 删除场景 + * @return ProjectRoleSetValidate + * @author likeadmin + * @date 2023/12/13 14:23 + */ + public function sceneDelete() + { + return $this->only(['id'])->remove('id', 'checkData'); + } + + + /** + * @notes 详情场景 + * @return ProjectRoleSetValidate + * @author likeadmin + * @date 2023/12/13 14:23 + */ + public function sceneDetail() + { + return $this->only(['id']); + } + + } \ No newline at end of file diff --git a/app/adminapi/validate/project/ProjectSalaryDetailValidate.php b/app/adminapi/validate/project/ProjectSalaryDetailValidate.php index cc4687bd6..01f12c67f 100644 --- a/app/adminapi/validate/project/ProjectSalaryDetailValidate.php +++ b/app/adminapi/validate/project/ProjectSalaryDetailValidate.php @@ -1,102 +1,104 @@ - 'require', - 'salary_payment_id' => 'require', - 'apply_date' => 'require', - 'apply_amount' => 'require', - 'person_id' => 'require', - ]; - - - /** - * 参数描述 - * @var string[] - */ - protected $field = [ - 'id' => 'id', - 'salary_payment_id' => '工资付款记录id', - 'apply_date' => '申请日期', - 'apply_amount' => '申请付款金额', - 'person_id' => '项目人员id', - ]; - - - /** - * @notes 添加场景 - * @return ProjectSalaryDetailValidate - * @author likeadmin - * @date 2023/12/27 16:12 - */ - public function sceneAdd() - { - return $this->only(['salary_payment_id','apply_date','apply_amount','person_id']); - } - - - /** - * @notes 编辑场景 - * @return ProjectSalaryDetailValidate - * @author likeadmin - * @date 2023/12/27 16:12 - */ - public function sceneEdit() - { - return $this->only(['id','salary_payment_id','apply_date','apply_amount','person_id']); - } - - - /** - * @notes 删除场景 - * @return ProjectSalaryDetailValidate - * @author likeadmin - * @date 2023/12/27 16:12 - */ - public function sceneDelete() - { - return $this->only(['id']); - } - - - /** - * @notes 详情场景 - * @return ProjectSalaryDetailValidate - * @author likeadmin - * @date 2023/12/27 16:12 - */ - public function sceneDetail() - { - return $this->only(['id']); - } - -} \ No newline at end of file + 'require', + 'salary_payment_id' => 'require', + 'apply_date' => 'require', + 'apply_amount' => 'require', + 'person_id' => 'require', + + ]; + + + /** + * 参数描述 + * @var string[] + */ + protected $field = [ + 'id' => 'id', + 'salary_payment_id' => '工资付款记录id', + 'apply_date' => '申请日期', + 'apply_amount' => '申请付款金额', + 'person_id' => '项目人员id', + + ]; + + + /** + * @notes 添加场景 + * @return ProjectSalaryDetailValidate + * @author likeadmin + * @date 2023/12/27 16:12 + */ + public function sceneAdd() + { + return $this->only(['salary_payment_id', 'apply_date', 'apply_amount', 'person_id']); + } + + + /** + * @notes 编辑场景 + * @return ProjectSalaryDetailValidate + * @author likeadmin + * @date 2023/12/27 16:12 + */ + public function sceneEdit() + { + return $this->only(['id', 'salary_payment_id', 'apply_date', 'apply_amount', 'person_id']); + } + + + /** + * @notes 删除场景 + * @return ProjectSalaryDetailValidate + * @author likeadmin + * @date 2023/12/27 16:12 + */ + public function sceneDelete() + { + return $this->only(['id'])->remove('id', 'checkData'); + } + + + /** + * @notes 详情场景 + * @return ProjectSalaryDetailValidate + * @author likeadmin + * @date 2023/12/27 16:12 + */ + public function sceneDetail() + { + return $this->only(['id']); + } + + } \ No newline at end of file diff --git a/app/adminapi/validate/project/ProjectSalaryPaymentValidate.php b/app/adminapi/validate/project/ProjectSalaryPaymentValidate.php index 80d60afb5..e4f292479 100644 --- a/app/adminapi/validate/project/ProjectSalaryPaymentValidate.php +++ b/app/adminapi/validate/project/ProjectSalaryPaymentValidate.php @@ -11,150 +11,151 @@ // +---------------------------------------------------------------------- // | author: likeadminTeam // +---------------------------------------------------------------------- - -namespace app\adminapi\validate\project; - - -use app\common\model\dict\DictData; -use app\common\model\project\Project; -use app\common\model\project\ProjectPersonnel; -use app\common\model\project\ProjectSalaryDetail; -use app\common\validate\BaseValidate; - - -/** - * 工资付款验证器 - * Class ProjectSalaryPaymentValidate - * @package app\adminapi\validate\project - */ -class ProjectSalaryPaymentValidate extends BaseValidate -{ - - /** - * 设置校验规则 - * @var string[] - */ - protected $rule = [ - 'id' => 'require', - 'project_id' => 'require|checkProject', - 'payment_type' => 'require|checkPaymentType', - 'apply_date' => 'require|dateFormat:Y-m-d', - 'annex' => 'checkAnnex', - 'payment_detail' => 'require|checkPaymentDetail' - ]; - protected $message = [ - 'id.require' => '缺少必要参数', - 'project_id.require' => '请选择项目', - 'payment_type.require' => '请选择付款类型', - 'apply_date.require' => '请选择申请日期', - 'apply_date.dateFormat' => '申请日期格式错误', - 'payment_detail.require' => '工资支付明细不能为空', - ]; - - /** - * @notes 添加场景 - * @return ProjectSalaryPaymentValidate - * @author likeadmin - * @date 2023/12/27 16:08 - */ - public function sceneAdd() - { - return $this->remove('id',true); - } - - - /** - * @notes 编辑场景 - * @return ProjectSalaryPaymentValidate - * @author likeadmin - * @date 2023/12/27 16:08 - */ - public function sceneEdit() - {} - - - /** - * @notes 删除场景 - * @return ProjectSalaryPaymentValidate - * @author likeadmin - * @date 2023/12/27 16:08 - */ - public function sceneDelete() - { - return $this->only(['id']); - } - - - /** - * @notes 详情场景 - * @return ProjectSalaryPaymentValidate - * @author likeadmin - * @date 2023/12/27 16:08 - */ - public function sceneDetail() - { - return $this->only(['id']); - } + namespace app\adminapi\validate\project; - public function checkProject($value): bool|string + + use app\common\model\dict\DictData; + use app\common\model\project\Project; + use app\common\model\project\ProjectPersonnel; + use app\common\model\project\ProjectSalaryDetail; + use app\common\validate\BaseValidate; + + + /** + * 工资付款验证器 + * Class ProjectSalaryPaymentValidate + * @package app\adminapi\validate\project + */ + class ProjectSalaryPaymentValidate extends BaseValidate { - $data = Project::where('id',$value)->findOrEmpty(); - if($data->isEmpty()){ - return '项目不存在'; + + /** + * 设置校验规则 + * @var string[] + */ + protected $rule = [ + 'id' => 'require', + 'project_id' => 'require|checkProject', + 'payment_type' => 'require|checkPaymentType', + 'apply_date' => 'require|dateFormat:Y-m-d', + 'annex' => 'checkAnnex', + 'payment_detail' => 'require|checkPaymentDetail' + ]; + + protected $message = [ + 'id.require' => '缺少必要参数', + 'project_id.require' => '请选择项目', + 'payment_type.require' => '请选择付款类型', + 'apply_date.require' => '请选择申请日期', + 'apply_date.dateFormat' => '申请日期格式错误', + 'payment_detail.require' => '工资支付明细不能为空', + ]; + + /** + * @notes 添加场景 + * @return ProjectSalaryPaymentValidate + * @author likeadmin + * @date 2023/12/27 16:08 + */ + public function sceneAdd() + { + return $this->remove('id', true); } - return true; - } - - public function checkPaymentType($value): bool|string - { - $dictData = DictData::where('type_value','salary_payment_type')->column('value'); - if(!in_array($value,$dictData)){ - return '付款类型无效'; + + + /** + * @notes 编辑场景 + * @return ProjectSalaryPaymentValidate + * @author likeadmin + * @date 2023/12/27 16:08 + */ + public function sceneEdit() + { } - return true; - } - - public function checkAnnex($value): bool|string - { - if(!empty($value) && $value != ''){ - if(!is_array($value)){ - return '附件必须是json数组'; + + + /** + * @notes 删除场景 + * @return ProjectSalaryPaymentValidate + * @author likeadmin + * @date 2023/12/27 16:08 + */ + public function sceneDelete() + { + return $this->only(['id'])->remove('id', 'checkData'); + } + + + /** + * @notes 详情场景 + * @return ProjectSalaryPaymentValidate + * @author likeadmin + * @date 2023/12/27 16:08 + */ + public function sceneDetail() + { + return $this->only(['id']); + } + + public function checkProject($value): bool|string + { + $data = Project::where('id', $value)->findOrEmpty(); + if ($data->isEmpty()) { + return '项目不存在'; } + return true; } - return true; - } - - public function checkPaymentDetail($value,$rule,$data): bool|string - { - $payment_detail = $value;//json_decode($value,true); - if(empty($payment_detail) || !is_array($payment_detail)){ - return '工资支付明细数据格式错误'; + + public function checkPaymentType($value): bool|string + { + $dictData = DictData::where('type_value', 'salary_payment_type')->column('value'); + if (!in_array($value, $dictData)) { + return '付款类型无效'; + } + return true; } - foreach($payment_detail as $v) { - if(isset($v['id']) && $v['id'] != ''){ - $info = ProjectSalaryDetail::where('id',$v['id'])->findOrEmpty(); - if($info->isEmpty()){ - return '工资支付明细信息不存在'; - } - } - if(empty($v['person_id'])){ - return '请选择项目人员'; - }else{ - $person = ProjectPersonnel::where('id',$v['person_id'])->findOrEmpty(); - if($person->isEmpty() || $person['project_id'] != $data['project_id']){ - return '项目人员不存在'; - } - } - if(empty($v['apply_amount'])){ - return '申请付款金额不能为空'; - }else{ - if(!is_numeric($v['apply_amount']) || $v['apply_amount'] <= 0){ - return '申请付款金额必须是大于0的数字'; + + public function checkAnnex($value): bool|string + { + if (!empty($value) && $value != '') { + if (!is_array($value)) { + return '附件必须是json数组'; } } + return true; } - return true; - } - -} \ No newline at end of file + + public function checkPaymentDetail($value, $rule, $data): bool|string + { + $payment_detail = $value;//json_decode($value,true); + if (empty($payment_detail) || !is_array($payment_detail)) { + return '工资支付明细数据格式错误'; + } + foreach ($payment_detail as $v) { + if (isset($v['id']) && $v['id'] != '') { + $info = ProjectSalaryDetail::where('id', $v['id'])->findOrEmpty(); + if ($info->isEmpty()) { + return '工资支付明细信息不存在'; + } + } + if (empty($v['person_id'])) { + return '请选择项目人员'; + } else { + $person = ProjectPersonnel::where('id', $v['person_id'])->findOrEmpty(); + if ($person->isEmpty() || $person['project_id'] != $data['project_id']) { + return '项目人员不存在'; + } + } + if (empty($v['apply_amount'])) { + return '申请付款金额不能为空'; + } else { + if (!is_numeric($v['apply_amount']) || $v['apply_amount'] <= 0) { + return '申请付款金额必须是大于0的数字'; + } + } + } + return true; + } + + } \ No newline at end of file diff --git a/app/adminapi/validate/project/ProjectSettlementValidate.php b/app/adminapi/validate/project/ProjectSettlementValidate.php index 7ee4ec426..cf89760f6 100644 --- a/app/adminapi/validate/project/ProjectSettlementValidate.php +++ b/app/adminapi/validate/project/ProjectSettlementValidate.php @@ -11,143 +11,143 @@ // +---------------------------------------------------------------------- // | author: likeadminTeam // +---------------------------------------------------------------------- - -namespace app\adminapi\validate\project; - - -use app\common\model\bid\BidBuyBiddingDocument; -use app\common\model\contract\Contract; -use app\common\model\project\Project; -use app\common\model\project\ProjectSettlement; -use app\common\validate\BaseValidate; - - -/** - * 甲方结算验证器 - * Class ProjectSettlementValidate - * @package app\adminapi\validate\project - */ -class ProjectSettlementValidate extends BaseValidate -{ - - /** - * 设置校验规则 - * @var string[] - */ - protected $rule = [ - 'id' => 'require|checkData', - 'project_id' => 'require|checkProject', - 'contract_id' => 'require|checkContract', - 'settlement_amount' => 'require|float|egt:0', - 'settlement_date' => 'require|dateFormat:Y-m-d', - 'annex' => 'checkAnnex', - 'flow_id' => 'require|checkFlow', - 'path' => 'require', - ]; - protected $message = [ - 'id.require' => '缺少必要参数', - 'project_id.require' => '请选择项目', - 'contract_id.require' => '请选择合同', - 'settlement_amount.require' => '请填写结算金额', - 'settlement_amount.float' => '结算金额值必须是数字', - 'settlement_amount.egt' => '结算金额值必须大于等于0', - 'settlement_date.require' => '请选择结算日期', - 'settlement_date.dateFormat' => '结算日期格式错误', - ]; - - - /** - * @notes 添加场景 - * @return ProjectSettlementValidate - * @author likeadmin - * @date 2023/12/29 10:22 - */ - public function sceneAdd() - { - return $this->remove('id',true)->remove('flow_id',true)->remove('path',true); - } - - - /** - * @notes 编辑场景 - * @return ProjectSettlementValidate - * @author likeadmin - * @date 2023/12/29 10:22 - */ - public function sceneEdit() - { - return $this->remove('flow_id',true)->remove('path',true); - } - - - /** - * @notes 删除场景 - * @return ProjectSettlementValidate - * @author likeadmin - * @date 2023/12/29 10:22 - */ - public function sceneDelete() - { - return $this->only(['id']); - } - - - /** - * @notes 详情场景 - * @return ProjectSettlementValidate - * @author likeadmin - * @date 2023/12/29 10:22 - */ - public function sceneDetail() - { - return $this->only(['id']); - } + namespace app\adminapi\validate\project; - public function sceneApprove() + + use app\common\model\bid\BidBuyBiddingDocument; + use app\common\model\contract\Contract; + use app\common\model\project\Project; + use app\common\model\project\ProjectSettlement; + use app\common\validate\BaseValidate; + + + /** + * 甲方结算验证器 + * Class ProjectSettlementValidate + * @package app\adminapi\validate\project + */ + class ProjectSettlementValidate extends BaseValidate { - return $this->only(['id','flow_id','path']); - } - - public function checkData($value): bool|string - { - $data = ProjectSettlement::where('id',$value)->findOrEmpty(); - if($data->isEmpty()){ - return '数据不存在'; + + /** + * 设置校验规则 + * @var string[] + */ + protected $rule = [ + 'id' => 'require|checkData', + 'project_id' => 'require|checkProject', + 'contract_id' => 'require|checkContract', + 'settlement_amount' => 'require|float|egt:0', + 'settlement_date' => 'require|dateFormat:Y-m-d', + 'annex' => 'checkAnnex', + 'flow_id' => 'require|checkFlow', + 'path' => 'require', + ]; + + protected $message = [ + 'id.require' => '缺少必要参数', + 'project_id.require' => '请选择项目', + 'contract_id.require' => '请选择合同', + 'settlement_amount.require' => '请填写结算金额', + 'settlement_amount.float' => '结算金额值必须是数字', + 'settlement_amount.egt' => '结算金额值必须大于等于0', + 'settlement_date.require' => '请选择结算日期', + 'settlement_date.dateFormat' => '结算日期格式错误', + ]; + + + /** + * @notes 添加场景 + * @return ProjectSettlementValidate + * @author likeadmin + * @date 2023/12/29 10:22 + */ + public function sceneAdd() + { + return $this->remove('id', true)->remove('flow_id', true)->remove('path', true); } - return true; - } - - public function checkProject($value): bool|string - { - $data = Project::where('id',$value)->findOrEmpty(); - if($data->isEmpty()){ - return '项目不存在'; + + + /** + * @notes 编辑场景 + * @return ProjectSettlementValidate + * @author likeadmin + * @date 2023/12/29 10:22 + */ + public function sceneEdit() + { + return $this->remove('flow_id', true)->remove('path', true); } - return true; - } - - public function checkContract($value,$rule,$data): bool|string - { - $contract = Contract::where('id',$value)->findOrEmpty(); - if($contract->isEmpty()){ - return '合同不存在'; + + + /** + * @notes 删除场景 + * @return ProjectSettlementValidate + * @author likeadmin + * @date 2023/12/29 10:22 + */ + public function sceneDelete() + { + return $this->only(['id'])->remove('id', 'checkData'); } - $bid = BidBuyBiddingDocument::where('id',$contract['buy_bidding_document_id'])->findOrEmpty(); - if($bid->isEmpty() || $bid['project_id'] != $data['project_id']){ - return '合同无效'; + + + /** + * @notes 详情场景 + * @return ProjectSettlementValidate + * @author likeadmin + * @date 2023/12/29 10:22 + */ + public function sceneDetail() + { + return $this->only(['id']); } - return true; - } - - public function checkAnnex($value): bool|string - { - if(!empty($value) && $value != ''){ - if(!is_array($value)){ - return '附件必须是json数组'; + + public function sceneApprove() + { + return $this->only(['id', 'flow_id', 'path']); + } + + public function checkData($value): bool|string + { + $data = ProjectSettlement::where('id', $value)->findOrEmpty(); + if ($data->isEmpty()) { + return '数据不存在'; } + return true; } - return true; - } - -} \ No newline at end of file + + public function checkProject($value): bool|string + { + $data = Project::where('id', $value)->findOrEmpty(); + if ($data->isEmpty()) { + return '项目不存在'; + } + return true; + } + + public function checkContract($value, $rule, $data): bool|string + { + $contract = Contract::where('id', $value)->findOrEmpty(); + if ($contract->isEmpty()) { + return '合同不存在'; + } + $bid = BidBuyBiddingDocument::where('id', $contract['buy_bidding_document_id'])->findOrEmpty(); + if ($bid->isEmpty() || $bid['project_id'] != $data['project_id']) { + return '合同无效'; + } + return true; + } + + public function checkAnnex($value): bool|string + { + if (!empty($value) && $value != '') { + if (!is_array($value)) { + return '附件必须是json数组'; + } + } + return true; + } + + } \ No newline at end of file diff --git a/app/adminapi/validate/project/ProjectStakeholderValidate.php b/app/adminapi/validate/project/ProjectStakeholderValidate.php index 43d415684..4911053c0 100644 --- a/app/adminapi/validate/project/ProjectStakeholderValidate.php +++ b/app/adminapi/validate/project/ProjectStakeholderValidate.php @@ -11,151 +11,152 @@ // +---------------------------------------------------------------------- // | author: likeadminTeam // +---------------------------------------------------------------------- - -namespace app\adminapi\validate\project; - - -use app\common\model\dict\DictData; -use app\common\model\project\Project; -use app\common\model\project\ProjectStakeholder; -use app\common\validate\BaseValidate; - - -/** - * 项目干系人验证器 - * Class ProjectStakeholderValidate - * @package app\adminapi\validate\project - */ -class ProjectStakeholderValidate extends BaseValidate -{ - - /** - * 设置校验规则 - * @var string[] - */ - protected $rule = [ - 'id' => 'require|checkData', - 'project_id' => 'require|checkProject', - 'name' => 'require', - 'identity' => 'require|checkIdentity', - 'phone' => 'require|mobile', - 'email' => 'email', - 'attitude' => 'checkAttitude', - 'degree_adaptability' => 'checkDegree' - ]; - protected $message = [ - 'id.require' => '缺少必要参数', - 'project_id.require' => '请选择项目', - 'name.require' => '请填写姓名', - 'identity.require' => '请选择身份', - 'phone.require' => '请填写电话', - 'phone.mobile' => '电话格式错误', - 'email.email' => '邮箱格式错误', - ]; - - - /** - * 参数描述 - * @var string[] - */ - protected $field = [ - 'id' => 'id', - 'project_id' => '项目id', - 'name' => '姓名', - 'identity' => '身份', - 'phone' => '电话', - ]; - - - /** - * @notes 添加场景 - * @return ProjectStakeholderValidate - * @author likeadmin - * @date 2023/12/15 11:20 - */ - public function sceneAdd() - { - return $this->remove('id',true); - } - - - /** - * @notes 编辑场景 - * @return ProjectStakeholderValidate - * @author likeadmin - * @date 2023/12/15 11:20 - */ - public function sceneEdit() - {} - - - /** - * @notes 删除场景 - * @return ProjectStakeholderValidate - * @author likeadmin - * @date 2023/12/15 11:20 - */ - public function sceneDelete() - { - return $this->only(['id']); - } - - - /** - * @notes 详情场景 - * @return ProjectStakeholderValidate - * @author likeadmin - * @date 2023/12/15 11:20 - */ - public function sceneDetail() - { - return $this->only(['id']); - } + namespace app\adminapi\validate\project; - public function checkData($value): bool|string + + use app\common\model\dict\DictData; + use app\common\model\project\Project; + use app\common\model\project\ProjectStakeholder; + use app\common\validate\BaseValidate; + + + /** + * 项目干系人验证器 + * Class ProjectStakeholderValidate + * @package app\adminapi\validate\project + */ + class ProjectStakeholderValidate extends BaseValidate { - $data = ProjectStakeholder::where('id',$value)->findOrEmpty(); - if($data->isEmpty()){ - return '数据不存在'; + + /** + * 设置校验规则 + * @var string[] + */ + protected $rule = [ + 'id' => 'require|checkData', + 'project_id' => 'require|checkProject', + 'name' => 'require', + 'identity' => 'require|checkIdentity', + 'phone' => 'require|mobile', + 'email' => 'email', + 'attitude' => 'checkAttitude', + 'degree_adaptability' => 'checkDegree' + ]; + + protected $message = [ + 'id.require' => '缺少必要参数', + 'project_id.require' => '请选择项目', + 'name.require' => '请填写姓名', + 'identity.require' => '请选择身份', + 'phone.require' => '请填写电话', + 'phone.mobile' => '电话格式错误', + 'email.email' => '邮箱格式错误', + ]; + + + /** + * 参数描述 + * @var string[] + */ + protected $field = [ + 'id' => 'id', + 'project_id' => '项目id', + 'name' => '姓名', + 'identity' => '身份', + 'phone' => '电话', + ]; + + + /** + * @notes 添加场景 + * @return ProjectStakeholderValidate + * @author likeadmin + * @date 2023/12/15 11:20 + */ + public function sceneAdd() + { + return $this->remove('id', true); } - return true; - } - - public function checkProject($value): bool|string - { - $data = Project::where('id',$value)->findOrEmpty(); - if($data->isEmpty()){ - return '项目不存在'; + + + /** + * @notes 编辑场景 + * @return ProjectStakeholderValidate + * @author likeadmin + * @date 2023/12/15 11:20 + */ + public function sceneEdit() + { } - return true; - } - - public function checkIdentity($value): bool|string - { - $data = DictData::where('type_value','project_stakeholder_identity')->column('value'); - if(!in_array($value,$data)){ - return '身份数据值错误'; + + + /** + * @notes 删除场景 + * @return ProjectStakeholderValidate + * @author likeadmin + * @date 2023/12/15 11:20 + */ + public function sceneDelete() + { + return $this->only(['id'])->remove('id', 'checkData'); } - return true; - } - - public function checkAttitude($value): bool|string - { - $data = DictData::where('type_value','project_stakeholder_attitude')->column('value'); - if(!in_array($value,$data)){ - return '对我方态度选项数据值错误'; + + + /** + * @notes 详情场景 + * @return ProjectStakeholderValidate + * @author likeadmin + * @date 2023/12/15 11:20 + */ + public function sceneDetail() + { + return $this->only(['id']); } - return true; - } - - public function checkDegree($value): bool|string - { - $data = DictData::where('type_value','project_stakeholder_degree_adaptability')->column('value'); - if(!in_array($value,$data)){ - return '工作配合度选项数据值错误'; + + public function checkData($value): bool|string + { + $data = ProjectStakeholder::where('id', $value)->findOrEmpty(); + if ($data->isEmpty()) { + return '数据不存在'; + } + return true; } - return true; - } - -} \ No newline at end of file + + public function checkProject($value): bool|string + { + $data = Project::where('id', $value)->findOrEmpty(); + if ($data->isEmpty()) { + return '项目不存在'; + } + return true; + } + + public function checkIdentity($value): bool|string + { + $data = DictData::where('type_value', 'project_stakeholder_identity')->column('value'); + if (!in_array($value, $data)) { + return '身份数据值错误'; + } + return true; + } + + public function checkAttitude($value): bool|string + { + $data = DictData::where('type_value', 'project_stakeholder_attitude')->column('value'); + if (!in_array($value, $data)) { + return '对我方态度选项数据值错误'; + } + return true; + } + + public function checkDegree($value): bool|string + { + $data = DictData::where('type_value', 'project_stakeholder_degree_adaptability')->column('value'); + if (!in_array($value, $data)) { + return '工作配合度选项数据值错误'; + } + return true; + } + + } \ No newline at end of file diff --git a/app/adminapi/validate/project/ProjectSubcontractSettlementValidate.php b/app/adminapi/validate/project/ProjectSubcontractSettlementValidate.php index bbc4acde6..a08447b9e 100644 --- a/app/adminapi/validate/project/ProjectSubcontractSettlementValidate.php +++ b/app/adminapi/validate/project/ProjectSubcontractSettlementValidate.php @@ -11,140 +11,140 @@ // +---------------------------------------------------------------------- // | author: likeadminTeam // +---------------------------------------------------------------------- - -namespace app\adminapi\validate\project; - -use app\common\model\contract\SubcontractingContract; -use app\common\model\project\Project; -use app\common\model\project\ProjectSubcontractSettlement; -use app\common\validate\BaseValidate; - - -/** - * 分包结算验证器 - * Class ProjectSubcontractSettlementValidate - * @package app\adminapi\validate\project - */ -class ProjectSubcontractSettlementValidate extends BaseValidate -{ - - /** - * 设置校验规则 - * @var string[] - */ - protected $rule = [ - 'id' => 'require|checkData', - 'project_id' => 'require|checkProject', - 'contract_id' => 'require|checkContract', - 'settlement_amount' => 'require|float|egt:0', - 'settlement_date' => 'require|dateFormat:Y-m-d', - 'annex' => 'checkAnnex', - 'flow_id' => 'require|checkFlow', - 'path' => 'require', - ]; - protected $message = [ - 'id.require' => '缺少必要参数', - 'project_id.require' => '请选择项目', - 'contract_id.require' => '请选择合同', - 'settlement_amount.require' => '请填写结算金额', - 'settlement_amount.float' => '结算金额值必须是数字', - 'settlement_amount.egt' => '结算金额值必须大于等于0', - 'settlement_date.require' => '请选择结算日期', - 'settlement_date.dateFormat' => '结算日期格式错误', - ]; - - - /** - * @notes 添加场景 - * @return ProjectSubcontractSettlementValidate - * @author likeadmin - * @date 2023/12/29 13:59 - */ - public function sceneAdd() - { - return $this->remove('id',true)->remove('flow_id',true)->remove('path',true); - } - - - /** - * @notes 编辑场景 - * @return ProjectSubcontractSettlementValidate - * @author likeadmin - * @date 2023/12/29 13:59 - */ - public function sceneEdit() - { - return $this->remove('flow_id',true)->remove('path',true); - } - - - /** - * @notes 删除场景 - * @return ProjectSubcontractSettlementValidate - * @author likeadmin - * @date 2023/12/29 13:59 - */ - public function sceneDelete() - { - return $this->only(['id']); - } - - - /** - * @notes 详情场景 - * @return ProjectSubcontractSettlementValidate - * @author likeadmin - * @date 2023/12/29 13:59 - */ - public function sceneDetail() - { - return $this->only(['id']); - } + namespace app\adminapi\validate\project; - public function sceneApprove() + use app\common\model\contract\SubcontractingContract; + use app\common\model\project\Project; + use app\common\model\project\ProjectSubcontractSettlement; + use app\common\validate\BaseValidate; + + + /** + * 分包结算验证器 + * Class ProjectSubcontractSettlementValidate + * @package app\adminapi\validate\project + */ + class ProjectSubcontractSettlementValidate extends BaseValidate { - return $this->only(['id','flow_id','path']); - } - - public function checkData($value): bool|string - { - $data = ProjectSubcontractSettlement::where('id',$value)->findOrEmpty(); - if($data->isEmpty()){ - return '数据不存在'; + + /** + * 设置校验规则 + * @var string[] + */ + protected $rule = [ + 'id' => 'require|checkData', + 'project_id' => 'require|checkProject', + 'contract_id' => 'require|checkContract', + 'settlement_amount' => 'require|float|egt:0', + 'settlement_date' => 'require|dateFormat:Y-m-d', + 'annex' => 'checkAnnex', + 'flow_id' => 'require|checkFlow', + 'path' => 'require', + ]; + + protected $message = [ + 'id.require' => '缺少必要参数', + 'project_id.require' => '请选择项目', + 'contract_id.require' => '请选择合同', + 'settlement_amount.require' => '请填写结算金额', + 'settlement_amount.float' => '结算金额值必须是数字', + 'settlement_amount.egt' => '结算金额值必须大于等于0', + 'settlement_date.require' => '请选择结算日期', + 'settlement_date.dateFormat' => '结算日期格式错误', + ]; + + + /** + * @notes 添加场景 + * @return ProjectSubcontractSettlementValidate + * @author likeadmin + * @date 2023/12/29 13:59 + */ + public function sceneAdd() + { + return $this->remove('id', true)->remove('flow_id', true)->remove('path', true); } - return true; - } - - public function checkProject($value): bool|string - { - $data = Project::where('id',$value)->findOrEmpty(); - if($data->isEmpty()){ - return '项目不存在'; + + + /** + * @notes 编辑场景 + * @return ProjectSubcontractSettlementValidate + * @author likeadmin + * @date 2023/12/29 13:59 + */ + public function sceneEdit() + { + return $this->remove('flow_id', true)->remove('path', true); } - return true; - } - - public function checkContract($value,$rule,$data): bool|string - { - $contract = SubcontractingContract::where('id',$value)->findOrEmpty(); - if($contract->isEmpty()){ - return '合同不存在'; + + + /** + * @notes 删除场景 + * @return ProjectSubcontractSettlementValidate + * @author likeadmin + * @date 2023/12/29 13:59 + */ + public function sceneDelete() + { + return $this->only(['id'])->remove('id', 'checkData'); } - if($contract['project_id'] != $data['project_id']){ - return '合同无效'; + + + /** + * @notes 详情场景 + * @return ProjectSubcontractSettlementValidate + * @author likeadmin + * @date 2023/12/29 13:59 + */ + public function sceneDetail() + { + return $this->only(['id']); } - return true; - } - - public function checkAnnex($value): bool|string - { - if(!empty($value) && $value != ''){ - if(!is_array($value)){ - return '附件格式错误'; + + public function sceneApprove() + { + return $this->only(['id', 'flow_id', 'path']); + } + + public function checkData($value): bool|string + { + $data = ProjectSubcontractSettlement::where('id', $value)->findOrEmpty(); + if ($data->isEmpty()) { + return '数据不存在'; } + return true; } - return true; - } - -} \ No newline at end of file + + public function checkProject($value): bool|string + { + $data = Project::where('id', $value)->findOrEmpty(); + if ($data->isEmpty()) { + return '项目不存在'; + } + return true; + } + + public function checkContract($value, $rule, $data): bool|string + { + $contract = SubcontractingContract::where('id', $value)->findOrEmpty(); + if ($contract->isEmpty()) { + return '合同不存在'; + } + if ($contract['project_id'] != $data['project_id']) { + return '合同无效'; + } + return true; + } + + public function checkAnnex($value): bool|string + { + if (!empty($value) && $value != '') { + if (!is_array($value)) { + return '附件格式错误'; + } + } + return true; + } + + } \ No newline at end of file diff --git a/app/adminapi/validate/project/ProjectSubpackageBudgetDetailValidate.php b/app/adminapi/validate/project/ProjectSubpackageBudgetDetailValidate.php index 63bd88b59..9129d18e7 100644 --- a/app/adminapi/validate/project/ProjectSubpackageBudgetDetailValidate.php +++ b/app/adminapi/validate/project/ProjectSubpackageBudgetDetailValidate.php @@ -11,103 +11,103 @@ // +---------------------------------------------------------------------- // | author: likeadminTeam // +---------------------------------------------------------------------- - -namespace app\adminapi\validate\project; - -use app\common\model\project\ProjectSubpackageBudget; -use app\common\model\project\ProjectSubpackageBudgetDetail; -use app\common\validate\BaseValidate; - - -/** - * 分包预算明细验证器 - * Class ProjectSubpackageBudgetDetailValidate - * @package app\adminapi\validate\project - */ -class ProjectSubpackageBudgetDetailValidate extends BaseValidate -{ - - /** - * 设置校验规则 - * @var string[] - */ - protected $rule = [ - 'id' => 'require', - 'subpackage_budget_id' => 'require|checkSubpackageBudget', - 'work_type' => 'require', - 'work_content' => 'require', - 'unit' => 'require', - 'num' => 'require|float|egt:0', - 'price' => 'require|float|egt:0', - ]; - - /** - * 参数描述 - * @var string[] - */ - protected $field = [ - 'id' => 'id', - 'subpackage_budget_id' => '分包预算id', - 'work_type' => '工作类型', - 'work_content' => '工作内容', - 'unit' => '单位', - 'num' => '工作量', - 'price' => '单价', - ]; - - - /** - * @notes 添加场景 - * @return ProjectSubpackageBudgetDetailValidate - * @author likeadmin - * @date 2024/01/10 15:19 - */ - public function sceneAdd() - { - return $this->remove('id',true); - } - - - /** - * @notes 编辑场景 - * @return ProjectSubpackageBudgetDetailValidate - * @author likeadmin - * @date 2024/01/10 15:19 - */ - public function sceneEdit() - {} - - - /** - * @notes 删除场景 - * @return ProjectSubpackageBudgetDetailValidate - * @author likeadmin - * @date 2024/01/10 15:19 - */ - public function sceneDelete() - { - return $this->only(['id']); - } - - - /** - * @notes 详情场景 - * @return ProjectSubpackageBudgetDetailValidate - * @author likeadmin - * @date 2024/01/10 15:19 - */ - public function sceneDetail() - { - return $this->only(['id']); - } - public function checkSubpackageBudget($value): bool|string + namespace app\adminapi\validate\project; + + use app\common\model\project\ProjectSubpackageBudget; + use app\common\validate\BaseValidate; + + + /** + * 分包预算明细验证器 + * Class ProjectSubpackageBudgetDetailValidate + * @package app\adminapi\validate\project + */ + class ProjectSubpackageBudgetDetailValidate extends BaseValidate { - $data = ProjectSubpackageBudget::where('id',$value)->findOrEmpty(); - if($data->isEmpty()){ - return '分包预算信息不存在'; + + /** + * 设置校验规则 + * @var string[] + */ + protected $rule = [ + 'id' => 'require', + 'subpackage_budget_id' => 'require|checkSubpackageBudget', + 'work_type' => 'require', + 'work_content' => 'require', + 'unit' => 'require', + 'num' => 'require|float|egt:0', + 'price' => 'require|float|egt:0', + ]; + + /** + * 参数描述 + * @var string[] + */ + protected $field = [ + 'id' => 'id', + 'subpackage_budget_id' => '分包预算id', + 'work_type' => '工作类型', + 'work_content' => '工作内容', + 'unit' => '单位', + 'num' => '工作量', + 'price' => '单价', + ]; + + + /** + * @notes 添加场景 + * @return ProjectSubpackageBudgetDetailValidate + * @author likeadmin + * @date 2024/01/10 15:19 + */ + public function sceneAdd() + { + return $this->remove('id', true); } - return true; - } - -} \ No newline at end of file + + + /** + * @notes 编辑场景 + * @return ProjectSubpackageBudgetDetailValidate + * @author likeadmin + * @date 2024/01/10 15:19 + */ + public function sceneEdit() + { + } + + + /** + * @notes 删除场景 + * @return ProjectSubpackageBudgetDetailValidate + * @author likeadmin + * @date 2024/01/10 15:19 + */ + public function sceneDelete() + { + return $this->only(['id'])->remove('id', 'checkData'); + } + + + /** + * @notes 详情场景 + * @return ProjectSubpackageBudgetDetailValidate + * @author likeadmin + * @date 2024/01/10 15:19 + */ + public function sceneDetail() + { + return $this->only(['id']); + } + + public function checkSubpackageBudget($value): bool|string + { + $data = ProjectSubpackageBudget::where('id', $value)->findOrEmpty(); + if ($data->isEmpty()) { + return '分包预算信息不存在'; + } + return true; + } + + } \ No newline at end of file diff --git a/app/adminapi/validate/project/ProjectSubpackageBudgetValidate.php b/app/adminapi/validate/project/ProjectSubpackageBudgetValidate.php index a74670c93..469418caf 100644 --- a/app/adminapi/validate/project/ProjectSubpackageBudgetValidate.php +++ b/app/adminapi/validate/project/ProjectSubpackageBudgetValidate.php @@ -11,196 +11,196 @@ // +---------------------------------------------------------------------- // | author: likeadminTeam // +---------------------------------------------------------------------- - -namespace app\adminapi\validate\project; - - -use app\common\model\dept\Dept; -use app\common\model\dept\Orgs; -use app\common\model\project\Project; -use app\common\model\project\ProjectSubpackageBudget; -use app\common\model\project\ProjectSubpackageBudgetDetail; -use app\common\validate\BaseValidate; - - -/** - * 分包预算验证器 - * Class ProjectSubpackageBudgetValidate - * @package app\adminapi\validate\project - */ -class ProjectSubpackageBudgetValidate extends BaseValidate -{ - - /** - * 设置校验规则 - * @var string[] - */ - protected $rule = [ - 'id' => 'require|checkData', - 'org_id' => 'require|checkOrg', - 'dept_id' => 'require|checkDept', - 'project_id' => 'require|checkProject', - 'annex' => 'checkAnnex', - 'subpackage_budget_detail' => 'require|checkSubpackageBudgetDetail', - 'flow_id' => 'require|checkFlow', - 'path' => 'require', - ]; - /** - * 参数描述 - * @var string[] - */ - protected $field = [ - 'id' => 'id', - 'org_id' => '组织id', - 'dept_id' => '部门id', - 'project_id' => '项目id', - 'material_budget_detail' => '分包预算明细', - ]; - - - /** - * @notes 添加场景 - * @return ProjectSubpackageBudgetValidate - * @author likeadmin - * @date 2024/01/10 15:19 - */ - public function sceneAdd() - { - return $this->remove('id',true)->remove('flow_id',true)->remove('path',true); - } - - - /** - * @notes 编辑场景 - * @return ProjectSubpackageBudgetValidate - * @author likeadmin - * @date 2024/01/10 15:19 - */ - public function sceneEdit() - { - return $this->remove('flow_id',true)->remove('path',true); - } - - - /** - * @notes 删除场景 - * @return ProjectSubpackageBudgetValidate - * @author likeadmin - * @date 2024/01/10 15:19 - */ - public function sceneDelete() - { - return $this->only(['id']); - } - - - /** - * @notes 详情场景 - * @return ProjectSubpackageBudgetValidate - * @author likeadmin - * @date 2024/01/10 15:19 - */ - public function sceneDetail() - { - return $this->only(['id']); - } + namespace app\adminapi\validate\project; - public function sceneApprove() + + use app\common\model\dept\Dept; + use app\common\model\dept\Orgs; + use app\common\model\project\Project; + use app\common\model\project\ProjectSubpackageBudget; + use app\common\model\project\ProjectSubpackageBudgetDetail; + use app\common\validate\BaseValidate; + + + /** + * 分包预算验证器 + * Class ProjectSubpackageBudgetValidate + * @package app\adminapi\validate\project + */ + class ProjectSubpackageBudgetValidate extends BaseValidate { - return $this->only(['id','flow_id','path']); - } - - public function checkData($value): bool|string - { - $data = ProjectSubpackageBudget::where('id',$value)->findOrEmpty(); - if($data->isEmpty()){ - return '数据不存在'; + + /** + * 设置校验规则 + * @var string[] + */ + protected $rule = [ + 'id' => 'require|checkData', + 'org_id' => 'require|checkOrg', + 'dept_id' => 'require|checkDept', + 'project_id' => 'require|checkProject', + 'annex' => 'checkAnnex', + 'subpackage_budget_detail' => 'require|checkSubpackageBudgetDetail', + 'flow_id' => 'require|checkFlow', + 'path' => 'require', + ]; + + /** + * 参数描述 + * @var string[] + */ + protected $field = [ + 'id' => 'id', + 'org_id' => '组织id', + 'dept_id' => '部门id', + 'project_id' => '项目id', + 'material_budget_detail' => '分包预算明细', + ]; + + + /** + * @notes 添加场景 + * @return ProjectSubpackageBudgetValidate + * @author likeadmin + * @date 2024/01/10 15:19 + */ + public function sceneAdd() + { + return $this->remove('id', true)->remove('flow_id', true)->remove('path', true); } - return true; - } - - public function checkOrg($value): bool|string - { - $org = Orgs::where('id',$value)->findOrEmpty(); - if($org->isEmpty()){ - return '组织不存在'; + + + /** + * @notes 编辑场景 + * @return ProjectSubpackageBudgetValidate + * @author likeadmin + * @date 2024/01/10 15:19 + */ + public function sceneEdit() + { + return $this->remove('flow_id', true)->remove('path', true); } - return true; - } - - public function checkDept($value,$rule,$data): bool|string - { - $dept = Dept::where('id',$value)->findOrEmpty(); - if($dept->isEmpty()){ - return '部门不存在'; + + + /** + * @notes 删除场景 + * @return ProjectSubpackageBudgetValidate + * @author likeadmin + * @date 2024/01/10 15:19 + */ + public function sceneDelete() + { + return $this->only(['id'])->remove('id', 'checkData'); } - if($dept['org_id'] != $data['org_id']){ - return '部门无效'; + + + /** + * @notes 详情场景 + * @return ProjectSubpackageBudgetValidate + * @author likeadmin + * @date 2024/01/10 15:19 + */ + public function sceneDetail() + { + return $this->only(['id']); } - return true; - } - - public function checkProject($value): bool|string - { - $project = Project::where('id',$value)->findOrEmpty(); - if($project->isEmpty()){ - return '项目信息不存在'; + + public function sceneApprove() + { + return $this->only(['id', 'flow_id', 'path']); } - if($project['is_budget'] != 1){ - return '该项目没有编制总预算,不能添加材料预算'; - } - return true; - } - - public function checkAnnex($value): bool|string - { - if(!empty($value) && $value != ''){ - if(!is_array($value)){ - return '附件格式错误'; + + public function checkData($value): bool|string + { + $data = ProjectSubpackageBudget::where('id', $value)->findOrEmpty(); + if ($data->isEmpty()) { + return '数据不存在'; } + return true; } - return true; - } - - public function checkSubpackageBudgetDetail($value): bool|string - { - $detail = $value;//json_decode($value,true); - if(empty($detail) || !is_array($detail)){ - return '分包预算明细数据格式错误'; + + public function checkOrg($value): bool|string + { + $org = Orgs::where('id', $value)->findOrEmpty(); + if ($org->isEmpty()) { + return '组织不存在'; + } + return true; } - foreach($detail as $v) { - if(isset($v['id']) && $v['id'] != ''){ - $data_detail = ProjectSubpackageBudgetDetail::where('id',$v['id'])->findOrEmpty(); - if($data_detail->isEmpty()){ - return '分包预算明细信息不存在'; - } - } - if(empty($v['work_type'])){ - return '请填写工作类型'; - } - if(empty($v['work_content'])){ - return '请填写工作内容'; - } - if(empty($v['unit'])){ - return '请填写单位'; - } - if(empty($v['num'])){ - return '工作量不能为空'; - }else{ - if(!is_numeric($v['num']) || $v['num'] < 0){ - return '工作量必须是大于0的数字'; - } - } - if(empty($v['price'])){ - return '单价不能为空'; - }else{ - if(!is_numeric($v['price']) || $v['price'] < 0){ - return '单价必须是大于0的数字'; + + public function checkDept($value, $rule, $data): bool|string + { + $dept = Dept::where('id', $value)->findOrEmpty(); + if ($dept->isEmpty()) { + return '部门不存在'; + } + if ($dept['org_id'] != $data['org_id']) { + return '部门无效'; + } + return true; + } + + public function checkProject($value): bool|string + { + $project = Project::where('id', $value)->findOrEmpty(); + if ($project->isEmpty()) { + return '项目信息不存在'; + } + if ($project['is_budget'] != 1) { + return '该项目没有编制总预算,不能添加材料预算'; + } + return true; + } + + public function checkAnnex($value): bool|string + { + if (!empty($value) && $value != '') { + if (!is_array($value)) { + return '附件格式错误'; } } + return true; } - return true; - } - -} \ No newline at end of file + + public function checkSubpackageBudgetDetail($value): bool|string + { + $detail = $value;//json_decode($value,true); + if (empty($detail) || !is_array($detail)) { + return '分包预算明细数据格式错误'; + } + foreach ($detail as $v) { + if (isset($v['id']) && $v['id'] != '') { + $data_detail = ProjectSubpackageBudgetDetail::where('id', $v['id'])->findOrEmpty(); + if ($data_detail->isEmpty()) { + return '分包预算明细信息不存在'; + } + } + if (empty($v['work_type'])) { + return '请填写工作类型'; + } + if (empty($v['work_content'])) { + return '请填写工作内容'; + } + if (empty($v['unit'])) { + return '请填写单位'; + } + if (empty($v['num'])) { + return '工作量不能为空'; + } else { + if (!is_numeric($v['num']) || $v['num'] < 0) { + return '工作量必须是大于0的数字'; + } + } + if (empty($v['price'])) { + return '单价不能为空'; + } else { + if (!is_numeric($v['price']) || $v['price'] < 0) { + return '单价必须是大于0的数字'; + } + } + } + return true; + } + + } \ No newline at end of file diff --git a/app/adminapi/validate/project/ProjectTotalBudgetValidate.php b/app/adminapi/validate/project/ProjectTotalBudgetValidate.php index 6072e6352..f29e79f28 100644 --- a/app/adminapi/validate/project/ProjectTotalBudgetValidate.php +++ b/app/adminapi/validate/project/ProjectTotalBudgetValidate.php @@ -11,173 +11,173 @@ // +---------------------------------------------------------------------- // | author: likeadminTeam // +---------------------------------------------------------------------- - -namespace app\adminapi\validate\project; - - -use app\common\model\dept\Dept; -use app\common\model\dept\Orgs; -use app\common\model\project\Project; -use app\common\model\project\ProjectTotalBudget; -use app\common\validate\BaseValidate; - - -/** - * 项目总预算验证器 - * Class ProjectTotalBudgetValidate - * @package app\adminapi\validate\project - */ -class ProjectTotalBudgetValidate extends BaseValidate -{ - - /** - * 设置校验规则 - * @var string[] - */ - protected $rule = [ - 'id' => 'require|checkData', - 'org_id' => 'require|checkOrg', - 'dept_id' => 'require|checkDept', - 'project_id' => 'require|checkProject', - 'contract_amount' => 'require|float|egt:0', - 'cl_cost' => 'float|egt:0', - 'fb_cost' => 'float|egt:0', - 'rg_cost' => 'float|egt:0', - 'fy_cost' => 'float|egt:0', - 'jj_cost' => 'float|egt:0', - 'budget_list' => 'checkAnnex', - 'budget_date' => 'require|dateFormat:Y-m-d', - 'project_manager' => 'require', - 'flow_id' => 'require|checkFlow', - 'path' => 'require', - ]; - - protected $message = [ - 'id.require' => '缺少必要参数', - 'org_id.require' => '请选择组织', - 'dept_id.require' => '请选择部门', - 'project_id.require' => '请选择项目', - 'contract_amount.require' => '请填写合同金额', - 'contract_amount.float' => '合同金额值必须是数字', - 'contract_amount.egt' => '合同金额值必须大于等于0', - 'cl_cost.float' => '材料成本值必须是数字', - 'cl_cost.egt' => '材料成本值必须大于等于0', - 'fb_cost.float' => '分包成本值必须是数字', - 'fb_cost.egt' => '分包成本值必须大于等于0', - 'rg_cost.float' => '人工成本值必须是数字', - 'rg_cost.egt' => '人工成本值必须大于等于0', - 'fy_cost.float' => '费用成本值必须是数字', - 'fy_cost.egt' => '费用成本值必须大于等于0', - 'jj_cost.float' => '机具成本值必须是数字', - 'jj_cost.egt' => '机具成本值必须大于等于0', - 'budget_date.dateFormat' => '预算日期数据格式错误', - 'project_manager' => '请填写项目经理', - ]; - - - /** - * @notes 添加场景 - * @return ProjectTotalBudgetValidate - * @author likeadmin - * @date 2024/01/08 14:25 - */ - public function sceneAdd() - { - return $this->remove('id',true)->remove('flow_id',true)->remove('path',true); - } - - - /** - * @notes 编辑场景 - * @return ProjectTotalBudgetValidate - * @author likeadmin - * @date 2024/01/08 14:25 - */ - public function sceneEdit() - { - return $this->remove('org_id',true)->remove('dept_id',true)->remove('project_id',true)->remove('flow_id',true)->remove('path',true); - } - - - /** - * @notes 删除场景 - * @return ProjectTotalBudgetValidate - * @author likeadmin - * @date 2024/01/08 14:25 - */ - public function sceneDelete() - { - return $this->only(['id']); - } - - - /** - * @notes 详情场景 - * @return ProjectTotalBudgetValidate - * @author likeadmin - * @date 2024/01/08 14:25 - */ - public function sceneDetail() - { - return $this->only(['id']); - } - public function sceneApprove() - { - return $this->only(['id','flow_id','path']); - } + namespace app\adminapi\validate\project; - public function checkData($value): bool|string - { - $data = ProjectTotalBudget::where('id',$value)->findOrEmpty(); - if($data->isEmpty()){ - return '数据不存在'; - } - return true; - } - public function checkOrg($value): bool|string - { - $org = Orgs::where('id',$value)->findOrEmpty(); - if($org->isEmpty()){ - return '组织不存在'; - } - return true; - } + use app\common\model\dept\Dept; + use app\common\model\dept\Orgs; + use app\common\model\project\Project; + use app\common\model\project\ProjectTotalBudget; + use app\common\validate\BaseValidate; - public function checkDept($value,$rule,$data): bool|string - { - $dept = Dept::where('id',$value)->findOrEmpty(); - if($dept->isEmpty()){ - return '部门不存在'; - } - if($dept['org_id'] != $data['org_id']){ - return '部门无效'; - } - return true; - } - public function checkProject($value): bool|string + /** + * 项目总预算验证器 + * Class ProjectTotalBudgetValidate + * @package app\adminapi\validate\project + */ + class ProjectTotalBudgetValidate extends BaseValidate { - $project = Project::where('id',$value)->findOrEmpty(); - if($project->isEmpty()){ - return '项目信息不存在'; + + /** + * 设置校验规则 + * @var string[] + */ + protected $rule = [ + 'id' => 'require|checkData', + 'org_id' => 'require|checkOrg', + 'dept_id' => 'require|checkDept', + 'project_id' => 'require|checkProject', + 'contract_amount' => 'require|float|egt:0', + 'cl_cost' => 'float|egt:0', + 'fb_cost' => 'float|egt:0', + 'rg_cost' => 'float|egt:0', + 'fy_cost' => 'float|egt:0', + 'jj_cost' => 'float|egt:0', + 'budget_list' => 'checkAnnex', + 'budget_date' => 'require|dateFormat:Y-m-d', + 'project_manager' => 'require', + 'flow_id' => 'require|checkFlow', + 'path' => 'require', + ]; + + protected $message = [ + 'id.require' => '缺少必要参数', + 'org_id.require' => '请选择组织', + 'dept_id.require' => '请选择部门', + 'project_id.require' => '请选择项目', + 'contract_amount.require' => '请填写合同金额', + 'contract_amount.float' => '合同金额值必须是数字', + 'contract_amount.egt' => '合同金额值必须大于等于0', + 'cl_cost.float' => '材料成本值必须是数字', + 'cl_cost.egt' => '材料成本值必须大于等于0', + 'fb_cost.float' => '分包成本值必须是数字', + 'fb_cost.egt' => '分包成本值必须大于等于0', + 'rg_cost.float' => '人工成本值必须是数字', + 'rg_cost.egt' => '人工成本值必须大于等于0', + 'fy_cost.float' => '费用成本值必须是数字', + 'fy_cost.egt' => '费用成本值必须大于等于0', + 'jj_cost.float' => '机具成本值必须是数字', + 'jj_cost.egt' => '机具成本值必须大于等于0', + 'budget_date.dateFormat' => '预算日期数据格式错误', + 'project_manager' => '请填写项目经理', + ]; + + + /** + * @notes 添加场景 + * @return ProjectTotalBudgetValidate + * @author likeadmin + * @date 2024/01/08 14:25 + */ + public function sceneAdd() + { + return $this->remove('id', true)->remove('flow_id', true)->remove('path', true); } - if($project['is_budget'] == 1){ - return '该项目已编制总预算'; + + + /** + * @notes 编辑场景 + * @return ProjectTotalBudgetValidate + * @author likeadmin + * @date 2024/01/08 14:25 + */ + public function sceneEdit() + { + return $this->remove('org_id', true)->remove('dept_id', true)->remove('project_id', true)->remove('flow_id', true)->remove('path', true); } - return true; - } - - public function checkAnnex($value): bool|string - { - if(!empty($value) && $value != ''){ - $annex = $value;//json_decode($value,true); - if(empty($annex) || !is_array($annex)){ - return '预算清单格式错误'; + + + /** + * @notes 删除场景 + * @return ProjectTotalBudgetValidate + * @author likeadmin + * @date 2024/01/08 14:25 + */ + public function sceneDelete() + { + return $this->only(['id'])->remove('id', 'checkData'); + } + + + /** + * @notes 详情场景 + * @return ProjectTotalBudgetValidate + * @author likeadmin + * @date 2024/01/08 14:25 + */ + public function sceneDetail() + { + return $this->only(['id']); + } + + public function sceneApprove() + { + return $this->only(['id', 'flow_id', 'path']); + } + + public function checkData($value): bool|string + { + $data = ProjectTotalBudget::where('id', $value)->findOrEmpty(); + if ($data->isEmpty()) { + return '数据不存在'; } + return true; } - return true; - } - -} \ No newline at end of file + + public function checkOrg($value): bool|string + { + $org = Orgs::where('id', $value)->findOrEmpty(); + if ($org->isEmpty()) { + return '组织不存在'; + } + return true; + } + + public function checkDept($value, $rule, $data): bool|string + { + $dept = Dept::where('id', $value)->findOrEmpty(); + if ($dept->isEmpty()) { + return '部门不存在'; + } + if ($dept['org_id'] != $data['org_id']) { + return '部门无效'; + } + return true; + } + + public function checkProject($value): bool|string + { + $project = Project::where('id', $value)->findOrEmpty(); + if ($project->isEmpty()) { + return '项目信息不存在'; + } + if ($project['is_budget'] == 1) { + return '该项目已编制总预算'; + } + return true; + } + + public function checkAnnex($value): bool|string + { + if (!empty($value) && $value != '') { + $annex = $value;//json_decode($value,true); + if (empty($annex) || !is_array($annex)) { + return '预算清单格式错误'; + } + } + return true; + } + + } \ No newline at end of file diff --git a/app/adminapi/validate/project/ProjectTravelReimbursementDetailValidate.php b/app/adminapi/validate/project/ProjectTravelReimbursementDetailValidate.php index 110064c79..cb2add871 100644 --- a/app/adminapi/validate/project/ProjectTravelReimbursementDetailValidate.php +++ b/app/adminapi/validate/project/ProjectTravelReimbursementDetailValidate.php @@ -11,116 +11,117 @@ // +---------------------------------------------------------------------- // | author: likeadminTeam // +---------------------------------------------------------------------- - -namespace app\adminapi\validate\project; - - -use app\common\model\project\ProjectCostTempSet; -use app\common\model\project\ProjectTravelReimbursement; -use app\common\validate\BaseValidate; - - -/** - * 报销明细验证器 - * Class ProjectTravelReimbursementDetailValidate - * @package app\adminapi\validate\project - */ -class ProjectTravelReimbursementDetailValidate extends BaseValidate -{ - - /** - * 设置校验规则 - * @var string[] - */ - protected $rule = [ - 'id' => 'require', - 'travel_reimbursement_id' => 'require|checkTravelReimbursement', - 'project_cost_temp_id' => 'require|checkProjectCostTemp', - 'traffic_fee' => 'require|float|egt:0', - 'stay_fee' => 'require|float|egt:0', - 'restaurant_fee' => 'require|float|egt:0', - 'subsidy_fee' => 'require|float|egt:0', - 'other_fee' => 'require|float|egt:0', - ]; - - - /** - * 参数描述 - * @var string[] - */ - protected $field = [ - 'id' => 'id', - 'travel_reimbursement_id' => '差旅报销单id', - 'project_cost_temp_id' => '项目费用模板id', - 'traffic_fee' => '交通费用', - 'stay_fee' => '住宿费用', - 'restaurant_fee' => '餐饮费用', - 'subsidy_fee' => '补助费用', - 'other_fee' => '其它费用', - ]; - - - /** - * @notes 添加场景 - * @return ProjectTravelReimbursementDetailValidate - * @author likeadmin - * @date 2024/01/18 13:57 - */ - public function sceneAdd() - { - return $this->remove('id',true); - } - - - /** - * @notes 编辑场景 - * @return ProjectTravelReimbursementDetailValidate - * @author likeadmin - * @date 2024/01/18 13:57 - */ - public function sceneEdit() - {} - - - /** - * @notes 删除场景 - * @return ProjectTravelReimbursementDetailValidate - * @author likeadmin - * @date 2024/01/18 13:57 - */ - public function sceneDelete() - { - return $this->only(['id']); - } - - - /** - * @notes 详情场景 - * @return ProjectTravelReimbursementDetailValidate - * @author likeadmin - * @date 2024/01/18 13:57 - */ - public function sceneDetail() - { - return $this->only(['id']); - } - public function checkTravelReimbursement($value): bool|string - { - $data = ProjectTravelReimbursement::where('id',$value)->findOrEmpty(); - if($data->isEmpty()){ - return '差旅报销申请信息不存在'; - } - return true; - } + namespace app\adminapi\validate\project; - public function checkProjectCostTemp($value): bool|string + + use app\common\model\project\ProjectCostTempSet; + use app\common\model\project\ProjectTravelReimbursement; + use app\common\validate\BaseValidate; + + + /** + * 报销明细验证器 + * Class ProjectTravelReimbursementDetailValidate + * @package app\adminapi\validate\project + */ + class ProjectTravelReimbursementDetailValidate extends BaseValidate { - $data = ProjectCostTempSet::where('id',$value)->findOrEmpty(); - if($data->isEmpty()){ - return '项目费用模板信息不存在'; + + /** + * 设置校验规则 + * @var string[] + */ + protected $rule = [ + 'id' => 'require', + 'travel_reimbursement_id' => 'require|checkTravelReimbursement', + 'project_cost_temp_id' => 'require|checkProjectCostTemp', + 'traffic_fee' => 'require|float|egt:0', + 'stay_fee' => 'require|float|egt:0', + 'restaurant_fee' => 'require|float|egt:0', + 'subsidy_fee' => 'require|float|egt:0', + 'other_fee' => 'require|float|egt:0', + ]; + + + /** + * 参数描述 + * @var string[] + */ + protected $field = [ + 'id' => 'id', + 'travel_reimbursement_id' => '差旅报销单id', + 'project_cost_temp_id' => '项目费用模板id', + 'traffic_fee' => '交通费用', + 'stay_fee' => '住宿费用', + 'restaurant_fee' => '餐饮费用', + 'subsidy_fee' => '补助费用', + 'other_fee' => '其它费用', + ]; + + + /** + * @notes 添加场景 + * @return ProjectTravelReimbursementDetailValidate + * @author likeadmin + * @date 2024/01/18 13:57 + */ + public function sceneAdd() + { + return $this->remove('id', true); } - return true; - } - -} \ No newline at end of file + + + /** + * @notes 编辑场景 + * @return ProjectTravelReimbursementDetailValidate + * @author likeadmin + * @date 2024/01/18 13:57 + */ + public function sceneEdit() + { + } + + + /** + * @notes 删除场景 + * @return ProjectTravelReimbursementDetailValidate + * @author likeadmin + * @date 2024/01/18 13:57 + */ + public function sceneDelete() + { + return $this->only(['id'])->remove('id', 'checkData'); + } + + + /** + * @notes 详情场景 + * @return ProjectTravelReimbursementDetailValidate + * @author likeadmin + * @date 2024/01/18 13:57 + */ + public function sceneDetail() + { + return $this->only(['id']); + } + + public function checkTravelReimbursement($value): bool|string + { + $data = ProjectTravelReimbursement::where('id', $value)->findOrEmpty(); + if ($data->isEmpty()) { + return '差旅报销申请信息不存在'; + } + return true; + } + + public function checkProjectCostTemp($value): bool|string + { + $data = ProjectCostTempSet::where('id', $value)->findOrEmpty(); + if ($data->isEmpty()) { + return '项目费用模板信息不存在'; + } + return true; + } + + } \ No newline at end of file diff --git a/app/adminapi/validate/project/ProjectTravelReimbursementInvoiceDetailValidate.php b/app/adminapi/validate/project/ProjectTravelReimbursementInvoiceDetailValidate.php index 1eae6d3f8..2461bbb20 100644 --- a/app/adminapi/validate/project/ProjectTravelReimbursementInvoiceDetailValidate.php +++ b/app/adminapi/validate/project/ProjectTravelReimbursementInvoiceDetailValidate.php @@ -11,142 +11,144 @@ // +---------------------------------------------------------------------- // | author: likeadminTeam // +---------------------------------------------------------------------- - -namespace app\adminapi\validate\project; - - -use app\common\model\dict\DictData; -use app\common\model\project\ProjectTravelReimbursement; -use app\common\validate\BaseValidate; - - -/** - * 发票明细验证器 - * Class ProjectTravelReimbursementInvoiceDetailValidate - * @package app\adminapi\validate\project - */ -class ProjectTravelReimbursementInvoiceDetailValidate extends BaseValidate -{ - - /** - * 设置校验规则 - * @var string[] - */ - protected $rule = [ - 'id' => 'require', - 'travel_reimbursement_id' => 'require|checkTravelReimbursement', - 'invoice_type' => 'require|checkInvoiceType', - 'invoice_sn' => 'require', - 'tax_rate' => 'require|checkTaxRate', - 'invoice_form' => 'require|checkInvoiceForm', - 'invoice_amount' => 'require|float|gt:0', - 'annex' => 'checkAnnex', - ]; - - - /** - * 参数描述 - * @var string[] - */ - protected $field = [ - 'id' => 'id', - 'travel_reimbursement_id' => '差旅报销id', - 'invoice_type' => '发票类型', - 'invoice_sn' => '发票号', - 'tax_rate' => '发票税率', - 'invoice_form' => '发票形式', - 'invoice_amount' => '发票金额', - ]; - - - /** - * @notes 添加场景 - * @return ProjectTravelReimbursementInvoiceDetailValidate - * @author likeadmin - * @date 2024/01/18 13:57 - */ - public function sceneAdd() - { - return $this->remove('id',true); - } - - - /** - * @notes 编辑场景 - * @return ProjectTravelReimbursementInvoiceDetailValidate - * @author likeadmin - * @date 2024/01/18 13:57 - */ - public function sceneEdit() - {} - - - /** - * @notes 删除场景 - * @return ProjectTravelReimbursementInvoiceDetailValidate - * @author likeadmin - * @date 2024/01/18 13:57 - */ - public function sceneDelete() - { - return $this->only(['id']); - } - - - /** - * @notes 详情场景 - * @return ProjectTravelReimbursementInvoiceDetailValidate - * @author likeadmin - * @date 2024/01/18 13:57 - */ - public function sceneDetail() - { - return $this->only(['id']); - } - public function checkTravelReimbursement($value): bool|string + namespace app\adminapi\validate\project; + + + use app\common\model\dict\DictData; + use app\common\model\project\ProjectTravelReimbursement; + use app\common\validate\BaseValidate; + + + /** + * 发票明细验证器 + * Class ProjectTravelReimbursementInvoiceDetailValidate + * @package app\adminapi\validate\project + */ + class ProjectTravelReimbursementInvoiceDetailValidate extends BaseValidate { - $data = ProjectTravelReimbursement::where('id',$value)->findOrEmpty(); - if($data->isEmpty()){ - return '差旅报销申请信息不存在'; + + /** + * 设置校验规则 + * @var string[] + */ + protected $rule = [ + 'id' => 'require', + 'travel_reimbursement_id' => 'require|checkTravelReimbursement', + 'invoice_type' => 'require|checkInvoiceType', + 'invoice_sn' => 'require', + 'tax_rate' => 'require|checkTaxRate', + 'invoice_form' => 'require|checkInvoiceForm', + 'invoice_amount' => 'require|float|gt:0', + 'annex' => 'checkAnnex', + ]; + + + /** + * 参数描述 + * @var string[] + */ + protected $field = [ + 'id' => 'id', + 'travel_reimbursement_id' => '差旅报销id', + 'invoice_type' => '发票类型', + 'invoice_sn' => '发票号', + 'tax_rate' => '发票税率', + 'invoice_form' => '发票形式', + 'invoice_amount' => '发票金额', + ]; + + + /** + * @notes 添加场景 + * @return ProjectTravelReimbursementInvoiceDetailValidate + * @author likeadmin + * @date 2024/01/18 13:57 + */ + public function sceneAdd() + { + return $this->remove('id', true); } - return true; - } - - public function checkInvoiceType($value): bool|string - { - $dict = DictData::where('type_value','invoice_type')->column('value'); - if(!in_array($value,$dict)){ - return '发票类型数据值无效'; + + + /** + * @notes 编辑场景 + * @return ProjectTravelReimbursementInvoiceDetailValidate + * @author likeadmin + * @date 2024/01/18 13:57 + */ + public function sceneEdit() + { } - return true; - } - - public function checkTaxRate($value): bool|string - { - $dict = DictData::where('type_value','tax_rate')->column('value'); - if(!in_array($value,$dict)){ - return '发票税率数据值无效'; + + + /** + * @notes 删除场景 + * @return ProjectTravelReimbursementInvoiceDetailValidate + * @author likeadmin + * @date 2024/01/18 13:57 + */ + public function sceneDelete() + { + return $this->only(['id'])->remove('id', 'checkData'); } - return true; - } - - public function checkInvoiceForm($value){ - $dict = DictData::where('type_value','invoice_form')->column('value'); - if(!in_array($value,$dict)){ - return '发票形式数据值无效'; + + + /** + * @notes 详情场景 + * @return ProjectTravelReimbursementInvoiceDetailValidate + * @author likeadmin + * @date 2024/01/18 13:57 + */ + public function sceneDetail() + { + return $this->only(['id']); } - return true; - } - - public function checkAnnex($value): bool|string - { - if(!empty($value) && $value != ''){ - if(!is_array($value)){ - return '附件格式错误'; + + public function checkTravelReimbursement($value): bool|string + { + $data = ProjectTravelReimbursement::where('id', $value)->findOrEmpty(); + if ($data->isEmpty()) { + return '差旅报销申请信息不存在'; } + return true; } - return true; - } - -} \ No newline at end of file + + public function checkInvoiceType($value): bool|string + { + $dict = DictData::where('type_value', 'invoice_type')->column('value'); + if (!in_array($value, $dict)) { + return '发票类型数据值无效'; + } + return true; + } + + public function checkTaxRate($value): bool|string + { + $dict = DictData::where('type_value', 'tax_rate')->column('value'); + if (!in_array($value, $dict)) { + return '发票税率数据值无效'; + } + return true; + } + + public function checkInvoiceForm($value) + { + $dict = DictData::where('type_value', 'invoice_form')->column('value'); + if (!in_array($value, $dict)) { + return '发票形式数据值无效'; + } + return true; + } + + public function checkAnnex($value): bool|string + { + if (!empty($value) && $value != '') { + if (!is_array($value)) { + return '附件格式错误'; + } + } + return true; + } + + } \ No newline at end of file diff --git a/app/adminapi/validate/project/ProjectTravelReimbursementValidate.php b/app/adminapi/validate/project/ProjectTravelReimbursementValidate.php index 52292f133..f50c5e3b3 100644 --- a/app/adminapi/validate/project/ProjectTravelReimbursementValidate.php +++ b/app/adminapi/validate/project/ProjectTravelReimbursementValidate.php @@ -11,295 +11,295 @@ // +---------------------------------------------------------------------- // | author: likeadminTeam // +---------------------------------------------------------------------- - -namespace app\adminapi\validate\project; - - -use app\common\model\bank\BankAccount; -use app\common\model\dict\DictData; -use app\common\model\project\ProjectCostTempSet; -use app\common\model\project\ProjectLoanApply; -use app\common\model\project\ProjectTravelReimbursement; -use app\common\model\project\ProjectTravelReimbursementDetail; -use app\common\model\project\ProjectTravelReimbursementInvoiceDetail; -use app\common\model\project\ProjectTripApply; -use app\common\validate\BaseValidate; - - -/** - * 差旅报销验证器 - * Class ProjectTravelReimbursementValidate - * @package app\adminapi\validate\project - */ -class ProjectTravelReimbursementValidate extends BaseValidate -{ - - /** - * 设置校验规则 - * @var string[] - */ - protected $rule = [ - 'id' => 'require|checkData', - 'trip_apply_id' => 'require|checkTripApply', - 'reimbursement_type' => 'require|checkReimbursementType', - 'loan_apply_id' => 'requireCallback:check_require|checkLoanApply', - 'offset_loan_amount' => 'requireCallback:check_require|float|egt:0', - 'apply_user' => 'require', - 'apply_date' => 'require|dateFormat:Y-m-d', - 'payee_name' => 'require', - 'payee_bank' => 'require', - 'payee_account' => 'require', - 'annex' => 'checkAnnex', - 'bank_account_id' => 'require|checkBankAccount', - 'reimbursement_detail' => 'require|checkReimbursementDetail', - 'invoice_detail' => 'require|checkInvoiceDetail', - 'flow_id' => 'require|checkFlow', - 'path' => 'require', - ]; - - - /** - * 参数描述 - * @var string[] - */ - protected $field = [ - 'id' => 'id', - 'trip_apply_id' => '出差申请单id', - 'reimbursement_type' => '报销类型', - 'loan_apply_id' => '借款申请id', - 'offset_loan_amount' => '冲抵借款金额', - 'apply_user' => '报销人', - 'apply_date' => '报销日期', - 'payee_name' => '收款人姓名', - 'payee_bank' => '收款银行', - 'payee_account' => '收款账号', - 'bank_account_id' => '付款银行账户id', - 'reimbursement_detail' => '报销明细', - 'invoice_detail' => '发票明细', - ]; - - - /** - * @notes 添加场景 - * @return ProjectTravelReimbursementValidate - * @author likeadmin - * @date 2024/01/18 13:57 - */ - public function sceneAdd() - { - return $this->remove('id',true)->remove('flow_id',true)->remove('path',true); - } - - - /** - * @notes 编辑场景 - * @return ProjectTravelReimbursementValidate - * @author likeadmin - * @date 2024/01/18 13:57 - */ - public function sceneEdit() - { - return $this->remove('flow_id',true)->remove('path',true); - } - - - /** - * @notes 删除场景 - * @return ProjectTravelReimbursementValidate - * @author likeadmin - * @date 2024/01/18 13:57 - */ - public function sceneDelete() - { - return $this->only(['id']); - } - - - /** - * @notes 详情场景 - * @return ProjectTravelReimbursementValidate - * @author likeadmin - * @date 2024/01/18 13:57 - */ - public function sceneDetail() - { - return $this->only(['id']); - } - public function sceneApprove() - { - return $this->only(['id','flow_id','path']); - } + namespace app\adminapi\validate\project; - public function checkData($value): bool|string - { - $data = ProjectTravelReimbursement::where('id',$value)->findOrEmpty(); - if($data->isEmpty()){ - return '数据不存在'; - } - return true; - } - public function checkTripApply($value): bool|string - { - $data = ProjectTripApply::where('id',$value)->findOrEmpty(); - if($data->isEmpty()){ - return '出差申请信息不存在'; - } - return true; - } + use app\common\model\bank\BankAccount; + use app\common\model\dict\DictData; + use app\common\model\project\ProjectCostTempSet; + use app\common\model\project\ProjectLoanApply; + use app\common\model\project\ProjectTravelReimbursement; + use app\common\model\project\ProjectTravelReimbursementDetail; + use app\common\model\project\ProjectTravelReimbursementInvoiceDetail; + use app\common\model\project\ProjectTripApply; + use app\common\validate\BaseValidate; - public function checkReimbursementType($value): bool|string - { - $data = explode(',',$value); - if(empty($data)){ - return '报销类型数据格式错误'; - } - foreach ($data as $v) { - $dict = DictData::where('type_value','reimbursement_type')->column('value'); - if(!in_array($v,$dict)){ - return '报销类型数据无效'; - } - } - return true; - } - function check_require($value,$data): bool + /** + * 差旅报销验证器 + * Class ProjectTravelReimbursementValidate + * @package app\adminapi\validate\project + */ + class ProjectTravelReimbursementValidate extends BaseValidate { - $reimbursement_type = explode(',',$data['reimbursement_type']); - return in_array(1,$reimbursement_type); - } - - public function checkLoanApply($value): bool|string - { - $loan_apply_data = ProjectLoanApply::where('id',$value)->findOrEmpty(); - if($loan_apply_data->isEmpty()){ - return '借款单信息不存在'; + + /** + * 设置校验规则 + * @var string[] + */ + protected $rule = [ + 'id' => 'require|checkData', + 'trip_apply_id' => 'require|checkTripApply', + 'reimbursement_type' => 'require|checkReimbursementType', + 'loan_apply_id' => 'requireCallback:check_require|checkLoanApply', + 'offset_loan_amount' => 'requireCallback:check_require|float|egt:0', + 'apply_user' => 'require', + 'apply_date' => 'require|dateFormat:Y-m-d', + 'payee_name' => 'require', + 'payee_bank' => 'require', + 'payee_account' => 'require', + 'annex' => 'checkAnnex', + 'bank_account_id' => 'require|checkBankAccount', + 'reimbursement_detail' => 'require|checkReimbursementDetail', + 'invoice_detail' => 'require|checkInvoiceDetail', + 'flow_id' => 'require|checkFlow', + 'path' => 'require', + ]; + + + /** + * 参数描述 + * @var string[] + */ + protected $field = [ + 'id' => 'id', + 'trip_apply_id' => '出差申请单id', + 'reimbursement_type' => '报销类型', + 'loan_apply_id' => '借款申请id', + 'offset_loan_amount' => '冲抵借款金额', + 'apply_user' => '报销人', + 'apply_date' => '报销日期', + 'payee_name' => '收款人姓名', + 'payee_bank' => '收款银行', + 'payee_account' => '收款账号', + 'bank_account_id' => '付款银行账户id', + 'reimbursement_detail' => '报销明细', + 'invoice_detail' => '发票明细', + ]; + + + /** + * @notes 添加场景 + * @return ProjectTravelReimbursementValidate + * @author likeadmin + * @date 2024/01/18 13:57 + */ + public function sceneAdd() + { + return $this->remove('id', true)->remove('flow_id', true)->remove('path', true); } - return true; - } - - public function checkAnnex($value): bool|string - { - if(!empty($value) && $value != ''){ - if(!is_array($value)){ - return '附件格式错误'; - } + + + /** + * @notes 编辑场景 + * @return ProjectTravelReimbursementValidate + * @author likeadmin + * @date 2024/01/18 13:57 + */ + public function sceneEdit() + { + return $this->remove('flow_id', true)->remove('path', true); } - return true; - } - - public function checkBankAccount($value): bool|string - { - $data = BankAccount::where('id',$value)->findOrEmpty(); - if($data->isEmpty()){ - return '付款银行账户信息不存在'; + + + /** + * @notes 删除场景 + * @return ProjectTravelReimbursementValidate + * @author likeadmin + * @date 2024/01/18 13:57 + */ + public function sceneDelete() + { + return $this->only(['id'])->remove('id', 'checkData'); } - return true; - } - - public function checkReimbursementDetail($value): bool|string - { - if(empty($value) || !is_array($value)){ - return '报销明细数据格式错误'; + + + /** + * @notes 详情场景 + * @return ProjectTravelReimbursementValidate + * @author likeadmin + * @date 2024/01/18 13:57 + */ + public function sceneDetail() + { + return $this->only(['id']); } - foreach($value as $v){ - if(isset($v['id']) && $v['id'] != ''){ - $reimbursement_detail = ProjectTravelReimbursementDetail::where('id',$v['id'])->findOrEmpty(); - if($reimbursement_detail->isEmpty()){ - return '报销明细信息不存在'; - } - } - if(empty($v['project_cost_temp_id'])){ - return '请选择项目费用模板'; - }else{ - $project_cost_temp = ProjectCostTempSet::where('id',$v['project_cost_temp_id'])->findOrEmpty(); - if($project_cost_temp->isEmpty()){ - return '项目费用模板信息不存在'; - } - } - if(isset($v['traffic_fee']) && $v['traffic_fee'] != ''){ - if(!is_numeric($v['traffic_fee'])){ - return '交通费用必须是数字'; - } - } - if(isset($v['stay_fee']) && $v['stay_fee'] != ''){ - if(!is_numeric($v['stay_fee'])){ - return '住宿费用必须是数字'; - } - } - if(isset($v['restaurant_fee']) && $v['restaurant_fee'] != ''){ - if(!is_numeric($v['restaurant_fee'])){ - return '餐饮费用必须是数字'; - } - } - if(isset($v['subsidy_fee']) && $v['subsidy_fee'] != ''){ - if(!is_numeric($v['subsidy_fee'])){ - return '补助费用必须是数字'; - } - } - if(isset($v['other_fee']) && $v['other_fee'] != ''){ - if(!is_numeric($v['other_fee'])){ - return '其他费用必须是数字'; - } - } + + public function sceneApprove() + { + return $this->only(['id', 'flow_id', 'path']); } - return true; - } - - public function checkInvoiceDetail($value): bool|string - { - if(empty($value) || !is_array($value)){ - return '发票明细数据格式错误'; + + public function checkData($value): bool|string + { + $data = ProjectTravelReimbursement::where('id', $value)->findOrEmpty(); + if ($data->isEmpty()) { + return '数据不存在'; + } + return true; } - foreach($value as $v){ - if(isset($v['id']) && $v['id'] != ''){ - $invoice_detail = ProjectTravelReimbursementInvoiceDetail::where('id',$v['id'])->findOrEmpty(); - if($invoice_detail->isEmpty()){ - return '发票明细信息不存在'; - } - } - if(empty($v['invoice_type'])){ - return '请选择发票类型'; - }else{ - $invoice_type_dict = DictData::where('type_value','invoice_type')->column('value'); - if(!in_array($v['invoice_type'],$invoice_type_dict)){ - return '发票类型数据值无效'; - } - } - if(empty($v['invoice_sn'])){ - return '请填写发票号'; - } - if(empty($v['tax_rate'])){ - return '请选择发票税率'; - }else{ - $tax_rate_dict = DictData::where('type_value','tax_rate')->column('value'); - if(!in_array($v['tax_rate'],$tax_rate_dict)){ - return '发票税率数据值无效'; - } - } - if(empty($v['invoice_form'])){ - return '请选择发票形式'; - }else{ - $invoice_form_dict = DictData::where('type_value','invoice_form')->column('value'); - if(!in_array($v['invoice_form'],$invoice_form_dict)){ - return '发票形式数据值无效'; - } - } - if(empty($v['invoice_amount'])){ - return '请填写发票金额'; - }else{ - if(!is_numeric($v['invoice_amount']) || $v['invoice_amount'] < 0){ - return '发票金额必须是大于0的数字'; - } - } - if(isset($v['annex']) && $v['annex'] != ''){ - if(!is_array($v['annex'])){ - return '发票附件格式错误'; - } + + public function checkTripApply($value): bool|string + { + $data = ProjectTripApply::where('id', $value)->findOrEmpty(); + if ($data->isEmpty()) { + return '出差申请信息不存在'; } + return true; } - return true; - } - -} \ No newline at end of file + + public function checkReimbursementType($value): bool|string + { + $data = explode(',', $value); + if (empty($data)) { + return '报销类型数据格式错误'; + } + foreach ($data as $v) { + $dict = DictData::where('type_value', 'reimbursement_type')->column('value'); + if (!in_array($v, $dict)) { + return '报销类型数据无效'; + } + } + return true; + } + + function check_require($value, $data): bool + { + $reimbursement_type = explode(',', $data['reimbursement_type']); + return in_array(1, $reimbursement_type); + } + + public function checkLoanApply($value): bool|string + { + $loan_apply_data = ProjectLoanApply::where('id', $value)->findOrEmpty(); + if ($loan_apply_data->isEmpty()) { + return '借款单信息不存在'; + } + return true; + } + + public function checkAnnex($value): bool|string + { + if (!empty($value) && $value != '') { + if (!is_array($value)) { + return '附件格式错误'; + } + } + return true; + } + + public function checkBankAccount($value): bool|string + { + $data = BankAccount::where('id', $value)->findOrEmpty(); + if ($data->isEmpty()) { + return '付款银行账户信息不存在'; + } + return true; + } + + public function checkReimbursementDetail($value): bool|string + { + if (empty($value) || !is_array($value)) { + return '报销明细数据格式错误'; + } + foreach ($value as $v) { + if (isset($v['id']) && $v['id'] != '') { + $reimbursement_detail = ProjectTravelReimbursementDetail::where('id', $v['id'])->findOrEmpty(); + if ($reimbursement_detail->isEmpty()) { + return '报销明细信息不存在'; + } + } + if (empty($v['project_cost_temp_id'])) { + return '请选择项目费用模板'; + } else { + $project_cost_temp = ProjectCostTempSet::where('id', $v['project_cost_temp_id'])->findOrEmpty(); + if ($project_cost_temp->isEmpty()) { + return '项目费用模板信息不存在'; + } + } + if (isset($v['traffic_fee']) && $v['traffic_fee'] != '') { + if (!is_numeric($v['traffic_fee'])) { + return '交通费用必须是数字'; + } + } + if (isset($v['stay_fee']) && $v['stay_fee'] != '') { + if (!is_numeric($v['stay_fee'])) { + return '住宿费用必须是数字'; + } + } + if (isset($v['restaurant_fee']) && $v['restaurant_fee'] != '') { + if (!is_numeric($v['restaurant_fee'])) { + return '餐饮费用必须是数字'; + } + } + if (isset($v['subsidy_fee']) && $v['subsidy_fee'] != '') { + if (!is_numeric($v['subsidy_fee'])) { + return '补助费用必须是数字'; + } + } + if (isset($v['other_fee']) && $v['other_fee'] != '') { + if (!is_numeric($v['other_fee'])) { + return '其他费用必须是数字'; + } + } + } + return true; + } + + public function checkInvoiceDetail($value): bool|string + { + if (empty($value) || !is_array($value)) { + return '发票明细数据格式错误'; + } + foreach ($value as $v) { + if (isset($v['id']) && $v['id'] != '') { + $invoice_detail = ProjectTravelReimbursementInvoiceDetail::where('id', $v['id'])->findOrEmpty(); + if ($invoice_detail->isEmpty()) { + return '发票明细信息不存在'; + } + } + if (empty($v['invoice_type'])) { + return '请选择发票类型'; + } else { + $invoice_type_dict = DictData::where('type_value', 'invoice_type')->column('value'); + if (!in_array($v['invoice_type'], $invoice_type_dict)) { + return '发票类型数据值无效'; + } + } + if (empty($v['invoice_sn'])) { + return '请填写发票号'; + } + if (empty($v['tax_rate'])) { + return '请选择发票税率'; + } else { + $tax_rate_dict = DictData::where('type_value', 'tax_rate')->column('value'); + if (!in_array($v['tax_rate'], $tax_rate_dict)) { + return '发票税率数据值无效'; + } + } + if (empty($v['invoice_form'])) { + return '请选择发票形式'; + } else { + $invoice_form_dict = DictData::where('type_value', 'invoice_form')->column('value'); + if (!in_array($v['invoice_form'], $invoice_form_dict)) { + return '发票形式数据值无效'; + } + } + if (empty($v['invoice_amount'])) { + return '请填写发票金额'; + } else { + if (!is_numeric($v['invoice_amount']) || $v['invoice_amount'] < 0) { + return '发票金额必须是大于0的数字'; + } + } + if (isset($v['annex']) && $v['annex'] != '') { + if (!is_array($v['annex'])) { + return '发票附件格式错误'; + } + } + } + return true; + } + + } \ No newline at end of file diff --git a/app/adminapi/validate/project/ProjectTripApplyValidate.php b/app/adminapi/validate/project/ProjectTripApplyValidate.php index 28d2f5ff9..31638e8fc 100644 --- a/app/adminapi/validate/project/ProjectTripApplyValidate.php +++ b/app/adminapi/validate/project/ProjectTripApplyValidate.php @@ -11,153 +11,153 @@ // +---------------------------------------------------------------------- // | author: likeadminTeam // +---------------------------------------------------------------------- - -namespace app\adminapi\validate\project; - - -use app\common\model\dict\DictData; -use app\common\model\project\Project; -use app\common\model\project\ProjectTripApply; -use app\common\validate\BaseValidate; - - -/** - * 出差申请验证器 - * Class ProjectTripApplyValidate - * @package app\adminapi\validate\project - */ -class ProjectTripApplyValidate extends BaseValidate -{ - - /** - * 设置校验规则 - * @var string[] - */ - protected $rule = [ - 'id' => 'require|checkData', - 'project_id' => 'require|checkProject', - 'origin_address' => 'require', - 'target_address' => 'require', - 'traffic' => 'require|checkTraffic', - 'start_date' => 'require|dateFormat:Y-m-d', - 'end_date' => 'require|dateFormat:Y-m-d|checkEndDate', - 'annex' => 'checkAnnex', - 'flow_id' => 'require|checkFlow', - 'path' => 'require', - ]; - - - /** - * 参数描述 - * @var string[] - */ - protected $field = [ - 'id' => 'id', - 'project_id' => '项目id', - 'origin_address' => '出差起始地', - 'target_address' => '出差目的地', - 'traffic' => '交通工具', - 'start_date' => '出差时间', - 'end_date' => '结束时间', - ]; - - - /** - * @notes 添加场景 - * @return ProjectTripApplyValidate - * @author likeadmin - * @date 2024/01/17 09:22 - */ - public function sceneAdd() - { - return $this->remove('id',true)->remove('flow_id',true)->remove('path',true); - } - - - /** - * @notes 编辑场景 - * @return ProjectTripApplyValidate - * @author likeadmin - * @date 2024/01/17 09:22 - */ - public function sceneEdit() - { - return $this->remove('flow_id',true)->remove('path',true); - } - - - /** - * @notes 删除场景 - * @return ProjectTripApplyValidate - * @author likeadmin - * @date 2024/01/17 09:22 - */ - public function sceneDelete() - { - return $this->only(['id']); - } - - - /** - * @notes 详情场景 - * @return ProjectTripApplyValidate - * @author likeadmin - * @date 2024/01/17 09:22 - */ - public function sceneDetail() - { - return $this->only(['id']); - } - public function sceneApprove() - { - return $this->only(['id','flow_id','path']); - } + namespace app\adminapi\validate\project; - public function checkData($value): bool|string + + use app\common\model\dict\DictData; + use app\common\model\project\Project; + use app\common\model\project\ProjectTripApply; + use app\common\validate\BaseValidate; + + + /** + * 出差申请验证器 + * Class ProjectTripApplyValidate + * @package app\adminapi\validate\project + */ + class ProjectTripApplyValidate extends BaseValidate { - $data = ProjectTripApply::where('id',$value)->findOrEmpty(); - if($data->isEmpty()){ - return '数据不存在'; + + /** + * 设置校验规则 + * @var string[] + */ + protected $rule = [ + 'id' => 'require|checkData', + 'project_id' => 'require|checkProject', + 'origin_address' => 'require', + 'target_address' => 'require', + 'traffic' => 'require|checkTraffic', + 'start_date' => 'require|dateFormat:Y-m-d', + 'end_date' => 'require|dateFormat:Y-m-d|checkEndDate', + 'annex' => 'checkAnnex', + 'flow_id' => 'require|checkFlow', + 'path' => 'require', + ]; + + + /** + * 参数描述 + * @var string[] + */ + protected $field = [ + 'id' => 'id', + 'project_id' => '项目id', + 'origin_address' => '出差起始地', + 'target_address' => '出差目的地', + 'traffic' => '交通工具', + 'start_date' => '出差时间', + 'end_date' => '结束时间', + ]; + + + /** + * @notes 添加场景 + * @return ProjectTripApplyValidate + * @author likeadmin + * @date 2024/01/17 09:22 + */ + public function sceneAdd() + { + return $this->remove('id', true)->remove('flow_id', true)->remove('path', true); } - return true; - } - - public function checkProject($value): bool|string - { - $data = Project::where('id',$value)->findOrEmpty(); - if($data->isEmpty()){ - return '项目信息不存在'; + + + /** + * @notes 编辑场景 + * @return ProjectTripApplyValidate + * @author likeadmin + * @date 2024/01/17 09:22 + */ + public function sceneEdit() + { + return $this->remove('flow_id', true)->remove('path', true); } - return true; - } - - public function checkTraffic($value): bool|string - { - $dict = DictData::where('type_value','traffic')->column('value'); - if(!in_array($value,$dict)){ - return '交通工具无效'; + + + /** + * @notes 删除场景 + * @return ProjectTripApplyValidate + * @author likeadmin + * @date 2024/01/17 09:22 + */ + public function sceneDelete() + { + return $this->only(['id'])->remove('id', 'checkData'); } - return true; - } - - public function checkEndDate($value,$rule,$data): bool|string - { - $end_time = strtotime($value); - $start_time = strtotime($data['start_date']); - if($end_time <= $start_time){ - return '结束时间必须大于开始时间'; + + + /** + * @notes 详情场景 + * @return ProjectTripApplyValidate + * @author likeadmin + * @date 2024/01/17 09:22 + */ + public function sceneDetail() + { + return $this->only(['id']); } - return true; - } - - public function checkAnnex($value): bool|string - { - if(!empty($value) && $value != ''){ - if(!is_array($value)){ - return '附件格式错误'; + + public function sceneApprove() + { + return $this->only(['id', 'flow_id', 'path']); + } + + public function checkData($value): bool|string + { + $data = ProjectTripApply::where('id', $value)->findOrEmpty(); + if ($data->isEmpty()) { + return '数据不存在'; } + return true; } - return true; - } -} \ No newline at end of file + + public function checkProject($value): bool|string + { + $data = Project::where('id', $value)->findOrEmpty(); + if ($data->isEmpty()) { + return '项目信息不存在'; + } + return true; + } + + public function checkTraffic($value): bool|string + { + $dict = DictData::where('type_value', 'traffic')->column('value'); + if (!in_array($value, $dict)) { + return '交通工具无效'; + } + return true; + } + + public function checkEndDate($value, $rule, $data): bool|string + { + $end_time = strtotime($value); + $start_time = strtotime($data['start_date']); + if ($end_time <= $start_time) { + return '结束时间必须大于开始时间'; + } + return true; + } + + public function checkAnnex($value): bool|string + { + if (!empty($value) && $value != '') { + if (!is_array($value)) { + return '附件格式错误'; + } + } + return true; + } + } \ No newline at end of file diff --git a/app/adminapi/validate/project/ProjectTypeSetValidate.php b/app/adminapi/validate/project/ProjectTypeSetValidate.php index 185da0973..e601599af 100644 --- a/app/adminapi/validate/project/ProjectTypeSetValidate.php +++ b/app/adminapi/validate/project/ProjectTypeSetValidate.php @@ -11,139 +11,140 @@ // +---------------------------------------------------------------------- // | author: likeadminTeam // +---------------------------------------------------------------------- - -namespace app\adminapi\validate\project; - - -use app\common\model\dict\DictData; -use app\common\model\project\ProjectTypeSet; -use app\common\validate\BaseValidate; - - -/** - * 项目类型设置验证器 - * Class ProjectTypeSetValidate - * @package app\adminapi\validate\project - */ -class ProjectTypeSetValidate extends BaseValidate -{ - - /** - * 设置校验规则 - * @var string[] - */ - protected $rule = [ - 'id' => 'require', - 'name' => 'require|unique:'.ProjectTypeSet::class, - 'web_tags' => 'checkWebTags', - 'app_tags' => 'checkAppTags', - 'budget_tags' => 'checkBudgetTags', - ]; - protected $message = [ - 'id.require' => '缺少必要参数', - 'name.require' => '请填写类型名称', - ]; - - - /** - * 参数描述 - * @var string[] - */ - protected $field = [ - 'id' => 'id', - 'name' => '项目类型名称', - ]; - - - /** - * @notes 添加场景 - * @return ProjectTypeSetValidate - * @author likeadmin - * @date 2023/12/13 11:15 - */ - public function sceneAdd() - { - return $this->remove('id',true); - } - - - /** - * @notes 编辑场景 - * @return ProjectTypeSetValidate - * @author likeadmin - * @date 2023/12/13 11:15 - */ - public function sceneEdit() - {} - - - /** - * @notes 删除场景 - * @return ProjectTypeSetValidate - * @author likeadmin - * @date 2023/12/13 11:15 - */ - public function sceneDelete() - { - return $this->only(['id']); - } - - - /** - * @notes 详情场景 - * @return ProjectTypeSetValidate - * @author likeadmin - * @date 2023/12/13 11:15 - */ - public function sceneDetail() - { - return $this->only(['id']); - } + namespace app\adminapi\validate\project; - public function checkWebTags($value): bool|string + + use app\common\model\dict\DictData; + use app\common\model\project\ProjectTypeSet; + use app\common\validate\BaseValidate; + + + /** + * 项目类型设置验证器 + * Class ProjectTypeSetValidate + * @package app\adminapi\validate\project + */ + class ProjectTypeSetValidate extends BaseValidate { - $tags = explode(',',$value); - if(empty($tags)){ - return '请选择web标签'; + + /** + * 设置校验规则 + * @var string[] + */ + protected $rule = [ + 'id' => 'require', + 'name' => 'require|unique:' . ProjectTypeSet::class, + 'web_tags' => 'checkWebTags', + 'app_tags' => 'checkAppTags', + 'budget_tags' => 'checkBudgetTags', + ]; + + protected $message = [ + 'id.require' => '缺少必要参数', + 'name.require' => '请填写类型名称', + ]; + + + /** + * 参数描述 + * @var string[] + */ + protected $field = [ + 'id' => 'id', + 'name' => '项目类型名称', + ]; + + + /** + * @notes 添加场景 + * @return ProjectTypeSetValidate + * @author likeadmin + * @date 2023/12/13 11:15 + */ + public function sceneAdd() + { + return $this->remove('id', true); } - $dictDate = DictData::where('type_value','project_web_tags')->column('value'); - foreach($tags as $v) { - if(!in_array($v,$dictDate)){ - return 'web标签不存在'; + + + /** + * @notes 编辑场景 + * @return ProjectTypeSetValidate + * @author likeadmin + * @date 2023/12/13 11:15 + */ + public function sceneEdit() + { + } + + + /** + * @notes 删除场景 + * @return ProjectTypeSetValidate + * @author likeadmin + * @date 2023/12/13 11:15 + */ + public function sceneDelete() + { + return $this->only(['id'])->remove('id', 'checkData'); + } + + + /** + * @notes 详情场景 + * @return ProjectTypeSetValidate + * @author likeadmin + * @date 2023/12/13 11:15 + */ + public function sceneDetail() + { + return $this->only(['id']); + } + + public function checkWebTags($value): bool|string + { + $tags = explode(',', $value); + if (empty($tags)) { + return '请选择web标签'; } - } - return true; - } - - public function checkAppTags($value): bool|string - { - $tags = explode(',',$value); - if(empty($tags)){ - return '请选择app标签'; - } - $dictDate = DictData::where('type_value','project_app_tags')->column('value'); - foreach($tags as $v) { - if(!in_array($v,$dictDate)){ - return 'app标签不存在'; + $dictDate = DictData::where('type_value', 'project_web_tags')->column('value'); + foreach ($tags as $v) { + if (!in_array($v, $dictDate)) { + return 'web标签不存在'; + } } + return true; } - return true; - } - - public function checkBudgetTags($value): bool|string - { - $tags = explode(',', $value); - if (empty($tags)) { - return '请选择预算标签'; - } - $dictDate = DictData::where('type_value','project_budget_tags')->column('value'); - foreach($tags as $v) { - if(!in_array($v,$dictDate)){ - return '预算标签不存在'; + + public function checkAppTags($value): bool|string + { + $tags = explode(',', $value); + if (empty($tags)) { + return '请选择app标签'; } + $dictDate = DictData::where('type_value', 'project_app_tags')->column('value'); + foreach ($tags as $v) { + if (!in_array($v, $dictDate)) { + return 'app标签不存在'; + } + } + return true; } - return true; - } - -} \ No newline at end of file + + public function checkBudgetTags($value): bool|string + { + $tags = explode(',', $value); + if (empty($tags)) { + return '请选择预算标签'; + } + $dictDate = DictData::where('type_value', 'project_budget_tags')->column('value'); + foreach ($tags as $v) { + if (!in_array($v, $dictDate)) { + return '预算标签不存在'; + } + } + return true; + } + + } \ No newline at end of file diff --git a/app/adminapi/validate/project/ProjectValidate.php b/app/adminapi/validate/project/ProjectValidate.php index d221b5d94..79fa28fd9 100644 --- a/app/adminapi/validate/project/ProjectValidate.php +++ b/app/adminapi/validate/project/ProjectValidate.php @@ -11,222 +11,223 @@ // +---------------------------------------------------------------------- // | author: likeadminTeam // +---------------------------------------------------------------------- - -namespace app\adminapi\validate\project; - - -use app\common\model\custom\Custom; -use app\common\model\dict\DictData; -use app\common\model\project\ProjectTypeSet; -use app\common\validate\BaseValidate; - - -/** - * Project验证器 - * Class ProjectValidate - * @package app\adminapi\validate\project - */ -class ProjectValidate extends BaseValidate -{ - - /** - * 设置校验规则 - * @var string[] - */ - protected $rule = [ - 'id' => 'require', - 'custom_id' => 'require|checkCustom', - 'project_type' => 'require|checkProjectType', - 'name' => 'require', - 'project_content' => 'checkProjectContent', - 'bidding_time' => 'dateFormat:Y-m-d', - 'bidding_method' => 'checkBidMethod', - 'relationship' => 'checkRelationship', - 'discovery_time' => 'require|dateFormat:Y-m-d', - 'information_sources' => 'require|checkInfoSource', - 'construction_funds_sources' => 'checkFundSource', - 'construction_financial_status' => 'checkFinancialStatus', - 'construction_recognition' => 'checkConstructionRecognition', - 'my_construction_recognition' => 'checkMyConstructionRecognition', - 'strategic_significance' => 'checkStrategicSignificance', - 'industry' => 'checkIndustry', - 'unit_nature' => 'checkUnitNature', - 'annex' => 'checkAnnex', - ]; - protected $message = [ - 'id.require' => '缺少必要参数', - 'custom_id.require' => '请选择客户', - 'project_type.require' => '请选择工程类型', - 'name.require' => '请填写工程名称', - 'discovery_time.require' => '请选择发现时间', - 'information_sources.require' => '请选择信息来源', - ]; - - - /** - * @notes 添加场景 - * @return ProjectValidate - * @author likeadmin - * @date 2023/11/12 14:30 - */ - public function sceneAdd() - { - return $this->remove('id', true); - } - - - /** - * @notes 编辑场景 - * @return ProjectValidate - * @author likeadmin - * @date 2023/11/12 14:30 - */ - public function sceneEdit() - {} - - - /** - * @notes 删除场景 - * @return ProjectValidate - * @author likeadmin - * @date 2023/11/12 14:30 - */ - public function sceneDelete() - { - return $this->only(['id']); - } - - - /** - * @notes 详情场景 - * @return ProjectValidate - * @author likeadmin - * @date 2023/11/12 14:30 - */ - public function sceneDetail() - { - return $this->only(['id']); - } + namespace app\adminapi\validate\project; - public function checkCustom($value): bool|string + + use app\common\model\custom\Custom; + use app\common\model\dict\DictData; + use app\common\model\project\ProjectTypeSet; + use app\common\validate\BaseValidate; + + + /** + * Project验证器 + * Class ProjectValidate + * @package app\adminapi\validate\project + */ + class ProjectValidate extends BaseValidate { - $custom = Custom::where('id',$value)->findOrEmpty(); - if($custom->isEmpty()){ - return '客户不存在'; + + /** + * 设置校验规则 + * @var string[] + */ + protected $rule = [ + 'id' => 'require', + 'custom_id' => 'require|checkCustom', + 'project_type' => 'require|checkProjectType', + 'name' => 'require', + 'project_content' => 'checkProjectContent', + 'bidding_time' => 'dateFormat:Y-m-d', + 'bidding_method' => 'checkBidMethod', + 'relationship' => 'checkRelationship', + 'discovery_time' => 'require|dateFormat:Y-m-d', + 'information_sources' => 'require|checkInfoSource', + 'construction_funds_sources' => 'checkFundSource', + 'construction_financial_status' => 'checkFinancialStatus', + 'construction_recognition' => 'checkConstructionRecognition', + 'my_construction_recognition' => 'checkMyConstructionRecognition', + 'strategic_significance' => 'checkStrategicSignificance', + 'industry' => 'checkIndustry', + 'unit_nature' => 'checkUnitNature', + 'annex' => 'checkAnnex', + ]; + + protected $message = [ + 'id.require' => '缺少必要参数', + 'custom_id.require' => '请选择客户', + 'project_type.require' => '请选择工程类型', + 'name.require' => '请填写工程名称', + 'discovery_time.require' => '请选择发现时间', + 'information_sources.require' => '请选择信息来源', + ]; + + + /** + * @notes 添加场景 + * @return ProjectValidate + * @author likeadmin + * @date 2023/11/12 14:30 + */ + public function sceneAdd() + { + return $this->remove('id', true); } - return true; - } - - public function checkProjectType($value): bool|string - { - $project_type = ProjectTypeSet::where('id',$value)->findOrEmpty(); - if($project_type->isEmpty()){ - return '项目类型不存在'; + + + /** + * @notes 编辑场景 + * @return ProjectValidate + * @author likeadmin + * @date 2023/11/12 14:30 + */ + public function sceneEdit() + { } - return true; - } - - public function checkProjectContent($value): bool|string - { - $dictData = DictData::where('type_value','project_content')->column('value'); - $value=explode(',',$value); - foreach($value as $v){ - if(!in_array($v,$dictData)){ - return '项目内容无效'; + + + /** + * @notes 删除场景 + * @return ProjectValidate + * @author likeadmin + * @date 2023/11/12 14:30 + */ + public function sceneDelete() + { + return $this->only(['id'])->remove('id', 'checkData'); + } + + + /** + * @notes 详情场景 + * @return ProjectValidate + * @author likeadmin + * @date 2023/11/12 14:30 + */ + public function sceneDetail() + { + return $this->only(['id']); + } + + public function checkCustom($value): bool|string + { + $custom = Custom::where('id', $value)->findOrEmpty(); + if ($custom->isEmpty()) { + return '客户不存在'; } + return true; } - return true; - } - - public function checkBidMethod($value): bool|string - { - $dictData = DictData::where('type_value','bidding_method')->column('value'); - if(!in_array($value,$dictData)){ - return '招标方式无效'; + + public function checkProjectType($value): bool|string + { + $project_type = ProjectTypeSet::where('id', $value)->findOrEmpty(); + if ($project_type->isEmpty()) { + return '项目类型不存在'; + } + return true; } - return true; - } - - public function checkRelationship($value): bool|string - { - $dictData = DictData::where('type_value','relationship')->column('value'); - if(!in_array($value,$dictData)){ - return '关系度无效'; + + public function checkProjectContent($value): bool|string + { + $dictData = DictData::where('type_value', 'project_content')->column('value'); + $value = explode(',', $value); + foreach ($value as $v) { + if (!in_array($v, $dictData)) { + return '项目内容无效'; + } + } + return true; } - return true; - } - - public function checkInfoSource($value): bool|string - { - $dictData = DictData::where('type_value','information_sources')->column('value'); - if(!in_array($value,$dictData)){ - return '信息来源无效'; + + public function checkBidMethod($value): bool|string + { + $dictData = DictData::where('type_value', 'bidding_method')->column('value'); + if (!in_array($value, $dictData)) { + return '招标方式无效'; + } + return true; } - return true; - } - - public function checkFundSource($value): bool|string - { - $dictData = DictData::where('type_value','construction_funds_sources')->column('value'); - if(!in_array($value,$dictData)){ - return '项目建设资金来源无效'; + + public function checkRelationship($value): bool|string + { + $dictData = DictData::where('type_value', 'relationship')->column('value'); + if (!in_array($value, $dictData)) { + return '关系度无效'; + } + return true; } - return true; - } - - public function checkFinancialStatus($value): bool|string - { - $dictData = DictData::where('type_value','construction_financial_status')->column('value'); - if(!in_array($value,$dictData)){ - return '建设方财务状况无效'; + + public function checkInfoSource($value): bool|string + { + $dictData = DictData::where('type_value', 'information_sources')->column('value'); + if (!in_array($value, $dictData)) { + return '信息来源无效'; + } + return true; } - return true; - } - - public function checkConstructionRecognition($value): bool|string - { - $dictData = DictData::where('type_value','construction_recognition')->column('value'); - if(!in_array($value,$dictData)){ - return '建设方对我方认可度无效'; + + public function checkFundSource($value): bool|string + { + $dictData = DictData::where('type_value', 'construction_funds_sources')->column('value'); + if (!in_array($value, $dictData)) { + return '项目建设资金来源无效'; + } + return true; } - return true; - } - - public function checkMyConstructionRecognition($value): bool|string - { - $dictData = DictData::where('type_value','my_construction_recognition')->column('value'); - if(!in_array($value,$dictData)){ - return '我方对建设方认可度无效'; + + public function checkFinancialStatus($value): bool|string + { + $dictData = DictData::where('type_value', 'construction_financial_status')->column('value'); + if (!in_array($value, $dictData)) { + return '建设方财务状况无效'; + } + return true; } - return true; - } - - public function checkStrategicSignificance($value): bool|string - { - $dictData = DictData::where('type_value','strategic_significance')->column('value'); - if(!in_array($value,$dictData)){ - return '战略意义无效'; + + public function checkConstructionRecognition($value): bool|string + { + $dictData = DictData::where('type_value', 'construction_recognition')->column('value'); + if (!in_array($value, $dictData)) { + return '建设方对我方认可度无效'; + } + return true; } - return true; - } - - public function checkIndustry($value): bool|string - { - $dictData = DictData::where('type_value','industry')->column('value'); - if(!in_array($value,$dictData)){ - return '所属行业无效'; + + public function checkMyConstructionRecognition($value): bool|string + { + $dictData = DictData::where('type_value', 'my_construction_recognition')->column('value'); + if (!in_array($value, $dictData)) { + return '我方对建设方认可度无效'; + } + return true; } - return true; - } - - public function checkUnitNature($value): bool|string - { - $dictData = DictData::where('type_value', 'unit_nature')->column('value'); - if (!in_array($value, $dictData)) { - return '单位性质无效'; + + public function checkStrategicSignificance($value): bool|string + { + $dictData = DictData::where('type_value', 'strategic_significance')->column('value'); + if (!in_array($value, $dictData)) { + return '战略意义无效'; + } + return true; } - return true; - } - -} \ No newline at end of file + + public function checkIndustry($value): bool|string + { + $dictData = DictData::where('type_value', 'industry')->column('value'); + if (!in_array($value, $dictData)) { + return '所属行业无效'; + } + return true; + } + + public function checkUnitNature($value): bool|string + { + $dictData = DictData::where('type_value', 'unit_nature')->column('value'); + if (!in_array($value, $dictData)) { + return '单位性质无效'; + } + return true; + } + + } \ No newline at end of file diff --git a/app/adminapi/validate/project/ProjectWbsSetValidate.php b/app/adminapi/validate/project/ProjectWbsSetValidate.php index d48b972f6..eaa80117a 100644 --- a/app/adminapi/validate/project/ProjectWbsSetValidate.php +++ b/app/adminapi/validate/project/ProjectWbsSetValidate.php @@ -11,147 +11,148 @@ // +---------------------------------------------------------------------- // | author: likeadminTeam // +---------------------------------------------------------------------- - -namespace app\adminapi\validate\project; - - -use app\common\model\project\ProjectRoleSet; -use app\common\model\project\ProjectTypeSet; -use app\common\model\project\ProjectWbsSet; -use app\common\validate\BaseValidate; - - -/** - * 项目WBS设置验证器 - * Class ProjectWbsSetValidate - * @package app\adminapi\validate\project - */ -class ProjectWbsSetValidate extends BaseValidate -{ - - /** - * 设置校验规则 - * @var string[] - */ - protected $rule = [ - 'id' => 'require|checkWbs', - 'project_type_id' => 'require|checkProjectType', - 'wbs_code' => 'require|unique:'.ProjectWbsSet::class, - 'name' => 'require|unique:'.ProjectWbsSet::class, - 'sort' => 'require|integer', - 'weight' => 'require|integer', - 'sup_wbs_code' => 'checkSupCode|different:wbs_code', - 'project_role_id' => 'integer|checkProjectRole', - ]; - - protected $message = [ - 'id.require' => '缺少必要参数', - 'project_type_id.require' => '请选择项目类型', - 'wbs_code.require' => 'WBS编码不能为空', - 'wbs_code.unique' => 'WBS编码不能重复', - 'name.require' => '节点名称不能为空', - 'name.unique' => '节点名称不能重复', - 'sort.require' => '排序号不能为空', - 'sort.integer' => '排序号必须是整数', - 'weight.require' => '权重不能为空', - 'weight.integer' => '权重必须是整数', - 'sup_wbs_code' => '父级WBS编码不能与WBS编码相同', - 'project_role_id.integer' => '项目角色数据格式错误', - ]; - /** - * 参数描述 - * @var string[] - */ - protected $field = [ - 'id' => 'id', - 'project_type_id' => '项目类型id', - 'wbs_code' => 'WBS编码', - 'name' => '节点名称', - 'sort' => '排序号', - 'weight' => '权重', - ]; - - - /** - * @notes 添加场景 - * @return ProjectWbsSetValidate - * @author likeadmin - * @date 2023/12/13 15:09 - */ - public function sceneAdd() - { - return $this->remove('id',true); - } - - - /** - * @notes 编辑场景 - * @return ProjectWbsSetValidate - * @author likeadmin - * @date 2023/12/13 15:09 - */ - public function sceneEdit() - {} - - - /** - * @notes 删除场景 - * @return ProjectWbsSetValidate - * @author likeadmin - * @date 2023/12/13 15:09 - */ - public function sceneDelete() - { - return $this->only(['id']); - } - - - /** - * @notes 详情场景 - * @return ProjectWbsSetValidate - * @author likeadmin - * @date 2023/12/13 15:09 - */ - public function sceneDetail() - { - return $this->only(['id']); - } + namespace app\adminapi\validate\project; - public function checkProjectType($value): bool|string + + use app\common\model\project\ProjectRoleSet; + use app\common\model\project\ProjectTypeSet; + use app\common\model\project\ProjectWbsSet; + use app\common\validate\BaseValidate; + + + /** + * 项目WBS设置验证器 + * Class ProjectWbsSetValidate + * @package app\adminapi\validate\project + */ + class ProjectWbsSetValidate extends BaseValidate { - $projectType = ProjectTypeSet::where('id',$value)->findOrEmpty(); - if($projectType->isEmpty()) { - return '项目类型不存在'; + + /** + * 设置校验规则 + * @var string[] + */ + protected $rule = [ + 'id' => 'require|checkWbs', + 'project_type_id' => 'require|checkProjectType', + 'wbs_code' => 'require|unique:' . ProjectWbsSet::class, + 'name' => 'require|unique:' . ProjectWbsSet::class, + 'sort' => 'require|integer', + 'weight' => 'require|integer', + 'sup_wbs_code' => 'checkSupCode|different:wbs_code', + 'project_role_id' => 'integer|checkProjectRole', + ]; + + protected $message = [ + 'id.require' => '缺少必要参数', + 'project_type_id.require' => '请选择项目类型', + 'wbs_code.require' => 'WBS编码不能为空', + 'wbs_code.unique' => 'WBS编码不能重复', + 'name.require' => '节点名称不能为空', + 'name.unique' => '节点名称不能重复', + 'sort.require' => '排序号不能为空', + 'sort.integer' => '排序号必须是整数', + 'weight.require' => '权重不能为空', + 'weight.integer' => '权重必须是整数', + 'sup_wbs_code' => '父级WBS编码不能与WBS编码相同', + 'project_role_id.integer' => '项目角色数据格式错误', + ]; + + /** + * 参数描述 + * @var string[] + */ + protected $field = [ + 'id' => 'id', + 'project_type_id' => '项目类型id', + 'wbs_code' => 'WBS编码', + 'name' => '节点名称', + 'sort' => '排序号', + 'weight' => '权重', + ]; + + + /** + * @notes 添加场景 + * @return ProjectWbsSetValidate + * @author likeadmin + * @date 2023/12/13 15:09 + */ + public function sceneAdd() + { + return $this->remove('id', true); } - return true; - } - - public function checkSupCode($value): bool|string - { - $projectWbs = ProjectWbsSet::where('wbs_code',$value)->findOrEmpty(); - if($projectWbs->isEmpty()){ - return '父级WBS编码错误'; + + + /** + * @notes 编辑场景 + * @return ProjectWbsSetValidate + * @author likeadmin + * @date 2023/12/13 15:09 + */ + public function sceneEdit() + { } - return true; - } - - public function checkProjectRole($value): bool|string - { - $projectRole = ProjectRoleSet::where('id',$value)->findOrEmpty(); - if($projectRole->isEmpty()) { - return '角色不存在'; + + + /** + * @notes 删除场景 + * @return ProjectWbsSetValidate + * @author likeadmin + * @date 2023/12/13 15:09 + */ + public function sceneDelete() + { + return $this->only(['id'])->remove('id', 'checkData'); } - return true; - } - - public function checkWbs($value,$rule, $data): bool|string - { - $data = ProjectWbsSet::where('id',$value)->findOrEmpty(); - if($data->isEmpty()){ - return '数据不存在'; + + + /** + * @notes 详情场景 + * @return ProjectWbsSetValidate + * @author likeadmin + * @date 2023/12/13 15:09 + */ + public function sceneDetail() + { + return $this->only(['id']); } - return true; - } - -} \ No newline at end of file + + public function checkProjectType($value): bool|string + { + $projectType = ProjectTypeSet::where('id', $value)->findOrEmpty(); + if ($projectType->isEmpty()) { + return '项目类型不存在'; + } + return true; + } + + public function checkSupCode($value): bool|string + { + $projectWbs = ProjectWbsSet::where('wbs_code', $value)->findOrEmpty(); + if ($projectWbs->isEmpty()) { + return '父级WBS编码错误'; + } + return true; + } + + public function checkProjectRole($value): bool|string + { + $projectRole = ProjectRoleSet::where('id', $value)->findOrEmpty(); + if ($projectRole->isEmpty()) { + return '角色不存在'; + } + return true; + } + + public function checkWbs($value, $rule, $data): bool|string + { + $data = ProjectWbsSet::where('id', $value)->findOrEmpty(); + if ($data->isEmpty()) { + return '数据不存在'; + } + return true; + } + + } \ No newline at end of file diff --git a/app/adminapi/validate/project_process_management/ApplyWithSealValidate.php b/app/adminapi/validate/project_process_management/ApplyWithSealValidate.php index c16cd06c1..1aeaf9430 100644 --- a/app/adminapi/validate/project_process_management/ApplyWithSealValidate.php +++ b/app/adminapi/validate/project_process_management/ApplyWithSealValidate.php @@ -1,94 +1,96 @@ - 'require', - ]; - - - /** - * 参数描述 - * @var string[] - */ - protected $field = [ - 'id' => 'id', - ]; - - - /** - * @notes 添加场景 - * @return ApplyWithSealValidate - * @author likeadmin - * @date 2024/02/23 15:05 - */ - public function sceneAdd() - { - return $this->remove('id', true); - } - - - /** - * @notes 编辑场景 - * @return ApplyWithSealValidate - * @author likeadmin - * @date 2024/02/23 15:05 - */ - public function sceneEdit() - { - return $this->only(['id']); - } - - - /** - * @notes 删除场景 - * @return ApplyWithSealValidate - * @author likeadmin - * @date 2024/02/23 15:05 - */ - public function sceneDelete() - { - return $this->only(['id']); - } - - - /** - * @notes 详情场景 - * @return ApplyWithSealValidate - * @author likeadmin - * @date 2024/02/23 15:05 - */ - public function sceneDetail() - { - return $this->only(['id']); - } - -} \ No newline at end of file + 'require', + + ]; + + + /** + * 参数描述 + * @var string[] + */ + protected $field = [ + 'id' => 'id', + + ]; + + + /** + * @notes 添加场景 + * @return ApplyWithSealValidate + * @author likeadmin + * @date 2024/02/23 15:05 + */ + public function sceneAdd() + { + return $this->remove('id', true); + } + + + /** + * @notes 编辑场景 + * @return ApplyWithSealValidate + * @author likeadmin + * @date 2024/02/23 15:05 + */ + public function sceneEdit() + { + return $this->only(['id']); + } + + + /** + * @notes 删除场景 + * @return ApplyWithSealValidate + * @author likeadmin + * @date 2024/02/23 15:05 + */ + public function sceneDelete() + { + return $this->only(['id'])->remove('id', 'checkData'); + } + + + /** + * @notes 详情场景 + * @return ApplyWithSealValidate + * @author likeadmin + * @date 2024/02/23 15:05 + */ + public function sceneDetail() + { + return $this->only(['id']); + } + + } \ No newline at end of file diff --git a/app/adminapi/validate/project_process_management/JianliProjectProgressReportValidate.php b/app/adminapi/validate/project_process_management/JianliProjectProgressReportValidate.php index 4df07591e..56136cebd 100644 --- a/app/adminapi/validate/project_process_management/JianliProjectProgressReportValidate.php +++ b/app/adminapi/validate/project_process_management/JianliProjectProgressReportValidate.php @@ -1,94 +1,96 @@ - 'require', - ]; - - - /** - * 参数描述 - * @var string[] - */ - protected $field = [ - 'id' => 'id', - ]; - - - /** - * @notes 添加场景 - * @return JianliProjectProgressReportValidate - * @author likeadmin - * @date 2024/02/23 11:47 - */ - public function sceneAdd() - { - return $this->remove('id', true); - } - - - /** - * @notes 编辑场景 - * @return JianliProjectProgressReportValidate - * @author likeadmin - * @date 2024/02/23 11:47 - */ - public function sceneEdit() - { - return $this->only(['id']); - } - - - /** - * @notes 删除场景 - * @return JianliProjectProgressReportValidate - * @author likeadmin - * @date 2024/02/23 11:47 - */ - public function sceneDelete() - { - return $this->only(['id']); - } - - - /** - * @notes 详情场景 - * @return JianliProjectProgressReportValidate - * @author likeadmin - * @date 2024/02/23 11:47 - */ - public function sceneDetail() - { - return $this->only(['id']); - } - -} \ No newline at end of file + 'require', + + ]; + + + /** + * 参数描述 + * @var string[] + */ + protected $field = [ + 'id' => 'id', + + ]; + + + /** + * @notes 添加场景 + * @return JianliProjectProgressReportValidate + * @author likeadmin + * @date 2024/02/23 11:47 + */ + public function sceneAdd() + { + return $this->remove('id', true); + } + + + /** + * @notes 编辑场景 + * @return JianliProjectProgressReportValidate + * @author likeadmin + * @date 2024/02/23 11:47 + */ + public function sceneEdit() + { + return $this->only(['id']); + } + + + /** + * @notes 删除场景 + * @return JianliProjectProgressReportValidate + * @author likeadmin + * @date 2024/02/23 11:47 + */ + public function sceneDelete() + { + return $this->only(['id'])->remove('id', 'checkData'); + } + + + /** + * @notes 详情场景 + * @return JianliProjectProgressReportValidate + * @author likeadmin + * @date 2024/02/23 11:47 + */ + public function sceneDetail() + { + return $this->only(['id']); + } + + } \ No newline at end of file diff --git a/app/adminapi/validate/project_process_management/ProjectChangeVisaContentValidate.php b/app/adminapi/validate/project_process_management/ProjectChangeVisaContentValidate.php index 2c16d5c76..467f24875 100644 --- a/app/adminapi/validate/project_process_management/ProjectChangeVisaContentValidate.php +++ b/app/adminapi/validate/project_process_management/ProjectChangeVisaContentValidate.php @@ -1,94 +1,96 @@ - 'require', - ]; - - - /** - * 参数描述 - * @var string[] - */ - protected $field = [ - 'id' => 'id', - ]; - - - /** - * @notes 添加场景 - * @return ProjectChangeVisaContentValidate - * @author likeadmin - * @date 2024/02/23 10:27 - */ - public function sceneAdd() - { - return $this->remove('id', true); - } - - - /** - * @notes 编辑场景 - * @return ProjectChangeVisaContentValidate - * @author likeadmin - * @date 2024/02/23 10:27 - */ - public function sceneEdit() - { - return $this->only(['id']); - } - - - /** - * @notes 删除场景 - * @return ProjectChangeVisaContentValidate - * @author likeadmin - * @date 2024/02/23 10:27 - */ - public function sceneDelete() - { - return $this->only(['id']); - } - - - /** - * @notes 详情场景 - * @return ProjectChangeVisaContentValidate - * @author likeadmin - * @date 2024/02/23 10:27 - */ - public function sceneDetail() - { - return $this->only(['id']); - } - -} \ No newline at end of file + 'require', + + ]; + + + /** + * 参数描述 + * @var string[] + */ + protected $field = [ + 'id' => 'id', + + ]; + + + /** + * @notes 添加场景 + * @return ProjectChangeVisaContentValidate + * @author likeadmin + * @date 2024/02/23 10:27 + */ + public function sceneAdd() + { + return $this->remove('id', true); + } + + + /** + * @notes 编辑场景 + * @return ProjectChangeVisaContentValidate + * @author likeadmin + * @date 2024/02/23 10:27 + */ + public function sceneEdit() + { + return $this->only(['id']); + } + + + /** + * @notes 删除场景 + * @return ProjectChangeVisaContentValidate + * @author likeadmin + * @date 2024/02/23 10:27 + */ + public function sceneDelete() + { + return $this->only(['id'])->remove('id', 'checkData'); + } + + + /** + * @notes 详情场景 + * @return ProjectChangeVisaContentValidate + * @author likeadmin + * @date 2024/02/23 10:27 + */ + public function sceneDetail() + { + return $this->only(['id']); + } + + } \ No newline at end of file diff --git a/app/adminapi/validate/project_process_management/ProjectChangeVisaValidate.php b/app/adminapi/validate/project_process_management/ProjectChangeVisaValidate.php index 1e8dab5a4..016588862 100644 --- a/app/adminapi/validate/project_process_management/ProjectChangeVisaValidate.php +++ b/app/adminapi/validate/project_process_management/ProjectChangeVisaValidate.php @@ -1,94 +1,96 @@ - 'require', - ]; - - - /** - * 参数描述 - * @var string[] - */ - protected $field = [ - 'id' => 'id', - ]; - - - /** - * @notes 添加场景 - * @return ProjectChangeVisaValidate - * @author likeadmin - * @date 2024/02/23 09:58 - */ - public function sceneAdd() - { - return $this->remove('id', true); - } - - - /** - * @notes 编辑场景 - * @return ProjectChangeVisaValidate - * @author likeadmin - * @date 2024/02/23 09:58 - */ - public function sceneEdit() - { - return $this->only(['id']); - } - - - /** - * @notes 删除场景 - * @return ProjectChangeVisaValidate - * @author likeadmin - * @date 2024/02/23 09:58 - */ - public function sceneDelete() - { - return $this->only(['id']); - } - - - /** - * @notes 详情场景 - * @return ProjectChangeVisaValidate - * @author likeadmin - * @date 2024/02/23 09:58 - */ - public function sceneDetail() - { - return $this->only(['id']); - } - -} \ No newline at end of file + 'require', + + ]; + + + /** + * 参数描述 + * @var string[] + */ + protected $field = [ + 'id' => 'id', + + ]; + + + /** + * @notes 添加场景 + * @return ProjectChangeVisaValidate + * @author likeadmin + * @date 2024/02/23 09:58 + */ + public function sceneAdd() + { + return $this->remove('id', true); + } + + + /** + * @notes 编辑场景 + * @return ProjectChangeVisaValidate + * @author likeadmin + * @date 2024/02/23 09:58 + */ + public function sceneEdit() + { + return $this->only(['id']); + } + + + /** + * @notes 删除场景 + * @return ProjectChangeVisaValidate + * @author likeadmin + * @date 2024/02/23 09:58 + */ + public function sceneDelete() + { + return $this->only(['id'])->remove('id', 'checkData'); + } + + + /** + * @notes 详情场景 + * @return ProjectChangeVisaValidate + * @author likeadmin + * @date 2024/02/23 09:58 + */ + public function sceneDetail() + { + return $this->only(['id']); + } + + } \ No newline at end of file diff --git a/app/adminapi/validate/project_process_management/ProjectProgressPaymentDetailValidate.php b/app/adminapi/validate/project_process_management/ProjectProgressPaymentDetailValidate.php index a853b8747..3b729daa4 100644 --- a/app/adminapi/validate/project_process_management/ProjectProgressPaymentDetailValidate.php +++ b/app/adminapi/validate/project_process_management/ProjectProgressPaymentDetailValidate.php @@ -1,94 +1,96 @@ - 'require', - ]; - - - /** - * 参数描述 - * @var string[] - */ - protected $field = [ - 'id' => 'id', - ]; - - - /** - * @notes 添加场景 - * @return ProjectProgressPaymentDetailValidate - * @author likeadmin - * @date 2024/02/23 14:17 - */ - public function sceneAdd() - { - return $this->remove('id', true); - } - - - /** - * @notes 编辑场景 - * @return ProjectProgressPaymentDetailValidate - * @author likeadmin - * @date 2024/02/23 14:17 - */ - public function sceneEdit() - { - return $this->only(['id']); - } - - - /** - * @notes 删除场景 - * @return ProjectProgressPaymentDetailValidate - * @author likeadmin - * @date 2024/02/23 14:17 - */ - public function sceneDelete() - { - return $this->only(['id']); - } - - - /** - * @notes 详情场景 - * @return ProjectProgressPaymentDetailValidate - * @author likeadmin - * @date 2024/02/23 14:17 - */ - public function sceneDetail() - { - return $this->only(['id']); - } - -} \ No newline at end of file + 'require', + + ]; + + + /** + * 参数描述 + * @var string[] + */ + protected $field = [ + 'id' => 'id', + + ]; + + + /** + * @notes 添加场景 + * @return ProjectProgressPaymentDetailValidate + * @author likeadmin + * @date 2024/02/23 14:17 + */ + public function sceneAdd() + { + return $this->remove('id', true); + } + + + /** + * @notes 编辑场景 + * @return ProjectProgressPaymentDetailValidate + * @author likeadmin + * @date 2024/02/23 14:17 + */ + public function sceneEdit() + { + return $this->only(['id']); + } + + + /** + * @notes 删除场景 + * @return ProjectProgressPaymentDetailValidate + * @author likeadmin + * @date 2024/02/23 14:17 + */ + public function sceneDelete() + { + return $this->only(['id'])->remove('id', 'checkData'); + } + + + /** + * @notes 详情场景 + * @return ProjectProgressPaymentDetailValidate + * @author likeadmin + * @date 2024/02/23 14:17 + */ + public function sceneDetail() + { + return $this->only(['id']); + } + + } \ No newline at end of file diff --git a/app/adminapi/validate/project_process_management/ProjectProgressPaymentValidate.php b/app/adminapi/validate/project_process_management/ProjectProgressPaymentValidate.php index 2c2634cc2..f8d7e54e4 100644 --- a/app/adminapi/validate/project_process_management/ProjectProgressPaymentValidate.php +++ b/app/adminapi/validate/project_process_management/ProjectProgressPaymentValidate.php @@ -1,94 +1,96 @@ - 'require', - ]; - - - /** - * 参数描述 - * @var string[] - */ - protected $field = [ - 'id' => 'id', - ]; - - - /** - * @notes 添加场景 - * @return ProjectProgressPaymentValidate - * @author likeadmin - * @date 2024/02/23 13:47 - */ - public function sceneAdd() - { - return $this->remove('id', true); - } - - - /** - * @notes 编辑场景 - * @return ProjectProgressPaymentValidate - * @author likeadmin - * @date 2024/02/23 13:47 - */ - public function sceneEdit() - { - return $this->only(['id']); - } - - - /** - * @notes 删除场景 - * @return ProjectProgressPaymentValidate - * @author likeadmin - * @date 2024/02/23 13:47 - */ - public function sceneDelete() - { - return $this->only(['id']); - } - - - /** - * @notes 详情场景 - * @return ProjectProgressPaymentValidate - * @author likeadmin - * @date 2024/02/23 13:47 - */ - public function sceneDetail() - { - return $this->only(['id']); - } - -} \ No newline at end of file + 'require', + + ]; + + + /** + * 参数描述 + * @var string[] + */ + protected $field = [ + 'id' => 'id', + + ]; + + + /** + * @notes 添加场景 + * @return ProjectProgressPaymentValidate + * @author likeadmin + * @date 2024/02/23 13:47 + */ + public function sceneAdd() + { + return $this->remove('id', true); + } + + + /** + * @notes 编辑场景 + * @return ProjectProgressPaymentValidate + * @author likeadmin + * @date 2024/02/23 13:47 + */ + public function sceneEdit() + { + return $this->only(['id']); + } + + + /** + * @notes 删除场景 + * @return ProjectProgressPaymentValidate + * @author likeadmin + * @date 2024/02/23 13:47 + */ + public function sceneDelete() + { + return $this->only(['id'])->remove('id', 'checkData'); + } + + + /** + * @notes 详情场景 + * @return ProjectProgressPaymentValidate + * @author likeadmin + * @date 2024/02/23 13:47 + */ + public function sceneDetail() + { + return $this->only(['id']); + } + + } \ No newline at end of file diff --git a/app/adminapi/validate/project_process_management/ProjectRectificationValidate.php b/app/adminapi/validate/project_process_management/ProjectRectificationValidate.php index 4bf125b58..721ed901b 100644 --- a/app/adminapi/validate/project_process_management/ProjectRectificationValidate.php +++ b/app/adminapi/validate/project_process_management/ProjectRectificationValidate.php @@ -1,94 +1,96 @@ - 'require', - ]; - - - /** - * 参数描述 - * @var string[] - */ - protected $field = [ - 'id' => 'id', - ]; - - - /** - * @notes 添加场景 - * @return ProjectRectificationValidate - * @author likeadmin - * @date 2024/02/23 11:22 - */ - public function sceneAdd() - { - return $this->remove('id', true); - } - - - /** - * @notes 编辑场景 - * @return ProjectRectificationValidate - * @author likeadmin - * @date 2024/02/23 11:22 - */ - public function sceneEdit() - { - return $this->only(['id']); - } - - - /** - * @notes 删除场景 - * @return ProjectRectificationValidate - * @author likeadmin - * @date 2024/02/23 11:22 - */ - public function sceneDelete() - { - return $this->only(['id']); - } - - - /** - * @notes 详情场景 - * @return ProjectRectificationValidate - * @author likeadmin - * @date 2024/02/23 11:22 - */ - public function sceneDetail() - { - return $this->only(['id']); - } - -} \ No newline at end of file + 'require', + + ]; + + + /** + * 参数描述 + * @var string[] + */ + protected $field = [ + 'id' => 'id', + + ]; + + + /** + * @notes 添加场景 + * @return ProjectRectificationValidate + * @author likeadmin + * @date 2024/02/23 11:22 + */ + public function sceneAdd() + { + return $this->remove('id', true); + } + + + /** + * @notes 编辑场景 + * @return ProjectRectificationValidate + * @author likeadmin + * @date 2024/02/23 11:22 + */ + public function sceneEdit() + { + return $this->only(['id']); + } + + + /** + * @notes 删除场景 + * @return ProjectRectificationValidate + * @author likeadmin + * @date 2024/02/23 11:22 + */ + public function sceneDelete() + { + return $this->only(['id'])->remove('id', 'checkData'); + } + + + /** + * @notes 详情场景 + * @return ProjectRectificationValidate + * @author likeadmin + * @date 2024/02/23 11:22 + */ + public function sceneDetail() + { + return $this->only(['id']); + } + + } \ No newline at end of file diff --git a/app/adminapi/validate/project_process_management/ProjectSurveySignatureValidate.php b/app/adminapi/validate/project_process_management/ProjectSurveySignatureValidate.php index 49176d764..560c55333 100644 --- a/app/adminapi/validate/project_process_management/ProjectSurveySignatureValidate.php +++ b/app/adminapi/validate/project_process_management/ProjectSurveySignatureValidate.php @@ -1,94 +1,96 @@ - 'require', - ]; - - - /** - * 参数描述 - * @var string[] - */ - protected $field = [ - 'id' => 'id', - ]; - - - /** - * @notes 添加场景 - * @return ProjectSurveySignatureValidate - * @author likeadmin - * @date 2024/02/23 11:06 - */ - public function sceneAdd() - { - return $this->remove('id', true); - } - - - /** - * @notes 编辑场景 - * @return ProjectSurveySignatureValidate - * @author likeadmin - * @date 2024/02/23 11:06 - */ - public function sceneEdit() - { - return $this->only(['id']); - } - - - /** - * @notes 删除场景 - * @return ProjectSurveySignatureValidate - * @author likeadmin - * @date 2024/02/23 11:06 - */ - public function sceneDelete() - { - return $this->only(['id']); - } - - - /** - * @notes 详情场景 - * @return ProjectSurveySignatureValidate - * @author likeadmin - * @date 2024/02/23 11:06 - */ - public function sceneDetail() - { - return $this->only(['id']); - } - -} \ No newline at end of file + 'require', + + ]; + + + /** + * 参数描述 + * @var string[] + */ + protected $field = [ + 'id' => 'id', + + ]; + + + /** + * @notes 添加场景 + * @return ProjectSurveySignatureValidate + * @author likeadmin + * @date 2024/02/23 11:06 + */ + public function sceneAdd() + { + return $this->remove('id', true); + } + + + /** + * @notes 编辑场景 + * @return ProjectSurveySignatureValidate + * @author likeadmin + * @date 2024/02/23 11:06 + */ + public function sceneEdit() + { + return $this->only(['id']); + } + + + /** + * @notes 删除场景 + * @return ProjectSurveySignatureValidate + * @author likeadmin + * @date 2024/02/23 11:06 + */ + public function sceneDelete() + { + return $this->only(['id'])->remove('id', 'checkData'); + } + + + /** + * @notes 详情场景 + * @return ProjectSurveySignatureValidate + * @author likeadmin + * @date 2024/02/23 11:06 + */ + public function sceneDetail() + { + return $this->only(['id']); + } + + } \ No newline at end of file diff --git a/app/adminapi/validate/quality/QualityAcceptValidate.php b/app/adminapi/validate/quality/QualityAcceptValidate.php index 329e797b8..6ddb1a7ac 100644 --- a/app/adminapi/validate/quality/QualityAcceptValidate.php +++ b/app/adminapi/validate/quality/QualityAcceptValidate.php @@ -11,129 +11,130 @@ // +---------------------------------------------------------------------- // | author: likeadminTeam // +---------------------------------------------------------------------- - -namespace app\adminapi\validate\quality; - - -use app\common\model\dept\Dept; -use app\common\model\dept\Orgs; -use app\common\model\project\Project; -use app\common\validate\BaseValidate; - - -/** - * 质量验收验证器 - * Class QualityAcceptValidate - * @package app\adminapi\validate\quality - */ -class QualityAcceptValidate extends BaseValidate -{ - - /** - * 设置校验规则 - * @var string[] - */ - protected $rule = [ - 'id' => 'require', - 'org_id' => 'require|checkOrg', - 'dept_id' => 'require|checkDept', - 'project_id' => 'require|checkProject', - 'accept_date' => 'dateFormat:Y-m-d', - 'file' => 'checkFile', - ]; - protected $message = [ - 'id.require' => '缺少必要参数', - 'org_id.require' => '请选择组织', - 'dept_id.require' => '请选择部门', - 'project_id.require' => '请选择项目', - 'accept_date.dateFormat' => '验收日期格式错误', - ]; + namespace app\adminapi\validate\quality; - - /** - * @notes 添加场景 - * @return QualityAcceptValidate - * @author likeadmin - * @date 2023/12/21 15:03 - */ - public function sceneAdd() - { - return $this->remove('id',true); - } - - - /** - * @notes 编辑场景 - * @return QualityAcceptValidate - * @author likeadmin - * @date 2023/12/21 15:03 - */ - public function sceneEdit() - {} - - - /** - * @notes 删除场景 - * @return QualityAcceptValidate - * @author likeadmin - * @date 2023/12/21 15:03 - */ - public function sceneDelete() - { - return $this->only(['id']); - } - - - /** - * @notes 详情场景 - * @return QualityAcceptValidate - * @author likeadmin - * @date 2023/12/21 15:03 - */ - public function sceneDetail() - { - return $this->only(['id']); - } - public function checkOrg($value): bool|string + use app\common\model\dept\Dept; + use app\common\model\dept\Orgs; + use app\common\model\project\Project; + use app\common\validate\BaseValidate; + + + /** + * 质量验收验证器 + * Class QualityAcceptValidate + * @package app\adminapi\validate\quality + */ + class QualityAcceptValidate extends BaseValidate { - $data = Orgs::where('id',$value)->findOrEmpty(); - if($data->isEmpty()){ - return '组织不存在'; + + /** + * 设置校验规则 + * @var string[] + */ + protected $rule = [ + 'id' => 'require', + 'org_id' => 'require|checkOrg', + 'dept_id' => 'require|checkDept', + 'project_id' => 'require|checkProject', + 'accept_date' => 'dateFormat:Y-m-d', + 'file' => 'checkFile', + ]; + + protected $message = [ + 'id.require' => '缺少必要参数', + 'org_id.require' => '请选择组织', + 'dept_id.require' => '请选择部门', + 'project_id.require' => '请选择项目', + 'accept_date.dateFormat' => '验收日期格式错误', + ]; + + + /** + * @notes 添加场景 + * @return QualityAcceptValidate + * @author likeadmin + * @date 2023/12/21 15:03 + */ + public function sceneAdd() + { + return $this->remove('id', true); } - return true; - } - - public function checkDept($value,$rule,$data): bool|string - { - $dept = Dept::where('id',$value)->findOrEmpty(); - if($dept->isEmpty()){ - return '部门不存在'; + + + /** + * @notes 编辑场景 + * @return QualityAcceptValidate + * @author likeadmin + * @date 2023/12/21 15:03 + */ + public function sceneEdit() + { } - if($dept['org_id'] != $data['org_id']){ - return '部门不属于当前选择的组织'; + + + /** + * @notes 删除场景 + * @return QualityAcceptValidate + * @author likeadmin + * @date 2023/12/21 15:03 + */ + public function sceneDelete() + { + return $this->only(['id'])->remove('id', 'checkData'); } - return true; - } - - public function checkProject($value): bool|string - { - $data = Project::where('id',$value)->findOrEmpty(); - if($data->isEmpty()){ - return '项目不存在'; + + + /** + * @notes 详情场景 + * @return QualityAcceptValidate + * @author likeadmin + * @date 2023/12/21 15:03 + */ + public function sceneDetail() + { + return $this->only(['id']); } - return true; - } - - public function checkFile($value): bool|string - { - if(!empty($value) && $value != ''){ - if(!is_array($value)){ - return '附件必须是json数组'; + + public function checkOrg($value): bool|string + { + $data = Orgs::where('id', $value)->findOrEmpty(); + if ($data->isEmpty()) { + return '组织不存在'; } + return true; } - return true; - } - -} \ No newline at end of file + + public function checkDept($value, $rule, $data): bool|string + { + $dept = Dept::where('id', $value)->findOrEmpty(); + if ($dept->isEmpty()) { + return '部门不存在'; + } + if ($dept['org_id'] != $data['org_id']) { + return '部门不属于当前选择的组织'; + } + return true; + } + + public function checkProject($value): bool|string + { + $data = Project::where('id', $value)->findOrEmpty(); + if ($data->isEmpty()) { + return '项目不存在'; + } + return true; + } + + public function checkFile($value): bool|string + { + if (!empty($value) && $value != '') { + if (!is_array($value)) { + return '附件必须是json数组'; + } + } + return true; + } + + } \ No newline at end of file diff --git a/app/adminapi/validate/quality/QualityAccidentValidate.php b/app/adminapi/validate/quality/QualityAccidentValidate.php index cd468f029..ecffdb3d0 100644 --- a/app/adminapi/validate/quality/QualityAccidentValidate.php +++ b/app/adminapi/validate/quality/QualityAccidentValidate.php @@ -11,129 +11,130 @@ // +---------------------------------------------------------------------- // | author: likeadminTeam // +---------------------------------------------------------------------- - -namespace app\adminapi\validate\quality; - - -use app\common\model\dept\Dept; -use app\common\model\dept\Orgs; -use app\common\model\project\Project; -use app\common\validate\BaseValidate; - - -/** - * 质量事故验证器 - * Class QualityAccidentValidate - * @package app\adminapi\validate\quality - */ -class QualityAccidentValidate extends BaseValidate -{ - - /** - * 设置校验规则 - * @var string[] - */ - protected $rule = [ - 'id' => 'require', - 'org_id' => 'require|checkOrg', - 'dept_id' => 'require|checkDept', - 'project_id' => 'require|checkProject', - 'happen_date' => 'dateFormat:Y-m-d', - 'file' => 'checkFile', - ]; - protected $message = [ - 'id.require' => '缺少必要参数', - 'org_id.require' => '请选择组织', - 'dept_id.require' => '请选择部门', - 'project_id.require' => '请选择项目', - 'happen_date.dateFormat' => '发生日期格式错误', - ]; - - - /** - * @notes 添加场景 - * @return QualityAccidentValidate - * @author likeadmin - * @date 2023/12/21 14:03 - */ - public function sceneAdd() - { - return $this->remove('id',true); - } - - - /** - * @notes 编辑场景 - * @return QualityAccidentValidate - * @author likeadmin - * @date 2023/12/21 14:03 - */ - public function sceneEdit() - {} - - - /** - * @notes 删除场景 - * @return QualityAccidentValidate - * @author likeadmin - * @date 2023/12/21 14:03 - */ - public function sceneDelete() - { - return $this->only(['id']); - } - - - /** - * @notes 详情场景 - * @return QualityAccidentValidate - * @author likeadmin - * @date 2023/12/21 14:03 - */ - public function sceneDetail() - { - return $this->only(['id']); - } + namespace app\adminapi\validate\quality; - public function checkOrg($value): bool|string + + use app\common\model\dept\Dept; + use app\common\model\dept\Orgs; + use app\common\model\project\Project; + use app\common\validate\BaseValidate; + + + /** + * 质量事故验证器 + * Class QualityAccidentValidate + * @package app\adminapi\validate\quality + */ + class QualityAccidentValidate extends BaseValidate { - $data = Orgs::where('id',$value)->findOrEmpty(); - if($data->isEmpty()){ - return '组织不存在'; + + /** + * 设置校验规则 + * @var string[] + */ + protected $rule = [ + 'id' => 'require', + 'org_id' => 'require|checkOrg', + 'dept_id' => 'require|checkDept', + 'project_id' => 'require|checkProject', + 'happen_date' => 'dateFormat:Y-m-d', + 'file' => 'checkFile', + ]; + + protected $message = [ + 'id.require' => '缺少必要参数', + 'org_id.require' => '请选择组织', + 'dept_id.require' => '请选择部门', + 'project_id.require' => '请选择项目', + 'happen_date.dateFormat' => '发生日期格式错误', + ]; + + + /** + * @notes 添加场景 + * @return QualityAccidentValidate + * @author likeadmin + * @date 2023/12/21 14:03 + */ + public function sceneAdd() + { + return $this->remove('id', true); } - return true; - } - - public function checkDept($value,$rule,$data): bool|string - { - $dept = Dept::where('id',$value)->findOrEmpty(); - if($dept->isEmpty()){ - return '部门不存在'; + + + /** + * @notes 编辑场景 + * @return QualityAccidentValidate + * @author likeadmin + * @date 2023/12/21 14:03 + */ + public function sceneEdit() + { } - if($dept['org_id'] != $data['org_id']){ - return '部门不属于当前选择的组织'; + + + /** + * @notes 删除场景 + * @return QualityAccidentValidate + * @author likeadmin + * @date 2023/12/21 14:03 + */ + public function sceneDelete() + { + return $this->only(['id'])->remove('id', 'checkData'); } - return true; - } - - public function checkProject($value): bool|string - { - $data = Project::where('id',$value)->findOrEmpty(); - if($data->isEmpty()){ - return '项目不存在'; + + + /** + * @notes 详情场景 + * @return QualityAccidentValidate + * @author likeadmin + * @date 2023/12/21 14:03 + */ + public function sceneDetail() + { + return $this->only(['id']); } - return true; - } - - public function checkFile($value): bool|string - { - if(!empty($value) && $value != ''){ - if(!is_array($value)){ - return '附件必须是json数组'; + + public function checkOrg($value): bool|string + { + $data = Orgs::where('id', $value)->findOrEmpty(); + if ($data->isEmpty()) { + return '组织不存在'; } + return true; } - return true; - } - -} \ No newline at end of file + + public function checkDept($value, $rule, $data): bool|string + { + $dept = Dept::where('id', $value)->findOrEmpty(); + if ($dept->isEmpty()) { + return '部门不存在'; + } + if ($dept['org_id'] != $data['org_id']) { + return '部门不属于当前选择的组织'; + } + return true; + } + + public function checkProject($value): bool|string + { + $data = Project::where('id', $value)->findOrEmpty(); + if ($data->isEmpty()) { + return '项目不存在'; + } + return true; + } + + public function checkFile($value): bool|string + { + if (!empty($value) && $value != '') { + if (!is_array($value)) { + return '附件必须是json数组'; + } + } + return true; + } + + } \ No newline at end of file diff --git a/app/adminapi/validate/quality/QualityCheckNatureValidate.php b/app/adminapi/validate/quality/QualityCheckNatureValidate.php index 941a81d81..a3ae48b0d 100644 --- a/app/adminapi/validate/quality/QualityCheckNatureValidate.php +++ b/app/adminapi/validate/quality/QualityCheckNatureValidate.php @@ -11,110 +11,111 @@ // +---------------------------------------------------------------------- // | author: likeadminTeam // +---------------------------------------------------------------------- - -namespace app\adminapi\validate\quality; - - -use app\common\model\dept\Dept; -use app\common\model\dept\Orgs; -use app\common\validate\BaseValidate; - - -/** - * 检查性质验证器 - * Class QualityCheckNatureValidate - * @package app\adminapi\validate\quality - */ -class QualityCheckNatureValidate extends BaseValidate -{ - - /** - * 设置校验规则 - * @var string[] - */ - protected $rule = [ - 'id' => 'require', - 'org_id' => 'require|checkOrg', - 'dept_id' => 'require|checkDept', - 'name' => 'require', - 'user' => 'require', - 'date' => 'dateFormat:Y-m-d', - ]; - protected $message = [ - 'id.require' => '缺少必要参数', - 'org_id.require' => '请选择组织', - 'dept_id.require' => '请选择部门', - 'name.require' => '请填写检查性质名称', - 'user.require' => '请填写创建人', - 'date.dateFormat' => '创建日期格式错误' - ]; + namespace app\adminapi\validate\quality; - - /** - * @notes 添加场景 - * @return QualityCheckNatureValidate - * @author likeadmin - * @date 2023/12/20 15:56 - */ - public function sceneAdd() - { - return $this->remove('id',true); - } - - - /** - * @notes 编辑场景 - * @return QualityCheckNatureValidate - * @author likeadmin - * @date 2023/12/20 15:56 - */ - public function sceneEdit() - {} - - - /** - * @notes 删除场景 - * @return QualityCheckNatureValidate - * @author likeadmin - * @date 2023/12/20 15:56 - */ - public function sceneDelete() - { - return $this->only(['id']); - } - - - /** - * @notes 详情场景 - * @return QualityCheckNatureValidate - * @author likeadmin - * @date 2023/12/20 15:56 - */ - public function sceneDetail() - { - return $this->only(['id']); - } - public function checkOrg($value): bool|string + use app\common\model\dept\Dept; + use app\common\model\dept\Orgs; + use app\common\validate\BaseValidate; + + + /** + * 检查性质验证器 + * Class QualityCheckNatureValidate + * @package app\adminapi\validate\quality + */ + class QualityCheckNatureValidate extends BaseValidate { - $data = Orgs::where('id',$value)->findOrEmpty(); - if($data->isEmpty()){ - return '组织不存在'; + + /** + * 设置校验规则 + * @var string[] + */ + protected $rule = [ + 'id' => 'require', + 'org_id' => 'require|checkOrg', + 'dept_id' => 'require|checkDept', + 'name' => 'require', + 'user' => 'require', + 'date' => 'dateFormat:Y-m-d', + ]; + + protected $message = [ + 'id.require' => '缺少必要参数', + 'org_id.require' => '请选择组织', + 'dept_id.require' => '请选择部门', + 'name.require' => '请填写检查性质名称', + 'user.require' => '请填写创建人', + 'date.dateFormat' => '创建日期格式错误' + ]; + + + /** + * @notes 添加场景 + * @return QualityCheckNatureValidate + * @author likeadmin + * @date 2023/12/20 15:56 + */ + public function sceneAdd() + { + return $this->remove('id', true); } - return true; - } - - public function checkDept($value,$rule,$data): bool|string - { - $dept = Dept::where('id',$value)->findOrEmpty(); - if($dept->isEmpty()){ - return '部门不存在'; + + + /** + * @notes 编辑场景 + * @return QualityCheckNatureValidate + * @author likeadmin + * @date 2023/12/20 15:56 + */ + public function sceneEdit() + { } - if($dept['org_id'] != $data['org_id']){ - return '部门不属于当前选择的组织'; + + + /** + * @notes 删除场景 + * @return QualityCheckNatureValidate + * @author likeadmin + * @date 2023/12/20 15:56 + */ + public function sceneDelete() + { + return $this->only(['id'])->remove('id', 'checkData'); } - return true; - } - -} \ No newline at end of file + + + /** + * @notes 详情场景 + * @return QualityCheckNatureValidate + * @author likeadmin + * @date 2023/12/20 15:56 + */ + public function sceneDetail() + { + return $this->only(['id']); + } + + public function checkOrg($value): bool|string + { + $data = Orgs::where('id', $value)->findOrEmpty(); + if ($data->isEmpty()) { + return '组织不存在'; + } + return true; + } + + public function checkDept($value, $rule, $data): bool|string + { + $dept = Dept::where('id', $value)->findOrEmpty(); + if ($dept->isEmpty()) { + return '部门不存在'; + } + if ($dept['org_id'] != $data['org_id']) { + return '部门不属于当前选择的组织'; + } + return true; + } + + } \ No newline at end of file diff --git a/app/adminapi/validate/quality/QualityCheckValidate.php b/app/adminapi/validate/quality/QualityCheckValidate.php index 3336b764c..5f42e2962 100644 --- a/app/adminapi/validate/quality/QualityCheckValidate.php +++ b/app/adminapi/validate/quality/QualityCheckValidate.php @@ -11,118 +11,119 @@ // +---------------------------------------------------------------------- // | author: likeadminTeam // +---------------------------------------------------------------------- - -namespace app\adminapi\validate\quality; - - -use app\common\model\dept\Dept; -use app\common\model\dept\Orgs; -use app\common\model\project\Project; -use app\common\validate\BaseValidate; - - -/** - * 质量检查验证器 - * Class QualityCheckValidate - * @package app\adminapi\validate\quality - */ -class QualityCheckValidate extends BaseValidate -{ - - /** - * 设置校验规则 - * @var string[] - */ - protected $rule = [ - 'id' => 'require', - 'org_id' => 'require|checkOrg', - 'dept_id' => 'require|checkDept', - 'project_id' => 'require|checkProject', - 'check_date' => 'dateFormat:Y-m-d', - ]; - protected $message = [ - 'id.require' => '缺少必要参数', - 'org_id.require' => '请选择组织', - 'dept_id.require' => '请选择部门', - 'project_id.require' => '请选择项目', - 'check_date.dateFormat' => '检查日期格式错误', - ]; + namespace app\adminapi\validate\quality; - /** - * @notes 添加场景 - * @return QualityCheckValidate - * @author likeadmin - * @date 2023/12/20 17:06 - */ - public function sceneAdd() - { - return $this->remove('id',true); - } - - - /** - * @notes 编辑场景 - * @return QualityCheckValidate - * @author likeadmin - * @date 2023/12/20 17:06 - */ - public function sceneEdit() - {} - - - /** - * @notes 删除场景 - * @return QualityCheckValidate - * @author likeadmin - * @date 2023/12/20 17:06 - */ - public function sceneDelete() - { - return $this->only(['id']); - } - - - /** - * @notes 详情场景 - * @return QualityCheckValidate - * @author likeadmin - * @date 2023/12/20 17:06 - */ - public function sceneDetail() - { - return $this->only(['id']); - } + use app\common\model\dept\Dept; + use app\common\model\dept\Orgs; + use app\common\model\project\Project; + use app\common\validate\BaseValidate; - public function checkOrg($value): bool|string + + /** + * 质量检查验证器 + * Class QualityCheckValidate + * @package app\adminapi\validate\quality + */ + class QualityCheckValidate extends BaseValidate { - $data = Orgs::where('id',$value)->findOrEmpty(); - if($data->isEmpty()){ - return '组织不存在'; + + /** + * 设置校验规则 + * @var string[] + */ + protected $rule = [ + 'id' => 'require', + 'org_id' => 'require|checkOrg', + 'dept_id' => 'require|checkDept', + 'project_id' => 'require|checkProject', + 'check_date' => 'dateFormat:Y-m-d', + ]; + + protected $message = [ + 'id.require' => '缺少必要参数', + 'org_id.require' => '请选择组织', + 'dept_id.require' => '请选择部门', + 'project_id.require' => '请选择项目', + 'check_date.dateFormat' => '检查日期格式错误', + ]; + + + /** + * @notes 添加场景 + * @return QualityCheckValidate + * @author likeadmin + * @date 2023/12/20 17:06 + */ + public function sceneAdd() + { + return $this->remove('id', true); } - return true; - } - - public function checkDept($value,$rule,$data): bool|string - { - $dept = Dept::where('id',$value)->findOrEmpty(); - if($dept->isEmpty()){ - return '部门不存在'; + + + /** + * @notes 编辑场景 + * @return QualityCheckValidate + * @author likeadmin + * @date 2023/12/20 17:06 + */ + public function sceneEdit() + { } - if($dept['org_id'] != $data['org_id']){ - return '部门不属于当前选择的组织'; + + + /** + * @notes 删除场景 + * @return QualityCheckValidate + * @author likeadmin + * @date 2023/12/20 17:06 + */ + public function sceneDelete() + { + return $this->only(['id'])->remove('id', 'checkData'); } - return true; - } - - public function checkProject($value): bool|string - { - $data = Project::where('id',$value)->findOrEmpty(); - if($data->isEmpty()){ - return '项目不存在'; + + + /** + * @notes 详情场景 + * @return QualityCheckValidate + * @author likeadmin + * @date 2023/12/20 17:06 + */ + public function sceneDetail() + { + return $this->only(['id']); } - return true; - } - -} \ No newline at end of file + + public function checkOrg($value): bool|string + { + $data = Orgs::where('id', $value)->findOrEmpty(); + if ($data->isEmpty()) { + return '组织不存在'; + } + return true; + } + + public function checkDept($value, $rule, $data): bool|string + { + $dept = Dept::where('id', $value)->findOrEmpty(); + if ($dept->isEmpty()) { + return '部门不存在'; + } + if ($dept['org_id'] != $data['org_id']) { + return '部门不属于当前选择的组织'; + } + return true; + } + + public function checkProject($value): bool|string + { + $data = Project::where('id', $value)->findOrEmpty(); + if ($data->isEmpty()) { + return '项目不存在'; + } + return true; + } + + } \ No newline at end of file diff --git a/app/adminapi/validate/quality/QualityDetectionTempValidate.php b/app/adminapi/validate/quality/QualityDetectionTempValidate.php index 09d6e0b52..350d5e0ea 100644 --- a/app/adminapi/validate/quality/QualityDetectionTempValidate.php +++ b/app/adminapi/validate/quality/QualityDetectionTempValidate.php @@ -11,127 +11,128 @@ // +---------------------------------------------------------------------- // | author: likeadminTeam // +---------------------------------------------------------------------- - -namespace app\adminapi\validate\quality; - - -use app\common\model\dept\Dept; -use app\common\model\dept\Orgs; -use app\common\model\dict\DictData; -use app\common\validate\BaseValidate; - - -/** - * 质量检测模板验证器 - * Class QualityDetectionTempValidate - * @package app\adminapi\validate\quality - */ -class QualityDetectionTempValidate extends BaseValidate -{ - - /** - * 设置校验规则 - * @var string[] - */ - protected $rule = [ - 'id' => 'require', - 'org_id' => 'require|checkOrg', - 'dept_id' => 'require|checkDept', - 'node' => 'require|checkNode', - 'file' => 'checkFile', - ]; - protected $message = [ - 'id.require' => '缺少必要参数', - 'org_id.require' => '请选择组织', - 'dept_id.require' => '请选择部门', - 'node.require' => '请选择质量检测节点', - ]; - - - /** - * @notes 添加场景 - * @return QualityDetectionTempValidate - * @author likeadmin - * @date 2023/12/21 15:41 - */ - public function sceneAdd() - { - return $this->remove('id',true); - } - - - /** - * @notes 编辑场景 - * @return QualityDetectionTempValidate - * @author likeadmin - * @date 2023/12/21 15:41 - */ - public function sceneEdit() - {} - - - /** - * @notes 删除场景 - * @return QualityDetectionTempValidate - * @author likeadmin - * @date 2023/12/21 15:41 - */ - public function sceneDelete() - { - return $this->only(['id']); - } - - - /** - * @notes 详情场景 - * @return QualityDetectionTempValidate - * @author likeadmin - * @date 2023/12/21 15:41 - */ - public function sceneDetail() - { - return $this->only(['id']); - } + namespace app\adminapi\validate\quality; - public function checkOrg($value): bool|string + + use app\common\model\dept\Dept; + use app\common\model\dept\Orgs; + use app\common\model\dict\DictData; + use app\common\validate\BaseValidate; + + + /** + * 质量检测模板验证器 + * Class QualityDetectionTempValidate + * @package app\adminapi\validate\quality + */ + class QualityDetectionTempValidate extends BaseValidate { - $data = Orgs::where('id',$value)->findOrEmpty(); - if($data->isEmpty()){ - return '组织不存在'; + + /** + * 设置校验规则 + * @var string[] + */ + protected $rule = [ + 'id' => 'require', + 'org_id' => 'require|checkOrg', + 'dept_id' => 'require|checkDept', + 'node' => 'require|checkNode', + 'file' => 'checkFile', + ]; + + protected $message = [ + 'id.require' => '缺少必要参数', + 'org_id.require' => '请选择组织', + 'dept_id.require' => '请选择部门', + 'node.require' => '请选择质量检测节点', + ]; + + + /** + * @notes 添加场景 + * @return QualityDetectionTempValidate + * @author likeadmin + * @date 2023/12/21 15:41 + */ + public function sceneAdd() + { + return $this->remove('id', true); } - return true; - } - - public function checkDept($value,$rule,$data): bool|string - { - $dept = Dept::where('id',$value)->findOrEmpty(); - if($dept->isEmpty()){ - return '部门不存在'; + + + /** + * @notes 编辑场景 + * @return QualityDetectionTempValidate + * @author likeadmin + * @date 2023/12/21 15:41 + */ + public function sceneEdit() + { } - if($dept['org_id'] != $data['org_id']){ - return '部门不属于当前选择的组织'; + + + /** + * @notes 删除场景 + * @return QualityDetectionTempValidate + * @author likeadmin + * @date 2023/12/21 15:41 + */ + public function sceneDelete() + { + return $this->only(['id'])->remove('id', 'checkData'); } - return true; - } - - public function checkFile($value): bool|string - { - if(!empty($value) && $value != ''){ - if(!is_array($value)){ - return '附件必须是json数组'; + + + /** + * @notes 详情场景 + * @return QualityDetectionTempValidate + * @author likeadmin + * @date 2023/12/21 15:41 + */ + public function sceneDetail() + { + return $this->only(['id']); + } + + public function checkOrg($value): bool|string + { + $data = Orgs::where('id', $value)->findOrEmpty(); + if ($data->isEmpty()) { + return '组织不存在'; } + return true; } - return true; - } - - public function checkNode($value): bool|string - { - $dictData = DictData::where('type_value','quality_detection_node')->column('value'); - if(!in_array($value,$dictData)){ - return '质量检测节点无效'; + + public function checkDept($value, $rule, $data): bool|string + { + $dept = Dept::where('id', $value)->findOrEmpty(); + if ($dept->isEmpty()) { + return '部门不存在'; + } + if ($dept['org_id'] != $data['org_id']) { + return '部门不属于当前选择的组织'; + } + return true; } - return true; - } - -} \ No newline at end of file + + public function checkFile($value): bool|string + { + if (!empty($value) && $value != '') { + if (!is_array($value)) { + return '附件必须是json数组'; + } + } + return true; + } + + public function checkNode($value): bool|string + { + $dictData = DictData::where('type_value', 'quality_detection_node')->column('value'); + if (!in_array($value, $dictData)) { + return '质量检测节点无效'; + } + return true; + } + + } \ No newline at end of file diff --git a/app/adminapi/validate/quality/QualityDetectionValidate.php b/app/adminapi/validate/quality/QualityDetectionValidate.php index 0ad9197be..ec1d655e6 100644 --- a/app/adminapi/validate/quality/QualityDetectionValidate.php +++ b/app/adminapi/validate/quality/QualityDetectionValidate.php @@ -1,129 +1,131 @@ 'require', - 'org_id' => 'require|checkOrg', - 'dept_id' => 'require|checkDept', - 'project_id' => 'require|checkProject', - 'scheduled_start_time' => 'dateFormat:Y-m-d', - 'scheduled_end_time' => 'dateFormat:Y-m-d', - 'actual_start_time' => 'dateFormat:Y-m-d', - 'actual_end_time' => 'dateFormat:Y-m-d', - 'file' => 'checkFile', - ]; - protected $message = [ - 'id.require' => '缺少必要参数', - 'org_id.require' => '请选择组织', - 'dept_id.require' => '请选择部门', - 'project_id.require' => '请选择项目', - 'scheduled_start_time.dateFormat' => '计划开始时间格式错误', - 'scheduled_end_time.dateFormat' => '计划结束时间格式错误', - 'actual_start_time.dateFormat' => '实际开始式错误', - 'actual_end_time.dateFormat' => '实际结束格式错误', - ]; + namespace app\adminapi\validate\quality; - /** - * @notes 添加场景 - * @return QualityDetectionValidate - * @author likeadmin - * @date 2023/12/21 16:14 - */ - public function sceneAdd() - { - return $this->remove('id',true); - } - - - /** - * @notes 编辑场景 - * @return QualityDetectionValidate - * @author likeadmin - * @date 2023/12/21 16:14 - */ - public function sceneEdit() - {} - - - /** - * @notes 删除场景 - * @return QualityDetectionValidate - * @author likeadmin - * @date 2023/12/21 16:14 - */ - public function sceneDelete() - { - return $this->only(['id']); - } - - - /** - * @notes 详情场景 - * @return QualityDetectionValidate - * @author likeadmin - * @date 2023/12/21 16:14 - */ - public function sceneDetail() - { - return $this->only(['id']); - } + use app\common\model\dept\Dept; + use app\common\model\dept\Orgs; + use app\common\model\project\Project; + use app\common\validate\BaseValidate; - public function checkOrg($value): bool|string + /** + * 质量检测验证器 + * Class QualityDetectionValidate + * @package app\adminapi\validate\quality + */ + class QualityDetectionValidate extends BaseValidate { - $data = Orgs::where('id',$value)->findOrEmpty(); - if($data->isEmpty()){ - return '组织不存在'; + + /** + * 设置校验规则 + * @var string[] + */ + protected $rule = [ + 'id' => 'require', + 'org_id' => 'require|checkOrg', + 'dept_id' => 'require|checkDept', + 'project_id' => 'require|checkProject', + 'scheduled_start_time' => 'dateFormat:Y-m-d', + 'scheduled_end_time' => 'dateFormat:Y-m-d', + 'actual_start_time' => 'dateFormat:Y-m-d', + 'actual_end_time' => 'dateFormat:Y-m-d', + 'file' => 'checkFile', + ]; + + protected $message = [ + 'id.require' => '缺少必要参数', + 'org_id.require' => '请选择组织', + 'dept_id.require' => '请选择部门', + 'project_id.require' => '请选择项目', + 'scheduled_start_time.dateFormat' => '计划开始时间格式错误', + 'scheduled_end_time.dateFormat' => '计划结束时间格式错误', + 'actual_start_time.dateFormat' => '实际开始式错误', + 'actual_end_time.dateFormat' => '实际结束格式错误', + ]; + + /** + * @notes 添加场景 + * @return QualityDetectionValidate + * @author likeadmin + * @date 2023/12/21 16:14 + */ + public function sceneAdd() + { + return $this->remove('id', true); } - return true; - } - - public function checkDept($value,$rule,$data): bool|string - { - $dept = Dept::where('id',$value)->findOrEmpty(); - if($dept->isEmpty()){ - return '部门不存在'; + + + /** + * @notes 编辑场景 + * @return QualityDetectionValidate + * @author likeadmin + * @date 2023/12/21 16:14 + */ + public function sceneEdit() + { } - if($dept['org_id'] != $data['org_id']){ - return '部门不属于当前选择的组织'; + + + /** + * @notes 删除场景 + * @return QualityDetectionValidate + * @author likeadmin + * @date 2023/12/21 16:14 + */ + public function sceneDelete() + { + return $this->only(['id'])->remove('id', 'checkData'); } - return true; - } - - public function checkProject($value): bool|string - { - $data = Project::where('id',$value)->findOrEmpty(); - if($data->isEmpty()){ - return '项目不存在'; + + + /** + * @notes 详情场景 + * @return QualityDetectionValidate + * @author likeadmin + * @date 2023/12/21 16:14 + */ + public function sceneDetail() + { + return $this->only(['id']); } - return true; - } - - public function checkFile($value): bool|string - { - if(!empty($value) && $value != ''){ - if(!is_array($value)){ - return '附件必须是json数组'; + + public function checkOrg($value): bool|string + { + $data = Orgs::where('id', $value)->findOrEmpty(); + if ($data->isEmpty()) { + return '组织不存在'; } + return true; } - return true; - } - -} \ No newline at end of file + + public function checkDept($value, $rule, $data): bool|string + { + $dept = Dept::where('id', $value)->findOrEmpty(); + if ($dept->isEmpty()) { + return '部门不存在'; + } + if ($dept['org_id'] != $data['org_id']) { + return '部门不属于当前选择的组织'; + } + return true; + } + + public function checkProject($value): bool|string + { + $data = Project::where('id', $value)->findOrEmpty(); + if ($data->isEmpty()) { + return '项目不存在'; + } + return true; + } + + public function checkFile($value): bool|string + { + if (!empty($value) && $value != '') { + if (!is_array($value)) { + return '附件必须是json数组'; + } + } + return true; + } + + } \ No newline at end of file diff --git a/app/adminapi/validate/quality/QualityEventValidate.php b/app/adminapi/validate/quality/QualityEventValidate.php index 989d166f8..affdb28c1 100644 --- a/app/adminapi/validate/quality/QualityEventValidate.php +++ b/app/adminapi/validate/quality/QualityEventValidate.php @@ -11,131 +11,132 @@ // +---------------------------------------------------------------------- // | author: likeadminTeam // +---------------------------------------------------------------------- - -namespace app\adminapi\validate\quality; - - -use app\common\model\dept\Dept; -use app\common\model\dept\Orgs; -use app\common\model\project\Project; -use app\common\validate\BaseValidate; - - -/** - * 质量事件验证器 - * Class QualityEventValidate - * @package app\adminapi\validate\quality - */ -class QualityEventValidate extends BaseValidate -{ - - /** - * 设置校验规则 - * @var string[] - */ - protected $rule = [ - 'id' => 'require', - 'org_id' => 'require|checkOrg', - 'dept_id' => 'require|checkDept', - 'project_id' => 'require|checkProject', - 'name' => 'require', - 'happen_date' => 'dateFormat:Y-m-d', - 'file' => 'checkFile', - ]; - protected $message = [ - 'id.require' => '缺少必要参数', - 'org_id.require' => '请选择组织', - 'dept_id.require' => '请选择部门', - 'project_id.require' => '请选择项目', - 'name.require' => '请填写事件名称', - 'happen_date.dateFormat' => '发生日期格式错误', - ]; - - /** - * @notes 添加场景 - * @return QualityEventValidate - * @author likeadmin - * @date 2023/12/21 09:42 - */ - public function sceneAdd() - { - return $this->remove('id',true); - } - - - /** - * @notes 编辑场景 - * @return QualityEventValidate - * @author likeadmin - * @date 2023/12/21 09:42 - */ - public function sceneEdit() - {} - - - /** - * @notes 删除场景 - * @return QualityEventValidate - * @author likeadmin - * @date 2023/12/21 09:42 - */ - public function sceneDelete() - { - return $this->only(['id']); - } - - - /** - * @notes 详情场景 - * @return QualityEventValidate - * @author likeadmin - * @date 2023/12/21 09:42 - */ - public function sceneDetail() - { - return $this->only(['id']); - } + namespace app\adminapi\validate\quality; - public function checkOrg($value): bool|string + + use app\common\model\dept\Dept; + use app\common\model\dept\Orgs; + use app\common\model\project\Project; + use app\common\validate\BaseValidate; + + + /** + * 质量事件验证器 + * Class QualityEventValidate + * @package app\adminapi\validate\quality + */ + class QualityEventValidate extends BaseValidate { - $data = Orgs::where('id',$value)->findOrEmpty(); - if($data->isEmpty()){ - return '组织不存在'; + + /** + * 设置校验规则 + * @var string[] + */ + protected $rule = [ + 'id' => 'require', + 'org_id' => 'require|checkOrg', + 'dept_id' => 'require|checkDept', + 'project_id' => 'require|checkProject', + 'name' => 'require', + 'happen_date' => 'dateFormat:Y-m-d', + 'file' => 'checkFile', + ]; + + protected $message = [ + 'id.require' => '缺少必要参数', + 'org_id.require' => '请选择组织', + 'dept_id.require' => '请选择部门', + 'project_id.require' => '请选择项目', + 'name.require' => '请填写事件名称', + 'happen_date.dateFormat' => '发生日期格式错误', + ]; + + /** + * @notes 添加场景 + * @return QualityEventValidate + * @author likeadmin + * @date 2023/12/21 09:42 + */ + public function sceneAdd() + { + return $this->remove('id', true); } - return true; - } - - public function checkDept($value,$rule,$data): bool|string - { - $dept = Dept::where('id',$value)->findOrEmpty(); - if($dept->isEmpty()){ - return '部门不存在'; + + + /** + * @notes 编辑场景 + * @return QualityEventValidate + * @author likeadmin + * @date 2023/12/21 09:42 + */ + public function sceneEdit() + { } - if($dept['org_id'] != $data['org_id']){ - return '部门不属于当前选择的组织'; + + + /** + * @notes 删除场景 + * @return QualityEventValidate + * @author likeadmin + * @date 2023/12/21 09:42 + */ + public function sceneDelete() + { + return $this->only(['id'])->remove('id', 'checkData'); } - return true; - } - - public function checkProject($value): bool|string - { - $data = Project::where('id',$value)->findOrEmpty(); - if($data->isEmpty()){ - return '项目不存在'; + + + /** + * @notes 详情场景 + * @return QualityEventValidate + * @author likeadmin + * @date 2023/12/21 09:42 + */ + public function sceneDetail() + { + return $this->only(['id']); } - return true; - } - - public function checkFile($value): bool|string - { - if($value != ''){ - $file =$value;// json_decode($value,true); - if(empty($file)){ - return '附件必须是json数组'; + + public function checkOrg($value): bool|string + { + $data = Orgs::where('id', $value)->findOrEmpty(); + if ($data->isEmpty()) { + return '组织不存在'; } + return true; } - return true; - } - -} \ No newline at end of file + + public function checkDept($value, $rule, $data): bool|string + { + $dept = Dept::where('id', $value)->findOrEmpty(); + if ($dept->isEmpty()) { + return '部门不存在'; + } + if ($dept['org_id'] != $data['org_id']) { + return '部门不属于当前选择的组织'; + } + return true; + } + + public function checkProject($value): bool|string + { + $data = Project::where('id', $value)->findOrEmpty(); + if ($data->isEmpty()) { + return '项目不存在'; + } + return true; + } + + public function checkFile($value): bool|string + { + if ($value != '') { + $file = $value;// json_decode($value,true); + if (empty($file)) { + return '附件必须是json数组'; + } + } + return true; + } + + } \ No newline at end of file diff --git a/app/adminapi/validate/quality/QualityMboValidate.php b/app/adminapi/validate/quality/QualityMboValidate.php index 4931fc846..43afd3621 100644 --- a/app/adminapi/validate/quality/QualityMboValidate.php +++ b/app/adminapi/validate/quality/QualityMboValidate.php @@ -11,130 +11,131 @@ // +---------------------------------------------------------------------- // | author: likeadminTeam // +---------------------------------------------------------------------- - -namespace app\adminapi\validate\quality; - - -use app\common\model\dept\Dept; -use app\common\model\dept\Orgs; -use app\common\model\project\Project; -use app\common\validate\BaseValidate; - - -/** - * 目标管理验证器 - * Class QualityMboValidate - * @package app\adminapi\validate\quality - */ -class QualityMboValidate extends BaseValidate -{ - - /** - * 设置校验规则 - * @var string[] - */ - protected $rule = [ - 'id' => 'require', - 'org_id' => 'require|checkOrg', - 'dept_id' => 'require|checkDept', - 'project_id' => 'require|checkProject', - 'pass_rate' => 'float|egt:0', - 'file' => 'checkFile' - ]; - protected $message = [ - 'id.require' => '缺少必要参数', - 'org_id.require' => '请选择组织', - 'dept_id.require' => '请选择部门', - 'project_id.require' => '请选择项目', - 'pass_rate.float' => '合格率值必须是数字', - 'pass_rate.egt' => '合格率值必须大于等于0', - ]; - - - /** - * @notes 添加场景 - * @return QualityMboValidate - * @author likeadmin - * @date 2023/12/21 09:17 - */ - public function sceneAdd() - { - return $this->remove('id',true); - } - - - /** - * @notes 编辑场景 - * @return QualityMboValidate - * @author likeadmin - * @date 2023/12/21 09:17 - */ - public function sceneEdit() - {} - - - /** - * @notes 删除场景 - * @return QualityMboValidate - * @author likeadmin - * @date 2023/12/21 09:17 - */ - public function sceneDelete() - { - return $this->only(['id']); - } - - - /** - * @notes 详情场景 - * @return QualityMboValidate - * @author likeadmin - * @date 2023/12/21 09:17 - */ - public function sceneDetail() - { - return $this->only(['id']); - } + namespace app\adminapi\validate\quality; - public function checkOrg($value): bool|string + + use app\common\model\dept\Dept; + use app\common\model\dept\Orgs; + use app\common\model\project\Project; + use app\common\validate\BaseValidate; + + + /** + * 目标管理验证器 + * Class QualityMboValidate + * @package app\adminapi\validate\quality + */ + class QualityMboValidate extends BaseValidate { - $data = Orgs::where('id',$value)->findOrEmpty(); - if($data->isEmpty()){ - return '组织不存在'; + + /** + * 设置校验规则 + * @var string[] + */ + protected $rule = [ + 'id' => 'require', + 'org_id' => 'require|checkOrg', + 'dept_id' => 'require|checkDept', + 'project_id' => 'require|checkProject', + 'pass_rate' => 'float|egt:0', + 'file' => 'checkFile' + ]; + + protected $message = [ + 'id.require' => '缺少必要参数', + 'org_id.require' => '请选择组织', + 'dept_id.require' => '请选择部门', + 'project_id.require' => '请选择项目', + 'pass_rate.float' => '合格率值必须是数字', + 'pass_rate.egt' => '合格率值必须大于等于0', + ]; + + + /** + * @notes 添加场景 + * @return QualityMboValidate + * @author likeadmin + * @date 2023/12/21 09:17 + */ + public function sceneAdd() + { + return $this->remove('id', true); } - return true; - } - - public function checkDept($value,$rule,$data): bool|string - { - $dept = Dept::where('id',$value)->findOrEmpty(); - if($dept->isEmpty()){ - return '部门不存在'; + + + /** + * @notes 编辑场景 + * @return QualityMboValidate + * @author likeadmin + * @date 2023/12/21 09:17 + */ + public function sceneEdit() + { } - if($dept['org_id'] != $data['org_id']){ - return '部门不属于当前选择的组织'; + + + /** + * @notes 删除场景 + * @return QualityMboValidate + * @author likeadmin + * @date 2023/12/21 09:17 + */ + public function sceneDelete() + { + return $this->only(['id'])->remove('id', 'checkData'); } - return true; - } - - public function checkProject($value): bool|string - { - $data = Project::where('id',$value)->findOrEmpty(); - if($data->isEmpty()){ - return '项目不存在'; + + + /** + * @notes 详情场景 + * @return QualityMboValidate + * @author likeadmin + * @date 2023/12/21 09:17 + */ + public function sceneDetail() + { + return $this->only(['id']); } - return true; - } - - public function checkFile($value): bool|string - { - if(!empty($value) && $value != ''){ - if(!is_array($value)){ - return '附件必须是json数组'; + + public function checkOrg($value): bool|string + { + $data = Orgs::where('id', $value)->findOrEmpty(); + if ($data->isEmpty()) { + return '组织不存在'; } + return true; } - return true; - } - -} \ No newline at end of file + + public function checkDept($value, $rule, $data): bool|string + { + $dept = Dept::where('id', $value)->findOrEmpty(); + if ($dept->isEmpty()) { + return '部门不存在'; + } + if ($dept['org_id'] != $data['org_id']) { + return '部门不属于当前选择的组织'; + } + return true; + } + + public function checkProject($value): bool|string + { + $data = Project::where('id', $value)->findOrEmpty(); + if ($data->isEmpty()) { + return '项目不存在'; + } + return true; + } + + public function checkFile($value): bool|string + { + if (!empty($value) && $value != '') { + if (!is_array($value)) { + return '附件必须是json数组'; + } + } + return true; + } + + } \ No newline at end of file diff --git a/app/adminapi/validate/quality/QualityModifyValidate.php b/app/adminapi/validate/quality/QualityModifyValidate.php index a3889d726..85fa598f4 100644 --- a/app/adminapi/validate/quality/QualityModifyValidate.php +++ b/app/adminapi/validate/quality/QualityModifyValidate.php @@ -11,117 +11,118 @@ // +---------------------------------------------------------------------- // | author: likeadminTeam // +---------------------------------------------------------------------- - -namespace app\adminapi\validate\quality; - - -use app\common\model\dept\Dept; -use app\common\model\dept\Orgs; -use app\common\model\project\Project; -use app\common\validate\BaseValidate; - - -/** - * 质量整改验证器 - * Class QualityModifyValidate - * @package app\adminapi\validate\quality - */ -class QualityModifyValidate extends BaseValidate -{ - - /** - * 设置校验规则 - * @var string[] - */ - protected $rule = [ - 'id' => 'require', - 'org_id' => 'require|checkOrg', - 'dept_id' => 'require|checkDept', - 'project_id' => 'require|checkProject', - 'check_date' => 'dateFormat:Y-m-d', - ]; - protected $message = [ - 'id.require' => '缺少必要参数', - 'org_id.require' => '请选择组织', - 'dept_id.require' => '请选择部门', - 'project_id.require' => '请选择项目', - 'check_date.dateFormat' => '检查日期格式错误', - ]; - - - /** - * @notes 添加场景 - * @return QualityModifyValidate - * @author likeadmin - * @date 2023/12/20 17:28 - */ - public function sceneAdd() - { - return $this->remove('id',true); - } - - - /** - * @notes 编辑场景 - * @return QualityModifyValidate - * @author likeadmin - * @date 2023/12/20 17:28 - */ - public function sceneEdit() - {} - - - /** - * @notes 删除场景 - * @return QualityModifyValidate - * @author likeadmin - * @date 2023/12/20 17:28 - */ - public function sceneDelete() - { - return $this->only(['id']); - } - - - /** - * @notes 详情场景 - * @return QualityModifyValidate - * @author likeadmin - * @date 2023/12/20 17:28 - */ - public function sceneDetail() - { - return $this->only(['id']); - } + namespace app\adminapi\validate\quality; - public function checkOrg($value): bool|string + + use app\common\model\dept\Dept; + use app\common\model\dept\Orgs; + use app\common\model\project\Project; + use app\common\validate\BaseValidate; + + + /** + * 质量整改验证器 + * Class QualityModifyValidate + * @package app\adminapi\validate\quality + */ + class QualityModifyValidate extends BaseValidate { - $data = Orgs::where('id',$value)->findOrEmpty(); - if($data->isEmpty()){ - return '组织不存在'; + + /** + * 设置校验规则 + * @var string[] + */ + protected $rule = [ + 'id' => 'require', + 'org_id' => 'require|checkOrg', + 'dept_id' => 'require|checkDept', + 'project_id' => 'require|checkProject', + 'check_date' => 'dateFormat:Y-m-d', + ]; + + protected $message = [ + 'id.require' => '缺少必要参数', + 'org_id.require' => '请选择组织', + 'dept_id.require' => '请选择部门', + 'project_id.require' => '请选择项目', + 'check_date.dateFormat' => '检查日期格式错误', + ]; + + + /** + * @notes 添加场景 + * @return QualityModifyValidate + * @author likeadmin + * @date 2023/12/20 17:28 + */ + public function sceneAdd() + { + return $this->remove('id', true); } - return true; - } - - public function checkDept($value,$rule,$data): bool|string - { - $dept = Dept::where('id',$value)->findOrEmpty(); - if($dept->isEmpty()){ - return '部门不存在'; + + + /** + * @notes 编辑场景 + * @return QualityModifyValidate + * @author likeadmin + * @date 2023/12/20 17:28 + */ + public function sceneEdit() + { } - if($dept['org_id'] != $data['org_id']){ - return '部门不属于当前选择的组织'; + + + /** + * @notes 删除场景 + * @return QualityModifyValidate + * @author likeadmin + * @date 2023/12/20 17:28 + */ + public function sceneDelete() + { + return $this->only(['id'])->remove('id', 'checkData'); } - return true; - } - - public function checkProject($value): bool|string - { - $data = Project::where('id',$value)->findOrEmpty(); - if($data->isEmpty()){ - return '项目不存在'; + + + /** + * @notes 详情场景 + * @return QualityModifyValidate + * @author likeadmin + * @date 2023/12/20 17:28 + */ + public function sceneDetail() + { + return $this->only(['id']); } - return true; - } -} \ No newline at end of file + + public function checkOrg($value): bool|string + { + $data = Orgs::where('id', $value)->findOrEmpty(); + if ($data->isEmpty()) { + return '组织不存在'; + } + return true; + } + + public function checkDept($value, $rule, $data): bool|string + { + $dept = Dept::where('id', $value)->findOrEmpty(); + if ($dept->isEmpty()) { + return '部门不存在'; + } + if ($dept['org_id'] != $data['org_id']) { + return '部门不属于当前选择的组织'; + } + return true; + } + + public function checkProject($value): bool|string + { + $data = Project::where('id', $value)->findOrEmpty(); + if ($data->isEmpty()) { + return '项目不存在'; + } + return true; + } + } \ No newline at end of file diff --git a/app/adminapi/validate/quality/QualityProfessionalCategoryValidate.php b/app/adminapi/validate/quality/QualityProfessionalCategoryValidate.php index 985428d64..1cda5f85d 100644 --- a/app/adminapi/validate/quality/QualityProfessionalCategoryValidate.php +++ b/app/adminapi/validate/quality/QualityProfessionalCategoryValidate.php @@ -11,105 +11,106 @@ // +---------------------------------------------------------------------- // | author: likeadminTeam // +---------------------------------------------------------------------- - -namespace app\adminapi\validate\quality; - - -use app\common\model\dept\Dept; -use app\common\model\dept\Orgs; -use app\common\validate\BaseValidate; - - -/** - * 专业类别验证器 - * Class QualityProfessionalCategoryValidate - * @package app\adminapi\validate\quality - */ -class QualityProfessionalCategoryValidate extends BaseValidate -{ - - /** - * 设置校验规则 - * @var string[] - */ - protected $rule = [ - 'id' => 'require', - 'org_id' => 'require|checkOrg', - 'dept_id' => 'require|checkDept', - 'classify_name' => 'require', - ]; - protected $message = [ - 'id.require' => '缺少必要参数', - 'org_id.require' => '请选择组织', - 'dept_id.require' => '请选择部门', - 'classify_name.require' => '请填写分类名', - ]; + namespace app\adminapi\validate\quality; - /** - * @notes 添加场景 - * @return QualityProfessionalCategoryValidate - * @author likeadmin - * @date 2023/12/20 14:50 - */ - public function sceneAdd() - { - return $this->remove('id',true); - } - - - /** - * @notes 编辑场景 - * @return QualityProfessionalCategoryValidate - * @author likeadmin - * @date 2023/12/20 14:50 - */ - public function sceneEdit() - {} - - - /** - * @notes 删除场景 - * @return QualityProfessionalCategoryValidate - * @author likeadmin - * @date 2023/12/20 14:50 - */ - public function sceneDelete() - { - return $this->only(['id']); - } - - - /** - * @notes 详情场景 - * @return QualityProfessionalCategoryValidate - * @author likeadmin - * @date 2023/12/20 14:50 - */ - public function sceneDetail() - { - return $this->only(['id']); - } - public function checkOrg($value): bool|string + use app\common\model\dept\Dept; + use app\common\model\dept\Orgs; + use app\common\validate\BaseValidate; + + + /** + * 专业类别验证器 + * Class QualityProfessionalCategoryValidate + * @package app\adminapi\validate\quality + */ + class QualityProfessionalCategoryValidate extends BaseValidate { - $data = Orgs::where('id',$value)->findOrEmpty(); - if($data->isEmpty()){ - return '组织不存在'; + + /** + * 设置校验规则 + * @var string[] + */ + protected $rule = [ + 'id' => 'require', + 'org_id' => 'require|checkOrg', + 'dept_id' => 'require|checkDept', + 'classify_name' => 'require', + ]; + + protected $message = [ + 'id.require' => '缺少必要参数', + 'org_id.require' => '请选择组织', + 'dept_id.require' => '请选择部门', + 'classify_name.require' => '请填写分类名', + ]; + + /** + * @notes 添加场景 + * @return QualityProfessionalCategoryValidate + * @author likeadmin + * @date 2023/12/20 14:50 + */ + public function sceneAdd() + { + return $this->remove('id', true); } - return true; - } - - public function checkDept($value,$rule,$data): bool|string - { - $dept = Dept::where('id',$value)->findOrEmpty(); - if($dept->isEmpty()){ - return '部门不存在'; + + + /** + * @notes 编辑场景 + * @return QualityProfessionalCategoryValidate + * @author likeadmin + * @date 2023/12/20 14:50 + */ + public function sceneEdit() + { } - if($dept['org_id'] != $data['org_id']){ - return '部门不属于当前选择的组织'; + + + /** + * @notes 删除场景 + * @return QualityProfessionalCategoryValidate + * @author likeadmin + * @date 2023/12/20 14:50 + */ + public function sceneDelete() + { + return $this->only(['id'])->remove('id', 'checkData'); } - return true; - } - -} \ No newline at end of file + + + /** + * @notes 详情场景 + * @return QualityProfessionalCategoryValidate + * @author likeadmin + * @date 2023/12/20 14:50 + */ + public function sceneDetail() + { + return $this->only(['id']); + } + + public function checkOrg($value): bool|string + { + $data = Orgs::where('id', $value)->findOrEmpty(); + if ($data->isEmpty()) { + return '组织不存在'; + } + return true; + } + + public function checkDept($value, $rule, $data): bool|string + { + $dept = Dept::where('id', $value)->findOrEmpty(); + if ($dept->isEmpty()) { + return '部门不存在'; + } + if ($dept['org_id'] != $data['org_id']) { + return '部门不属于当前选择的组织'; + } + return true; + } + + } \ No newline at end of file diff --git a/app/adminapi/validate/quality/QualitySpecificationValidate.php b/app/adminapi/validate/quality/QualitySpecificationValidate.php index d3955ea21..64ef3531c 100644 --- a/app/adminapi/validate/quality/QualitySpecificationValidate.php +++ b/app/adminapi/validate/quality/QualitySpecificationValidate.php @@ -11,118 +11,119 @@ // +---------------------------------------------------------------------- // | author: likeadminTeam // +---------------------------------------------------------------------- - -namespace app\adminapi\validate\quality; - - -use app\common\model\dept\Dept; -use app\common\model\dept\Orgs; -use app\common\validate\BaseValidate; - - -/** - * 质量规范验证器 - * Class QualitySpecificationValidate - * @package app\adminapi\validate\quality - */ -class QualitySpecificationValidate extends BaseValidate -{ - - /** - * 设置校验规则 - * @var string[] - */ - protected $rule = [ - 'id' => 'require', - 'org_id' => 'require|checkOrg', - 'dept_id' => 'require|checkDept', - 'name' => 'require', - 'release_date' => 'dateFormat:Y-m-d', - 'file' => 'checkFile' - ]; - protected $message = [ - 'id.require' => '缺少必要参数', - 'org_id.require' => '请选择组织', - 'dept_id.require' => '请选择部门', - 'name.require' => '请填写规范名称', - 'release_date.dateFormat' => '发布时间格式错误', - ]; + namespace app\adminapi\validate\quality; - /** - * @notes 添加场景 - * @return QualitySpecificationValidate - * @author likeadmin - * @date 2023/12/20 16:30 - */ - public function sceneAdd() - { - return $this->remove('id',true); - } - - - /** - * @notes 编辑场景 - * @return QualitySpecificationValidate - * @author likeadmin - * @date 2023/12/20 16:30 - */ - public function sceneEdit() - {} - - - /** - * @notes 删除场景 - * @return QualitySpecificationValidate - * @author likeadmin - * @date 2023/12/20 16:30 - */ - public function sceneDelete() - { - return $this->only(['id']); - } - - - /** - * @notes 详情场景 - * @return QualitySpecificationValidate - * @author likeadmin - * @date 2023/12/20 16:30 - */ - public function sceneDetail() - { - return $this->only(['id']); - } - public function checkOrg($value): bool|string + use app\common\model\dept\Dept; + use app\common\model\dept\Orgs; + use app\common\validate\BaseValidate; + + + /** + * 质量规范验证器 + * Class QualitySpecificationValidate + * @package app\adminapi\validate\quality + */ + class QualitySpecificationValidate extends BaseValidate { - $data = Orgs::where('id',$value)->findOrEmpty(); - if($data->isEmpty()){ - return '组织不存在'; + + /** + * 设置校验规则 + * @var string[] + */ + protected $rule = [ + 'id' => 'require', + 'org_id' => 'require|checkOrg', + 'dept_id' => 'require|checkDept', + 'name' => 'require', + 'release_date' => 'dateFormat:Y-m-d', + 'file' => 'checkFile' + ]; + + protected $message = [ + 'id.require' => '缺少必要参数', + 'org_id.require' => '请选择组织', + 'dept_id.require' => '请选择部门', + 'name.require' => '请填写规范名称', + 'release_date.dateFormat' => '发布时间格式错误', + ]; + + /** + * @notes 添加场景 + * @return QualitySpecificationValidate + * @author likeadmin + * @date 2023/12/20 16:30 + */ + public function sceneAdd() + { + return $this->remove('id', true); } - return true; - } - - public function checkDept($value,$rule,$data): bool|string - { - $dept = Dept::where('id',$value)->findOrEmpty(); - if($dept->isEmpty()){ - return '部门不存在'; + + + /** + * @notes 编辑场景 + * @return QualitySpecificationValidate + * @author likeadmin + * @date 2023/12/20 16:30 + */ + public function sceneEdit() + { } - if($dept['org_id'] != $data['org_id']){ - return '部门不属于当前选择的组织'; + + + /** + * @notes 删除场景 + * @return QualitySpecificationValidate + * @author likeadmin + * @date 2023/12/20 16:30 + */ + public function sceneDelete() + { + return $this->only(['id'])->remove('id', 'checkData'); } - return true; - } - - public function checkFile($value): bool|string - { - if(!empty($value) && $value != ''){ - if(!is_array($value)){ - return '附件必须是json数组'; + + + /** + * @notes 详情场景 + * @return QualitySpecificationValidate + * @author likeadmin + * @date 2023/12/20 16:30 + */ + public function sceneDetail() + { + return $this->only(['id']); + } + + public function checkOrg($value): bool|string + { + $data = Orgs::where('id', $value)->findOrEmpty(); + if ($data->isEmpty()) { + return '组织不存在'; } + return true; } - return true; - } - -} \ No newline at end of file + + public function checkDept($value, $rule, $data): bool|string + { + $dept = Dept::where('id', $value)->findOrEmpty(); + if ($dept->isEmpty()) { + return '部门不存在'; + } + if ($dept['org_id'] != $data['org_id']) { + return '部门不属于当前选择的组织'; + } + return true; + } + + public function checkFile($value): bool|string + { + if (!empty($value) && $value != '') { + if (!is_array($value)) { + return '附件必须是json数组'; + } + } + return true; + } + + } \ No newline at end of file diff --git a/app/adminapi/validate/quality/QualitySuperviseValidate.php b/app/adminapi/validate/quality/QualitySuperviseValidate.php index fc33fcb80..d44dc9874 100644 --- a/app/adminapi/validate/quality/QualitySuperviseValidate.php +++ b/app/adminapi/validate/quality/QualitySuperviseValidate.php @@ -11,129 +11,130 @@ // +---------------------------------------------------------------------- // | author: likeadminTeam // +---------------------------------------------------------------------- - -namespace app\adminapi\validate\quality; - - -use app\common\model\dept\Dept; -use app\common\model\dept\Orgs; -use app\common\model\project\Project; -use app\common\validate\BaseValidate; - - -/** - * 质量监督验证器 - * Class QualitySuperviseValidate - * @package app\adminapi\validate\quality - */ -class QualitySuperviseValidate extends BaseValidate -{ - - /** - * 设置校验规则 - * @var string[] - */ - protected $rule = [ - 'id' => 'require', - 'org_id' => 'require|checkOrg', - 'dept_id' => 'require|checkDept', - 'project_id' => 'require|checkProject', - 'happen_date' => 'dateFormat:Y-m-d', - 'file' => 'checkFile', - ]; - protected $message = [ - 'id.require' => '缺少必要参数', - 'org_id.require' => '请选择组织', - 'dept_id.require' => '请选择部门', - 'project_id.require' => '请选择项目', - 'happen_date.dateFormat' => '发生日期格式错误', - ]; - - - /** - * @notes 添加场景 - * @return QualitySuperviseValidate - * @author likeadmin - * @date 2023/12/21 14:32 - */ - public function sceneAdd() - { - return $this->remove('id',true); - } - - - /** - * @notes 编辑场景 - * @return QualitySuperviseValidate - * @author likeadmin - * @date 2023/12/21 14:32 - */ - public function sceneEdit() - {} - - - /** - * @notes 删除场景 - * @return QualitySuperviseValidate - * @author likeadmin - * @date 2023/12/21 14:32 - */ - public function sceneDelete() - { - return $this->only(['id']); - } - - - /** - * @notes 详情场景 - * @return QualitySuperviseValidate - * @author likeadmin - * @date 2023/12/21 14:32 - */ - public function sceneDetail() - { - return $this->only(['id']); - } + namespace app\adminapi\validate\quality; - public function checkOrg($value): bool|string + + use app\common\model\dept\Dept; + use app\common\model\dept\Orgs; + use app\common\model\project\Project; + use app\common\validate\BaseValidate; + + + /** + * 质量监督验证器 + * Class QualitySuperviseValidate + * @package app\adminapi\validate\quality + */ + class QualitySuperviseValidate extends BaseValidate { - $data = Orgs::where('id',$value)->findOrEmpty(); - if($data->isEmpty()){ - return '组织不存在'; + + /** + * 设置校验规则 + * @var string[] + */ + protected $rule = [ + 'id' => 'require', + 'org_id' => 'require|checkOrg', + 'dept_id' => 'require|checkDept', + 'project_id' => 'require|checkProject', + 'happen_date' => 'dateFormat:Y-m-d', + 'file' => 'checkFile', + ]; + + protected $message = [ + 'id.require' => '缺少必要参数', + 'org_id.require' => '请选择组织', + 'dept_id.require' => '请选择部门', + 'project_id.require' => '请选择项目', + 'happen_date.dateFormat' => '发生日期格式错误', + ]; + + + /** + * @notes 添加场景 + * @return QualitySuperviseValidate + * @author likeadmin + * @date 2023/12/21 14:32 + */ + public function sceneAdd() + { + return $this->remove('id', true); } - return true; - } - - public function checkDept($value,$rule,$data): bool|string - { - $dept = Dept::where('id',$value)->findOrEmpty(); - if($dept->isEmpty()){ - return '部门不存在'; + + + /** + * @notes 编辑场景 + * @return QualitySuperviseValidate + * @author likeadmin + * @date 2023/12/21 14:32 + */ + public function sceneEdit() + { } - if($dept['org_id'] != $data['org_id']){ - return '部门不属于当前选择的组织'; + + + /** + * @notes 删除场景 + * @return QualitySuperviseValidate + * @author likeadmin + * @date 2023/12/21 14:32 + */ + public function sceneDelete() + { + return $this->only(['id'])->remove('id', 'checkData'); } - return true; - } - - public function checkProject($value): bool|string - { - $data = Project::where('id',$value)->findOrEmpty(); - if($data->isEmpty()){ - return '项目不存在'; + + + /** + * @notes 详情场景 + * @return QualitySuperviseValidate + * @author likeadmin + * @date 2023/12/21 14:32 + */ + public function sceneDetail() + { + return $this->only(['id']); } - return true; - } - - public function checkFile($value): bool|string - { - if(!empty($value) && $value != ''){ - if(!is_array($value)){ - return '附件必须是json数组'; + + public function checkOrg($value): bool|string + { + $data = Orgs::where('id', $value)->findOrEmpty(); + if ($data->isEmpty()) { + return '组织不存在'; } + return true; } - return true; - } - -} \ No newline at end of file + + public function checkDept($value, $rule, $data): bool|string + { + $dept = Dept::where('id', $value)->findOrEmpty(); + if ($dept->isEmpty()) { + return '部门不存在'; + } + if ($dept['org_id'] != $data['org_id']) { + return '部门不属于当前选择的组织'; + } + return true; + } + + public function checkProject($value): bool|string + { + $data = Project::where('id', $value)->findOrEmpty(); + if ($data->isEmpty()) { + return '项目不存在'; + } + return true; + } + + public function checkFile($value): bool|string + { + if (!empty($value) && $value != '') { + if (!is_array($value)) { + return '附件必须是json数组'; + } + } + return true; + } + + } \ No newline at end of file diff --git a/app/adminapi/validate/quotation/QuotationDetailValidate.php b/app/adminapi/validate/quotation/QuotationDetailValidate.php index d8f1c7a47..ebea4cb26 100644 --- a/app/adminapi/validate/quotation/QuotationDetailValidate.php +++ b/app/adminapi/validate/quotation/QuotationDetailValidate.php @@ -11,84 +11,84 @@ // +---------------------------------------------------------------------- // | author: likeadminTeam // +---------------------------------------------------------------------- - -namespace app\adminapi\validate\quotation; - - -use app\common\validate\BaseValidate; - - -/** - * 报价明细验证器 - * Class QuotationDetailValidate - * @package app\adminapi\validate\quotation - */ -class QuotationDetailValidate extends BaseValidate -{ - - /** - * 设置校验规则 - * @var string[] - */ - protected $rule = [ - 'id' => 'require', - ]; - - - /** - * 参数描述 - * @var string[] - */ - protected $field = [ - 'id' => 'id', - ]; - - - /** - * @notes 添加场景 - * @return QuotationDetailValidate - * @author likeadmin - * @date 2023/11/27 17:59 - */ - public function sceneAdd() - { - return $this->remove('id', true); - } - - - /** - * @notes 编辑场景 - * @return QuotationDetailValidate - * @author likeadmin - * @date 2023/11/27 17:59 - */ - public function sceneEdit() - { - return $this->only(['id']); - } - - - /** - * @notes 删除场景 - * @return QuotationDetailValidate - * @author likeadmin - * @date 2023/11/27 17:59 - */ - public function sceneDelete() - { - return $this->only(['id']); - } - - - /** - * @notes 详情场景 - * @return QuotationDetailValidate - * @author likeadmin - * @date 2023/11/27 17:59 - */ - public function sceneDetail() - { - return $this->only(['id']); - } - -} \ No newline at end of file + + namespace app\adminapi\validate\quotation; + + + use app\common\validate\BaseValidate; + + + /** + * 报价明细验证器 + * Class QuotationDetailValidate + * @package app\adminapi\validate\quotation + */ + class QuotationDetailValidate extends BaseValidate + { + + /** + * 设置校验规则 + * @var string[] + */ + protected $rule = [ + 'id' => 'require', + ]; + + + /** + * 参数描述 + * @var string[] + */ + protected $field = [ + 'id' => 'id', + ]; + + + /** + * @notes 添加场景 + * @return QuotationDetailValidate + * @author likeadmin + * @date 2023/11/27 17:59 + */ + public function sceneAdd() + { + return $this->remove('id', true); + } + + + /** + * @notes 编辑场景 + * @return QuotationDetailValidate + * @author likeadmin + * @date 2023/11/27 17:59 + */ + public function sceneEdit() + { + return $this->only(['id']); + } + + + /** + * @notes 删除场景 + * @return QuotationDetailValidate + * @author likeadmin + * @date 2023/11/27 17:59 + */ + public function sceneDelete() + { + return $this->only(['id'])->remove('id', 'checkData'); + } + + + /** + * @notes 详情场景 + * @return QuotationDetailValidate + * @author likeadmin + * @date 2023/11/27 17:59 + */ + public function sceneDetail() + { + return $this->only(['id']); + } + + } \ No newline at end of file diff --git a/app/adminapi/validate/quotation/QuotationValidate.php b/app/adminapi/validate/quotation/QuotationValidate.php index 7172b73c9..f5612730b 100644 --- a/app/adminapi/validate/quotation/QuotationValidate.php +++ b/app/adminapi/validate/quotation/QuotationValidate.php @@ -11,159 +11,160 @@ // +---------------------------------------------------------------------- // | author: likeadminTeam // +---------------------------------------------------------------------- - -namespace app\adminapi\validate\quotation; - - -use app\common\model\custom\Custom; -use app\common\model\dict\DictData; -use app\common\model\material\Material; -use app\common\model\quotation\QuotationDetail; -use app\common\validate\BaseValidate; - - -/** - * 报价单验证器 - * Class QuotationValidate - * @package app\adminapi\validate\quotation - */ -class QuotationValidate extends BaseValidate -{ - - /** - * 设置校验规则 - * @var string[] - */ - protected $rule = [ - 'id' => 'require', - 'custom_id' => 'require|checkCustom', - 'quotation_date' => 'dateFormat:Y-m-d', - 'invoice_type' => 'checkInvoiceType', - 'freight' => 'require|float|egt:0', - 'other_fee' => 'require|float|egt:0', - 'annex' => 'checkAnnex', - 'quotation_detail' => 'require|checkQuotationDetail', - ]; - - protected $message = [ - 'id.require' => '缺少必要参数', - 'custom_id.require' => '请选择客户', - 'quotation_date.dateFormat' => '报价日期格式错误', - 'freight.require' => '运费不能为空', - 'freight.float' => '运费值必须是数字', - 'freight.egt' => '运费值必须大于等于0', - 'other_fee.require' => '其它费用不能为空', - 'other_fee.float' => '其它费用值必须是数字', - 'other_fee.egt' => '其它费用值必须大于等于0', - 'quotation_detail.require' => '报价明细不能为空', - ]; - - - /** - * @notes 添加场景 - * @return QuotationValidate - * @author likeadmin - * @date 2023/11/27 17:23 - */ - public function sceneAdd() - { - return $this->remove('id', true); - } - - /** - * @notes 编辑场景 - * @return QuotationValidate - * @author likeadmin - * @date 2023/11/27 17:23 - */ - public function sceneEdit() - {} - - - /** - * @notes 删除场景 - * @return QuotationValidate - * @author likeadmin - * @date 2023/11/27 17:23 - */ - public function sceneDelete() - { - return $this->only(['id']); - } - - - /** - * @notes 详情场景 - * @return QuotationValidate - * @author likeadmin - * @date 2023/11/27 17:23 - */ - public function sceneDetail() - { - return $this->only(['id']); - } - public function checkCustom($value): bool|string + namespace app\adminapi\validate\quotation; + + + use app\common\model\custom\Custom; + use app\common\model\dict\DictData; + use app\common\model\material\Material; + use app\common\model\quotation\QuotationDetail; + use app\common\validate\BaseValidate; + + + /** + * 报价单验证器 + * Class QuotationValidate + * @package app\adminapi\validate\quotation + */ + class QuotationValidate extends BaseValidate { - $custom = Custom::where('id',$value)->findOrEmpty(); - if($custom->isEmpty()){ - return '客户不存在'; + + /** + * 设置校验规则 + * @var string[] + */ + protected $rule = [ + 'id' => 'require', + 'custom_id' => 'require|checkCustom', + 'quotation_date' => 'dateFormat:Y-m-d', + 'invoice_type' => 'checkInvoiceType', + 'freight' => 'require|float|egt:0', + 'other_fee' => 'require|float|egt:0', + 'annex' => 'checkAnnex', + 'quotation_detail' => 'require|checkQuotationDetail', + ]; + + protected $message = [ + 'id.require' => '缺少必要参数', + 'custom_id.require' => '请选择客户', + 'quotation_date.dateFormat' => '报价日期格式错误', + 'freight.require' => '运费不能为空', + 'freight.float' => '运费值必须是数字', + 'freight.egt' => '运费值必须大于等于0', + 'other_fee.require' => '其它费用不能为空', + 'other_fee.float' => '其它费用值必须是数字', + 'other_fee.egt' => '其它费用值必须大于等于0', + 'quotation_detail.require' => '报价明细不能为空', + ]; + + + /** + * @notes 添加场景 + * @return QuotationValidate + * @author likeadmin + * @date 2023/11/27 17:23 + */ + public function sceneAdd() + { + return $this->remove('id', true); } - return true; - } - - public function checkInvoiceType($value): bool|string - { - $dictData = DictData::where('type_value','invoice_type')->column('value'); - if(!in_array($value,$dictData)){ - return '发票类型无效'; + + /** + * @notes 编辑场景 + * @return QuotationValidate + * @author likeadmin + * @date 2023/11/27 17:23 + */ + public function sceneEdit() + { } - return true; - } - - public function checkQuotationDetail($value): bool|string - { - if(!empty($value) && !is_array($value)){ - return '报价明细数据格式错误'; + + + /** + * @notes 删除场景 + * @return QuotationValidate + * @author likeadmin + * @date 2023/11/27 17:23 + */ + public function sceneDelete() + { + return $this->only(['id'])->remove('id', 'checkData'); } - foreach($value as $k=>$v) { - if(!empty($v['id'])){ - $quotation_detail = QuotationDetail::where('id',$v['id'])->findOrEmpty(); - if($quotation_detail->isEmpty()) return '报价明细列表第'.($k+1).'行报价明细数据不存在'; + + + /** + * @notes 详情场景 + * @return QuotationValidate + * @author likeadmin + * @date 2023/11/27 17:23 + */ + public function sceneDetail() + { + return $this->only(['id']); + } + + public function checkCustom($value): bool|string + { + $custom = Custom::where('id', $value)->findOrEmpty(); + if ($custom->isEmpty()) { + return '客户不存在'; } - if(empty($v['product_id'])){ - return '请选择产品'; - }else{ - $product = Material::where('id',$v['product_id'])->findOrEmpty(); - if($product->isEmpty()){ - return '产品信息不存在'; - } - } - if(empty($v['num'])){ - return '报价明细列表第'.($k+1).'行数量不能为空'; - }else{ - if(!is_numeric($v['num']) || $v['num'] < 0){ - return '报价明细列表第'.($k+1).'行数量必须是大于0的数字'; - } - } - if(empty($v['tax_rate'])){ - return '报价明细列表第'.($k+1).'行税率不能为空'; - }else{ - $tax_rate_dict_data = DictData::where('type_value','tax_rate')->column('value'); - if(!in_array($v['tax_rate'],$tax_rate_dict_data)){ - return '报价明细列表第'.($k+1).'行税率无效'; - } - } - if(empty($v['tax_inclusive_price'])){ - return '报价明细列表第'.($k+1).'行含税单价不能为空'; - }else{ - if(!is_numeric($v['tax_inclusive_price']) || $v['tax_inclusive_price'] < 0){ - return '报价明细列表第'.($k+1).'行含税单价必须是大于0的数字'; + return true; + } + + public function checkInvoiceType($value): bool|string + { + $dictData = DictData::where('type_value', 'invoice_type')->column('value'); + if (!in_array($value, $dictData)) { + return '发票类型无效'; + } + return true; + } + + public function checkQuotationDetail($value): bool|string + { + if (!empty($value) && !is_array($value)) { + return '报价明细数据格式错误'; + } + foreach ($value as $k => $v) { + if (!empty($v['id'])) { + $quotation_detail = QuotationDetail::where('id', $v['id'])->findOrEmpty(); + if ($quotation_detail->isEmpty()) return '报价明细列表第' . ($k + 1) . '行报价明细数据不存在'; + } + if (empty($v['product_id'])) { + return '请选择产品'; + } else { + $product = Material::where('id', $v['product_id'])->findOrEmpty(); + if ($product->isEmpty()) { + return '产品信息不存在'; + } + } + if (empty($v['num'])) { + return '报价明细列表第' . ($k + 1) . '行数量不能为空'; + } else { + if (!is_numeric($v['num']) || $v['num'] < 0) { + return '报价明细列表第' . ($k + 1) . '行数量必须是大于0的数字'; + } + } + if (empty($v['tax_rate'])) { + return '报价明细列表第' . ($k + 1) . '行税率不能为空'; + } else { + $tax_rate_dict_data = DictData::where('type_value', 'tax_rate')->column('value'); + if (!in_array($v['tax_rate'], $tax_rate_dict_data)) { + return '报价明细列表第' . ($k + 1) . '行税率无效'; + } + } + if (empty($v['tax_inclusive_price'])) { + return '报价明细列表第' . ($k + 1) . '行含税单价不能为空'; + } else { + if (!is_numeric($v['tax_inclusive_price']) || $v['tax_inclusive_price'] < 0) { + return '报价明细列表第' . ($k + 1) . '行含税单价必须是大于0的数字'; + } } } + return true; } - return true; - } - - -} \ No newline at end of file + + + } \ No newline at end of file diff --git a/app/adminapi/validate/safety/SafetyAccidentValidate.php b/app/adminapi/validate/safety/SafetyAccidentValidate.php index 30cc783e1..f1c2a6418 100644 --- a/app/adminapi/validate/safety/SafetyAccidentValidate.php +++ b/app/adminapi/validate/safety/SafetyAccidentValidate.php @@ -11,145 +11,145 @@ // +---------------------------------------------------------------------- // | author: likeadminTeam // +---------------------------------------------------------------------- - -namespace app\adminapi\validate\safety; - - -use app\common\model\dept\Dept; -use app\common\model\dept\Orgs; -use app\common\model\project\Project; -use app\common\validate\BaseValidate; - - -/** - * 安全事故验证器 - * Class SafetyAccidentValidate - * @package app\adminapi\validate\safety - */ -class SafetyAccidentValidate extends BaseValidate -{ - - /** - * 设置校验规则 - * @var string[] - */ - protected $rule = [ - 'id' => 'require', - 'org_id' => 'require|checkOrg', - 'dept_id' => 'require|checkDept', - 'project_id' => 'require|checkProject', - 'happen_time' => 'dateFormat:Y-m-d', - 'file' => 'checkFile' - ]; - protected $message = [ - 'id.require' => '缺少必要参数', - 'org_id.require' => '请选择组织', - 'dept_id.require' => '请选择部门', - 'project_id.require' => '请选择项目', - 'happen_time.dateFormat' => '发生时间格式错误', - ]; - - - /** - * 参数描述 - * @var string[] - */ - protected $field = [ - 'id' => 'id', - 'org_id' => '组织id', - 'dept_id' => '部门id', - 'project_id' => '项目id', - 'add_user' => '添加人', - 'update_user' => '更新人', - ]; - - - /** - * @notes 添加场景 - * @return SafetyAccidentValidate - * @author likeadmin - * @date 2023/12/19 14:28 - */ - public function sceneAdd() - { - return $this->only(['org_id','dept_id','project_id','name','type','happen_time','device_accident','contractor_user','our_company_user','not_our_company_user','content','remark','file']); - } - - - /** - * @notes 编辑场景 - * @return SafetyAccidentValidate - * @author likeadmin - * @date 2023/12/19 14:28 - */ - public function sceneEdit() - { - return $this->only(['id','org_id','dept_id','project_id','name','type','happen_time','device_accident','contractor_user','our_company_user','not_our_company_user','content','remark','file']); - } - - - /** - * @notes 删除场景 - * @return SafetyAccidentValidate - * @author likeadmin - * @date 2023/12/19 14:28 - */ - public function sceneDelete() - { - return $this->only(['id']); - } - - - /** - * @notes 详情场景 - * @return SafetyAccidentValidate - * @author likeadmin - * @date 2023/12/19 14:28 - */ - public function sceneDetail() - { - return $this->only(['id']); - } + namespace app\adminapi\validate\safety; - public function checkOrg($value): bool|string + + use app\common\model\dept\Dept; + use app\common\model\dept\Orgs; + use app\common\model\project\Project; + use app\common\validate\BaseValidate; + + + /** + * 安全事故验证器 + * Class SafetyAccidentValidate + * @package app\adminapi\validate\safety + */ + class SafetyAccidentValidate extends BaseValidate { - $data = Orgs::where('id',$value)->findOrEmpty(); - if($data->isEmpty()){ - return '组织不存在'; + + /** + * 设置校验规则 + * @var string[] + */ + protected $rule = [ + 'id' => 'require', + 'org_id' => 'require|checkOrg', + 'dept_id' => 'require|checkDept', + 'project_id' => 'require|checkProject', + 'happen_time' => 'dateFormat:Y-m-d', + 'file' => 'checkFile' + ]; + + protected $message = [ + 'id.require' => '缺少必要参数', + 'org_id.require' => '请选择组织', + 'dept_id.require' => '请选择部门', + 'project_id.require' => '请选择项目', + 'happen_time.dateFormat' => '发生时间格式错误', + ]; + + + /** + * 参数描述 + * @var string[] + */ + protected $field = [ + 'id' => 'id', + 'org_id' => '组织id', + 'dept_id' => '部门id', + 'project_id' => '项目id', + 'add_user' => '添加人', + 'update_user' => '更新人', + ]; + + + /** + * @notes 添加场景 + * @return SafetyAccidentValidate + * @author likeadmin + * @date 2023/12/19 14:28 + */ + public function sceneAdd() + { + return $this->only(['org_id', 'dept_id', 'project_id', 'name', 'type', 'happen_time', 'device_accident', 'contractor_user', 'our_company_user', 'not_our_company_user', 'content', 'remark', 'file']); } - return true; - } - - public function checkDept($value,$rule,$data): bool|string - { - $dept = Dept::where('id',$value)->findOrEmpty(); - if($dept->isEmpty()){ - return '部门不存在'; + + + /** + * @notes 编辑场景 + * @return SafetyAccidentValidate + * @author likeadmin + * @date 2023/12/19 14:28 + */ + public function sceneEdit() + { + return $this->only(['id', 'org_id', 'dept_id', 'project_id', 'name', 'type', 'happen_time', 'device_accident', 'contractor_user', 'our_company_user', 'not_our_company_user', 'content', 'remark', 'file']); } - if($dept['org_id'] != $data['org_id']){ - return '部门不属于当前选择的组织'; + + + /** + * @notes 删除场景 + * @return SafetyAccidentValidate + * @author likeadmin + * @date 2023/12/19 14:28 + */ + public function sceneDelete() + { + return $this->only(['id'])->remove('id', 'checkData'); } - return true; - } - - public function checkProject($value): bool|string - { - $data = Project::where('id',$value)->findOrEmpty(); - if($data->isEmpty()){ - return '项目不存在'; + + + /** + * @notes 详情场景 + * @return SafetyAccidentValidate + * @author likeadmin + * @date 2023/12/19 14:28 + */ + public function sceneDetail() + { + return $this->only(['id']); } - return true; - } - - public function checkFile($value): bool|string - { - if(!empty($value) && $value != ''){ - if(!is_array($value)){ - return '附件必须是json数组'; + + public function checkOrg($value): bool|string + { + $data = Orgs::where('id', $value)->findOrEmpty(); + if ($data->isEmpty()) { + return '组织不存在'; } + return true; } - return true; - } - -} \ No newline at end of file + + public function checkDept($value, $rule, $data): bool|string + { + $dept = Dept::where('id', $value)->findOrEmpty(); + if ($dept->isEmpty()) { + return '部门不存在'; + } + if ($dept['org_id'] != $data['org_id']) { + return '部门不属于当前选择的组织'; + } + return true; + } + + public function checkProject($value): bool|string + { + $data = Project::where('id', $value)->findOrEmpty(); + if ($data->isEmpty()) { + return '项目不存在'; + } + return true; + } + + public function checkFile($value): bool|string + { + if (!empty($value) && $value != '') { + if (!is_array($value)) { + return '附件必须是json数组'; + } + } + return true; + } + + } \ No newline at end of file diff --git a/app/adminapi/validate/safety/SafetyCheckValidate.php b/app/adminapi/validate/safety/SafetyCheckValidate.php index 473e15e43..f82b07648 100644 --- a/app/adminapi/validate/safety/SafetyCheckValidate.php +++ b/app/adminapi/validate/safety/SafetyCheckValidate.php @@ -11,128 +11,129 @@ // +---------------------------------------------------------------------- // | author: likeadminTeam // +---------------------------------------------------------------------- - -namespace app\adminapi\validate\safety; - - -use app\common\model\dept\Dept; -use app\common\model\dept\Orgs; -use app\common\model\project\Project; -use app\common\validate\BaseValidate; - - -/** - * 安全检查验证器 - * Class SafetyCheckValidate - * @package app\adminapi\validate\safety - */ -class SafetyCheckValidate extends BaseValidate -{ - - /** - * 设置校验规则 - * @var string[] - */ - protected $rule = [ - 'id' => 'require', - 'org_id' => 'require|checkOrg', - 'dept_id' => 'require|checkDept', - 'project_id' => 'require|checkProject', - 'check_date' => 'dateFormat:Y-m-d', - 'file' => 'checkFile' - ]; - protected $message = [ - 'id.require' => '缺少必要参数', - 'org_id.require' => '请选择组织', - 'dept_id.require' => '请选择部门', - 'project_id.require' => '请选择项目', - 'check_date.dateFormat' => '检查日期格式错误', - ]; - - /** - * @notes 添加场景 - * @return SafetyCheckValidate - * @author likeadmin - * @date 2023/12/19 16:10 - */ - public function sceneAdd() - { - return $this->remove('id',true); - } - - - /** - * @notes 编辑场景 - * @return SafetyCheckValidate - * @author likeadmin - * @date 2023/12/19 16:10 - */ - public function sceneEdit() - {} - - - /** - * @notes 删除场景 - * @return SafetyCheckValidate - * @author likeadmin - * @date 2023/12/19 16:10 - */ - public function sceneDelete() - { - return $this->only(['id']); - } - - - /** - * @notes 详情场景 - * @return SafetyCheckValidate - * @author likeadmin - * @date 2023/12/19 16:10 - */ - public function sceneDetail() - { - return $this->only(['id']); - } + namespace app\adminapi\validate\safety; - public function checkOrg($value): bool|string + + use app\common\model\dept\Dept; + use app\common\model\dept\Orgs; + use app\common\model\project\Project; + use app\common\validate\BaseValidate; + + + /** + * 安全检查验证器 + * Class SafetyCheckValidate + * @package app\adminapi\validate\safety + */ + class SafetyCheckValidate extends BaseValidate { - $data = Orgs::where('id',$value)->findOrEmpty(); - if($data->isEmpty()){ - return '组织不存在'; + + /** + * 设置校验规则 + * @var string[] + */ + protected $rule = [ + 'id' => 'require', + 'org_id' => 'require|checkOrg', + 'dept_id' => 'require|checkDept', + 'project_id' => 'require|checkProject', + 'check_date' => 'dateFormat:Y-m-d', + 'file' => 'checkFile' + ]; + + protected $message = [ + 'id.require' => '缺少必要参数', + 'org_id.require' => '请选择组织', + 'dept_id.require' => '请选择部门', + 'project_id.require' => '请选择项目', + 'check_date.dateFormat' => '检查日期格式错误', + ]; + + /** + * @notes 添加场景 + * @return SafetyCheckValidate + * @author likeadmin + * @date 2023/12/19 16:10 + */ + public function sceneAdd() + { + return $this->remove('id', true); } - return true; - } - - public function checkDept($value,$rule,$data): bool|string - { - $dept = Dept::where('id',$value)->findOrEmpty(); - if($dept->isEmpty()){ - return '部门不存在'; + + + /** + * @notes 编辑场景 + * @return SafetyCheckValidate + * @author likeadmin + * @date 2023/12/19 16:10 + */ + public function sceneEdit() + { } - if($dept['org_id'] != $data['org_id']){ - return '部门不属于当前选择的组织'; + + + /** + * @notes 删除场景 + * @return SafetyCheckValidate + * @author likeadmin + * @date 2023/12/19 16:10 + */ + public function sceneDelete() + { + return $this->only(['id'])->remove('id', 'checkData'); } - return true; - } - - public function checkProject($value): bool|string - { - $data = Project::where('id',$value)->findOrEmpty(); - if($data->isEmpty()){ - return '项目不存在'; + + + /** + * @notes 详情场景 + * @return SafetyCheckValidate + * @author likeadmin + * @date 2023/12/19 16:10 + */ + public function sceneDetail() + { + return $this->only(['id']); } - return true; - } - - public function checkFile($value): bool|string - { - if(!empty($value) && $value != ''){ - if(!is_array($value)){ - return '附件必须是json数组'; + + public function checkOrg($value): bool|string + { + $data = Orgs::where('id', $value)->findOrEmpty(); + if ($data->isEmpty()) { + return '组织不存在'; } + return true; } - return true; - } - -} \ No newline at end of file + + public function checkDept($value, $rule, $data): bool|string + { + $dept = Dept::where('id', $value)->findOrEmpty(); + if ($dept->isEmpty()) { + return '部门不存在'; + } + if ($dept['org_id'] != $data['org_id']) { + return '部门不属于当前选择的组织'; + } + return true; + } + + public function checkProject($value): bool|string + { + $data = Project::where('id', $value)->findOrEmpty(); + if ($data->isEmpty()) { + return '项目不存在'; + } + return true; + } + + public function checkFile($value): bool|string + { + if (!empty($value) && $value != '') { + if (!is_array($value)) { + return '附件必须是json数组'; + } + } + return true; + } + + } \ No newline at end of file diff --git a/app/adminapi/validate/safety/SafetyEmergencyPlanValidate.php b/app/adminapi/validate/safety/SafetyEmergencyPlanValidate.php index cec9fa1af..fd63c3723 100644 --- a/app/adminapi/validate/safety/SafetyEmergencyPlanValidate.php +++ b/app/adminapi/validate/safety/SafetyEmergencyPlanValidate.php @@ -11,141 +11,142 @@ // +---------------------------------------------------------------------- // | author: likeadminTeam // +---------------------------------------------------------------------- - -namespace app\adminapi\validate\safety; - - -use app\common\model\dept\Dept; -use app\common\model\dept\Orgs; -use app\common\model\project\Project; -use app\common\validate\BaseValidate; - - -/** - * 安全应急预案验证器 - * Class SafetyEmergencyPlanValidate - * @package app\adminapi\validate\safety - */ -class SafetyEmergencyPlanValidate extends BaseValidate -{ - - /** - * 设置校验规则 - * @var string[] - */ - protected $rule = [ - 'id' => 'require', - 'org_id' => 'require|checkOrg', - 'dept_id' => 'require|checkDept', - 'project_id' => 'require|checkProject', - 'name' => 'require', - 'happen_date' => 'dateFormat:Y-m-d', - 'file' => 'checkFile' - ]; - protected $message = [ - 'id.require' => '缺少必要参数', - 'org_id.require' => '请选择组织', - 'dept_id.require' => '请选择部门', - 'project_id.require' => '请选择项目', - 'name.require' => '请填写名称', - 'happen_date.dateFormat' => '发生日期格式错误', - ]; - - - /** - * 参数描述 - * @var string[] - */ - protected $field = [ - 'id' => 'id', - 'project_id' => '项目id', - ]; - - - /** - * @notes 添加场景 - * @return SafetyEmergencyPlanValidate - * @author likeadmin - * @date 2023/12/20 09:27 - */ - public function sceneAdd() - { - return $this->remove('id',true); - } - - - /** - * @notes 编辑场景 - * @return SafetyEmergencyPlanValidate - * @author likeadmin - * @date 2023/12/20 09:27 - */ - public function sceneEdit() - {} - - - /** - * @notes 删除场景 - * @return SafetyEmergencyPlanValidate - * @author likeadmin - * @date 2023/12/20 09:27 - */ - public function sceneDelete() - { - return $this->only(['id']); - } - - - /** - * @notes 详情场景 - * @return SafetyEmergencyPlanValidate - * @author likeadmin - * @date 2023/12/20 09:27 - */ - public function sceneDetail() - { - return $this->only(['id']); - } + namespace app\adminapi\validate\safety; - public function checkOrg($value): bool|string + + use app\common\model\dept\Dept; + use app\common\model\dept\Orgs; + use app\common\model\project\Project; + use app\common\validate\BaseValidate; + + + /** + * 安全应急预案验证器 + * Class SafetyEmergencyPlanValidate + * @package app\adminapi\validate\safety + */ + class SafetyEmergencyPlanValidate extends BaseValidate { - $data = Orgs::where('id',$value)->findOrEmpty(); - if($data->isEmpty()){ - return '组织不存在'; + + /** + * 设置校验规则 + * @var string[] + */ + protected $rule = [ + 'id' => 'require', + 'org_id' => 'require|checkOrg', + 'dept_id' => 'require|checkDept', + 'project_id' => 'require|checkProject', + 'name' => 'require', + 'happen_date' => 'dateFormat:Y-m-d', + 'file' => 'checkFile' + ]; + + protected $message = [ + 'id.require' => '缺少必要参数', + 'org_id.require' => '请选择组织', + 'dept_id.require' => '请选择部门', + 'project_id.require' => '请选择项目', + 'name.require' => '请填写名称', + 'happen_date.dateFormat' => '发生日期格式错误', + ]; + + + /** + * 参数描述 + * @var string[] + */ + protected $field = [ + 'id' => 'id', + 'project_id' => '项目id', + ]; + + + /** + * @notes 添加场景 + * @return SafetyEmergencyPlanValidate + * @author likeadmin + * @date 2023/12/20 09:27 + */ + public function sceneAdd() + { + return $this->remove('id', true); } - return true; - } - - public function checkDept($value,$rule,$data): bool|string - { - $dept = Dept::where('id',$value)->findOrEmpty(); - if($dept->isEmpty()){ - return '部门不存在'; + + + /** + * @notes 编辑场景 + * @return SafetyEmergencyPlanValidate + * @author likeadmin + * @date 2023/12/20 09:27 + */ + public function sceneEdit() + { } - if($dept['org_id'] != $data['org_id']){ - return '部门不属于当前选择的组织'; + + + /** + * @notes 删除场景 + * @return SafetyEmergencyPlanValidate + * @author likeadmin + * @date 2023/12/20 09:27 + */ + public function sceneDelete() + { + return $this->only(['id'])->remove('id', 'checkData'); } - return true; - } - - public function checkProject($value): bool|string - { - $data = Project::where('id',$value)->findOrEmpty(); - if($data->isEmpty()){ - return '项目不存在'; + + + /** + * @notes 详情场景 + * @return SafetyEmergencyPlanValidate + * @author likeadmin + * @date 2023/12/20 09:27 + */ + public function sceneDetail() + { + return $this->only(['id']); } - return true; - } - - public function checkFile($value): bool|string - { - if(!empty($value) && $value != ''){ - if(!is_array($value)){ - return '附件必须是json数组'; + + public function checkOrg($value): bool|string + { + $data = Orgs::where('id', $value)->findOrEmpty(); + if ($data->isEmpty()) { + return '组织不存在'; } + return true; } - return true; - } - -} \ No newline at end of file + + public function checkDept($value, $rule, $data): bool|string + { + $dept = Dept::where('id', $value)->findOrEmpty(); + if ($dept->isEmpty()) { + return '部门不存在'; + } + if ($dept['org_id'] != $data['org_id']) { + return '部门不属于当前选择的组织'; + } + return true; + } + + public function checkProject($value): bool|string + { + $data = Project::where('id', $value)->findOrEmpty(); + if ($data->isEmpty()) { + return '项目不存在'; + } + return true; + } + + public function checkFile($value): bool|string + { + if (!empty($value) && $value != '') { + if (!is_array($value)) { + return '附件必须是json数组'; + } + } + return true; + } + + } \ No newline at end of file diff --git a/app/adminapi/validate/safety/SafetyEvaluateValidate.php b/app/adminapi/validate/safety/SafetyEvaluateValidate.php index 2ad307f24..2b96ccf95 100644 --- a/app/adminapi/validate/safety/SafetyEvaluateValidate.php +++ b/app/adminapi/validate/safety/SafetyEvaluateValidate.php @@ -11,144 +11,145 @@ // +---------------------------------------------------------------------- // | author: likeadminTeam // +---------------------------------------------------------------------- - -namespace app\adminapi\validate\safety; - - -use app\common\model\dept\Dept; -use app\common\model\dept\Orgs; -use app\common\model\project\Project; -use app\common\validate\BaseValidate; - - -/** - * 安全评估验证器 - * Class SafetyEvaluateValidate - * @package app\adminapi\validate\safety - */ -class SafetyEvaluateValidate extends BaseValidate -{ - - /** - * 设置校验规则 - * @var string[] - */ - protected $rule = [ - 'id' => 'require', - 'org_id' => 'require|checkOrg', - 'dept_id' => 'require|checkDept', - 'project_id' => 'require|checkProject', - 'name' => 'require', - 'happen_date' => 'dateFormat:Y-m-d', - 'file' => 'checkFile' - ]; - protected $message = [ - 'id.require' => '缺少必要参数', - 'org_id.require' => '请选择组织', - 'dept_id.require' => '请选择部门', - 'project_id.require' => '请选择项目', - 'name.require' => '请填写名称', - 'happen_date.dateFormat' => '发生日期格式错误', - ]; - - - /** - * 参数描述 - * @var string[] - */ - protected $field = [ - 'id' => 'id', - 'org_id' => '组织id', - 'dept_id' => '部门id', - 'project_id' => '项目id', - 'name' => '名称', - ]; - - - /** - * @notes 添加场景 - * @return SafetyEvaluateValidate - * @author likeadmin - * @date 2023/12/20 10:27 - */ - public function sceneAdd() - { - return $this->remove('id',true); - } - - - /** - * @notes 编辑场景 - * @return SafetyEvaluateValidate - * @author likeadmin - * @date 2023/12/20 10:27 - */ - public function sceneEdit() - {} - - - /** - * @notes 删除场景 - * @return SafetyEvaluateValidate - * @author likeadmin - * @date 2023/12/20 10:27 - */ - public function sceneDelete() - { - return $this->only(['id']); - } - - - /** - * @notes 详情场景 - * @return SafetyEvaluateValidate - * @author likeadmin - * @date 2023/12/20 10:27 - */ - public function sceneDetail() - { - return $this->only(['id']); - } + namespace app\adminapi\validate\safety; - public function checkOrg($value): bool|string + + use app\common\model\dept\Dept; + use app\common\model\dept\Orgs; + use app\common\model\project\Project; + use app\common\validate\BaseValidate; + + + /** + * 安全评估验证器 + * Class SafetyEvaluateValidate + * @package app\adminapi\validate\safety + */ + class SafetyEvaluateValidate extends BaseValidate { - $data = Orgs::where('id',$value)->findOrEmpty(); - if($data->isEmpty()){ - return '组织不存在'; + + /** + * 设置校验规则 + * @var string[] + */ + protected $rule = [ + 'id' => 'require', + 'org_id' => 'require|checkOrg', + 'dept_id' => 'require|checkDept', + 'project_id' => 'require|checkProject', + 'name' => 'require', + 'happen_date' => 'dateFormat:Y-m-d', + 'file' => 'checkFile' + ]; + + protected $message = [ + 'id.require' => '缺少必要参数', + 'org_id.require' => '请选择组织', + 'dept_id.require' => '请选择部门', + 'project_id.require' => '请选择项目', + 'name.require' => '请填写名称', + 'happen_date.dateFormat' => '发生日期格式错误', + ]; + + + /** + * 参数描述 + * @var string[] + */ + protected $field = [ + 'id' => 'id', + 'org_id' => '组织id', + 'dept_id' => '部门id', + 'project_id' => '项目id', + 'name' => '名称', + ]; + + + /** + * @notes 添加场景 + * @return SafetyEvaluateValidate + * @author likeadmin + * @date 2023/12/20 10:27 + */ + public function sceneAdd() + { + return $this->remove('id', true); } - return true; - } - - public function checkDept($value,$rule,$data): bool|string - { - $dept = Dept::where('id',$value)->findOrEmpty(); - if($dept->isEmpty()){ - return '部门不存在'; + + + /** + * @notes 编辑场景 + * @return SafetyEvaluateValidate + * @author likeadmin + * @date 2023/12/20 10:27 + */ + public function sceneEdit() + { } - if($dept['org_id'] != $data['org_id']){ - return '部门不属于当前选择的组织'; + + + /** + * @notes 删除场景 + * @return SafetyEvaluateValidate + * @author likeadmin + * @date 2023/12/20 10:27 + */ + public function sceneDelete() + { + return $this->only(['id'])->remove('id', 'checkData'); } - return true; - } - - public function checkProject($value): bool|string - { - $data = Project::where('id',$value)->findOrEmpty(); - if($data->isEmpty()){ - return '项目不存在'; + + + /** + * @notes 详情场景 + * @return SafetyEvaluateValidate + * @author likeadmin + * @date 2023/12/20 10:27 + */ + public function sceneDetail() + { + return $this->only(['id']); } - return true; - } - - public function checkFile($value): bool|string - { - if(!empty($value) && $value != ''){ - if(!is_array($value)){ - return '附件必须是json数组'; + + public function checkOrg($value): bool|string + { + $data = Orgs::where('id', $value)->findOrEmpty(); + if ($data->isEmpty()) { + return '组织不存在'; } + return true; } - return true; - } - -} \ No newline at end of file + + public function checkDept($value, $rule, $data): bool|string + { + $dept = Dept::where('id', $value)->findOrEmpty(); + if ($dept->isEmpty()) { + return '部门不存在'; + } + if ($dept['org_id'] != $data['org_id']) { + return '部门不属于当前选择的组织'; + } + return true; + } + + public function checkProject($value): bool|string + { + $data = Project::where('id', $value)->findOrEmpty(); + if ($data->isEmpty()) { + return '项目不存在'; + } + return true; + } + + public function checkFile($value): bool|string + { + if (!empty($value) && $value != '') { + if (!is_array($value)) { + return '附件必须是json数组'; + } + } + return true; + } + + } \ No newline at end of file diff --git a/app/adminapi/validate/safety/SafetyEventValidate.php b/app/adminapi/validate/safety/SafetyEventValidate.php index 76bbe62fc..4e1638c64 100644 --- a/app/adminapi/validate/safety/SafetyEventValidate.php +++ b/app/adminapi/validate/safety/SafetyEventValidate.php @@ -11,145 +11,145 @@ // +---------------------------------------------------------------------- // | author: likeadminTeam // +---------------------------------------------------------------------- - -namespace app\adminapi\validate\safety; - - -use app\common\model\dept\Dept; -use app\common\model\dept\Orgs; -use app\common\model\project\Project; -use app\common\validate\BaseValidate; - - -/** - * 安全事件验证器 - * Class SafetyEventValidate - * @package app\adminapi\validate\safety - */ -class SafetyEventValidate extends BaseValidate -{ - - /** - * 设置校验规则 - * @var string[] - */ - protected $rule = [ - 'id' => 'require', - 'org_id' => 'require|checkOrg', - 'dept_id' => 'require|checkDept', - 'project_id' => 'require|checkProject', - 'happen_time' => 'dateFormat:Y-m-d', - 'file' => 'checkFile' - ]; - protected $message = [ - 'id.require' => '缺少必要参数', - 'org_id.require' => '请选择组织', - 'dept_id.require' => '请选择部门', - 'project_id.require' => '请选择项目', - 'happen_time.dateFormat' => '发生时间格式错误', - ]; - - - /** - * 参数描述 - * @var string[] - */ - protected $field = [ - 'id' => 'id', - 'org_id' => '组织id', - 'dept_id' => '部门id', - 'project_id' => '项目id', - 'add_user' => '添加人', - 'update_user' => '更新人', - ]; - - - /** - * @notes 添加场景 - * @return SafetyEventValidate - * @author likeadmin - * @date 2023/12/19 13:52 - */ - public function sceneAdd() - { - return $this->only(['org_id','dept_id','project_id','name','happen_time','content','remark','file']); - } - - - /** - * @notes 编辑场景 - * @return SafetyEventValidate - * @author likeadmin - * @date 2023/12/19 13:52 - */ - public function sceneEdit() - { - return $this->only(['id','org_id','dept_id','project_id','name','happen_time','content','remark','file']); - } - - - /** - * @notes 删除场景 - * @return SafetyEventValidate - * @author likeadmin - * @date 2023/12/19 13:52 - */ - public function sceneDelete() - { - return $this->only(['id']); - } - - - /** - * @notes 详情场景 - * @return SafetyEventValidate - * @author likeadmin - * @date 2023/12/19 13:52 - */ - public function sceneDetail() - { - return $this->only(['id']); - } + namespace app\adminapi\validate\safety; - public function checkOrg($value): bool|string + + use app\common\model\dept\Dept; + use app\common\model\dept\Orgs; + use app\common\model\project\Project; + use app\common\validate\BaseValidate; + + + /** + * 安全事件验证器 + * Class SafetyEventValidate + * @package app\adminapi\validate\safety + */ + class SafetyEventValidate extends BaseValidate { - $data = Orgs::where('id',$value)->findOrEmpty(); - if($data->isEmpty()){ - return '组织不存在'; + + /** + * 设置校验规则 + * @var string[] + */ + protected $rule = [ + 'id' => 'require', + 'org_id' => 'require|checkOrg', + 'dept_id' => 'require|checkDept', + 'project_id' => 'require|checkProject', + 'happen_time' => 'dateFormat:Y-m-d', + 'file' => 'checkFile' + ]; + + protected $message = [ + 'id.require' => '缺少必要参数', + 'org_id.require' => '请选择组织', + 'dept_id.require' => '请选择部门', + 'project_id.require' => '请选择项目', + 'happen_time.dateFormat' => '发生时间格式错误', + ]; + + + /** + * 参数描述 + * @var string[] + */ + protected $field = [ + 'id' => 'id', + 'org_id' => '组织id', + 'dept_id' => '部门id', + 'project_id' => '项目id', + 'add_user' => '添加人', + 'update_user' => '更新人', + ]; + + + /** + * @notes 添加场景 + * @return SafetyEventValidate + * @author likeadmin + * @date 2023/12/19 13:52 + */ + public function sceneAdd() + { + return $this->only(['org_id', 'dept_id', 'project_id', 'name', 'happen_time', 'content', 'remark', 'file']); } - return true; - } - - public function checkDept($value,$rule,$data): bool|string - { - $dept = Dept::where('id',$value)->findOrEmpty(); - if($dept->isEmpty()){ - return '部门不存在'; + + + /** + * @notes 编辑场景 + * @return SafetyEventValidate + * @author likeadmin + * @date 2023/12/19 13:52 + */ + public function sceneEdit() + { + return $this->only(['id', 'org_id', 'dept_id', 'project_id', 'name', 'happen_time', 'content', 'remark', 'file']); } - if($dept['org_id'] != $data['org_id']){ - return '部门不属于当前选择的组织'; + + + /** + * @notes 删除场景 + * @return SafetyEventValidate + * @author likeadmin + * @date 2023/12/19 13:52 + */ + public function sceneDelete() + { + return $this->only(['id'])->remove('id', 'checkData'); } - return true; - } - - public function checkProject($value): bool|string - { - $data = Project::where('id',$value)->findOrEmpty(); - if($data->isEmpty()){ - return '项目不存在'; + + + /** + * @notes 详情场景 + * @return SafetyEventValidate + * @author likeadmin + * @date 2023/12/19 13:52 + */ + public function sceneDetail() + { + return $this->only(['id']); } - return true; - } - - public function checkFile($value): bool|string - { - if(!empty($value) && $value != ''){ - if(!is_array($value)){ - return '附件必须是json数组'; + + public function checkOrg($value): bool|string + { + $data = Orgs::where('id', $value)->findOrEmpty(); + if ($data->isEmpty()) { + return '组织不存在'; } + return true; } - return true; - } - -} \ No newline at end of file + + public function checkDept($value, $rule, $data): bool|string + { + $dept = Dept::where('id', $value)->findOrEmpty(); + if ($dept->isEmpty()) { + return '部门不存在'; + } + if ($dept['org_id'] != $data['org_id']) { + return '部门不属于当前选择的组织'; + } + return true; + } + + public function checkProject($value): bool|string + { + $data = Project::where('id', $value)->findOrEmpty(); + if ($data->isEmpty()) { + return '项目不存在'; + } + return true; + } + + public function checkFile($value): bool|string + { + if (!empty($value) && $value != '') { + if (!is_array($value)) { + return '附件必须是json数组'; + } + } + return true; + } + + } \ No newline at end of file diff --git a/app/adminapi/validate/safety/SafetyHazardValidate.php b/app/adminapi/validate/safety/SafetyHazardValidate.php index 154defe9b..3e07477e5 100644 --- a/app/adminapi/validate/safety/SafetyHazardValidate.php +++ b/app/adminapi/validate/safety/SafetyHazardValidate.php @@ -11,127 +11,128 @@ // +---------------------------------------------------------------------- // | author: likeadminTeam // +---------------------------------------------------------------------- - -namespace app\adminapi\validate\safety; - - -use app\common\model\dept\Dept; -use app\common\model\dept\Orgs; -use app\common\model\project\Project; -use app\common\validate\BaseValidate; - - -/** - * 危险源管理验证器 - * Class SafetyHazardValidate - * @package app\adminapi\validate\safety - */ -class SafetyHazardValidate extends BaseValidate -{ - - /** - * 设置校验规则 - * @var string[] - */ - protected $rule = [ - 'id' => 'require', - 'org_id' => 'require|checkOrg', - 'dept_id' => 'require|checkDept', - 'project_id' => 'require|checkProject', - 'file' => 'checkFile' - ]; - protected $message = [ - 'id.require' => '缺少必要参数', - 'org_id.require' => '请选择组织', - 'dept_id.require' => '请选择部门', - 'project_id.require' => '请选择项目', - ]; + namespace app\adminapi\validate\safety; - - /** - * @notes 添加场景 - * @return SafetyHazardValidate - * @author likeadmin - * @date 2023/12/19 17:22 - */ - public function sceneAdd() - { - return $this->remove('id',true); - } - - - /** - * @notes 编辑场景 - * @return SafetyHazardValidate - * @author likeadmin - * @date 2023/12/19 17:22 - */ - public function sceneEdit() - {} - - - /** - * @notes 删除场景 - * @return SafetyHazardValidate - * @author likeadmin - * @date 2023/12/19 17:22 - */ - public function sceneDelete() - { - return $this->only(['id']); - } - - - /** - * @notes 详情场景 - * @return SafetyHazardValidate - * @author likeadmin - * @date 2023/12/19 17:22 - */ - public function sceneDetail() - { - return $this->only(['id']); - } - public function checkOrg($value): bool|string + use app\common\model\dept\Dept; + use app\common\model\dept\Orgs; + use app\common\model\project\Project; + use app\common\validate\BaseValidate; + + + /** + * 危险源管理验证器 + * Class SafetyHazardValidate + * @package app\adminapi\validate\safety + */ + class SafetyHazardValidate extends BaseValidate { - $data = Orgs::where('id',$value)->findOrEmpty(); - if($data->isEmpty()){ - return '组织不存在'; + + /** + * 设置校验规则 + * @var string[] + */ + protected $rule = [ + 'id' => 'require', + 'org_id' => 'require|checkOrg', + 'dept_id' => 'require|checkDept', + 'project_id' => 'require|checkProject', + 'file' => 'checkFile' + ]; + + protected $message = [ + 'id.require' => '缺少必要参数', + 'org_id.require' => '请选择组织', + 'dept_id.require' => '请选择部门', + 'project_id.require' => '请选择项目', + ]; + + + /** + * @notes 添加场景 + * @return SafetyHazardValidate + * @author likeadmin + * @date 2023/12/19 17:22 + */ + public function sceneAdd() + { + return $this->remove('id', true); } - return true; - } - - public function checkDept($value,$rule,$data): bool|string - { - $dept = Dept::where('id',$value)->findOrEmpty(); - if($dept->isEmpty()){ - return '部门不存在'; + + + /** + * @notes 编辑场景 + * @return SafetyHazardValidate + * @author likeadmin + * @date 2023/12/19 17:22 + */ + public function sceneEdit() + { } - if($dept['org_id'] != $data['org_id']){ - return '部门不属于当前选择的组织'; + + + /** + * @notes 删除场景 + * @return SafetyHazardValidate + * @author likeadmin + * @date 2023/12/19 17:22 + */ + public function sceneDelete() + { + return $this->only(['id'])->remove('id', 'checkData'); } - return true; - } - - public function checkProject($value): bool|string - { - $data = Project::where('id',$value)->findOrEmpty(); - if($data->isEmpty()){ - return '项目不存在'; + + + /** + * @notes 详情场景 + * @return SafetyHazardValidate + * @author likeadmin + * @date 2023/12/19 17:22 + */ + public function sceneDetail() + { + return $this->only(['id']); } - return true; - } - - public function checkFile($value): bool|string - { - if(!empty($value) && $value != ''){ - if(!is_array($value)){ - return '附件必须是json数组'; + + public function checkOrg($value): bool|string + { + $data = Orgs::where('id', $value)->findOrEmpty(); + if ($data->isEmpty()) { + return '组织不存在'; } + return true; } - return true; - } - -} \ No newline at end of file + + public function checkDept($value, $rule, $data): bool|string + { + $dept = Dept::where('id', $value)->findOrEmpty(); + if ($dept->isEmpty()) { + return '部门不存在'; + } + if ($dept['org_id'] != $data['org_id']) { + return '部门不属于当前选择的组织'; + } + return true; + } + + public function checkProject($value): bool|string + { + $data = Project::where('id', $value)->findOrEmpty(); + if ($data->isEmpty()) { + return '项目不存在'; + } + return true; + } + + public function checkFile($value): bool|string + { + if (!empty($value) && $value != '') { + if (!is_array($value)) { + return '附件必须是json数组'; + } + } + return true; + } + + } \ No newline at end of file diff --git a/app/adminapi/validate/safety/SafetyModifyValidate.php b/app/adminapi/validate/safety/SafetyModifyValidate.php index 7f63120ea..11a5133a1 100644 --- a/app/adminapi/validate/safety/SafetyModifyValidate.php +++ b/app/adminapi/validate/safety/SafetyModifyValidate.php @@ -11,132 +11,133 @@ // +---------------------------------------------------------------------- // | author: likeadminTeam // +---------------------------------------------------------------------- - -namespace app\adminapi\validate\safety; - - -use app\common\model\dept\Dept; -use app\common\model\dept\Orgs; -use app\common\model\project\Project; -use app\common\validate\BaseValidate; - - -/** - * 安全整改验证器 - * Class SafetyModifyValidate - * @package app\adminapi\validate\safety - */ -class SafetyModifyValidate extends BaseValidate -{ - - /** - * 设置校验规则 - * @var string[] - */ - protected $rule = [ - 'id' => 'require', - 'org_id' => 'require|checkOrg', - 'dept_id' => 'require|checkDept', - 'project_id' => 'require|checkProject', - 'check_date' => 'dateFormat:Y-m-d', - ]; - protected $message = [ - 'id.require' => '缺少必要参数', - 'org_id.require' => '请选择组织', - 'dept_id.require' => '请选择部门', - 'project_id.require' => '请选择项目', - 'check_date.dateFormat' => '检查日期格式错误', - ]; - - - /** - * 参数描述 - * @var string[] - */ - protected $field = [ - 'id' => 'id', - 'org_id' => '组织id', - 'dept_id' => '部门id', - 'project_id' => '项目id', - 'add_user' => '添加人', - 'update_user' => '更新人', - ]; - - - /** - * @notes 添加场景 - * @return SafetyModifyValidate - * @author likeadmin - * @date 2023/12/19 16:40 - */ - public function sceneAdd() - { - return $this->remove('id',true); - } - - - /** - * @notes 编辑场景 - * @return SafetyModifyValidate - * @author likeadmin - * @date 2023/12/19 16:40 - */ - public function sceneEdit() - {} - - - /** - * @notes 删除场景 - * @return SafetyModifyValidate - * @author likeadmin - * @date 2023/12/19 16:40 - */ - public function sceneDelete() - { - return $this->only(['id']); - } - - - /** - * @notes 详情场景 - * @return SafetyModifyValidate - * @author likeadmin - * @date 2023/12/19 16:40 - */ - public function sceneDetail() - { - return $this->only(['id']); - } + namespace app\adminapi\validate\safety; - public function checkOrg($value): bool|string + + use app\common\model\dept\Dept; + use app\common\model\dept\Orgs; + use app\common\model\project\Project; + use app\common\validate\BaseValidate; + + + /** + * 安全整改验证器 + * Class SafetyModifyValidate + * @package app\adminapi\validate\safety + */ + class SafetyModifyValidate extends BaseValidate { - $data = Orgs::where('id',$value)->findOrEmpty(); - if($data->isEmpty()){ - return '组织不存在'; + + /** + * 设置校验规则 + * @var string[] + */ + protected $rule = [ + 'id' => 'require', + 'org_id' => 'require|checkOrg', + 'dept_id' => 'require|checkDept', + 'project_id' => 'require|checkProject', + 'check_date' => 'dateFormat:Y-m-d', + ]; + + protected $message = [ + 'id.require' => '缺少必要参数', + 'org_id.require' => '请选择组织', + 'dept_id.require' => '请选择部门', + 'project_id.require' => '请选择项目', + 'check_date.dateFormat' => '检查日期格式错误', + ]; + + + /** + * 参数描述 + * @var string[] + */ + protected $field = [ + 'id' => 'id', + 'org_id' => '组织id', + 'dept_id' => '部门id', + 'project_id' => '项目id', + 'add_user' => '添加人', + 'update_user' => '更新人', + ]; + + + /** + * @notes 添加场景 + * @return SafetyModifyValidate + * @author likeadmin + * @date 2023/12/19 16:40 + */ + public function sceneAdd() + { + return $this->remove('id', true); } - return true; - } - - public function checkDept($value,$rule,$data): bool|string - { - $dept = Dept::where('id',$value)->findOrEmpty(); - if($dept->isEmpty()){ - return '部门不存在'; + + + /** + * @notes 编辑场景 + * @return SafetyModifyValidate + * @author likeadmin + * @date 2023/12/19 16:40 + */ + public function sceneEdit() + { } - if($dept['org_id'] != $data['org_id']){ - return '部门不属于当前选择的组织'; + + + /** + * @notes 删除场景 + * @return SafetyModifyValidate + * @author likeadmin + * @date 2023/12/19 16:40 + */ + public function sceneDelete() + { + return $this->only(['id'])->remove('id', 'checkData'); } - return true; - } - - public function checkProject($value): bool|string - { - $data = Project::where('id',$value)->findOrEmpty(); - if($data->isEmpty()){ - return '项目不存在'; + + + /** + * @notes 详情场景 + * @return SafetyModifyValidate + * @author likeadmin + * @date 2023/12/19 16:40 + */ + public function sceneDetail() + { + return $this->only(['id']); } - return true; - } - -} \ No newline at end of file + + public function checkOrg($value): bool|string + { + $data = Orgs::where('id', $value)->findOrEmpty(); + if ($data->isEmpty()) { + return '组织不存在'; + } + return true; + } + + public function checkDept($value, $rule, $data): bool|string + { + $dept = Dept::where('id', $value)->findOrEmpty(); + if ($dept->isEmpty()) { + return '部门不存在'; + } + if ($dept['org_id'] != $data['org_id']) { + return '部门不属于当前选择的组织'; + } + return true; + } + + public function checkProject($value): bool|string + { + $data = Project::where('id', $value)->findOrEmpty(); + if ($data->isEmpty()) { + return '项目不存在'; + } + return true; + } + + } \ No newline at end of file diff --git a/app/adminapi/validate/safety/SafetyProductMonthValidate.php b/app/adminapi/validate/safety/SafetyProductMonthValidate.php index 305e37e99..73e0ab3fb 100644 --- a/app/adminapi/validate/safety/SafetyProductMonthValidate.php +++ b/app/adminapi/validate/safety/SafetyProductMonthValidate.php @@ -11,149 +11,150 @@ // +---------------------------------------------------------------------- // | author: likeadminTeam // +---------------------------------------------------------------------- - -namespace app\adminapi\validate\safety; - - -use app\common\model\dept\Dept; -use app\common\model\dept\Orgs; -use app\common\model\project\Project; -use app\common\validate\BaseValidate; - - -/** - * 安全生产月验证器 - * Class SafetyProductMonthValidate - * @package app\adminapi\validate\safety - */ -class SafetyProductMonthValidate extends BaseValidate -{ - - /** - * 设置校验规则 - * @var string[] - */ - protected $rule = [ - 'id' => 'require', - 'org_id' => 'require|checkOrg', - 'dept_id' => 'require|checkDept', - 'project_id' => 'require|checkProject', - 'month' => 'require|in:1,2,3,4,5,6,7,8,9,10,11,12', - 'resp_user' => 'require', - 'hazard_num' => 'integer|gt:0', - 'file' => 'checkFile' - ]; - protected $message = [ - 'id.require' => '缺少必要参数', - 'org_id.require' => '请选择组织', - 'dept_id.require' => '请选择部门', - 'project_id.require' => '请选择项目', - 'month.require' => '请选择月份', - 'month.in' => '月份数据值错误', - 'resp_user.require' => '请填写负责人', - 'hazard_num.integer' => '隐患数量值必须是整数', - 'hazard_num.gt' => '隐患数量值必须大于0', - ]; - - - /** - * 参数描述 - * @var string[] - */ - protected $field = [ - 'id' => 'id', - 'org_id' => '组织id', - 'dept_id' => '部门id', - 'project_id' => '项目id', - 'month' => '月份', - 'resp_user' => '负责人', - ]; - - - /** - * @notes 添加场景 - * @return SafetyProductMonthValidate - * @author likeadmin - * @date 2023/12/20 10:46 - */ - public function sceneAdd() - { - return $this->remove('id',true); - } - - - /** - * @notes 编辑场景 - * @return SafetyProductMonthValidate - * @author likeadmin - * @date 2023/12/20 10:46 - */ - public function sceneEdit() - {} - - - /** - * @notes 删除场景 - * @return SafetyProductMonthValidate - * @author likeadmin - * @date 2023/12/20 10:46 - */ - public function sceneDelete() - { - return $this->only(['id']); - } - - - /** - * @notes 详情场景 - * @return SafetyProductMonthValidate - * @author likeadmin - * @date 2023/12/20 10:46 - */ - public function sceneDetail() - { - return $this->only(['id']); - } + namespace app\adminapi\validate\safety; - public function checkOrg($value): bool|string + + use app\common\model\dept\Dept; + use app\common\model\dept\Orgs; + use app\common\model\project\Project; + use app\common\validate\BaseValidate; + + + /** + * 安全生产月验证器 + * Class SafetyProductMonthValidate + * @package app\adminapi\validate\safety + */ + class SafetyProductMonthValidate extends BaseValidate { - $data = Orgs::where('id',$value)->findOrEmpty(); - if($data->isEmpty()){ - return '组织不存在'; + + /** + * 设置校验规则 + * @var string[] + */ + protected $rule = [ + 'id' => 'require', + 'org_id' => 'require|checkOrg', + 'dept_id' => 'require|checkDept', + 'project_id' => 'require|checkProject', + 'month' => 'require|in:1,2,3,4,5,6,7,8,9,10,11,12', + 'resp_user' => 'require', + 'hazard_num' => 'integer|gt:0', + 'file' => 'checkFile' + ]; + + protected $message = [ + 'id.require' => '缺少必要参数', + 'org_id.require' => '请选择组织', + 'dept_id.require' => '请选择部门', + 'project_id.require' => '请选择项目', + 'month.require' => '请选择月份', + 'month.in' => '月份数据值错误', + 'resp_user.require' => '请填写负责人', + 'hazard_num.integer' => '隐患数量值必须是整数', + 'hazard_num.gt' => '隐患数量值必须大于0', + ]; + + + /** + * 参数描述 + * @var string[] + */ + protected $field = [ + 'id' => 'id', + 'org_id' => '组织id', + 'dept_id' => '部门id', + 'project_id' => '项目id', + 'month' => '月份', + 'resp_user' => '负责人', + ]; + + + /** + * @notes 添加场景 + * @return SafetyProductMonthValidate + * @author likeadmin + * @date 2023/12/20 10:46 + */ + public function sceneAdd() + { + return $this->remove('id', true); } - return true; - } - - public function checkDept($value,$rule,$data): bool|string - { - $dept = Dept::where('id',$value)->findOrEmpty(); - if($dept->isEmpty()){ - return '部门不存在'; + + + /** + * @notes 编辑场景 + * @return SafetyProductMonthValidate + * @author likeadmin + * @date 2023/12/20 10:46 + */ + public function sceneEdit() + { } - if($dept['org_id'] != $data['org_id']){ - return '部门不属于当前选择的组织'; + + + /** + * @notes 删除场景 + * @return SafetyProductMonthValidate + * @author likeadmin + * @date 2023/12/20 10:46 + */ + public function sceneDelete() + { + return $this->only(['id'])->remove('id', 'checkData'); } - return true; - } - - public function checkProject($value): bool|string - { - $data = Project::where('id',$value)->findOrEmpty(); - if($data->isEmpty()){ - return '项目不存在'; + + + /** + * @notes 详情场景 + * @return SafetyProductMonthValidate + * @author likeadmin + * @date 2023/12/20 10:46 + */ + public function sceneDetail() + { + return $this->only(['id']); } - return true; - } - - public function checkFile($value): bool|string - { - if(!empty($value) && $value != ''){ - if(!is_array($value)){ - return '附件必须是json数组'; + + public function checkOrg($value): bool|string + { + $data = Orgs::where('id', $value)->findOrEmpty(); + if ($data->isEmpty()) { + return '组织不存在'; } + return true; } - return true; - } - -} \ No newline at end of file + + public function checkDept($value, $rule, $data): bool|string + { + $dept = Dept::where('id', $value)->findOrEmpty(); + if ($dept->isEmpty()) { + return '部门不存在'; + } + if ($dept['org_id'] != $data['org_id']) { + return '部门不属于当前选择的组织'; + } + return true; + } + + public function checkProject($value): bool|string + { + $data = Project::where('id', $value)->findOrEmpty(); + if ($data->isEmpty()) { + return '项目不存在'; + } + return true; + } + + public function checkFile($value): bool|string + { + if (!empty($value) && $value != '') { + if (!is_array($value)) { + return '附件必须是json数组'; + } + } + return true; + } + + } \ No newline at end of file diff --git a/app/adminapi/validate/safety/SafetyRehearsalValidate.php b/app/adminapi/validate/safety/SafetyRehearsalValidate.php index a7ee2aa18..f60cd7dd4 100644 --- a/app/adminapi/validate/safety/SafetyRehearsalValidate.php +++ b/app/adminapi/validate/safety/SafetyRehearsalValidate.php @@ -11,144 +11,145 @@ // +---------------------------------------------------------------------- // | author: likeadminTeam // +---------------------------------------------------------------------- - -namespace app\adminapi\validate\safety; - - -use app\common\model\dept\Dept; -use app\common\model\dept\Orgs; -use app\common\model\project\Project; -use app\common\validate\BaseValidate; - - -/** - * 安全演练验证器 - * Class SafetyRehearsalValidate - * @package app\adminapi\validate\safety - */ -class SafetyRehearsalValidate extends BaseValidate -{ - - /** - * 设置校验规则 - * @var string[] - */ - protected $rule = [ - 'id' => 'require', - 'org_id' => 'require|checkOrg', - 'dept_id' => 'require|checkDept', - 'project_id' => 'require|checkProject', - 'name' => 'require', - 'happen_date' => 'dateFormat:Y-m-d', - 'file' => 'checkFile' - ]; - protected $message = [ - 'id.require' => '缺少必要参数', - 'org_id.require' => '请选择组织', - 'dept_id.require' => '请选择部门', - 'project_id.require' => '请选择项目', - 'name.require' => '请填写名称', - 'happen_date.dateFormat' => '发生日期格式错误', - ]; - - - /** - * 参数描述 - * @var string[] - */ - protected $field = [ - 'id' => 'id', - 'org_id' => '组织id', - 'dept_id' => '部门id', - 'project_id' => '项目id', - 'name' => '名称', - ]; - - - /** - * @notes 添加场景 - * @return SafetyRehearsalValidate - * @author likeadmin - * @date 2023/12/20 10:05 - */ - public function sceneAdd() - { - return $this->remove('id',true); - } - - - /** - * @notes 编辑场景 - * @return SafetyRehearsalValidate - * @author likeadmin - * @date 2023/12/20 10:05 - */ - public function sceneEdit() - {} - - - /** - * @notes 删除场景 - * @return SafetyRehearsalValidate - * @author likeadmin - * @date 2023/12/20 10:05 - */ - public function sceneDelete() - { - return $this->only(['id']); - } - - - /** - * @notes 详情场景 - * @return SafetyRehearsalValidate - * @author likeadmin - * @date 2023/12/20 10:05 - */ - public function sceneDetail() - { - return $this->only(['id']); - } + namespace app\adminapi\validate\safety; - public function checkOrg($value): bool|string + + use app\common\model\dept\Dept; + use app\common\model\dept\Orgs; + use app\common\model\project\Project; + use app\common\validate\BaseValidate; + + + /** + * 安全演练验证器 + * Class SafetyRehearsalValidate + * @package app\adminapi\validate\safety + */ + class SafetyRehearsalValidate extends BaseValidate { - $data = Orgs::where('id',$value)->findOrEmpty(); - if($data->isEmpty()){ - return '组织不存在'; + + /** + * 设置校验规则 + * @var string[] + */ + protected $rule = [ + 'id' => 'require', + 'org_id' => 'require|checkOrg', + 'dept_id' => 'require|checkDept', + 'project_id' => 'require|checkProject', + 'name' => 'require', + 'happen_date' => 'dateFormat:Y-m-d', + 'file' => 'checkFile' + ]; + + protected $message = [ + 'id.require' => '缺少必要参数', + 'org_id.require' => '请选择组织', + 'dept_id.require' => '请选择部门', + 'project_id.require' => '请选择项目', + 'name.require' => '请填写名称', + 'happen_date.dateFormat' => '发生日期格式错误', + ]; + + + /** + * 参数描述 + * @var string[] + */ + protected $field = [ + 'id' => 'id', + 'org_id' => '组织id', + 'dept_id' => '部门id', + 'project_id' => '项目id', + 'name' => '名称', + ]; + + + /** + * @notes 添加场景 + * @return SafetyRehearsalValidate + * @author likeadmin + * @date 2023/12/20 10:05 + */ + public function sceneAdd() + { + return $this->remove('id', true); } - return true; - } - - public function checkDept($value,$rule,$data): bool|string - { - $dept = Dept::where('id',$value)->findOrEmpty(); - if($dept->isEmpty()){ - return '部门不存在'; + + + /** + * @notes 编辑场景 + * @return SafetyRehearsalValidate + * @author likeadmin + * @date 2023/12/20 10:05 + */ + public function sceneEdit() + { } - if($dept['org_id'] != $data['org_id']){ - return '部门不属于当前选择的组织'; + + + /** + * @notes 删除场景 + * @return SafetyRehearsalValidate + * @author likeadmin + * @date 2023/12/20 10:05 + */ + public function sceneDelete() + { + return $this->only(['id'])->remove('id', 'checkData'); } - return true; - } - - public function checkProject($value): bool|string - { - $data = Project::where('id',$value)->findOrEmpty(); - if($data->isEmpty()){ - return '项目不存在'; + + + /** + * @notes 详情场景 + * @return SafetyRehearsalValidate + * @author likeadmin + * @date 2023/12/20 10:05 + */ + public function sceneDetail() + { + return $this->only(['id']); } - return true; - } - - public function checkFile($value): bool|string - { - if(!empty($value) && $value != ''){ - if(!is_array($value)){ - return '附件必须是json数组'; + + public function checkOrg($value): bool|string + { + $data = Orgs::where('id', $value)->findOrEmpty(); + if ($data->isEmpty()) { + return '组织不存在'; } + return true; } - return true; - } - -} \ No newline at end of file + + public function checkDept($value, $rule, $data): bool|string + { + $dept = Dept::where('id', $value)->findOrEmpty(); + if ($dept->isEmpty()) { + return '部门不存在'; + } + if ($dept['org_id'] != $data['org_id']) { + return '部门不属于当前选择的组织'; + } + return true; + } + + public function checkProject($value): bool|string + { + $data = Project::where('id', $value)->findOrEmpty(); + if ($data->isEmpty()) { + return '项目不存在'; + } + return true; + } + + public function checkFile($value): bool|string + { + if (!empty($value) && $value != '') { + if (!is_array($value)) { + return '附件必须是json数组'; + } + } + return true; + } + + } \ No newline at end of file diff --git a/app/adminapi/validate/safety/SafetyStandardValidate.php b/app/adminapi/validate/safety/SafetyStandardValidate.php index 1f8d27e89..8251d8638 100644 --- a/app/adminapi/validate/safety/SafetyStandardValidate.php +++ b/app/adminapi/validate/safety/SafetyStandardValidate.php @@ -11,135 +11,135 @@ // +---------------------------------------------------------------------- // | author: likeadminTeam // +---------------------------------------------------------------------- - -namespace app\adminapi\validate\safety; - - -use app\common\model\dept\Dept; -use app\common\model\dept\Orgs; -use app\common\validate\BaseValidate; - - -/** - * 安全规范验证器 - * Class SafetyStandardValidate - * @package app\adminapi\validate\safety - */ -class SafetyStandardValidate extends BaseValidate -{ - - /** - * 设置校验规则 - * @var string[] - */ - protected $rule = [ - 'id' => 'require', - 'org_id' => 'require|checkOrg', - 'dept_id' => 'require|checkDept', - 'name' => 'require', - 'file' => 'checkFile' - ]; - protected $message = [ - 'id.require' => '缺少必要参数', - 'org_id.require' => '请选择组织', - 'dept_id.require' => '请选择部门', - 'name.require' => '请填写规范名称', - ]; - - - /** - * 参数描述 - * @var string[] - */ - protected $field = [ - 'id' => 'id', - 'org_id' => '组织id', - 'dept_id' => '部门id', - 'type' => '规范类别', - 'name' => '规范名称', - 'publish_dep' => '发布部门', - 'content' => '规范内容', - 'file' => '附件', - ]; - - - /** - * @notes 添加场景 - * @return SafetyStandardValidate - * @author likeadmin - * @date 2023/12/19 10:21 - */ - public function sceneAdd() - { - return $this->only(['org_id','dept_id','type','name','publish_dep','content','file']); - } - - - /** - * @notes 编辑场景 - * @return SafetyStandardValidate - * @author likeadmin - * @date 2023/12/19 10:21 - */ - public function sceneEdit() - { - return $this->only(['id','org_id','dept_id','type','name','publish_dep','content','file']); - } - - - /** - * @notes 删除场景 - * @return SafetyStandardValidate - * @author likeadmin - * @date 2023/12/19 10:21 - */ - public function sceneDelete() - { - return $this->only(['id']); - } - - - /** - * @notes 详情场景 - * @return SafetyStandardValidate - * @author likeadmin - * @date 2023/12/19 10:21 - */ - public function sceneDetail() - { - return $this->only(['id']); - } + namespace app\adminapi\validate\safety; - public function checkOrg($value): bool|string + + use app\common\model\dept\Dept; + use app\common\model\dept\Orgs; + use app\common\validate\BaseValidate; + + + /** + * 安全规范验证器 + * Class SafetyStandardValidate + * @package app\adminapi\validate\safety + */ + class SafetyStandardValidate extends BaseValidate { - $data = Orgs::where('id',$value)->findOrEmpty(); - if($data->isEmpty()){ - return '组织不存在'; + + /** + * 设置校验规则 + * @var string[] + */ + protected $rule = [ + 'id' => 'require', + 'org_id' => 'require|checkOrg', + 'dept_id' => 'require|checkDept', + 'name' => 'require', + 'file' => 'checkFile' + ]; + + protected $message = [ + 'id.require' => '缺少必要参数', + 'org_id.require' => '请选择组织', + 'dept_id.require' => '请选择部门', + 'name.require' => '请填写规范名称', + ]; + + + /** + * 参数描述 + * @var string[] + */ + protected $field = [ + 'id' => 'id', + 'org_id' => '组织id', + 'dept_id' => '部门id', + 'type' => '规范类别', + 'name' => '规范名称', + 'publish_dep' => '发布部门', + 'content' => '规范内容', + 'file' => '附件', + ]; + + + /** + * @notes 添加场景 + * @return SafetyStandardValidate + * @author likeadmin + * @date 2023/12/19 10:21 + */ + public function sceneAdd() + { + return $this->only(['org_id', 'dept_id', 'type', 'name', 'publish_dep', 'content', 'file']); } - return true; - } - - public function checkDept($value,$rule,$data): bool|string - { - $dept = Dept::where('id',$value)->findOrEmpty(); - if($dept->isEmpty()){ - return '部门不存在'; + + + /** + * @notes 编辑场景 + * @return SafetyStandardValidate + * @author likeadmin + * @date 2023/12/19 10:21 + */ + public function sceneEdit() + { + return $this->only(['id', 'org_id', 'dept_id', 'type', 'name', 'publish_dep', 'content', 'file']); } - if($dept['org_id'] != $data['org_id']){ - return '部门不属于当前选择的组织'; + + + /** + * @notes 删除场景 + * @return SafetyStandardValidate + * @author likeadmin + * @date 2023/12/19 10:21 + */ + public function sceneDelete() + { + return $this->only(['id'])->remove('id', 'checkData'); } - return true; - } - - public function checkFile($value): bool|string - { - if(!empty($value) && $value != ''){ - if(!is_array($value)){ - return '附件必须是json数组'; + + + /** + * @notes 详情场景 + * @return SafetyStandardValidate + * @author likeadmin + * @date 2023/12/19 10:21 + */ + public function sceneDetail() + { + return $this->only(['id']); + } + + public function checkOrg($value): bool|string + { + $data = Orgs::where('id', $value)->findOrEmpty(); + if ($data->isEmpty()) { + return '组织不存在'; } + return true; } - return true; - } - -} \ No newline at end of file + + public function checkDept($value, $rule, $data): bool|string + { + $dept = Dept::where('id', $value)->findOrEmpty(); + if ($dept->isEmpty()) { + return '部门不存在'; + } + if ($dept['org_id'] != $data['org_id']) { + return '部门不属于当前选择的组织'; + } + return true; + } + + public function checkFile($value): bool|string + { + if (!empty($value) && $value != '') { + if (!is_array($value)) { + return '附件必须是json数组'; + } + } + return true; + } + + } \ No newline at end of file diff --git a/app/adminapi/validate/safety/SafetySuperviseValidate.php b/app/adminapi/validate/safety/SafetySuperviseValidate.php index 5d29a61b0..adad3589c 100644 --- a/app/adminapi/validate/safety/SafetySuperviseValidate.php +++ b/app/adminapi/validate/safety/SafetySuperviseValidate.php @@ -11,121 +11,119 @@ // +---------------------------------------------------------------------- // | author: likeadminTeam // +---------------------------------------------------------------------- - -namespace app\adminapi\validate\safety; - - -use app\common\model\dept\Dept; -use app\common\model\dept\Orgs; -use app\common\model\project\Project; -use app\common\validate\BaseValidate; - - -/** - * 安全监督验证器 - * Class SafetySuperviseValidate - * @package app\adminapi\validate\safety - */ -class SafetySuperviseValidate extends BaseValidate -{ - - /** - * 设置校验规则 - * @var string[] - */ - protected $rule = [ - 'id' => 'require', - 'org_id' => 'require|checkOrg', - 'dept_id' => 'require|checkDept', - 'happen_time' => 'dateFormat:Y-m-d', - 'file' => 'checkFile' - ]; - protected $message = [ - 'id.require' => '缺少必要参数', - 'org_id.require' => '请选择组织', - 'dept_id.require' => '请选择部门', - 'happen_time.dateFormat' => '发生时间格式错误', - ]; + namespace app\adminapi\validate\safety; - - - /** - * @notes 添加场景 - * @return SafetySuperviseValidate - * @author likeadmin - * @date 2023/12/19 15:11 - */ - public function sceneAdd() - { - return $this->only(['org_id','dept_id','project_name','name','happen_time','device_accident','content','remark','file']); - } - - - /** - * @notes 编辑场景 - * @return SafetySuperviseValidate - * @author likeadmin - * @date 2023/12/19 15:11 - */ - public function sceneEdit() - { - return $this->only(['id','org_id','dept_id','project_name','name','happen_time','device_accident','content','remark','file']); - } - - - /** - * @notes 删除场景 - * @return SafetySuperviseValidate - * @author likeadmin - * @date 2023/12/19 15:11 - */ - public function sceneDelete() - { - return $this->only(['id']); - } - - - /** - * @notes 详情场景 - * @return SafetySuperviseValidate - * @author likeadmin - * @date 2023/12/19 15:11 - */ - public function sceneDetail() - { - return $this->only(['id']); - } - public function checkOrg($value): bool|string + use app\common\model\dept\Dept; + use app\common\model\dept\Orgs; + use app\common\validate\BaseValidate; + + + /** + * 安全监督验证器 + * Class SafetySuperviseValidate + * @package app\adminapi\validate\safety + */ + class SafetySuperviseValidate extends BaseValidate { - $data = Orgs::where('id',$value)->findOrEmpty(); - if($data->isEmpty()){ - return '组织不存在'; + + /** + * 设置校验规则 + * @var string[] + */ + protected $rule = [ + 'id' => 'require', + 'org_id' => 'require|checkOrg', + 'dept_id' => 'require|checkDept', + 'happen_time' => 'dateFormat:Y-m-d', + 'file' => 'checkFile' + ]; + + protected $message = [ + 'id.require' => '缺少必要参数', + 'org_id.require' => '请选择组织', + 'dept_id.require' => '请选择部门', + 'happen_time.dateFormat' => '发生时间格式错误', + ]; + + + /** + * @notes 添加场景 + * @return SafetySuperviseValidate + * @author likeadmin + * @date 2023/12/19 15:11 + */ + public function sceneAdd() + { + return $this->only(['org_id', 'dept_id', 'project_name', 'name', 'happen_time', 'device_accident', 'content', 'remark', 'file']); } - return true; - } - - public function checkDept($value,$rule,$data): bool|string - { - $dept = Dept::where('id',$value)->findOrEmpty(); - if($dept->isEmpty()){ - return '部门不存在'; + + + /** + * @notes 编辑场景 + * @return SafetySuperviseValidate + * @author likeadmin + * @date 2023/12/19 15:11 + */ + public function sceneEdit() + { + return $this->only(['id', 'org_id', 'dept_id', 'project_name', 'name', 'happen_time', 'device_accident', 'content', 'remark', 'file']); } - if($dept['org_id'] != $data['org_id']){ - return '部门不属于当前选择的组织'; + + + /** + * @notes 删除场景 + * @return SafetySuperviseValidate + * @author likeadmin + * @date 2023/12/19 15:11 + */ + public function sceneDelete() + { + return $this->only(['id'])->remove('id', 'checkData'); } - return true; - } - - public function checkFile($value): bool|string - { - if(!empty($value) && $value != ''){ - if(!is_array($value)){ - return '附件必须是json数组'; + + + /** + * @notes 详情场景 + * @return SafetySuperviseValidate + * @author likeadmin + * @date 2023/12/19 15:11 + */ + public function sceneDetail() + { + return $this->only(['id']); + } + + public function checkOrg($value): bool|string + { + $data = Orgs::where('id', $value)->findOrEmpty(); + if ($data->isEmpty()) { + return '组织不存在'; } + return true; } - return true; - } - -} \ No newline at end of file + + public function checkDept($value, $rule, $data): bool|string + { + $dept = Dept::where('id', $value)->findOrEmpty(); + if ($dept->isEmpty()) { + return '部门不存在'; + } + if ($dept['org_id'] != $data['org_id']) { + return '部门不属于当前选择的组织'; + } + return true; + } + + public function checkFile($value): bool|string + { + if (!empty($value) && $value != '') { + if (!is_array($value)) { + return '附件必须是json数组'; + } + } + return true; + } + + } \ No newline at end of file diff --git a/app/adminapi/validate/safety/SafetyTargetValidate.php b/app/adminapi/validate/safety/SafetyTargetValidate.php index 6a2d0d327..dc92ff8a3 100644 --- a/app/adminapi/validate/safety/SafetyTargetValidate.php +++ b/app/adminapi/validate/safety/SafetyTargetValidate.php @@ -11,144 +11,144 @@ // +---------------------------------------------------------------------- // | author: likeadminTeam // +---------------------------------------------------------------------- - -namespace app\adminapi\validate\safety; - - -use app\common\model\dept\Dept; -use app\common\model\dept\Orgs; -use app\common\model\project\Project; -use app\common\validate\BaseValidate; - - -/** - * 安全目标验证器 - * Class SafetyTargetValidate - * @package app\adminapi\validate\safety - */ -class SafetyTargetValidate extends BaseValidate -{ - - /** - * 设置校验规则 - * @var string[] - */ - protected $rule = [ - 'id' => 'require', - 'org_id' => 'require|checkOrg', - 'dept_id' => 'require|checkDept', - 'project_id' => 'require|checkProject', - 'file' => 'checkFile' - ]; - protected $message = [ - 'id.require' => '缺少必要参数', - 'org_id.require' => '请选择组织', - 'dept_id.require' => '请选择部门', - 'project_id.require' => '请选择项目', - ]; - - - /** - * 参数描述 - * @var string[] - */ - protected $field = [ - 'id' => 'id', - 'org_id' => '组织id', - 'dept_id' => '部门id', - 'project_id' => '项目id', - 'target' => '安全目标', - 'add_user' => '创建人', - 'update_user' => '更新人', - ]; - - - /** - * @notes 添加场景 - * @return SafetyTargetValidate - * @author likeadmin - * @date 2023/12/19 11:20 - */ - public function sceneAdd() - { - return $this->only(['org_id','dept_id','project_id','project_type','target','require','target_standard','pass_rate','deviation','file']); - } - - - /** - * @notes 编辑场景 - * @return SafetyTargetValidate - * @author likeadmin - * @date 2023/12/19 11:20 - */ - public function sceneEdit() - { - return $this->only(['id','org_id','dept_id','project_id','project_type','target','require','target_standard','pass_rate','deviation','file']); - } - - - /** - * @notes 删除场景 - * @return SafetyTargetValidate - * @author likeadmin - * @date 2023/12/19 11:20 - */ - public function sceneDelete() - { - return $this->only(['id']); - } - - - /** - * @notes 详情场景 - * @return SafetyTargetValidate - * @author likeadmin - * @date 2023/12/19 11:20 - */ - public function sceneDetail() - { - return $this->only(['id']); - } + namespace app\adminapi\validate\safety; - public function checkOrg($value): bool|string + + use app\common\model\dept\Dept; + use app\common\model\dept\Orgs; + use app\common\model\project\Project; + use app\common\validate\BaseValidate; + + + /** + * 安全目标验证器 + * Class SafetyTargetValidate + * @package app\adminapi\validate\safety + */ + class SafetyTargetValidate extends BaseValidate { - $data = Orgs::where('id',$value)->findOrEmpty(); - if($data->isEmpty()){ - return '组织不存在'; + + /** + * 设置校验规则 + * @var string[] + */ + protected $rule = [ + 'id' => 'require', + 'org_id' => 'require|checkOrg', + 'dept_id' => 'require|checkDept', + 'project_id' => 'require|checkProject', + 'file' => 'checkFile' + ]; + + protected $message = [ + 'id.require' => '缺少必要参数', + 'org_id.require' => '请选择组织', + 'dept_id.require' => '请选择部门', + 'project_id.require' => '请选择项目', + ]; + + + /** + * 参数描述 + * @var string[] + */ + protected $field = [ + 'id' => 'id', + 'org_id' => '组织id', + 'dept_id' => '部门id', + 'project_id' => '项目id', + 'target' => '安全目标', + 'add_user' => '创建人', + 'update_user' => '更新人', + ]; + + + /** + * @notes 添加场景 + * @return SafetyTargetValidate + * @author likeadmin + * @date 2023/12/19 11:20 + */ + public function sceneAdd() + { + return $this->only(['org_id', 'dept_id', 'project_id', 'project_type', 'target', 'require', 'target_standard', 'pass_rate', 'deviation', 'file']); } - return true; - } - - public function checkDept($value,$rule,$data): bool|string - { - $dept = Dept::where('id',$value)->findOrEmpty(); - if($dept->isEmpty()){ - return '部门不存在'; + + + /** + * @notes 编辑场景 + * @return SafetyTargetValidate + * @author likeadmin + * @date 2023/12/19 11:20 + */ + public function sceneEdit() + { + return $this->only(['id', 'org_id', 'dept_id', 'project_id', 'project_type', 'target', 'require', 'target_standard', 'pass_rate', 'deviation', 'file']); } - if($dept['org_id'] != $data['org_id']){ - return '部门不属于当前选择的组织'; + + + /** + * @notes 删除场景 + * @return SafetyTargetValidate + * @author likeadmin + * @date 2023/12/19 11:20 + */ + public function sceneDelete() + { + return $this->only(['id'])->remove('id', 'checkData'); } - return true; - } - - public function checkProject($value): bool|string - { - $data = Project::where('id',$value)->findOrEmpty(); - if($data->isEmpty()){ - return '项目不存在'; + + + /** + * @notes 详情场景 + * @return SafetyTargetValidate + * @author likeadmin + * @date 2023/12/19 11:20 + */ + public function sceneDetail() + { + return $this->only(['id']); } - return true; - } - - public function checkFile($value): bool|string - { - if(!empty($value) && $value != ''){ - if(!is_array($value)){ - return '附件必须是json数组'; + + public function checkOrg($value): bool|string + { + $data = Orgs::where('id', $value)->findOrEmpty(); + if ($data->isEmpty()) { + return '组织不存在'; } + return true; } - return true; - } - -} \ No newline at end of file + + public function checkDept($value, $rule, $data): bool|string + { + $dept = Dept::where('id', $value)->findOrEmpty(); + if ($dept->isEmpty()) { + return '部门不存在'; + } + if ($dept['org_id'] != $data['org_id']) { + return '部门不属于当前选择的组织'; + } + return true; + } + + public function checkProject($value): bool|string + { + $data = Project::where('id', $value)->findOrEmpty(); + if ($data->isEmpty()) { + return '项目不存在'; + } + return true; + } + + public function checkFile($value): bool|string + { + if (!empty($value) && $value != '') { + if (!is_array($value)) { + return '附件必须是json数组'; + } + } + return true; + } + + } \ No newline at end of file diff --git a/app/adminapi/validate/supplier/SupplierContactsValidate.php b/app/adminapi/validate/supplier/SupplierContactsValidate.php index a30eb6a7c..89496c137 100644 --- a/app/adminapi/validate/supplier/SupplierContactsValidate.php +++ b/app/adminapi/validate/supplier/SupplierContactsValidate.php @@ -11,137 +11,138 @@ // +---------------------------------------------------------------------- // | author: likeadminTeam // +---------------------------------------------------------------------- - -namespace app\adminapi\validate\supplier; - - -use app\common\model\dict\DictData; -use app\common\model\supplier\Supplier; -use app\common\validate\BaseValidate; - - -/** - * SupplierContacts验证器 - * Class SupplierContactsValidate - * @package app\adminapi\validate\supplier - */ -class SupplierContactsValidate extends BaseValidate -{ - - /** - * 设置校验规则 - * @var string[] - */ - protected $rule = [ - 'id' => 'require', - 'supplier_id' => 'require|checkSupplier', - 'name' => 'require', - 'sex' => 'in:0,1', - 'birthday' => 'dateFormat:Y-m-d', - 'contacts_type' => 'checkContactsType', - 'contacts_cate' => 'checkContactsCate', - 'id_type' => 'checkIdType', - 'annex' => 'checkAnnex' - ]; - - protected $message = [ - 'id.require' => '缺少必要参数', - 'supplier_id.require' => '请选择供应商', - 'name.require' => '请填写姓名', - 'sex.in' => '性别值无效', - 'birthday.dateFormat' => '出生日期数据格式错误', - ]; - - - /** - * @notes 添加场景 - * @return SupplierContactsValidate - * @author likeadmin - * @date 2023/12/26 13:47 - */ - public function sceneAdd() - { - return $this->remove('id',true); - } - - - /** - * @notes 编辑场景 - * @return SupplierContactsValidate - * @author likeadmin - * @date 2023/12/26 13:47 - */ - public function sceneEdit() - {} - - - /** - * @notes 删除场景 - * @return SupplierContactsValidate - * @author likeadmin - * @date 2023/12/26 13:47 - */ - public function sceneDelete() - { - return $this->only(['id']); - } - - - /** - * @notes 详情场景 - * @return SupplierContactsValidate - * @author likeadmin - * @date 2023/12/26 13:47 - */ - public function sceneDetail() - { - return $this->only(['id']); - } - public function checkSupplier($value): bool|string + namespace app\adminapi\validate\supplier; + + + use app\common\model\dict\DictData; + use app\common\model\supplier\Supplier; + use app\common\validate\BaseValidate; + + + /** + * SupplierContacts验证器 + * Class SupplierContactsValidate + * @package app\adminapi\validate\supplier + */ + class SupplierContactsValidate extends BaseValidate { - $supplier = Supplier::where('id',$value)->findOrEmpty(); - if($supplier->isEmpty()){ - return '供应商信息不存在'; + + /** + * 设置校验规则 + * @var string[] + */ + protected $rule = [ + 'id' => 'require', + 'supplier_id' => 'require|checkSupplier', + 'name' => 'require', + 'sex' => 'in:0,1', + 'birthday' => 'dateFormat:Y-m-d', + 'contacts_type' => 'checkContactsType', + 'contacts_cate' => 'checkContactsCate', + 'id_type' => 'checkIdType', + 'annex' => 'checkAnnex' + ]; + + protected $message = [ + 'id.require' => '缺少必要参数', + 'supplier_id.require' => '请选择供应商', + 'name.require' => '请填写姓名', + 'sex.in' => '性别值无效', + 'birthday.dateFormat' => '出生日期数据格式错误', + ]; + + + /** + * @notes 添加场景 + * @return SupplierContactsValidate + * @author likeadmin + * @date 2023/12/26 13:47 + */ + public function sceneAdd() + { + return $this->remove('id', true); } - return true; - } - - public function checkContactsType($value): bool|string - { - $dict = DictData::where('type_value','contacts_type')->column('value'); - if(!in_array($value,$dict)){ - return '联系人分类无效'; + + + /** + * @notes 编辑场景 + * @return SupplierContactsValidate + * @author likeadmin + * @date 2023/12/26 13:47 + */ + public function sceneEdit() + { } - return true; - } - - public function checkContactsCate($value): bool|string - { - $dict = DictData::where('type_value','contacts_cate')->column('value'); - if(!in_array($value,$dict)){ - return '联系人类型无效'; + + + /** + * @notes 删除场景 + * @return SupplierContactsValidate + * @author likeadmin + * @date 2023/12/26 13:47 + */ + public function sceneDelete() + { + return $this->only(['id'])->remove('id', 'checkData'); } - return true; - } - - public function checkIdType($value): bool|string - { - $dict = DictData::where('type_value','id_type')->column('value'); - if(!in_array($value,$dict)){ - return '证件类型无效'; + + + /** + * @notes 详情场景 + * @return SupplierContactsValidate + * @author likeadmin + * @date 2023/12/26 13:47 + */ + public function sceneDetail() + { + return $this->only(['id']); } - return true; - } - - public function checkAnnex($value): bool|string - { - if(!empty($value) && $value != ''){ - if(!is_array($value)){ - return '附件格式错误'; + + public function checkSupplier($value): bool|string + { + $supplier = Supplier::where('id', $value)->findOrEmpty(); + if ($supplier->isEmpty()) { + return '供应商信息不存在'; } + return true; } - return true; - } - -} \ No newline at end of file + + public function checkContactsType($value): bool|string + { + $dict = DictData::where('type_value', 'contacts_type')->column('value'); + if (!in_array($value, $dict)) { + return '联系人分类无效'; + } + return true; + } + + public function checkContactsCate($value): bool|string + { + $dict = DictData::where('type_value', 'contacts_cate')->column('value'); + if (!in_array($value, $dict)) { + return '联系人类型无效'; + } + return true; + } + + public function checkIdType($value): bool|string + { + $dict = DictData::where('type_value', 'id_type')->column('value'); + if (!in_array($value, $dict)) { + return '证件类型无效'; + } + return true; + } + + public function checkAnnex($value): bool|string + { + if (!empty($value) && $value != '') { + if (!is_array($value)) { + return '附件格式错误'; + } + } + return true; + } + + } \ No newline at end of file diff --git a/app/adminapi/validate/supplier/SupplierValidate.php b/app/adminapi/validate/supplier/SupplierValidate.php index bdd1485a6..4ea34ede6 100644 --- a/app/adminapi/validate/supplier/SupplierValidate.php +++ b/app/adminapi/validate/supplier/SupplierValidate.php @@ -11,171 +11,172 @@ // +---------------------------------------------------------------------- // | author: likeadminTeam // +---------------------------------------------------------------------- - -namespace app\adminapi\validate\supplier; - - -use app\common\model\auth\Admin; -use app\common\model\dept\Dept; -use app\common\model\dept\Orgs; -use app\common\model\dict\DictData; -use app\common\validate\BaseValidate; - - -/** - * Supplier验证器 - * Class SupplierValidate - * @package app\adminapi\validate\supplier - */ -class SupplierValidate extends BaseValidate -{ - - /** - * 设置校验规则 - * @var string[] - */ - protected $rule = [ - 'id' => 'require', - 'create_user_id' => 'require|checkCreateUser', - 'org_id' => 'require|checkOrg', - 'dept_id' => 'require|checkDept', - 'supplier_name' => 'require', - 'supplier_photos' => 'checkAnnex', - 'supplier_group' => 'checkSupplierGroup', - 'supplier_category' => 'checkSupplierCategory', - 'supplier_grade' => 'checkSupplierGrade', - 'contacts_sex' => 'in:0,1', - 'birthday' => 'dateFormat:Y-m-d', - 'annex' => 'checkAnnex', - 'init_invoice_amount' => 'float|egt:0', - 'credit_limit' => 'float|egt:0', - ]; - - protected $message = [ - 'id.require' => '缺少必要参数', - 'create_user_id.require' => '请选择建档人', - 'org_id.require' => '请选择组织', - 'dept_id.require' => '请选择部门', - 'supplier_name.require' => '请填写供应商名称', - 'contacts_sex.in' => '联系人性别无效', - 'birthday.dateFormat' => '出生日期数据格式错误', - 'init_invoice_amount.float' => '期初未开票金额值必须是数字', - 'init_invoice_amount.egt' => '期初未开票金额值必须大于等于0', - 'credit_limit.float' => '授信额度值必须是数字', - 'credit_limit.egt' => '授信额度值必须大于等于0', - ]; - - - /** - * @notes 添加场景 - * @return SupplierValidate - * @author likeadmin - * @date 2023/12/26 10:56 - */ - public function sceneAdd() - { - return $this->remove('id',true); - } - - - /** - * @notes 编辑场景 - * @return SupplierValidate - * @author likeadmin - * @date 2023/12/26 10:56 - */ - public function sceneEdit() - {} - - - /** - * @notes 删除场景 - * @return SupplierValidate - * @author likeadmin - * @date 2023/12/26 10:56 - */ - public function sceneDelete() - { - return $this->only(['id']); - } - - - /** - * @notes 详情场景 - * @return SupplierValidate - * @author likeadmin - * @date 2023/12/26 10:56 - */ - public function sceneDetail() - { - return $this->only(['id']); - } - public function checkCreateUser($value): bool|string - { - $user = Admin::where('id',$value)->findOrEmpty(); - if($user->isEmpty()){ - return '建档人信息不存在'; - } - return true; - } + namespace app\adminapi\validate\supplier; - public function checkOrg($value): bool|string - { - $org = Orgs::where('id',$value)->findOrEmpty(); - if($org->isEmpty()) { - return '组织不存在'; - } - return true; - } - public function checkDept($value,$rule,$data): bool|string - { - $dept = Dept::where('id',$value)->findOrEmpty(); - if($dept->isEmpty()){ - return '部门不存在'; - } - if($dept['org_id'] != $data['org_id']){ - return '当前部门不属于所选择的组织'; - } - return true; - } + use app\common\model\auth\Admin; + use app\common\model\dept\Dept; + use app\common\model\dept\Orgs; + use app\common\model\dict\DictData; + use app\common\validate\BaseValidate; - public function checkSupplierGroup($value): bool|string - { - $dict = DictData::where('type_value','supplier_group')->column('value'); - if(!in_array($value,$dict)){ - return '供应商分组无效'; - } - return true; - } - public function checkSupplierCategory($value): bool|string + /** + * Supplier验证器 + * Class SupplierValidate + * @package app\adminapi\validate\supplier + */ + class SupplierValidate extends BaseValidate { - $dict = DictData::where('type_value','supplier_category')->column('value'); - if(!in_array($value,$dict)){ - return '供应商分类无效'; + + /** + * 设置校验规则 + * @var string[] + */ + protected $rule = [ + 'id' => 'require', + 'create_user_id' => 'require|checkCreateUser', + 'org_id' => 'require|checkOrg', + 'dept_id' => 'require|checkDept', + 'supplier_name' => 'require', + 'supplier_photos' => 'checkAnnex', + 'supplier_group' => 'checkSupplierGroup', + 'supplier_category' => 'checkSupplierCategory', + 'supplier_grade' => 'checkSupplierGrade', + 'contacts_sex' => 'in:0,1', + 'birthday' => 'dateFormat:Y-m-d', + 'annex' => 'checkAnnex', + 'init_invoice_amount' => 'float|egt:0', + 'credit_limit' => 'float|egt:0', + ]; + + protected $message = [ + 'id.require' => '缺少必要参数', + 'create_user_id.require' => '请选择建档人', + 'org_id.require' => '请选择组织', + 'dept_id.require' => '请选择部门', + 'supplier_name.require' => '请填写供应商名称', + 'contacts_sex.in' => '联系人性别无效', + 'birthday.dateFormat' => '出生日期数据格式错误', + 'init_invoice_amount.float' => '期初未开票金额值必须是数字', + 'init_invoice_amount.egt' => '期初未开票金额值必须大于等于0', + 'credit_limit.float' => '授信额度值必须是数字', + 'credit_limit.egt' => '授信额度值必须大于等于0', + ]; + + + /** + * @notes 添加场景 + * @return SupplierValidate + * @author likeadmin + * @date 2023/12/26 10:56 + */ + public function sceneAdd() + { + return $this->remove('id', true); } - return true; - } - - public function checkSupplierGrade($value): bool|string - { - $dict = DictData::where('type_value','supplier_grade')->column('value'); - if(!in_array($value,$dict)){ - return '供应商等级无效'; + + + /** + * @notes 编辑场景 + * @return SupplierValidate + * @author likeadmin + * @date 2023/12/26 10:56 + */ + public function sceneEdit() + { } - return true; - } - - public function checkAnnex($value): bool|string - { - if(!empty($value) && $value != ''){ - if(!is_array($value)){ - return '附件格式错误'; + + + /** + * @notes 删除场景 + * @return SupplierValidate + * @author likeadmin + * @date 2023/12/26 10:56 + */ + public function sceneDelete() + { + return $this->only(['id'])->remove('id', 'checkData'); + } + + + /** + * @notes 详情场景 + * @return SupplierValidate + * @author likeadmin + * @date 2023/12/26 10:56 + */ + public function sceneDetail() + { + return $this->only(['id']); + } + + public function checkCreateUser($value): bool|string + { + $user = Admin::where('id', $value)->findOrEmpty(); + if ($user->isEmpty()) { + return '建档人信息不存在'; } + return true; } - return true; - } - -} \ No newline at end of file + + public function checkOrg($value): bool|string + { + $org = Orgs::where('id', $value)->findOrEmpty(); + if ($org->isEmpty()) { + return '组织不存在'; + } + return true; + } + + public function checkDept($value, $rule, $data): bool|string + { + $dept = Dept::where('id', $value)->findOrEmpty(); + if ($dept->isEmpty()) { + return '部门不存在'; + } + if ($dept['org_id'] != $data['org_id']) { + return '当前部门不属于所选择的组织'; + } + return true; + } + + public function checkSupplierGroup($value): bool|string + { + $dict = DictData::where('type_value', 'supplier_group')->column('value'); + if (!in_array($value, $dict)) { + return '供应商分组无效'; + } + return true; + } + + public function checkSupplierCategory($value): bool|string + { + $dict = DictData::where('type_value', 'supplier_category')->column('value'); + if (!in_array($value, $dict)) { + return '供应商分类无效'; + } + return true; + } + + public function checkSupplierGrade($value): bool|string + { + $dict = DictData::where('type_value', 'supplier_grade')->column('value'); + if (!in_array($value, $dict)) { + return '供应商等级无效'; + } + return true; + } + + public function checkAnnex($value): bool|string + { + if (!empty($value) && $value != '') { + if (!is_array($value)) { + return '附件格式错误'; + } + } + return true; + } + + } \ No newline at end of file diff --git a/app/adminapi/validate/task/TaskAllocationValidate.php b/app/adminapi/validate/task/TaskAllocationValidate.php index 6ff684f66..3dd3b070f 100644 --- a/app/adminapi/validate/task/TaskAllocationValidate.php +++ b/app/adminapi/validate/task/TaskAllocationValidate.php @@ -11,86 +11,86 @@ // +---------------------------------------------------------------------- // | author: likeadminTeam // +---------------------------------------------------------------------- - -namespace app\adminapi\validate\task; - - -use app\common\validate\BaseValidate; - - -/** - * TaskAllocation验证器 - * Class TaskAllocationValidate - * @package app\adminapi\validate\task - */ -class TaskAllocationValidate extends BaseValidate -{ - - /** - * 设置校验规则 - * @var string[] - */ - protected $rule = [ - 'id' => 'require', - 'annex' => 'checkAnnex' - ]; - - - /** - * 参数描述 - * @var string[] - */ - protected $field = [ - 'id' => 'id', - - ]; - - - /** - * @notes 添加场景 - * @return TaskAllocationValidate - * @author likeadmin - * @date 2024/02/22 10:47 - */ - public function sceneAdd() - { - return $this->remove('id', true); - } - - - /** - * @notes 编辑场景 - * @return TaskAllocationValidate - * @author likeadmin - * @date 2024/02/22 10:47 - */ - public function sceneEdit() - { - return $this->only(['id','annex']); - } - - - /** - * @notes 删除场景 - * @return TaskAllocationValidate - * @author likeadmin - * @date 2024/02/22 10:47 - */ - public function sceneDelete() - { - return $this->only(['id']); - } - - - /** - * @notes 详情场景 - * @return TaskAllocationValidate - * @author likeadmin - * @date 2024/02/22 10:47 - */ - public function sceneDetail() - { - return $this->only(['id']); - } - -} \ No newline at end of file + + namespace app\adminapi\validate\task; + + + use app\common\validate\BaseValidate; + + + /** + * TaskAllocation验证器 + * Class TaskAllocationValidate + * @package app\adminapi\validate\task + */ + class TaskAllocationValidate extends BaseValidate + { + + /** + * 设置校验规则 + * @var string[] + */ + protected $rule = [ + 'id' => 'require', + 'annex' => 'checkAnnex' + ]; + + + /** + * 参数描述 + * @var string[] + */ + protected $field = [ + 'id' => 'id', + + ]; + + + /** + * @notes 添加场景 + * @return TaskAllocationValidate + * @author likeadmin + * @date 2024/02/22 10:47 + */ + public function sceneAdd() + { + return $this->remove('id', true); + } + + + /** + * @notes 编辑场景 + * @return TaskAllocationValidate + * @author likeadmin + * @date 2024/02/22 10:47 + */ + public function sceneEdit() + { + return $this->only(['id', 'annex']); + } + + + /** + * @notes 删除场景 + * @return TaskAllocationValidate + * @author likeadmin + * @date 2024/02/22 10:47 + */ + public function sceneDelete() + { + return $this->only(['id'])->remove('id', 'checkData'); + } + + + /** + * @notes 详情场景 + * @return TaskAllocationValidate + * @author likeadmin + * @date 2024/02/22 10:47 + */ + public function sceneDetail() + { + return $this->only(['id']); + } + + } \ No newline at end of file diff --git a/app/adminapi/validate/task/TaskTypeValidate.php b/app/adminapi/validate/task/TaskTypeValidate.php index 017432ff5..91566349d 100644 --- a/app/adminapi/validate/task/TaskTypeValidate.php +++ b/app/adminapi/validate/task/TaskTypeValidate.php @@ -1,94 +1,96 @@ - 'require', - ]; - - - /** - * 参数描述 - * @var string[] - */ - protected $field = [ - 'id' => 'id', - ]; - - - /** - * @notes 添加场景 - * @return TaskTypeValidate - * @author likeadmin - * @date 2024/02/23 17:06 - */ - public function sceneAdd() - { - return $this->remove('id', true); - } - - - /** - * @notes 编辑场景 - * @return TaskTypeValidate - * @author likeadmin - * @date 2024/02/23 17:06 - */ - public function sceneEdit() - { - return $this->only(['id']); - } - - - /** - * @notes 删除场景 - * @return TaskTypeValidate - * @author likeadmin - * @date 2024/02/23 17:06 - */ - public function sceneDelete() - { - return $this->only(['id']); - } - - - /** - * @notes 详情场景 - * @return TaskTypeValidate - * @author likeadmin - * @date 2024/02/23 17:06 - */ - public function sceneDetail() - { - return $this->only(['id']); - } - -} \ No newline at end of file + 'require', + + ]; + + + /** + * 参数描述 + * @var string[] + */ + protected $field = [ + 'id' => 'id', + + ]; + + + /** + * @notes 添加场景 + * @return TaskTypeValidate + * @author likeadmin + * @date 2024/02/23 17:06 + */ + public function sceneAdd() + { + return $this->remove('id', true); + } + + + /** + * @notes 编辑场景 + * @return TaskTypeValidate + * @author likeadmin + * @date 2024/02/23 17:06 + */ + public function sceneEdit() + { + return $this->only(['id']); + } + + + /** + * @notes 删除场景 + * @return TaskTypeValidate + * @author likeadmin + * @date 2024/02/23 17:06 + */ + public function sceneDelete() + { + return $this->only(['id'])->remove('id', 'checkData'); + } + + + /** + * @notes 详情场景 + * @return TaskTypeValidate + * @author likeadmin + * @date 2024/02/23 17:06 + */ + public function sceneDetail() + { + return $this->only(['id']); + } + + } \ No newline at end of file diff --git a/app/adminapi/validate/zjzx_finance/ZjzxInvoiceValidate.php b/app/adminapi/validate/zjzx_finance/ZjzxInvoiceValidate.php index f357f677f..3a87cde17 100644 --- a/app/adminapi/validate/zjzx_finance/ZjzxInvoiceValidate.php +++ b/app/adminapi/validate/zjzx_finance/ZjzxInvoiceValidate.php @@ -1,125 +1,126 @@ 'require|checkData', - 'project_id' => 'require|checkProject', - 'invoice_type' => 'require|checkInvoiceType', - 'apply_amount' => 'require|float|gt:0', - 'apply_company' => 'require', - 'apply_company_number' => 'require', - 'apply_email' => 'email', - 'create_user' => 'require', - 'create_time' => 'require|dateFormat:Y-m-d H:i:s' - ]; - - - /** - * 参数描述 - * @var string[] - */ - protected $field = [ - 'id' => 'id', - 'project_id' => '项目id', - 'invoice_code' => '开票编号', - 'invoice_type' => '发票类型', - 'apply_amount' => '开票申请金额', - 'apply_company' => '开票单位名称', - 'apply_company_number' => '纳税人识别号', - 'apply_company_address' => '开票单位注册地址', - 'apply_company_telephone' => '开票单位电话', - 'apply_company_bank' => '开户银行', - 'apply_company_account' => '开户账号', - 'apply_contact' => '开票联系人', - 'pay_type' => '对应付款方式', - 'invoice_content' => '开票内容', - 'apply_email' => '发票接收邮箱', - 'create_user' => '开票申请人', - 'create_time' => '开票申请时间' - ]; - - - /** - * @notes 添加场景 - * @return ZjzxInvoiceValidate - * @author likeadmin - * @date 2024/03/15 17:05 - */ - public function sceneAdd() - { - return $this->remove('id',true); - } - - - /** - * @notes 编辑场景 - * @return ZjzxInvoiceValidate - * @author likeadmin - * @date 2024/03/15 17:05 - */ - public function sceneEdit() - { - return $this->remove('id','checkData'); - } - - - /** - * @notes 删除场景 - * @return ZjzxInvoiceValidate - * @author likeadmin - * @date 2024/03/15 17:05 - */ - public function sceneDelete() - { - return $this->only(['id']); - } - - - /** - * @notes 详情场景 - * @return ZjzxInvoiceValidate - * @author likeadmin - * @date 2024/03/15 17:05 - */ - public function sceneDetail() - { - return $this->only(['id']); - } - public function checkData($value): bool|string - { - $data = ZjzxInvoice::where('id',$value)->findOrEmpty(); - return $data->isEmpty() ? '数据不存在' : true; - } + namespace app\adminapi\validate\zjzx_finance; - public function checkProject($value): bool|string - { - $data = CostProject::where('id',$value)->findOrEmpty(); - return $data->isEmpty() ? '项目信息不存在' : true; - } + use app\common\model\cost_project\CostProject; + use app\common\model\dict\DictData; + use app\common\model\zjzx_finance\ZjzxInvoice; + use app\common\validate\BaseValidate; - public function checkInvoiceType($value): bool|string + + /** + * 造价咨询--开票台账验证器 + * Class ZjzxInvoiceValidate + * @package app\adminapi\validate\zjzx_finance + */ + class ZjzxInvoiceValidate extends BaseValidate { - $dict = DictData::where('type_value','zjzx_invoice_type')->column('value'); - return !in_array($value,$dict) ? '发票类型数据值无效' : true; - } - -} \ No newline at end of file + + /** + * 设置校验规则 + * @var string[] + */ + protected $rule = [ + 'id' => 'require|checkData', + 'project_id' => 'require|checkProject', + 'invoice_type' => 'require|checkInvoiceType', + 'apply_amount' => 'require|float|gt:0', + 'apply_company' => 'require', + 'apply_company_number' => 'require', + 'apply_email' => 'email', + 'create_user' => 'require', + 'create_time' => 'require|dateFormat:Y-m-d H:i:s' + ]; + + + /** + * 参数描述 + * @var string[] + */ + protected $field = [ + 'id' => 'id', + 'project_id' => '项目id', + 'invoice_code' => '开票编号', + 'invoice_type' => '发票类型', + 'apply_amount' => '开票申请金额', + 'apply_company' => '开票单位名称', + 'apply_company_number' => '纳税人识别号', + 'apply_company_address' => '开票单位注册地址', + 'apply_company_telephone' => '开票单位电话', + 'apply_company_bank' => '开户银行', + 'apply_company_account' => '开户账号', + 'apply_contact' => '开票联系人', + 'pay_type' => '对应付款方式', + 'invoice_content' => '开票内容', + 'apply_email' => '发票接收邮箱', + 'create_user' => '开票申请人', + 'create_time' => '开票申请时间' + ]; + + + /** + * @notes 添加场景 + * @return ZjzxInvoiceValidate + * @author likeadmin + * @date 2024/03/15 17:05 + */ + public function sceneAdd() + { + return $this->remove('id', true); + } + + + /** + * @notes 编辑场景 + * @return ZjzxInvoiceValidate + * @author likeadmin + * @date 2024/03/15 17:05 + */ + public function sceneEdit() + { + return $this->remove('id', 'checkData'); + } + + + /** + * @notes 删除场景 + * @return ZjzxInvoiceValidate + * @author likeadmin + * @date 2024/03/15 17:05 + */ + public function sceneDelete() + { + return $this->only(['id'])->remove('id', 'checkData'); + } + + + /** + * @notes 详情场景 + * @return ZjzxInvoiceValidate + * @author likeadmin + * @date 2024/03/15 17:05 + */ + public function sceneDetail() + { + return $this->only(['id']); + } + + public function checkData($value): bool|string + { + $data = ZjzxInvoice::where('id', $value)->findOrEmpty(); + return $data->isEmpty() ? '数据不存在' : true; + } + + public function checkProject($value): bool|string + { + $data = CostProject::where('id', $value)->findOrEmpty(); + return $data->isEmpty() ? '项目信息不存在' : true; + } + + public function checkInvoiceType($value): bool|string + { + $dict = DictData::where('type_value', 'zjzx_invoice_type')->column('value'); + return !in_array($value, $dict) ? '发票类型数据值无效' : true; + } + + } \ No newline at end of file