feat(优化):年培训计划:已确认行的删除按钮、勾选框、批量删除均仅超级管理员可见/可用;提示文案随角色变化
deploy-hxtesting / build-and-deploy (push) Successful in 1m14s
deploy-hxtesting / build-and-deploy (push) Successful in 1m14s
课程管理:canDeleteCourse 超管不限状态/部门(已审核/已发布行可删,确认弹窗文案区分);批量删除按钮超管可见 月培训计划:已发布行的「删除」仅超管可见(普通维护角色仍只能删未发布计划),行内确认弹窗替代原 window.confirm,失败时透出后端文案 Training.vue:canManageTabs 加入 super_admin,纯超管(未兼其他角色)也能进入这三个页面执行删除
This commit is contained in:
1 parent
a448598df5
commit
2f1cda34da
19 files changed
+589
-278
No files matched your search
@@ -599,13 +599,14 @@ func (s *trainingService) ConfirmDemand(ctx context.Context, tenantID uint64, id
|
||||
}
|
||||
|
||||
// DeleteDemand soft-deletes one unconfirmed demand.
|
||||
// 状态「已确认」的需求不可删除,避免误删已纳入年度排期的口径。
|
||||
func (s *trainingService) DeleteDemand(ctx context.Context, tenantID uint64, id string) error {
|
||||
// 状态「已确认」的需求不可删除,避免误删已纳入年度排期的口径;仅超级管理员
|
||||
// (bySuperAdmin:super_admin 职称角色或空间 Owner 兜底)放开终态删除。
|
||||
func (s *trainingService) DeleteDemand(ctx context.Context, tenantID uint64, id string, bySuperAdmin bool) error {
|
||||
demand, err := s.repo.GetDemand(ctx, tenantID, id)
|
||||
if err != nil {
|
||||
return errors.NewNotFoundError("需求不存在")
|
||||
}
|
||||
if demand.Status == types.TrainingDemandConfirmed {
|
||||
if demand.Status == types.TrainingDemandConfirmed && !bySuperAdmin {
|
||||
return errors.NewBadRequestError("已确认的需求不可删除")
|
||||
}
|
||||
return s.repo.DeleteDemand(ctx, tenantID, id)
|
||||
|
||||
Reference in new issue
Block a user