diff --git a/COMCMS.Web/Areas/AdminCP/Controllers/PermissionController.cs b/COMCMS.Web/Areas/AdminCP/Controllers/PermissionController.cs index 1dc3afe..5a26dff 100644 --- a/COMCMS.Web/Areas/AdminCP/Controllers/PermissionController.cs +++ b/COMCMS.Web/Areas/AdminCP/Controllers/PermissionController.cs @@ -418,6 +418,27 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers tip.Message = "删除后台菜单成功"; return Json(tip); } + + //修改栏目是否隐藏 + [HttpPost] + [MyAuthorize("edit", "adminmenu", "JSON")] + public IActionResult DoChangeAdminMenuHide(int id) + { + AdminMenu entity = AdminMenu.Find(AdminMenu._.Id == id); + if (entity == null) + { + tip.Message = "系统找不到本记录!"; + return Json(tip); + } + if (entity.IsHide == 1) + entity.IsHide = 0; + else + entity.IsHide = 1; + entity.Update(); + tip.Status = JsonTip.SUCCESS; + tip.Message = "修改菜单隐藏状态成功"; + return Json(tip); + } #endregion #region 系统运行日志 diff --git a/COMCMS.Web/Areas/AdminCP/Views/Permission/AdminMenuList.cshtml b/COMCMS.Web/Areas/AdminCP/Views/Permission/AdminMenuList.cshtml index 28f2aa2..a614a73 100644 --- a/COMCMS.Web/Areas/AdminCP/Views/Permission/AdminMenuList.cshtml +++ b/COMCMS.Web/Areas/AdminCP/Views/Permission/AdminMenuList.cshtml @@ -16,7 +16,7 @@ 刷新 -
| 菜单名称 | @@ -48,7 +48,11 @@@if (m.IsHide == 1) { - + + } + else + { + } | @@ -69,6 +73,30 @@ $(document).ready(function () { $('.tree').treegrid(); }); + function doChangeHide(id) { + var loading = layer.load(0, { + shade: [0.2, '#000'] //0.1透明度的背景 + }); + $.ajax({ + type: "POST", + url: "/AdminCP/Permission/DoChangeAdminMenuHide", + data: { id: id }, + dataType: "JSON", + success: function (data) { + if (data.status == "success") { + layer.close(loading); + window.location.href = window.location.href; + } else { + layer.close(loading); + layer.alert(data.message, { icon: 2 }); + } + }, + error: function () { + layer.close(loading); + layer.alert('执行错误,请联系管理员!', { icon: 2 }); + } + }); + } |
|---|