diff --git a/app/adminapi/logic/supervision_work/SupervisionInspectionLogic.php b/app/adminapi/logic/supervision_work/SupervisionInspectionLogic.php index f6a18955b..f55a55d3f 100644 --- a/app/adminapi/logic/supervision_work/SupervisionInspectionLogic.php +++ b/app/adminapi/logic/supervision_work/SupervisionInspectionLogic.php @@ -185,6 +185,16 @@ class SupervisionInspectionLogic extends BaseLogic */ public static function delete(array $params): bool { + $inspection_result = SupervisionInspectionResult::where('inspection_id',$params['id'])->findOrEmpty(); + if(!$inspection_result->isEmpty()){ + self::setError('该巡视内容下存在巡视结果数据,请先删除巡视结果数据'); + return false; + } + $inspection_problem = SupervisionInspectionProblem::where('inspection_id',$params['id'])->findOrEmpty(); + if(!$inspection_problem->isEmpty()){ + self::setError('该巡视内容下存在巡视问题数据,请先删除巡视问题数据'); + return false; + } return SupervisionInspection::destroy($params['id']); }