数据结构
权限分配
1.在项目中新建文件夹Helpers
2.在HR.Helpers文件夹下添加EnumMoudle.Cs
namespace HR.Helpers
{
public enum EnumMoudle
{
/// <summary>
/// 模块
/// </summary>
[EnumTitle("用户管理")]
SysUserManage_Role = 102,
[EnumTitle("机构管理")]
Department = 201,
[EnumTitle("人事资料")]
Employees = 301,
[EnumTitle("系统管理")]
BaseInfo = 404,
}
}
</div>
3.在HR.Helpers文件夹下添加ControllerBase.Cs
namespace HR.Helpers
{
public class ControllerBase : Controller
{
/// <summary>
/// 操作人,传IP....到后端记录
/// </summary>
public virtual Operater Operater
{
get
{
return null;
}
}
/// <summary>
/// 分页大小
/// </summary>
public virtual int PageSize
{
get
{
return 15;
}
}
protected ContentResult JsonP(string callback, object data)
{
var json = Newtonsoft.Json.JsonConvert.SerializeObject(data);
return this.Content(string.Format("{0}({1})", callback, json));
}
/// <summary>
/// 当弹出DIV弹窗时,需要刷新浏览器整个页面
/// </summary>
/// <returns></returns>
public ContentResult RefreshParent(string alert = null)
{
var script = string.Format("<script>{0}; parent.location.reload(1)</script>", string.IsNullOrEmpty(alert) ? string.Empty : "alert('" + alert + "')");
return this.Content(script);
}
public new ContentResult RefreshParentTab(string alert = null)
{
var script = string.Format("<script>{0}; if (window.opener != null) {{ window.opener.location.reload(); window.opener = null;window.open('', '_self', ''); window.close()}} else {{parent.location.reload(1)}}</script>", string.IsNullOrEmpty(alert) ? string.Empty : "alert('" + alert + "')");
return this.Content(script);
}
/// <summary>
/// 用JS关闭弹窗
/// </summary>
/// <returns></returns>
public ContentResult CloseThickbox()
{
return this.Content("<script>top.tb_remove()</script>");
}
/// <summary>
/// 警告并且历史返回
/// </summary>
/// <param name="notice"></param>
/// <returns></returns>
public ContentResult Back(string notice)
{
var content = new StringBuilder("<script>");
if (!string.IsNullOrEmpty(notice))
content.AppendFormat("alert('{0}');", notice);
content.Append("history.go(-1)</script>");
return this.Content(content.ToString());
}
public ContentResult PageReturn(string msg, string url = null)
{
var content = new StringBuilder("<script type='text/javascript'>");
if (!string.IsNullOrEmpty(msg))
content.AppendFormat("alert('{0}');", msg);