void itemClick_Event(object sender, DirectEventArgs e) { int menuId = ConvertHelper.ToInt32(e.ExtraParams["id"]); var menu =privilege.GetMenu(menuId); if (menu == null) { Alert("该菜单不存在"); return; } if (menu.PrivilegeId == null) { Alert("该菜单没有对应的权限"); return; } var menuPrivilege = privilege.GetPrivilege(menu.PrivilegeId.Value); if (menuPrivilege == null) { Alert("该菜单对应的权限不存在"); return; } if (!HasPrivilege(menuPrivilege.Id)) { Alert("您没有权限使用该菜单"); return; } if (string.IsNullOrEmpty(menu.Url)) return; string menuIdString = "menu" + menu.Id.ToString(); var tabPage = _workArea.Items.FirstOrDefault(x => x.ID == menuIdString); if (tabPage == null) { tabPage = new Ext.Net.Panel(new Ext.Net.Panel.Config() { Title = menu.Name, Closable = true }); tabPage.ID = menuIdString; tabPage.Loader = new ComponentLoader(new ComponentLoader.Config() { Mode = LoadMode.Frame }); tabPage.Loader.Url = menu.Url; tabPage.Loader.LoadMask.ShowMask = true; tabPage.Loader.LoadMask.Msg = "正在加载"; tabPage.AddTo(_workArea); } _workArea.SetActiveTab(tabPage); }