更新管理员管理
This commit is contained in:
@@ -11,14 +11,578 @@ using COMCMS.Web.Common;
|
||||
using COMCMS.Core.Models;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using System.IO;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
|
||||
namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
{
|
||||
public class MemberController : Controller
|
||||
/// <summary>
|
||||
/// 后台用户管理控制器
|
||||
/// </summary>
|
||||
public class MemberController : AdminBaseController
|
||||
{
|
||||
public IActionResult Index()
|
||||
#region 修改密码
|
||||
//修改个人信息
|
||||
[MyAuthorize("view", "editme")]
|
||||
public IActionResult EditMe()
|
||||
{
|
||||
Core.Admin my = Core.Admin.GetMyInfo();
|
||||
Core.Admin.WriteLogActions("查看/编辑我的信息;");
|
||||
return View(my);
|
||||
}
|
||||
[HttpPost]
|
||||
[MyAuthorize("view", "editme", "JSON")]
|
||||
public IActionResult EditMe(FormCollection fc)
|
||||
{
|
||||
Core.Admin my = Core.Admin.GetMyInfo();
|
||||
|
||||
string userName = fc["UserName"];
|
||||
string oldPwd = fc["txtOldPwd"];
|
||||
string newPwd = fc["txtNewPwd"];
|
||||
string renewPwd = fc["txtreNewPwd"];
|
||||
string realname = fc["RealName"];
|
||||
string tel = fc["Tel"];
|
||||
string email = fc["Email"];
|
||||
string editor = fc["Editor"];
|
||||
if (!Utils.IsInt(editor)) editor = "0";
|
||||
//判断
|
||||
if (string.IsNullOrWhiteSpace(userName))
|
||||
{
|
||||
tip.Message = "用户名不能为空!";
|
||||
return Json(tip);
|
||||
}
|
||||
userName = userName.Trim();
|
||||
if (Utils.GetStringLength(userName) < 5)
|
||||
{
|
||||
tip.Message = "用户名不能小于5个字符!";
|
||||
return Json(tip);
|
||||
}
|
||||
if (!string.IsNullOrEmpty(email) && !Utils.IsValidEmail(email))
|
||||
{
|
||||
tip.Message = "请填写正确的Email地址!";
|
||||
return Json(tip);
|
||||
}
|
||||
|
||||
if (userName != my.UserName)//修改用户名
|
||||
{
|
||||
if (Core.Admin.FindCount(Core.Admin._.UserName == userName.Trim() & Core.Admin._.Id != my.Id, null, null, 0, 0) > 0)
|
||||
{
|
||||
tip.Message = "新用户名在已经存在,请选择其他用户名!";
|
||||
return Json(tip);
|
||||
}
|
||||
my.UserName = userName.Trim();
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(newPwd))
|
||||
{
|
||||
//修改密码的情况
|
||||
if (string.IsNullOrWhiteSpace(oldPwd) || oldPwd.Length < 5)
|
||||
{
|
||||
tip.Message = "您修改密码,旧密码不能为空!";
|
||||
return Json(tip);
|
||||
}
|
||||
if (newPwd.Length < 5)
|
||||
{
|
||||
tip.Message = "新密码不能小于5个字符!";
|
||||
return Json(tip);
|
||||
}
|
||||
if (newPwd != renewPwd)
|
||||
{
|
||||
tip.Message = "您输入的两次密码不一样!";
|
||||
return Json(tip);
|
||||
}
|
||||
//判断旧密码是否正确
|
||||
if (my.PassWord != Utils.MD5(my.Salt + oldPwd.Trim()))
|
||||
{
|
||||
tip.Message = "您输入的旧密码不正确,请重新输入!";
|
||||
return Json(tip);
|
||||
}
|
||||
my.PassWord = Utils.MD5(my.Salt + newPwd);
|
||||
}
|
||||
tip.Message = "测试版暂时屏蔽修改密码,敬请原谅!";
|
||||
return Json(tip);
|
||||
//my.Tel = tel;
|
||||
//my.Email = email;
|
||||
//my.RealName = realname;
|
||||
//my.Update();
|
||||
//Core.Admin.WriteLogActions("修改我的信息;");
|
||||
//tip.Status = JsonTip.SUCCESS;
|
||||
//tip.Message = "编辑我的信息成功!";
|
||||
|
||||
//return Json(tip);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 管理组管理
|
||||
[MyAuthorize("viewlist", "adminrole")]
|
||||
public IActionResult AdminRole()
|
||||
{
|
||||
IList<AdminRoles> list = AdminRoles.FindAll(AdminRoles._.Id > 0, AdminRoles._.Rank.Asc(), null, 0, 0);
|
||||
Core.Admin.WriteLogActions("查看管理组列表;");
|
||||
return View(list);
|
||||
}
|
||||
//添加管理组
|
||||
[MyAuthorize("add", "adminrole")]
|
||||
public IActionResult AddAdminRole()
|
||||
{
|
||||
//获取所有的菜单列表
|
||||
IList<AdminMenu> list = AdminMenu.GetListTree(0, -1, false, false);
|
||||
ViewBag.MenuList = list;
|
||||
Core.Admin.WriteLogActions("查看添加管理页面;");
|
||||
return View();
|
||||
}
|
||||
//执行添加管理组
|
||||
[HttpPost]
|
||||
[MyAuthorize("add", "adminrole", "JSON")]
|
||||
public IActionResult AddAdminRole(FormCollection fc)
|
||||
{
|
||||
string RoleName = fc["RoleName"];
|
||||
string RoleDescription = fc["RoleDescription"];
|
||||
string IsSuperAdmin = fc["IsSuperAdmin"];
|
||||
string NotAllowDel = fc["NotAllowDel"];
|
||||
if (string.IsNullOrEmpty(RoleName))
|
||||
{
|
||||
tip.Message = "管理组名称不能为空!";
|
||||
return Json(tip);
|
||||
}
|
||||
|
||||
AdminRoles entity = new AdminRoles();
|
||||
|
||||
entity.RoleName = RoleName;
|
||||
entity.RoleDescription = RoleDescription;
|
||||
entity.IsSuperAdmin = int.Parse(IsSuperAdmin);
|
||||
entity.NotAllowDel = !string.IsNullOrEmpty(NotAllowDel) && NotAllowDel == "1" ? 1 : 0;
|
||||
|
||||
//处理权限
|
||||
if (entity.IsSuperAdmin == 1)
|
||||
{
|
||||
entity.Powers = "";
|
||||
entity.Menus = "";
|
||||
}
|
||||
else
|
||||
{
|
||||
//第一步,获取菜单
|
||||
string[] menuids = Request.Form["menuid"];
|
||||
//获取所有的菜单列表
|
||||
IList<AdminMenu> alllist = AdminMenu.GetListTree(0, -1, false, false);
|
||||
IList<AdminMenu> list = new List<AdminMenu>();
|
||||
IList<AdminMenuEvent> listevents = new List<AdminMenuEvent>();
|
||||
if (menuids != null && menuids.Length > 0)
|
||||
{
|
||||
foreach (string s in menuids)
|
||||
{
|
||||
if (Utils.IsInt(s) && alllist.FirstOrDefault(v => v.Id == int.Parse(s)) != null)
|
||||
{
|
||||
AdminMenu tmp = alllist.FirstOrDefault(a => a.Id == int.Parse(s)).CloneEntity();
|
||||
list.Add(tmp);
|
||||
//处理详细权限 详细权限,每一行,则每一个菜单的详细权限,则同一个name
|
||||
string[] eventids = Request.Form["EventKey_" + s];
|
||||
if (eventids != null && eventids.Length > 0)
|
||||
{
|
||||
foreach (var item in eventids)
|
||||
{
|
||||
if (Utils.IsInt(item))
|
||||
{
|
||||
AdminMenuEvent model = AdminMenuEvent.Find(AdminMenuEvent._.Id == int.Parse(item));
|
||||
if (model != null)
|
||||
{
|
||||
listevents.Add(model);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//序列化成json
|
||||
if (list != null && list.Count > 0)
|
||||
{
|
||||
entity.Menus = JsonConvert.SerializeObject(list);
|
||||
}
|
||||
if (listevents != null && listevents.Count > 0)
|
||||
{
|
||||
entity.Powers = JsonConvert.SerializeObject(listevents);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
entity.Insert();
|
||||
tip.Status = JsonTip.SUCCESS;
|
||||
tip.Message = "添加管理组成功";
|
||||
tip.ReturnUrl = "close";
|
||||
Core.Admin.WriteLogActions($"添加新管理组({entity.Id});");
|
||||
|
||||
return Json(tip);
|
||||
}
|
||||
|
||||
//查看编辑管理组
|
||||
[MyAuthorize("edit", "adminrole")]
|
||||
public IActionResult EditAdminRole(int id)
|
||||
{
|
||||
AdminRoles entity = AdminRoles.Find(AdminRoles._.Id == id);
|
||||
if (entity == null)
|
||||
{
|
||||
return EchoTipPage("系统找不到本记录!", 0, true, "");
|
||||
}
|
||||
if (string.IsNullOrEmpty(entity.Powers))
|
||||
entity.Powers = "[]";
|
||||
if (string.IsNullOrEmpty(entity.Menus))
|
||||
entity.Menus = "[]";
|
||||
//获取所有的菜单列表
|
||||
IList<AdminMenu> list = AdminMenu.GetListTree(0, -1, false, false);
|
||||
ViewBag.MenuList = list;
|
||||
Core.Admin.WriteLogActions($"查看管理组({id})详情;");
|
||||
return View(entity);
|
||||
}
|
||||
//执行编辑管理组
|
||||
[HttpPost]
|
||||
[MyAuthorize("edit", "adminrole", "JSON")]
|
||||
public IActionResult EditAdminRole(FormCollection fc)
|
||||
{
|
||||
string Id = fc["Id"];
|
||||
string RoleName = fc["RoleName"];
|
||||
string RoleDescription = fc["RoleDescription"];
|
||||
string IsSuperAdmin = fc["IsSuperAdmin"];
|
||||
string NotAllowDel = fc["NotAllowDel"];
|
||||
if (string.IsNullOrEmpty(Id))
|
||||
{
|
||||
tip.Message = "错误参数传递!";
|
||||
return Json(tip);
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(RoleName))
|
||||
{
|
||||
tip.Message = "管理组名称不能为空!";
|
||||
return Json(tip);
|
||||
}
|
||||
|
||||
AdminRoles entity = AdminRoles.Find(AdminRoles._.Id == int.Parse(Id));
|
||||
if (entity == null)
|
||||
{
|
||||
tip.Message = "系统找不到本记录!";
|
||||
return Json(tip);
|
||||
}
|
||||
entity.RoleName = RoleName;
|
||||
entity.RoleDescription = RoleDescription;
|
||||
entity.IsSuperAdmin = int.Parse(IsSuperAdmin);
|
||||
entity.NotAllowDel = !string.IsNullOrEmpty(NotAllowDel) && NotAllowDel == "1" ? 1 : 0;
|
||||
|
||||
//处理权限
|
||||
if (entity.IsSuperAdmin == 1)
|
||||
{
|
||||
entity.Powers = "";
|
||||
entity.Menus = "";
|
||||
}
|
||||
else
|
||||
{
|
||||
//第一步,获取菜单
|
||||
string[] menuids = Request.Form["menuid"];
|
||||
//获取所有的菜单列表
|
||||
IList<AdminMenu> alllist = AdminMenu.GetListTree(0, -1, false, false);
|
||||
IList<AdminMenu> list = new List<AdminMenu>();
|
||||
IList<AdminMenuEvent> listevents = new List<AdminMenuEvent>();
|
||||
if (menuids != null && menuids.Length > 0)
|
||||
{
|
||||
foreach (string s in menuids)
|
||||
{
|
||||
if (Utils.IsInt(s) && alllist.FirstOrDefault(v => v.Id == int.Parse(s)) != null)
|
||||
{
|
||||
AdminMenu tmp = alllist.FirstOrDefault(a => a.Id == int.Parse(s)).CloneEntity();
|
||||
list.Add(tmp);
|
||||
//处理详细权限 详细权限,每一行,则每一个菜单的详细权限,则同一个name
|
||||
string[] eventids = Request.Form["EventKey_" + s];
|
||||
if (eventids != null && eventids.Length > 0)
|
||||
{
|
||||
foreach (var item in eventids)
|
||||
{
|
||||
if (Utils.IsInt(item))
|
||||
{
|
||||
AdminMenuEvent model = AdminMenuEvent.Find(AdminMenuEvent._.Id == int.Parse(item));
|
||||
if (model != null)
|
||||
{
|
||||
listevents.Add(model);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//序列化成json
|
||||
if (list != null && list.Count > 0)
|
||||
{
|
||||
entity.Menus = JsonConvert.SerializeObject(list);
|
||||
}
|
||||
if (listevents != null && listevents.Count > 0)
|
||||
{
|
||||
entity.Powers = JsonConvert.SerializeObject(listevents);
|
||||
}
|
||||
}
|
||||
}
|
||||
entity.Update();
|
||||
tip.Status = JsonTip.SUCCESS;
|
||||
tip.Message = "编辑管理组详情成功";
|
||||
tip.ReturnUrl = "close";
|
||||
Core.Admin.WriteLogActions($"执行编辑管理组({entity.Id})详情;");
|
||||
return Json(tip);
|
||||
}
|
||||
//删除管理组
|
||||
[HttpPost]
|
||||
[MyAuthorize("del", "adminrole", "JSON")]
|
||||
public IActionResult DelAdminRole(int id)
|
||||
{
|
||||
AdminRoles entity = AdminRoles.Find(AdminRoles._.Id == id);
|
||||
if (entity == null)
|
||||
{
|
||||
tip.Message = "系统找不到本管理组详情!";
|
||||
return Json(tip);
|
||||
}
|
||||
if (entity.NotAllowDel == 1)
|
||||
{
|
||||
tip.Message = "本管理组设定不允许删除,如果需要删除,请先解除限制!";
|
||||
return Json(tip);
|
||||
}
|
||||
//如果不是超级管理员,不允许删除
|
||||
Core.Admin my = Core.Admin.GetMyInfo();
|
||||
if (my.Roles.IsSuperAdmin != 1)
|
||||
{
|
||||
tip.Message = "非超级管理员,不能执行此操作!";
|
||||
return Json(tip);
|
||||
}
|
||||
//如果只有一个管理组,不允许删除!
|
||||
if (AdminRoles.FindCount(null, null, null, 0, 0) == 1)
|
||||
{
|
||||
tip.Message = "只有一个管理组,不能删除!";
|
||||
return Json(tip);
|
||||
}
|
||||
//删除管理组,并删除旗下所有管理员
|
||||
Core.Admin.WriteLogActions($"执行删除管理组({entity.Id}:{entity.RoleName})详情;");
|
||||
entity.Delete();
|
||||
|
||||
tip.Status = JsonTip.SUCCESS;
|
||||
tip.Message = "删除管理组成功";
|
||||
return Json(tip);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 管理员管理
|
||||
//管理员管理
|
||||
[MyAuthorize("viewlist", "admins")]
|
||||
public IActionResult Admins()
|
||||
{
|
||||
//加载管理组
|
||||
IList<AdminRoles> list = AdminRoles.FindAll(AdminRoles._.Id > 0, AdminRoles._.Rank.Asc(), null, 0, 0);
|
||||
ViewBag.RoleList = list;
|
||||
Core.Admin.WriteLogActions("查看管理员列表");
|
||||
return View();
|
||||
}
|
||||
[MyAuthorize("viewlist", "admins", "JSON")]
|
||||
public IActionResult GetAdmins(string keyword, int page = 1, int limit = 20, int roleid = 0)
|
||||
{
|
||||
int numPerPage, currentPage, startRowIndex;
|
||||
long totalCount = 0;
|
||||
|
||||
numPerPage = limit;
|
||||
currentPage = page;
|
||||
startRowIndex = (currentPage - 1) * numPerPage;
|
||||
Expression ex = Core.Admin._.Id > 0;
|
||||
|
||||
if (roleid > 0)
|
||||
ex &= Core.Admin._.RoleId == roleid;
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(keyword))
|
||||
ex &= Core.Admin._.UserName.Contains(keyword);
|
||||
|
||||
IList<Core.Admin> list = Core.Admin.FindAll(ex, null, null, startRowIndex, numPerPage);
|
||||
totalCount = Core.Admin.FindCount(ex, null, null, startRowIndex, numPerPage);
|
||||
return Content(JsonConvert.SerializeObject(new { total = totalCount, rows = list }), "text/plain");
|
||||
}
|
||||
//添加管理员
|
||||
[MyAuthorize("add", "admins")]
|
||||
public IActionResult AddAdmin()
|
||||
{
|
||||
//加载管理组
|
||||
IList<AdminRoles> list = AdminRoles.FindAll(AdminRoles._.Id > 0, AdminRoles._.Rank.Asc(), null, 0, 0);
|
||||
ViewBag.RoleList = list;
|
||||
Core.Admin.WriteLogActions("查看添加管理员页面;");
|
||||
return View();
|
||||
}
|
||||
//执行添加管理员
|
||||
[HttpPost]
|
||||
[MyAuthorize("add", "admins", "JSON")]
|
||||
public IActionResult AddAdmin(FormCollection fc)
|
||||
{
|
||||
string userName = fc["UserName"];
|
||||
string newPwd = fc["PassWord"];
|
||||
string renewPwd = fc["PassWord2"];
|
||||
string roleid = fc["RoleId"];
|
||||
string realname = fc["RealName"];
|
||||
|
||||
if (!Utils.IsInt(roleid))
|
||||
{
|
||||
tip.Message = "请选择一个管理组!";
|
||||
return Json(tip);
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(userName))
|
||||
{
|
||||
tip.Message = "登录用户名不能为空!";
|
||||
return Json(tip);
|
||||
}
|
||||
if (Utils.GetStringLength(userName.Trim()) < 5)
|
||||
{
|
||||
tip.Message = "登录用户名不能小于5个字节!";
|
||||
return Json(tip);
|
||||
}
|
||||
if (string.IsNullOrEmpty(newPwd))
|
||||
{
|
||||
tip.Message = "密码不能为空!";
|
||||
return Json(tip);
|
||||
}
|
||||
if (newPwd.Length < 5)
|
||||
{
|
||||
tip.Message = "密码不能小于5个字符!";
|
||||
return Json(tip);
|
||||
}
|
||||
if (newPwd != renewPwd)
|
||||
{
|
||||
tip.Message = "两次输入密码不一致,请重新输入!";
|
||||
return Json(tip);
|
||||
}
|
||||
//验证用户名
|
||||
if (Core.Admin.FindCount(Core.Admin._.UserName == userName, null, null, 0, 0) > 0)
|
||||
{
|
||||
tip.Message = "该用户名已经存在,请选择其他用户名!";
|
||||
return Json(tip);
|
||||
}
|
||||
|
||||
Core.Admin entity = new Core.Admin();
|
||||
entity.UserName = userName;
|
||||
entity.RealName = realname;
|
||||
entity.Salt = Utils.GetRandomChar(10);
|
||||
entity.PassWord = Utils.MD5(entity.Salt + newPwd);
|
||||
entity.RoleId = int.Parse(roleid);
|
||||
entity.Insert();
|
||||
tip.Status = JsonTip.SUCCESS;
|
||||
tip.Message = "添加管理员成功!";
|
||||
tip.ReturnUrl = "close";
|
||||
Core.Admin.WriteLogActions($"添加新管理员({entity.UserName});");
|
||||
return Json(tip);
|
||||
}
|
||||
|
||||
//查看,编辑管理员
|
||||
[MyAuthorize("edit", "admins")]
|
||||
public IActionResult EditAdmin(int id)
|
||||
{
|
||||
//加载管理组
|
||||
IList<AdminRoles> list = AdminRoles.FindAll(AdminRoles._.Id > 0, AdminRoles._.Rank.Asc(), null, 0, 0);
|
||||
ViewBag.RoleList = list;
|
||||
|
||||
Core.Admin entity = Core.Admin.Find(Core.Admin._.Id == id);
|
||||
if (entity == null)
|
||||
{
|
||||
return EchoTipPage("系统找不到本记录!");
|
||||
}
|
||||
Core.Admin.WriteLogActions($"查看/编辑管理员({entity.UserName});");
|
||||
return View(entity);
|
||||
}
|
||||
//执行编辑管理员
|
||||
[HttpPost]
|
||||
[MyAuthorize("edit", "admins", "JSON")]
|
||||
public IActionResult EditAdmin(FormCollection fc)
|
||||
{
|
||||
string userName = fc["UserName"];
|
||||
string newPwd = fc["PassWord"];
|
||||
string renewPwd = fc["PassWord2"];
|
||||
string roleid = fc["RoleId"];
|
||||
string realname = fc["RealName"];
|
||||
string Id = fc["Id"];
|
||||
if (!Utils.IsInt(Id))
|
||||
{
|
||||
tip.Message = "错误参数传递!";
|
||||
return Json(tip);
|
||||
}
|
||||
Core.Admin entity = Core.Admin.Find(Core.Admin._.Id == int.Parse(Id));
|
||||
if (entity == null)
|
||||
{
|
||||
tip.Message = "系统找不到本记录!";
|
||||
return Json(tip);
|
||||
}
|
||||
if (!Utils.IsInt(roleid))
|
||||
{
|
||||
tip.Message = "请选择一个管理组!";
|
||||
return Json(tip);
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(userName))
|
||||
{
|
||||
tip.Message = "登录用户名不能为空!";
|
||||
return Json(tip);
|
||||
}
|
||||
if (Utils.GetStringLength(userName.Trim()) < 5)
|
||||
{
|
||||
tip.Message = "登录用户名不能小于5个字节!";
|
||||
return Json(tip);
|
||||
}
|
||||
if (entity.UserName != userName)//修改用户名
|
||||
{
|
||||
//验证用户名是否存在
|
||||
if (Core.Admin.FindCount(Core.Admin._.Id != entity.Id & Core.Admin._.UserName == userName, null, null, 0, 0) > 0)
|
||||
{
|
||||
tip.Message = "该用户名已经存在,请选择其他用户名!";
|
||||
return Json(tip);
|
||||
}
|
||||
entity.UserName = userName;
|
||||
}
|
||||
if (!string.IsNullOrEmpty(newPwd))//修改密码
|
||||
{
|
||||
if (newPwd.Length < 5)
|
||||
{
|
||||
tip.Message = "密码不能小于5个字符!";
|
||||
return Json(tip);
|
||||
}
|
||||
if (newPwd != renewPwd)
|
||||
{
|
||||
tip.Message = "两次输入密码不一致,请重新输入!";
|
||||
return Json(tip);
|
||||
}
|
||||
entity.PassWord = Utils.MD5(entity.Salt + newPwd);
|
||||
}
|
||||
entity.RoleId = int.Parse(roleid);
|
||||
entity.RealName = realname;
|
||||
entity.Update();
|
||||
tip.Status = JsonTip.SUCCESS;
|
||||
tip.Message = "修改管理员信息成功!";
|
||||
tip.ReturnUrl = "close";
|
||||
Core.Admin.WriteLogActions($"修改新管理员({entity.Id}:{entity.UserName});");
|
||||
return Json(tip);
|
||||
}
|
||||
//删除管理员
|
||||
[HttpPost]
|
||||
[MyAuthorize("del", "admins", "JSON")]
|
||||
public IActionResult DelAdmin(int id)
|
||||
{
|
||||
Core.Admin entity = Core.Admin.Find(Core.Admin._.Id == id);
|
||||
if (entity == null)
|
||||
{
|
||||
tip.Message = "系统找不到本记录!";
|
||||
return Json(tip);
|
||||
}
|
||||
Core.Admin my = Core.Admin.GetMyInfo();
|
||||
if (entity.Id == my.Id)
|
||||
{
|
||||
tip.Message = "您不可以删除自己!";
|
||||
return Json(tip);
|
||||
}
|
||||
//如果是普通管理员,不能删除超级管理员
|
||||
if (entity.Roles.IsSuperAdmin == 1 && my.Roles.IsSuperAdmin != 1)
|
||||
{
|
||||
tip.Message = "您不可以删除超级管理员!";
|
||||
return Json(tip);
|
||||
}
|
||||
Core.Admin.WriteLogActions($"删除管理员(id:{entity.Id};usernmae:{entity.UserName});");
|
||||
entity.Delete();
|
||||
tip.Status = JsonTip.SUCCESS;
|
||||
tip.Message = "删除管理员成功";
|
||||
return Json(tip);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
|
||||
@{
|
||||
ViewBag.title = "添加管理员";
|
||||
}
|
||||
<div class="wrapper wrapper-content animated fadeInRight">
|
||||
<div class="ibox float-e-margins">
|
||||
<div class="ibox-title">
|
||||
<h5>@ViewBag.title</h5>
|
||||
<div class="ibox-tools">
|
||||
</div>
|
||||
</div>
|
||||
<div class="ibox-content">
|
||||
@using (Html.BeginForm(null, null, FormMethod.Post, new { id = "addAdminForm", @class = "form-horizontal m-t" }))
|
||||
{
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">所属管理组:</label>
|
||||
<div class="col-sm-8">
|
||||
<select class="form-control m-b" name="RoleId" id="RoleId">
|
||||
@foreach (var m in ViewBag.RoleList)
|
||||
{
|
||||
<option value="@m.Id">@m.RoleName</option>
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">用户名:</label>
|
||||
<div class="col-sm-8">
|
||||
<input id="UserName" name="UserName" maxlength="20" type="text" class="form-control" required aria-required="true" placeholder="填写管理员登录用户名">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">姓名:</label>
|
||||
<div class="col-sm-8">
|
||||
<input id="RealName" name="RealName" maxlength="20" type="text" class="form-control" placeholder="可以填写备注管理员的姓名,非必填">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">登录密码:</label>
|
||||
<div class="col-sm-8">
|
||||
<input id="PassWord" name="PassWord" maxlength="20" type="password" class="form-control" placeholder="填写管理员登录密码" required>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">重复密码:</label>
|
||||
<div class="col-sm-8">
|
||||
<input id="PassWord2" type="password" class="form-control" name="PassWord2" maxlength="20" placeholder="请重复填写一次登录密码" aria-required="true" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="hr-line-dashed"></div>
|
||||
<div class="form-group">
|
||||
<div class="col-sm-4 col-sm-offset-3">
|
||||
<button class="btn btn-primary" type="submit"><i class="fa fa-save"></i> 提交 </button>
|
||||
<button class="btn btn-default" type="button" onclick="closethisdialog();"><i class="fa fa-close"></i> 取消 </button>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
<script>
|
||||
$(function () {
|
||||
DoPost("addAdminForm");
|
||||
})
|
||||
</script>
|
||||
@@ -0,0 +1,130 @@
|
||||
|
||||
@{
|
||||
ViewBag.title = "添加新管理组";
|
||||
}
|
||||
<div class="wrapper wrapper-content">
|
||||
<div class="ibox float-e-margins">
|
||||
<div class="ibox-title">
|
||||
<h5>@ViewBag.title</h5>
|
||||
<div class="ibox-tools">
|
||||
</div>
|
||||
</div>
|
||||
<div class="ibox-content">
|
||||
@using (Html.BeginForm(null, null, FormMethod.Post, new { id = "addadminroleForm", @class = "form-horizontal m-t" }))
|
||||
{
|
||||
<div class="tabs-container">
|
||||
<ul class="nav nav-tabs">
|
||||
<li class="active">
|
||||
<a data-toggle="tab" href="#tab-1" aria-expanded="true"> 管理组基本设置</a>
|
||||
</li>
|
||||
<li class="">
|
||||
<a data-toggle="tab" href="#tab-2" aria-expanded="false"> 管理组权限设置</a>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="tab-content">
|
||||
<div id="tab-1" class="tab-pane active">
|
||||
<div class="panel-body">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">管理组名称:</label>
|
||||
<div class="col-sm-8">
|
||||
<input id="RoleName" name="RoleName" maxlength="200" type="text" class="form-control" value="" required aria-required="true" placeholder="填写管理组名称">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">是否超级管理员:</label>
|
||||
<div class="col-sm-8">
|
||||
<select class="form-control" id="IsSuperAdmin" name="IsSuperAdmin">
|
||||
<option value="0">普通管理员</option>
|
||||
<option value="1">超级管理员</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">管理组简介:</label>
|
||||
<div class="col-sm-8">
|
||||
<input id="RoleDescription" type="text" class="form-control" name="RoleDescription" placeholder="管理组简介,非必填" value="" maxlength="200">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">不允许删除:</label>
|
||||
<div class="col-sm-8">
|
||||
<label class="checkbox-inline i-checks">
|
||||
<input type="checkbox" value="1" name="NotAllowDel" id="NotAllowDel"> 不允许删除(勾选则该管理组不允许直接删除)
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="tab-2" class="tab-pane">
|
||||
<div class="panel-body">
|
||||
<div class="alert alert-info">
|
||||
温馨提示:如果选择『超级管理员』级别,则默认拥有所有权限,不需要在此勾选权限;若版面不正常,请最大化查看
|
||||
</div>
|
||||
<table class="tree table table-striped table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>菜单名称</th>
|
||||
<th>菜单Key</th>
|
||||
<th>权限详情</th>
|
||||
</tr>
|
||||
</thead>
|
||||
@foreach (AdminMenu m in ViewBag.MenuList)
|
||||
{
|
||||
<tr class="treegrid-@m.Id @(m.PId !=0?"treegrid-parent-"+m.PId:"") ">
|
||||
<td>
|
||||
<label class="checkbox-inline i-checks">
|
||||
<input type="checkbox" value="@m.Id" name="menuid" id="menuid_@m.Id">
|
||||
@if (!string.IsNullOrWhiteSpace(m.ClassName))
|
||||
{
|
||||
<i class="fa @m.ClassName"></i>
|
||||
}
|
||||
@m.MenuName
|
||||
</label>
|
||||
</td>
|
||||
<td>@m.MenuKey</td>
|
||||
<td>
|
||||
@foreach (var e in @m.ListEvent)
|
||||
{
|
||||
<span>
|
||||
<label class="checkbox-inline i-checks">
|
||||
<input type="checkbox" value="@e.Id" name="EventKey_@(m.Id)" id="@(e.MenuKey)_@(e.Id)_@(m.Id)">
|
||||
@e.EventName
|
||||
</label>
|
||||
</span>
|
||||
}
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</table>
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
$('.tree').treegrid();
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row white-bg">
|
||||
<div class="hr-line-dashed"></div>
|
||||
<div class="form-group">
|
||||
<div class="col-sm-4 col-sm-offset-3">
|
||||
<button class="btn btn-primary" type="submit"><i class="fa fa-save"></i> 提交 </button>
|
||||
<button class="btn btn-default" type="button" onclick="closethisdialog();"><i class="fa fa-close"></i> 取消 </button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
<script>
|
||||
$(function () {
|
||||
DoPost("addadminroleForm");
|
||||
})
|
||||
</script>
|
||||
@@ -0,0 +1,70 @@
|
||||
@model IList<AdminRoles>
|
||||
@{
|
||||
ViewBag.title = "管理组管理";
|
||||
}
|
||||
<div class="wrapper wrapper-content">
|
||||
<div class="ibox float-e-margins">
|
||||
<div class="ibox-title">
|
||||
<h5>@ViewBag.title</h5>
|
||||
</div>
|
||||
<div class="ibox-content">
|
||||
<div id="toolbar" class="btn-group">
|
||||
<button id="btn_add" type="button" class="btn btn-outline btn-default" onclick="top.showDialog('addadminrole', '添加管理组', '/AdminCP/Member/AddAdminRole', 0, 0)">
|
||||
<span class="glyphicon glyphicon-plus" aria-hidden="true"></span>新增
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div id="toolbar2" class="btn-group pull-right">
|
||||
<button id="btn_refresh" type="button" class="btn btn-outline btn-default" onclick="refresh();">
|
||||
<span class="fa fa-refresh" aria-hidden="true"></span>刷新
|
||||
</button>
|
||||
</div>
|
||||
<table class="tree table table-striped table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
<th>管理组名称</th>
|
||||
<th class="text-center">是否超级管理员</th>
|
||||
<th class="text-center">是否不许删除</th>
|
||||
<th class="text-center">排序</th>
|
||||
<th>管理组简介</th>
|
||||
<th>操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
@if (Model.Count == 0)
|
||||
{
|
||||
<tr><td colspan="6" class="text-center">暂无记录...</td></tr>
|
||||
}
|
||||
@foreach (var m in Model)
|
||||
{
|
||||
<tr>
|
||||
<td>@m.Id</td>
|
||||
<td>
|
||||
@m.RoleName
|
||||
</td>
|
||||
<td class="text-center">
|
||||
@if (m.IsSuperAdmin == 1)
|
||||
{
|
||||
<i class="fa fa-check"></i>
|
||||
}
|
||||
</td>
|
||||
<td class="text-center">
|
||||
@if (m.NotAllowDel == 1)
|
||||
{
|
||||
<i class="fa fa-check"></i>
|
||||
}
|
||||
</td>
|
||||
<td class="text-center">@m.Rank</td>
|
||||
<td>@m.RoleDescription</td>
|
||||
<td>
|
||||
<a href="javascript:;" class="btn btn-xs btn-primary" title="编辑" onclick="top.showDialog('eidtadminrole', '编辑管理组详情', '/AdminCP/Member/EditAdminRole/@m.Id', 0, 0)"><i class="fa fa-edit"></i> 编辑</a>
|
||||
<a href="javascript:;" class="btn btn-xs btn-danger" title="删除" onclick="doDel('/AdminCP/Member/DelAdminRole',@m.Id);"><i class="fa fa-close"></i> 删除</a>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
@@ -0,0 +1,167 @@
|
||||
|
||||
@{
|
||||
ViewBag.title = "管理员管理";
|
||||
}
|
||||
<div class="wrapper wrapper-content ">
|
||||
<div class="ibox float-e-margins">
|
||||
<div class="ibox-title">
|
||||
<h5>@ViewBag.title</h5>
|
||||
<div class="ibox-tools">
|
||||
</div>
|
||||
</div>
|
||||
<div class="ibox-content">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">筛选条件</div>
|
||||
<div class="panel-body">
|
||||
<form id="formSearch" class="form-horizontal form-inline">
|
||||
<div>
|
||||
<label class="control-label">管理组:</label>
|
||||
|
||||
<select class="form-control" name="roleid" id="roleid">
|
||||
<option value="0">所有管理组</option>
|
||||
@foreach (var m in ViewBag.RoleList)
|
||||
{
|
||||
<option value="@m.Id">@m.RoleName</option>
|
||||
}
|
||||
</select>
|
||||
<label class="control-label">关键字:</label>
|
||||
<input type="text" placeholder="用户名关键字" name="keyword" id="keyword" class="form-control">
|
||||
<button type="button" style="margin-left:50px" id="btn_query" class="btn btn-primary" onclick="doSearch();">查询</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<div id="toolbar" class="btn-group">
|
||||
<button id="btn_add" type="button" class="btn btn-outline btn-default" onclick="top.showDialog('addadmins', '添加管理员', '/AdminCP/Member/AddAdmin', 1000, 600)">
|
||||
<span class="glyphicon glyphicon-plus" aria-hidden="true"></span>新增
|
||||
</button>
|
||||
</div>
|
||||
<table id="tb_departments"></table>
|
||||
|
||||
<script>
|
||||
$(function () {
|
||||
|
||||
//1.初始化Table
|
||||
var oTable = new TableInit();
|
||||
oTable.Init();
|
||||
|
||||
//2.初始化Button的点击事件
|
||||
var oButtonInit = new ButtonInit();
|
||||
oButtonInit.Init();
|
||||
|
||||
});
|
||||
|
||||
function doSearch() {
|
||||
var params = $('#tb_departments').bootstrapTable('getOptions');
|
||||
//console.log(params);
|
||||
params.queryParams = function (params) {
|
||||
|
||||
var temp = { //这里的键的名字和控制器的变量名必须一直,这边改动,控制器也需要改成一样的
|
||||
limit: params.limit, //页面大小
|
||||
page: (params.offset / params.limit) + 1, //页码
|
||||
roleid: $("#roleid").val(),
|
||||
keyword: $("#keyword").val()
|
||||
};
|
||||
return temp;
|
||||
}
|
||||
$('#tb_departments').bootstrapTable('refresh', params);
|
||||
}
|
||||
|
||||
var TableInit = function () {
|
||||
var oTableInit = new Object();
|
||||
//初始化Table
|
||||
oTableInit.Init = function () {
|
||||
$('#tb_departments').bootstrapTable({
|
||||
url: '/AdminCP/Member/GetAdmins', //请求后台的URL(*)
|
||||
method: 'get', //请求方式(*)
|
||||
toolbar: '#toolbar', //工具按钮用哪个容器
|
||||
striped: true, //是否显示行间隔色
|
||||
cache: false, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
|
||||
pagination: true, //是否显示分页(*)
|
||||
sortable: false, //是否启用排序
|
||||
sortOrder: "asc", //排序方式
|
||||
queryParams: oTableInit.queryParams,//传递参数(*)
|
||||
sidePagination: "server", //分页方式:client客户端分页,server服务端分页(*)
|
||||
pageNumber: 1, //初始化加载第一页,默认第一页
|
||||
pageSize: 25, //每页的记录行数(*)
|
||||
pageList: [10, 25, 50, 100], //可供选择的每页的行数(*)
|
||||
search: true, //是否显示表格搜索,此搜索是客户端搜索,不会进服务端,所以,个人感觉意义不大
|
||||
strictSearch: true,
|
||||
showColumns: true, //是否显示所有的列
|
||||
showRefresh: true, //是否显示刷新按钮
|
||||
minimumCountColumns: 2, //最少允许的列数
|
||||
clickToSelect: true, //是否启用点击选中行
|
||||
height: 0, //行高,如果没有设置height属性,表格自动根据记录条数觉得表格高度
|
||||
uniqueId: "Id", //每一行的唯一标识,一般为主键列
|
||||
showToggle: true, //是否显示详细视图和列表视图的切换按钮
|
||||
cardView: false, //是否显示详细视图
|
||||
detailView: false, //是否显示父子表
|
||||
columns: [{
|
||||
checkbox: true
|
||||
}, {
|
||||
field: 'Id',
|
||||
title: 'ID'
|
||||
}, {
|
||||
field: 'UserName',
|
||||
title: '用户名'
|
||||
}, {
|
||||
field: 'Roles',
|
||||
title: '管理组',
|
||||
formatter: function (value, row, index) {
|
||||
if (value)
|
||||
return value.RoleName;
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'RealName',
|
||||
title: '姓名'
|
||||
},
|
||||
{
|
||||
field: 'LastLoginTime',
|
||||
title: '最后登录时间'
|
||||
},
|
||||
{
|
||||
field: 'Id',
|
||||
title: '操作',
|
||||
formatter: 'actionFormatter'
|
||||
}
|
||||
]
|
||||
});
|
||||
};
|
||||
|
||||
//得到查询的参数
|
||||
oTableInit.queryParams = function (params) {
|
||||
var temp = { //这里的键的名字和控制器的变量名必须一直,这边改动,控制器也需要改成一样的
|
||||
limit: params.limit, //页面大小
|
||||
page: (params.offset / params.limit) + 1, //页码
|
||||
roleid: $("#roleid").val(),
|
||||
departmentname: $("#keyword").val()
|
||||
};
|
||||
return temp;
|
||||
};
|
||||
return oTableInit;
|
||||
};
|
||||
|
||||
function actionFormatter(value, row, index) {
|
||||
return [
|
||||
'<a href="javascript:;" class="btn btn-xs btn-primary" title="查看/编辑" onclick="top.showDialog(\'eidtads\', \'查看/编辑管理员详情\', \'/AdminCP/Member/EditAdmin/' + value + '\', 0, 0)"><i class="fa fa-edit"></i> 查看/编辑</a>',
|
||||
'<a href="javascript:;" class="btn btn-xs btn-danger m-l-xs" title="删除" onclick="doDel(\'/AdminCP/Member/DelAdmin\',' + value + ');"><i class="fa fa-close"></i> 删除</a>',
|
||||
].join('');
|
||||
}
|
||||
|
||||
var ButtonInit = function () {
|
||||
var oInit = new Object();
|
||||
var postdata = {};
|
||||
|
||||
oInit.Init = function () {
|
||||
//初始化页面上面的按钮事件
|
||||
};
|
||||
|
||||
return oInit;
|
||||
};
|
||||
</script>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
@@ -0,0 +1,65 @@
|
||||
@model Admin
|
||||
@{
|
||||
ViewBag.title = "查看/编辑管理员";
|
||||
}
|
||||
<div class="wrapper wrapper-content animated fadeInRight">
|
||||
<div class="ibox float-e-margins">
|
||||
<div class="ibox-title">
|
||||
<h5>@ViewBag.Title</h5>
|
||||
<div class="ibox-tools">
|
||||
</div>
|
||||
</div>
|
||||
<div class="ibox-content">
|
||||
@using (Html.BeginForm(null, null, FormMethod.Post, new { id = "eidtAdminForm", @class = "form-horizontal m-t" }))
|
||||
{
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">所属管理组:</label>
|
||||
<div class="col-sm-8">
|
||||
<select class="form-control m-b" asp-for="RoleId">
|
||||
@foreach (var m in ViewBag.RoleList)
|
||||
{
|
||||
<option value="@m.Id">@m.RoleName</option>
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">用户名:</label>
|
||||
<div class="col-sm-8">
|
||||
<input id="UserName" name="UserName" maxlength="20" type="text" class="form-control" value="@Model.UserName" required aria-required="true" placeholder="填写管理员登录用户名">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">姓名:</label>
|
||||
<div class="col-sm-8">
|
||||
<input id="RealName" name="RealName" maxlength="20" type="text" class="form-control" value="@Model.RealName" placeholder="可以填写备注管理员的姓名,非必填">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">登录密码:</label>
|
||||
<div class="col-sm-8">
|
||||
<input id="PassWord" name="PassWord" maxlength="20" type="password" class="form-control" placeholder="如果修改密码,则请输入,否则,请留空">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">重复密码:</label>
|
||||
<div class="col-sm-8">
|
||||
<input id="PassWord2" type="password" class="form-control" name="PassWord2" maxlength="20" placeholder="请重复填写一次登录密码">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="hr-line-dashed"></div>
|
||||
<div class="form-group">
|
||||
<div class="col-sm-4 col-sm-offset-3">
|
||||
<input type="hidden" value="@Model.Id" name="Id" id="Id" />
|
||||
<button class="btn btn-primary" type="submit"><i class="fa fa-save"></i> 提交 </button>
|
||||
<button class="btn btn-default" type="button" onclick="closethisdialog();"><i class="fa fa-close"></i> 取消 </button>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
DoPost("editAdminForm");
|
||||
</script>
|
||||
@@ -0,0 +1,129 @@
|
||||
@model AdminRoles
|
||||
@{
|
||||
ViewBag.title = "查看/编辑管理组详情";
|
||||
}
|
||||
<div class="wrapper wrapper-content ">
|
||||
<div class="ibox float-e-margins">
|
||||
<div class="ibox-title">
|
||||
<h5>@ViewBag.title</h5>
|
||||
<div class="ibox-tools">
|
||||
</div>
|
||||
</div>
|
||||
<div class="ibox-content">
|
||||
@using (Html.BeginForm(null, null, FormMethod.Post, new { id = "editadminroleForm", @class = "form-horizontal m-t" }))
|
||||
{
|
||||
<div class="tabs-container">
|
||||
<ul class="nav nav-tabs">
|
||||
<li class="active">
|
||||
<a data-toggle="tab" href="#tab-1" aria-expanded="true"> 管理组基本设置</a>
|
||||
</li>
|
||||
<li class="">
|
||||
<a data-toggle="tab" href="#tab-2" aria-expanded="false"> 管理组权限设置</a>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="tab-content">
|
||||
<div id="tab-1" class="tab-pane active">
|
||||
<div class="panel-body">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">管理组名称:</label>
|
||||
<div class="col-sm-8">
|
||||
<input id="RoleName" name="RoleName" maxlength="200" type="text" class="form-control" value="@Model.RoleName" required aria-required="true" placeholder="填写管理组名称">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">是否超级管理员:</label>
|
||||
<div class="col-sm-8">
|
||||
<select class="form-control" asp-for="IsSuperAdmin">
|
||||
<option value="1" >超级管理员</option>
|
||||
<option value="0" >普通管理员</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">管理组简介:</label>
|
||||
<div class="col-sm-8">
|
||||
<input id="RoleDescription" type="text" class="form-control" name="RoleDescription" placeholder="管理组简介,非必填" value="@Model.RoleDescription" maxlength="200">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">不允许删除:</label>
|
||||
<div class="col-sm-8">
|
||||
<label class="checkbox-inline i-checks">
|
||||
<input type="checkbox" value="1" name="NotAllowDel" id="NotAllowDel" @(Model.NotAllowDel == 1 ? "checked" : "")> 不允许删除(勾选则该管理组不允许直接删除)
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="tab-2" class="tab-pane">
|
||||
<div class="panel-body">
|
||||
<div class="alert alert-info">
|
||||
温馨提示:如果选择『超级管理员』级别,则默认拥有所有权限,不需要在此勾选权限;若版面不正常,请最大化查看
|
||||
</div>
|
||||
<table class="tree table table-striped table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>菜单名称</th>
|
||||
<th>菜单Key</th>
|
||||
<th>权限详情</th>
|
||||
</tr>
|
||||
</thead>
|
||||
@foreach (AdminMenu m in ViewBag.MenuList)
|
||||
{
|
||||
<tr class="treegrid-@m.Id @(m.PId !=0?"treegrid-parent-"+m.PId:"") ">
|
||||
<td>
|
||||
<label class="checkbox-inline i-checks">
|
||||
<input type="checkbox" value="@m.Id" name="menuid" id="menuid_@m.Id">
|
||||
@if (!string.IsNullOrWhiteSpace(m.ClassName))
|
||||
{
|
||||
<i class="fa @m.ClassName"></i>
|
||||
}
|
||||
@m.MenuName
|
||||
</label>
|
||||
</td>
|
||||
<td>@m.MenuKey</td>
|
||||
<td>
|
||||
@foreach (var e in @m.ListEvent)
|
||||
{
|
||||
<span>
|
||||
<label class="checkbox-inline i-checks">
|
||||
<input type="checkbox" value="@e.Id" name="EventKey_@(m.Id)" id="@(e.MenuKey)_@(e.Id)">
|
||||
@e.EventName
|
||||
</label>
|
||||
</span>
|
||||
}
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</table>
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
$('.tree').treegrid();
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row white-bg">
|
||||
<div class="hr-line-dashed"></div>
|
||||
<div class="form-group">
|
||||
<div class="col-sm-4 col-sm-offset-3">
|
||||
<input type="hidden" value="@Model.Id" id="Id" name="Id" />
|
||||
<button class="btn btn-primary" type="submit"><i class="fa fa-save"></i> 提交 </button>
|
||||
<button class="btn btn-default" type="button" onclick="closethisdialog();"><i class="fa fa-close"></i> 取消 </button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
$(function () {
|
||||
DoPost("editadminroleForm");
|
||||
})
|
||||
</script>
|
||||
@@ -0,0 +1,85 @@
|
||||
@model COMCMS.Core.Admin
|
||||
@{
|
||||
ViewBag.title = "编辑我的信息";
|
||||
}
|
||||
<div class="wrapper wrapper-content ">
|
||||
<div class="row">
|
||||
<div class="tabs-container">
|
||||
<ul class="nav nav-tabs">
|
||||
<li class="active">
|
||||
<a data-toggle="tab" href="#tab-1" aria-expanded="true"> 编辑我的信息</a>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="tab-content">
|
||||
<div id="tab-1" class="tab-pane active">
|
||||
<div class="panel-body">
|
||||
<div class="alert alert-info">
|
||||
您可以修改密码,请务必设置一个比较复杂的密码,以免被爆破!
|
||||
</div>
|
||||
@using (Html.BeginForm(null, null, FormMethod.Post, new { id = "editmyinfoForm", @class = "form-horizontal m-t" }))
|
||||
{
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">用户名:</label>
|
||||
<div class="col-sm-8">
|
||||
<input id="UserName" name="UserName" minlength="2" maxlength="20" type="text" class="form-control" required aria-required="true" placeholder="用户名,可以中英文,但不能少于5个字符" value="@Model.UserName">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">旧密码:</label>
|
||||
<div class="col-sm-8">
|
||||
<input id="txtOldPwd" name="txtOldPwd" type="password" class="form-control" placeholder="如果修改密码,则必须填写,否则,请留空" value="">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">新密码:</label>
|
||||
<div class="col-sm-8">
|
||||
<input id="txtNewPwd" name="txtNewPwd" type="password" class="form-control" placeholder="如果修改登录密码,请填写,否则,请留空" value="">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">重复新密码:</label>
|
||||
<div class="col-sm-8">
|
||||
<input id="txtreNewPwd" name="txtreNewPwd" type="password" class="form-control" placeholder="如果修改密码,请重复输入一次新密码,否则请流控" value="">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">真实姓名:</label>
|
||||
<div class="col-sm-8">
|
||||
<input id="RealName" name="RealName" type="text" maxlength="20" class="form-control" placeholder="您可以设置真实姓名" value="@Model.RealName">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">手机号码:</label>
|
||||
<div class="col-sm-8">
|
||||
<input id="Tel" name="Tel" maxlength="20" type="text" class="form-control" placeholder="您可以填写手机号码" value="@Model.Tel">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">电子邮箱:</label>
|
||||
<div class="col-sm-8">
|
||||
<input id="Email" name="Email" maxlength="50" type="email" class="form-control" placeholder="您可以填写Email" value="@Model.Email">
|
||||
</div>
|
||||
</div>
|
||||
<div class="hr-line-dashed"></div>
|
||||
<div class="form-group">
|
||||
<div class="col-sm-4 col-sm-offset-2">
|
||||
<button class="btn btn-primary" type="submit"><i class="fa fa-save"></i> 提交 </button>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<script>
|
||||
$(function () {
|
||||
DoPost("editmyinfoForm");
|
||||
})
|
||||
</script>
|
||||
@@ -8,7 +8,7 @@
|
||||
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.7" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Session" Version="2.0.2" />
|
||||
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.0.3" />
|
||||
<PackageReference Include="MySql.Data" Version="6.10.6" />
|
||||
<PackageReference Include="MySql.Data" Version="8.0.11" />
|
||||
<PackageReference Include="NewLife.XCode" Version="9.6.6678.32715" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="11.0.2" />
|
||||
<PackageReference Include="Senparc.Weixin.MP" Version="14.10.13" />
|
||||
|
||||
Reference in New Issue
Block a user