'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->remove('id', true); } /** * @notes 编辑场景 * @return CostProjectValidate * @author likeadmin * @date 2024/02/21 09:23 */ public function sceneEdit() { } /** * @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; } public function checkIndustry($value): bool|string { $dict = DictData::where('type_value', 'cost_consultation_industry_nature')->column('value'); return !in_array($value, $dict) ? '行业数据值无效' : true; } }