点检方案树的删除闲置功能

This commit is contained in:
zhangjunwen 2024-11-11 15:59:39 +08:00
parent 30f9e6aa85
commit 1260d288a2
5 changed files with 42 additions and 3 deletions

View File

@ -119,4 +119,9 @@ public class InspectionPlanController {
BeanUtils.toBean(list, InspectionPlanRespVO.class)); BeanUtils.toBean(list, InspectionPlanRespVO.class));
} }
@GetMapping("/hasChild")
@Operation(summary = "是否有子节点")
public CommonResult<Boolean> hasInspectionPlan(@RequestParam("id") Long id) {
return success(inspectionPlanService.hasChildInspectionPlan(id));
}
} }

View File

@ -77,4 +77,9 @@ public interface InspectionPlanService {
* @return java.util.List<com.inspur.module.system.dal.dataobject.inspection.InspectionPlanDO> * @return java.util.List<com.inspur.module.system.dal.dataobject.inspection.InspectionPlanDO>
*/ */
List<InspectionPlanDO> getInspectionPlanHaveFeedbackList(InspectionPlanListReqVO reqVO); List<InspectionPlanDO> getInspectionPlanHaveFeedbackList(InspectionPlanListReqVO reqVO);
/**
* 是否有子节点
*/
Boolean hasChildInspectionPlan(Long id);
} }

View File

@ -127,4 +127,15 @@ public class InspectionPlanServiceImpl implements InspectionPlanService {
} }
return inspectionPlanDOS; return inspectionPlanDOS;
} }
@Override
/**
* 是否有子节点
*/
public Boolean hasChildInspectionPlan(Long id){
QueryWrapper<InspectionPlanDO> queryWrapper = new QueryWrapper<>();
queryWrapper.apply("find_in_set("+id+",ancestors)")
.eq("deleted",0);
return inspectionPlanMapper.selectCount(queryWrapper) > 0;
}
} }

View File

@ -77,3 +77,11 @@ export function getInspectionPlanListHaveFeedback(params) {
params, params,
}); });
} }
//是否有子节点
export function hasInspectionPlanChild(id) {
return request({
url: "/imt/inspection-plan/hasChild?id=" + id,
method: "get",
});
}

View File

@ -257,9 +257,19 @@ export default {
'是否确认删除点检方案编号为"' + inspectionPlanId + '"的数据项?' '是否确认删除点检方案编号为"' + inspectionPlanId + '"的数据项?'
); );
try { try {
await InspectionPlanApi.deleteInspectionPlan(inspectionPlanId); const hasChildRes = await InspectionPlanApi.hasInspectionPlanChild(
await this.getList(); inspectionPlanId
this.$modal.msgSuccess("删除成功"); );
if (hasChildRes.data) {
this.$message({
message: "该节点存在子节点,请先删除子节点!",
type: "warning",
});
} else {
await InspectionPlanApi.deleteInspectionPlan(inspectionPlanId);
await this.getList();
this.$modal.msgSuccess("删除成功");
}
} catch {} } catch {}
}, },
/** 导出按钮操作 */ /** 导出按钮操作 */