'require|checkData', 'contract_name' => 'require', 'agreement_nature' => 'require|checkAgreementNature', 'part_a' => 'require|checkPartA', 'part_b' => 'require', 'part_b_signatory' => 'checkPartBSignatory', 'business_nature' => 'require|checkBusinessNature', 'signed_amount' => 'float|egt:0', 'signed_rate' => 'float|egt:0', 'signed_dept' => 'require|checkSignedDept', 'signed_head' => 'require|checkSignedHead', 'seal_name' => 'checkSealName', 'is_limit' => 'integer|in:0,1', 'limit_num' => 'integer|egt:0', 'file_type' => 'checkFileType', 'seal_num' => 'integer|egt:0', 'seal_user' => 'checkSealUser', 'plance_seal' => 'integer|in:0,1', 'send_date' => 'dateFormat:Y-m-d', 'create_user' => 'require', 'create_time' => 'require|dateFormat:Y-m-d H:i:s', 'annex' => 'checkAnnex', 'flow_id' => 'require|checkFlow', 'path' => 'require', ]; /** * 参数描述 * @var string[] */ protected $field = [ 'id' => 'id', 'contract_name' => '协议名称', 'agreement_nature' => '协议性质', 'part_a' => '甲方签订单位', 'part_b' => '乙方签约单位', 'part_b_signatory' => '乙方签约人', 'business_nature' => '业务性质', 'signed_amount' => '暂估签订金额', 'signed_rate' => '签订费率', 'signed_dept' => '签订部门', 'signed_head' => '签订负责人', 'seal_name' => '盖章名称', 'is_limit' => '是否限制次数', 'limit_num' => '限制次数', 'file_type' => '文件类型', 'seal_num' => '盖章份数', 'seal_user' => '盖章人', 'plance_seal' => '骑缝盖章', 'send_date' => '发出日期', 'create_user' => '录入人', 'create_time' => '录入时间', ]; /** * @notes 添加场景 * @return MarketingFrameworkAgreementValidate * @author likeadmin * @date 2024/04/01 14:26 */ public function sceneAdd() { return $this->remove('id', true)->remove('flow_id', true)->remove('path', true); } /** * @notes 编辑场景 * @return MarketingFrameworkAgreementValidate * @author likeadmin * @date 2024/04/01 14:26 */ public function sceneEdit() { return $this->remove('flow_id', true)->remove('path', true); } /** * @notes 删除场景 * @return MarketingFrameworkAgreementValidate * @author likeadmin * @date 2024/04/01 14:26 */ public function sceneDelete() { return $this->only(['id'])->remove('id', 'checkData'); } /** * @notes 详情场景 * @return MarketingFrameworkAgreementValidate * @author likeadmin * @date 2024/04/01 14:26 */ public function sceneDetail() { return $this->only(['id']); } public function sceneApprove() { return $this->only(['id', 'flow_id', 'path']); } public function checkData($value): bool|string { $data = MarketingContract::where('id', $value)->findOrEmpty(); return $data->isEmpty() ? '数据不存在' : true; } public function checkAgreementNature($value): bool|string { $dict = DictData::where('type_value', 'agreement_nature')->column('value'); if (!in_array($value, $dict)) { return '协议性质数据值无效'; } return true; } public function checkPartA($value): bool|string { $data = MarketingCustom::where('id', $value)->findOrEmpty(); return $data->isEmpty() ? '甲方签订单位数据不存在' : true; } public function checkPartBSignatory($value): bool|string { if (empty($value)) return true; $data = Admin::where('id', $value)->findOrEmpty(); return $data->isEmpty() ? '乙方签约人数据不存在' : true; } public function checkBusinessNature($value): bool|string { $dict = DictData::where('type_value', 'cost_consultation_business_nature')->column('value'); if (!in_array($value, $dict)) { return '业务性质数据值无效'; } return true; } public function checkSignedDept($value): bool|string { $data = Dept::where('id', $value)->findOrEmpty(); return $data->isEmpty() ? '签订部门数据不存在' : true; } public function checkSignedHead($value): bool|string { $data = Admin::where('id', $value)->findOrEmpty(); return $data->isEmpty() ? '签订负责人数据不存在' : true; } public function checkSealName($value): bool|string { if (empty($value)) return true; $dict = DictData::where('type_value', 'cost_consultation_seal_name')->column('value'); if (!in_array($value, $dict)) { return '盖章名称数据值无效'; } return true; } public function checkFileType($value): bool|string { if (empty($value)) return true; $dict = DictData::where('type_value', 'cost_consultation_file_type')->column('value'); if (!in_array($value, $dict)) { return '文件类型数据值无效'; } return true; } public function checkSealUser($value): bool|string { if (empty($value)) return true; $data = Admin::where('id', $value)->findOrEmpty(); return $data->isEmpty() ? '盖章人数据不存在' : true; } }