engineering/app/adminapi/validate/supervision_qualification_review/SupervisionConstructionManagementPersonnelValidate.php
2024-02-26 15:19:56 +08:00

148 lines
4.4 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\adminapi\validate\supervision_qualification_review;
use app\common\model\supervision_qualification_review\SupervisionConstructionManagementPersonnel;
use app\common\model\supervision_qualification_review\SupervisionParticipatingUnitsQualifications;
use app\common\validate\BaseValidate;
/**
* 工程监理--施工管理人员验证器
* Class SupervisionConstructionManagementPersonnelValidate
* @package app\adminapi\validate\supervision_qualification_review
*/
class SupervisionConstructionManagementPersonnelValidate extends BaseValidate
{
/**
* 设置校验规则
* @var string[]
*/
protected $rule = [
'id' => 'require|checkData',
'unit_qualification_id' => 'require|checkUnitQualification',
'name' => 'require',
'id_card' => 'idCard',
'get_date_one' => 'dateFormat:Y-m-d',
'effective_date_one' => 'dateFormat:Y-m-d',
'qualification_one_status' => 'in:0,1',
'get_date_two' => 'dateFormat:Y-m-d',
'effective_date_two' => 'dateFormat:Y-m-d',
'qualification_two_status' => 'in:0,1',
'annex' => 'checkAnnex',
];
/**
* 参数描述
* @var string[]
*/
protected $field = [
'id' => 'id',
'unit_qualification_id' => '参建单位资质id',
'name' => '姓名',
'id_card' => '身份证',
'technical_title' => '技术职称',
'job' => '岗位',
'qualification_name_one' => '资质名称1',
'certification_body_one' => '认证机构1',
'qualification_number_one' => '资质编号1',
'get_date_one' => '发证日期1',
'effective_date_one' => '有效日期1',
'qualification_one_status' => '资质1状态',
'qualification_name_two' => '资质名称2',
'certification_body_two' => '认证机构2',
'qualification_number_two' => '资质编号2',
'get_date_two' => '发证日期2',
'effective_date_two' => '有效日期2',
'qualification_two_status' => '资质2状态',
'remark' => '备注',
'create_user' => '创建人',
];
/**
* @notes 添加场景
* @return SupervisionConstructionManagementPersonnelValidate
* @author likeadmin
* @date 2024/02/26 10:33
*/
public function sceneAdd()
{
return $this->remove('id',true);
}
/**
* @notes 编辑场景
* @return SupervisionConstructionManagementPersonnelValidate
* @author likeadmin
* @date 2024/02/26 10:33
*/
public function sceneEdit()
{}
/**
* @notes 删除场景
* @return SupervisionConstructionManagementPersonnelValidate
* @author likeadmin
* @date 2024/02/26 10:33
*/
public function sceneDelete()
{
return $this->only(['id']);
}
/**
* @notes 详情场景
* @return SupervisionConstructionManagementPersonnelValidate
* @author likeadmin
* @date 2024/02/26 10:33
*/
public function sceneDetail()
{
return $this->only(['id']);
}
public function checkData($value): bool|string
{
$data = SupervisionConstructionManagementPersonnel::where('id',$value)->findOrEmpty();
if($data->isEmpty()){
return '数据不存在';
}
return true;
}
public function checkUnitQualification($value): bool|string
{
$data = SupervisionParticipatingUnitsQualifications::where('id',$value)->findOrEmpty();
if($data->isEmpty()){
return '参建单位资质信息不存在';
}
return true;
}
public function checkAnnex($value): bool|string
{
if(!empty($value) && $value != '' && !is_array($value)){
return '附件格式错误';
}
return true;
}
}