public MenuCheckBoxModel(MenuConfigEntity item, string parentId = "0", bool showCheckBox = false) : this() { this.id = item.Id; this.text = item.ModuleName; this.value = item.Id; this.parentnodes = parentId; this.platformType = item.PaltformType; this.showcheck = showCheckBox; }
/// <summary> /// 保存表单(新增、修改) /// </summary> /// <param name="keyValue">主键值</param> /// <param name="entity">实体对象</param> /// <returns></returns> public void SaveForm(string keyValue, MenuConfigEntity entity) { try { service.SaveForm(keyValue, entity); } catch (Exception) { throw; } }
public MenuTreeModel(MenuConfigEntity item, string parentId = "0", bool showCheckBox = false, int checkstate = 0, bool showRemark = false) : this() { this.id = item.Id; this.text = item.ModuleName; this.value = item.Id; this.parentnodes = parentId; this.platformType = item.PaltformType; this.showcheck = showCheckBox; this.checkstate = checkstate; if (showRemark) { this.text = string.IsNullOrWhiteSpace(item.Remark) ? this.text : this.text += " (" + item.Remark + ")"; } this.associationId = item.AssociationId; }
/// <summary> /// 保存(新增修改) /// </summary> /// <param name="keyValue">主键 可为空</param> /// <param name="model">实体</param> /// <returns></returns> public ActionResult SaveForm(string keyValue, RquestModel request) { //实体类有私有属性,作为参数会请求失败 MenuConfigEntity model = new MenuConfigEntity() { Id = request.Id, AssociationId = request.AssociationId, AssociationName = request.AssociationName, AuthorizeId = request.AuthorizeId, AuthorizeName = request.AuthorizeName, BAK3 = request.BAK3, BAK2 = request.BAK2, BAK4 = request.BAK4, Sort = request.Sort, CreateUserName = request.CreateUserName, CreateDate = request.CreateDate, DeptCode = request.DeptCode, DeptId = request.DeptId, DeptName = request.DeptName, ModifyDate = request.ModifyDate, CreateUserId = request.CreateUserId, IsView = request.IsView, ModuleCode = request.ModuleCode, ModifyUserId = request.ModifyUserId, ModifyUserName = request.ModifyUserName, ModuleId = request.ModuleId, ModuleName = request.ModuleName, PaltformType = request.PaltformType, ParentId = request.ParentId, ParentName = request.ParentName, Remark = request.Remark, MenuIcon = request.MenuIcon, JsonData = request.JsonData }; ModuleBLL modulebll = new ModuleBLL(); if (!string.IsNullOrWhiteSpace(model.ModuleId)) { var module = modulebll.GetEntity(model.ModuleId); if (module != null) { model.ModuleCode = module.EnCode; } } menuConfigBll.SaveForm(keyValue, model); return(Success("操作成功。")); }
/// <summary> /// 处理数据 /// </summary> /// <param name="treeModel">包含三个平台树的数据</param> /// <param name="item">下级菜单</param> /// <param name="showCheckBox">是否显示单选钮</param> public static void FomateTree(List <MenuTreeModel> treeModel, MenuConfigEntity item, bool showCheckBox = false) { foreach (var x in treeModel) { bool matched = false; switch (item.PaltformType) { case 0: if (x.text == "Windows终端") { x.AddChild(new MenuTreeModel(item, x.id, showCheckBox)); matched = true; } break; case 1: if (x.text == "安卓终端") { x.AddChild(new MenuTreeModel(item, x.id, showCheckBox)); matched = true; } break; case 2: if (x.text == "手机APP") { x.AddChild(new MenuTreeModel(item, x.id, showCheckBox)); matched = true; } break; default: break; } if (matched) { break; } } }