'require|checkData', 'project_name' => 'require', 'bid_date' => 'require|dateFormat:Y-m-d', 'construct_company' => 'require|checkConstructCompany', 'management_company' => 'require', 'business_nature' => 'checkBusinessNature', 'industry_nature' => 'checkIndustryNature', 'info_sources' => 'checkInfoSources', 'fund_sources' => 'checkFundSources', 'const_area' => 'checkConstArea', 'total_investment' => 'float|egt:0', 'jianan_investment' => 'float|egt:0', 'head' => 'checkHead', 'dept' => 'checkDept', 'leader' => 'checkLeader', 'annex' => 'checkAnnex', 'flow_id' => 'require|checkFlow', 'path' => 'require', ]; /** * 参数描述 * @var string[] */ protected $field = [ 'id' => 'id', 'project_name' => '项目名称', 'project_code' => '项目编号', 'bid_date' => '预计招标日期', 'construct_company' => '建设单位', 'management_company' => '建设管理单位', 'business_nature' => '业务性质', 'industry_nature' => '行业性质', 'info_sources' => '消息来源', 'fund_sources' => '资金来源', 'const_area' => '建设区域', 'project_address' => '项目地点', 'total_investment' => '工程总投资', 'jianan_investment' => '建安投资额', 'project_overview' => '工程概况', 'remark' => '备注', 'head' => '负责人', 'dept' => '负责部门', 'leader' => '分管领导', 'contacts' => '联系人信息', 'flow_id' => '审批流id', 'path' => '路径', ]; /** * @notes 添加场景 * @return MarketingBusinessOpportunityValidate * @author likeadmin * @date 2024/04/11 14:27 */ public function sceneAdd() { return $this->remove('id', true)->remove('flow_id', true)->remove('path', true); } /** * @notes 编辑场景 * @return MarketingBusinessOpportunityValidate * @author likeadmin * @date 2024/04/11 14:27 */ public function sceneEdit() { return $this->remove('flow_id', true)->remove('path', true); } /** * @notes 删除场景 * @return MarketingBusinessOpportunityValidate * @author likeadmin * @date 2024/04/11 14:27 */ public function sceneDelete() { return $this->only(['id'])->remove('id', 'checkData'); } /** * @notes 详情场景 * @return MarketingBusinessOpportunityValidate * @author likeadmin * @date 2024/04/11 14:27 */ public function sceneDetail() { return $this->only(['id']); } /** * @notes 审批场景 * @return MarketingBusinessOpportunityValidate * @author likeadmin * @date 2024/04/11 14:27 */ public function sceneApprove() { return $this->only(['id', 'flow_id', 'path']); } public function checkData($value): bool|string { $data = MarketingBusinessOpportunity::where('id', $value)->findOrEmpty(); return $data->isEmpty() ? '数据不存在' : true; } public function checkConstructCompany($value): bool|string { $data = MarketingCustom::where('id', $value)->findOrEmpty(); return $data->isEmpty() ? '建设单位数据不存在' : true; } public function checkBusinessNature($value): bool|string { if (empty($value)) return true; $dict = DictData::where('type_value', 'cost_consultation_business_nature')->column('value'); if (!in_array($value, $dict)) { return '业务性质数据值无效'; } return true; } public function checkIndustryNature($value): bool|string { if (empty($value)) return true; $dict = DictData::where('type_value', 'cost_consultation_industry_nature')->column('value'); if (!in_array($value, $dict)) { return '行业性质数据值无效'; } return true; } public function checkInfoSources($value): bool|string { if (empty($value)) return true; $dict = DictData::where('type_value', 'info_sources')->column('value'); if (!in_array($value, $dict)) { return '消息来源数据值无效'; } return true; } public function checkFundSources($value): bool|string { if (empty($value)) return true; $dict = DictData::where('type_value', 'cost_consultation_fund_sources')->column('value'); if (!in_array($value, $dict)) { return '资金来源数据值无效'; } return true; } public function checkConstArea($value): bool|string { if (empty($value)) return true; $dict = DictData::where('type_value', 'cost_consultation_const_area')->column('value'); if (!in_array($value, $dict)) { return '建设区域数据值无效'; } return true; } public function checkHead($value): bool|string { if (empty($value)) return true; $data = Admin::where('id', $value)->findOrEmpty(); return $data->isEmpty() ? '负责人数据不存在' : true; } public function checkDept($value): bool|string { if (empty($value)) return true; $data = Dept::where('id', $value)->findOrEmpty(); return $data->isEmpty() ? '负责部门数据不存在' : true; } public function checkLeader($value): bool|string { if (empty($value)) return true; $data = Admin::where('id', $value)->findOrEmpty(); return $data->isEmpty() ? '分管领导数据不存在' : true; } }