mirror of
https://gitee.com/dotnetchina/OpenAuth.Net.git
synced 2025-07-15 14:04:41 +08:00
完成菜单分配JS模块化
This commit is contained in:
parent
2c521e3244
commit
0738c84535
@ -54,6 +54,18 @@ namespace OpenAuth.App
|
|||||||
return _repository.Find(null).ToList();
|
return _repository.Find(null).ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<Module> LoadTree(int firstId, string key)
|
||||||
|
{
|
||||||
|
if (key == "UserElement") //todo:因为在分配菜单页面出现的树,只能收到这个值,蛋疼
|
||||||
|
{
|
||||||
|
return LoadForUser(firstId);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return LoadForRole(firstId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 以组合的方式显示所有的模块信息
|
/// 以组合的方式显示所有的模块信息
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -137,19 +137,5 @@ namespace OpenAuth.App
|
|||||||
return listVms;
|
return listVms;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 为角色分配资源
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="roleId">角色ID</param>
|
|
||||||
/// <param name="resIds">资源ID数组</param>
|
|
||||||
public void AssignResForRole(int roleId, int[] resIds)
|
|
||||||
{
|
|
||||||
_relevanceRepository.AddRelevance("RoleResource", resIds.ToLookup(u => roleId));
|
|
||||||
}
|
|
||||||
|
|
||||||
public void DelResForRole(int roleId, int[] resIds)
|
|
||||||
{
|
|
||||||
_relevanceRepository.DeleteBy("RoleResource", resIds.ToLookup(u =>roleId));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,57 +1,59 @@
|
|||||||
// ***********************************************************************
|
// ***********************************************************************
|
||||||
// Assembly : OpenAuth.Mvc
|
// Assembly : OpenAuth.Mvc
|
||||||
// Author : yubaolee
|
// Author : yubaolee
|
||||||
// Created : 04-13-2016
|
// Created : 04-16-2016
|
||||||
//
|
//
|
||||||
// Last Modified By : yubaolee
|
// Last Modified By : yubaolee
|
||||||
// Last Modified On : 04-13-2016
|
// Last Modified On : 04-16-2016
|
||||||
// ***********************************************************************
|
// ***********************************************************************
|
||||||
// <copyright file="userModuleElement.js" company="www.cnblogs.com/yubaolee">
|
// <copyright file="userRes.js" company="www.cnblogs.com/yubaolee">
|
||||||
// 版权所有(C) 2015
|
// 版权所有(C) 2015
|
||||||
// </copyright>
|
// </copyright>
|
||||||
// <summary>为用户分配模块菜单</summary>
|
// <summary>分配模块菜单(按钮)</summary>
|
||||||
// ***********************************************************************
|
// ***********************************************************************
|
||||||
|
|
||||||
|
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
$.CurrentDialog.find("#btnAccess").on("click", function () {
|
$.CurrentDialog.find("#btnAccess").on("click", function () {
|
||||||
var ids = userMenuList.getSelectedProperties('Id');
|
var ids = dlgList.getSelectedProperties('Id');
|
||||||
if (ids == null) return;
|
if (ids == null) return;
|
||||||
|
|
||||||
$.post("/ModuleElementManager/AssignForUser",
|
$.post('/RelevanceManager/Assign', {
|
||||||
{
|
type: $("#moduleType").val(),
|
||||||
userId: $('#userId').val(),
|
firstId: $('#firstId').val(),
|
||||||
menuIds: ids,
|
secIds: ids
|
||||||
}, function (json) {
|
}, function (json) {
|
||||||
userMenuList.reload();
|
dlgList.reload();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
$.CurrentDialog.find("#btnDelAccess").on("click", function () {
|
$.CurrentDialog.find("#btnDelAccess").on("click", function () {
|
||||||
var ids = userMenuList.getSelectedProperties('Id');
|
var ids = dlgList.getSelectedProperties('Id');
|
||||||
if (ids == null) return;
|
if (ids == null) return;
|
||||||
|
|
||||||
$.post("/ModuleElementManager/CancelForUser",{
|
$.post('/RelevanceManager/UnAssign', {
|
||||||
userId: $('#userId').val(),
|
type: $("#moduleType").val(),
|
||||||
menuIds: ids,
|
firstId: $('#firstId').val(),
|
||||||
|
secIds: ids
|
||||||
}, function (json) {
|
}, function (json) {
|
||||||
userMenuList.reload();
|
dlgList.reload();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
//grid列表模块
|
//grid列表模块
|
||||||
function UserMEGrid() {
|
function DialogList() {
|
||||||
var selectedId = 0; //ztree选中的模块
|
var selectedId = 0; //选中的ID
|
||||||
|
var url = '/ModuleElementManager/LoadWithAccess?tId=';
|
||||||
this.maingrid = $.CurrentDialog.find('#maingrid').datagrid({
|
this.maingrid = $.CurrentDialog.find('#maingrid').datagrid({
|
||||||
showToolbar: false,
|
showToolbar: false,
|
||||||
filterThead: false,
|
filterThead: false,
|
||||||
target: $(this),
|
target: $(this),
|
||||||
columns: [
|
columns: [
|
||||||
{
|
{
|
||||||
name: 'Id',
|
name: 'Id',
|
||||||
label: '元素名称',
|
label: '元素名称',
|
||||||
hide: true
|
hide: true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Name',
|
name: 'Name',
|
||||||
label: '元素名称',
|
label: '元素名称',
|
||||||
@ -65,13 +67,12 @@ function UserMEGrid() {
|
|||||||
{
|
{
|
||||||
name: 'Accessed',
|
name: 'Accessed',
|
||||||
label: '是否已经授权',
|
label: '是否已经授权',
|
||||||
type: 'select',
|
|
||||||
align: 'center',
|
align: 'center',
|
||||||
items: [{ 'false': '未授权', 'true': '已授权' }],
|
items: [{ 'false': '未授权', 'true': '已授权' }],
|
||||||
width: 80
|
width: 80
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
dataUrl: '/ModuleElementManager/LoadForUser?moduleId=' + selectedId + '&userId=' + $('#userId').val(),
|
dataUrl: url + selectedId + '&key=' + $('#moduleType').val() + '&firstId=' + $('#firstId').val(),
|
||||||
fullGrid: true,
|
fullGrid: true,
|
||||||
showLinenumber: true,
|
showLinenumber: true,
|
||||||
showCheckboxcol: true,
|
showCheckboxcol: true,
|
||||||
@ -80,13 +81,13 @@ function UserMEGrid() {
|
|||||||
showTfoot: false,
|
showTfoot: false,
|
||||||
|
|
||||||
});
|
});
|
||||||
this.reload = function(id) {
|
this.reload = function (id) {
|
||||||
if (id != undefined) selectedId = id;
|
if (id != undefined) selectedId = id;
|
||||||
this.maingrid.datagrid('reload', { dataUrl: '/ModuleElementManager/LoadForUser?moduleId=' + selectedId + '&userId=' + $('#userId').val() });
|
this.maingrid.datagrid('reload', { dataUrl: url + selectedId + '&key=' + $('#moduleType').val() + '&firstId=' + $('#firstId').val() });
|
||||||
};
|
}
|
||||||
};
|
};
|
||||||
UserMEGrid.prototype = new Grid();
|
DialogList.prototype = new Grid();
|
||||||
var userMenuList = new UserMEGrid();
|
var dlgList = new DialogList();
|
||||||
|
|
||||||
var ztree = function () {
|
var ztree = function () {
|
||||||
var setting = {
|
var setting = {
|
||||||
@ -105,12 +106,11 @@ var ztree = function () {
|
|||||||
},
|
},
|
||||||
callback: { onClick: zTreeOnClick }
|
callback: { onClick: zTreeOnClick }
|
||||||
};
|
};
|
||||||
$.getJSON('/ModuleManager/LoadForUser?userId=' + $('#userId').val(), function (json) {
|
$.getJSON('/ModuleManager/LoadTree?firstId=' + $('#firstId').val()+ '&key=' + $('#moduleType').val() , function (json) {
|
||||||
var zTreeObj = $.fn.zTree.init($.CurrentDialog.find("#tree"), setting, json);
|
var zTreeObj = $.fn.zTree.init($.CurrentDialog.find("#tree"), setting, json);
|
||||||
zTreeObj.expandAll(true);
|
zTreeObj.expandAll(true);
|
||||||
});
|
});
|
||||||
}();
|
}();
|
||||||
function zTreeOnClick(event, treeId, treeNode) {
|
function zTreeOnClick(event, treeId, treeNode) {
|
||||||
userMenuList.reload(treeNode.Id);
|
dlgList.reload(treeNode.Id);
|
||||||
}
|
}
|
||||||
//@@ sourceURL=userModuleElement.js
|
|
@ -271,7 +271,7 @@ function openRoleReourceAccess(obj) {
|
|||||||
if (selected == null) return;
|
if (selected == null) return;
|
||||||
|
|
||||||
$(obj).dialog({
|
$(obj).dialog({
|
||||||
id: 'accessUserRole',
|
id: 'assignRes',
|
||||||
url: '/ResourceManager/AssignRes',
|
url: '/ResourceManager/AssignRes',
|
||||||
title: '为角色分配资源',
|
title: '为角色分配资源',
|
||||||
width: 600,
|
width: 600,
|
||||||
@ -289,11 +289,15 @@ function assignRoleElement(obj) {
|
|||||||
if (selected == null) return;
|
if (selected == null) return;
|
||||||
|
|
||||||
$(obj).dialog({
|
$(obj).dialog({
|
||||||
id: 'assignElement',
|
id: 'accessRoleElement',
|
||||||
url: '/ModuleElementManager/AssignForRole?roleId=' + selected.Id,
|
url: '/ModuleElementManager/AssignModuleElement',
|
||||||
title: '为角色分配菜单',
|
title: '为角色分配菜单',
|
||||||
width: 700,
|
width: 600,
|
||||||
height: 380
|
height: 380,
|
||||||
|
data: {
|
||||||
|
firstId: selected.Id,
|
||||||
|
key: "RoleElement"
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,115 +0,0 @@
|
|||||||
// ***********************************************************************
|
|
||||||
// Assembly : OpenAuth.Mvc
|
|
||||||
// Author : yubaolee
|
|
||||||
// Created : 04-13-2016
|
|
||||||
//
|
|
||||||
// Last Modified By : yubaolee
|
|
||||||
// Last Modified On : 04-13-2016
|
|
||||||
// ***********************************************************************
|
|
||||||
// <copyright file="RoleModuleElement.js" company="www.cnblogs.com/yubaolee">
|
|
||||||
// 版权所有(C) 2015
|
|
||||||
// </copyright>
|
|
||||||
// <summary>为角色分配模块菜单</summary>
|
|
||||||
// ***********************************************************************
|
|
||||||
|
|
||||||
|
|
||||||
$(document).ready(function () {
|
|
||||||
$.CurrentDialog.find("#btnAccess").on("click", function () {
|
|
||||||
var ids = roleMenuList.getSelectedProperties('Id');
|
|
||||||
if (ids == null) return;
|
|
||||||
|
|
||||||
$.post("/ModuleElementManager/AssignForRole",
|
|
||||||
{
|
|
||||||
RoleId: $('#roleId').val(),
|
|
||||||
menuIds: ids,
|
|
||||||
}, function (json) {
|
|
||||||
roleMenuList.reload();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
$.CurrentDialog.find("#btnDelAccess").on("click", function () {
|
|
||||||
var ids = roleMenuList.getSelectedProperties('Id');
|
|
||||||
if (ids == null) return;
|
|
||||||
|
|
||||||
$.post("/ModuleElementManager/CancelForRole",{
|
|
||||||
RoleId: $('#roleId').val(),
|
|
||||||
menuIds: ids,
|
|
||||||
}, function (json) {
|
|
||||||
roleMenuList.reload();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
//grid列表模块
|
|
||||||
function RoleMEGrid() {
|
|
||||||
var selectedId = 0; //ztree选中的模块
|
|
||||||
this.maingrid = $.CurrentDialog.find('#maingrid').datagrid({
|
|
||||||
showToolbar: false,
|
|
||||||
filterThead: false,
|
|
||||||
target: $(this),
|
|
||||||
columns: [
|
|
||||||
{
|
|
||||||
name: 'Id',
|
|
||||||
label: '元素名称',
|
|
||||||
hide: true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'Name',
|
|
||||||
label: '元素名称',
|
|
||||||
width: 80
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'ModuleName',
|
|
||||||
label: '所属模块',
|
|
||||||
width: 80
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'Accessed',
|
|
||||||
label: '是否已经授权',
|
|
||||||
type: 'select',
|
|
||||||
align: 'center',
|
|
||||||
items: [{ 'false': '未授权', 'true': '已授权' }],
|
|
||||||
width: 80
|
|
||||||
}
|
|
||||||
],
|
|
||||||
dataUrl: '/ModuleElementManager/LoadForRole?moduleId=' + selectedId + '&RoleId=' + $('#roleId').val(),
|
|
||||||
fullGrid: true,
|
|
||||||
showLinenumber: true,
|
|
||||||
showCheckboxcol: true,
|
|
||||||
paging: true,
|
|
||||||
filterMult: false,
|
|
||||||
showTfoot: false
|
|
||||||
});
|
|
||||||
this.reload = function(id) {
|
|
||||||
if (id != undefined) selectedId = id;
|
|
||||||
this.maingrid.datagrid('reload', { dataUrl: '/ModuleElementManager/LoadForRole?moduleId=' + selectedId + '&RoleId=' + $('#roleId').val() });
|
|
||||||
};
|
|
||||||
};
|
|
||||||
RoleMEGrid.prototype = new Grid();
|
|
||||||
var roleMenuList = new RoleMEGrid();
|
|
||||||
|
|
||||||
var ztree = function () {
|
|
||||||
var setting = {
|
|
||||||
view: { selectedMulti: false },
|
|
||||||
data: {
|
|
||||||
key: {
|
|
||||||
name: 'Name',
|
|
||||||
title: 'Name'
|
|
||||||
},
|
|
||||||
simpleData: {
|
|
||||||
enable: true,
|
|
||||||
idKey: 'Id',
|
|
||||||
pIdKey: 'ParentId',
|
|
||||||
rootPId: 'null'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
callback: { onClick: zTreeOnClick }
|
|
||||||
};
|
|
||||||
$.getJSON('/ModuleManager/LoadForRole?RoleId=' + $('#roleId').val(), function (json) {
|
|
||||||
var zTreeObj = $.fn.zTree.init($.CurrentDialog.find("#tree"), setting, json);
|
|
||||||
zTreeObj.expandAll(true);
|
|
||||||
});
|
|
||||||
}();
|
|
||||||
function zTreeOnClick(event, treeId, treeNode) {
|
|
||||||
roleMenuList.reload(treeNode.Id);
|
|
||||||
}
|
|
||||||
//@@ sourceURL=RoleModuleElement.js
|
|
@ -317,11 +317,15 @@ function openAssignUserElement(obj) {
|
|||||||
if (selected == null) return;
|
if (selected == null) return;
|
||||||
|
|
||||||
$(obj).dialog({
|
$(obj).dialog({
|
||||||
id: 'assignElement',
|
id: 'accessUserElement',
|
||||||
url: '/ModuleElementManager/AssignForUser?userId=' + selected.Id,
|
url: '/ModuleElementManager/AssignModuleElement',
|
||||||
title: '为用户分配菜单',
|
title: '为用户分配资源',
|
||||||
width: 700,
|
width: 600,
|
||||||
height: 380
|
height: 380,
|
||||||
|
data: {
|
||||||
|
firstId: selected.Id,
|
||||||
|
key: "UserElement"
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,16 +12,13 @@
|
|||||||
// <summary>模块元素管理,无需权限控制</summary>
|
// <summary>模块元素管理,无需权限控制</summary>
|
||||||
// ***********************************************************************
|
// ***********************************************************************
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Data.Entity.Validation;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Web.Mvc;
|
|
||||||
using Infrastructure;
|
using Infrastructure;
|
||||||
using OpenAuth.App;
|
using OpenAuth.App;
|
||||||
using OpenAuth.App.ViewModel;
|
|
||||||
using OpenAuth.Domain;
|
using OpenAuth.Domain;
|
||||||
using OpenAuth.Mvc.Models;
|
using OpenAuth.Mvc.Models;
|
||||||
|
using System;
|
||||||
|
using System.Data.Entity.Validation;
|
||||||
|
using System.Web.Mvc;
|
||||||
|
|
||||||
namespace OpenAuth.Mvc.Controllers
|
namespace OpenAuth.Mvc.Controllers
|
||||||
{
|
{
|
||||||
@ -76,107 +73,23 @@ namespace OpenAuth.Mvc.Controllers
|
|||||||
return JsonHelper.Instance.Serialize(_bjuiResponse);
|
return JsonHelper.Instance.Serialize(_bjuiResponse);
|
||||||
}
|
}
|
||||||
|
|
||||||
#region 为角色分配菜单
|
/// <summary>
|
||||||
|
/// 分配模块菜单(按钮)界面
|
||||||
public ActionResult AssignForRole(int roleId)
|
/// <para>可以为用户/角色分配,同过key(UserElement/RoleElement)区分</para>
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="firstId">The first identifier.</param>
|
||||||
|
/// <param name="key">The key.</param>
|
||||||
|
/// <returns>ActionResult.</returns>
|
||||||
|
public ActionResult AssignModuleElement(int firstId, string key)
|
||||||
{
|
{
|
||||||
ViewBag.RoleId = roleId;
|
ViewBag.FirstId = firstId;
|
||||||
|
ViewBag.ModuleType = key;
|
||||||
return View();
|
return View();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
public string LoadWithAccess(int tId, int firstId, string key)
|
||||||
/// 为角色分配菜单
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="roleId">角色ID</param>
|
|
||||||
/// <param name="moduleId">模块ID</param>
|
|
||||||
/// <param name="menuIds">菜单ID列表</param>
|
|
||||||
/// <returns></returns>
|
|
||||||
[HttpPost]
|
|
||||||
public string AssignForRole(int roleId, string menuIds)
|
|
||||||
{
|
{
|
||||||
try
|
return JsonHelper.Instance.Serialize(_app.LoadWithAccess(key, firstId, tId));
|
||||||
{
|
|
||||||
var ids = JsonHelper.Instance.Deserialize<int[]>(menuIds);
|
|
||||||
_app.AssignForRole(roleId, ids);
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
_bjuiResponse.statusCode = "300";
|
|
||||||
_bjuiResponse.message = e.Message;
|
|
||||||
}
|
|
||||||
return JsonHelper.Instance.Serialize(_bjuiResponse);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpPost]
|
|
||||||
public string CancelForRole(int roleId, string menuIds)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var ids = JsonHelper.Instance.Deserialize<int[]>(menuIds);
|
|
||||||
_app.CancelForRole(roleId, ids);
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
_bjuiResponse.statusCode = "300";
|
|
||||||
_bjuiResponse.message = e.Message;
|
|
||||||
}
|
|
||||||
return JsonHelper.Instance.Serialize(_bjuiResponse);
|
|
||||||
}
|
|
||||||
|
|
||||||
public string LoadForRole(int roleId, int moduleId)
|
|
||||||
{
|
|
||||||
return JsonHelper.Instance.Serialize(_app.LoadWithAccess("RoleElement", roleId, moduleId));
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region 为用户分配菜单
|
|
||||||
|
|
||||||
public ActionResult AssignForUser(int userId)
|
|
||||||
{
|
|
||||||
ViewBag.UserId = userId;
|
|
||||||
return View();
|
|
||||||
}
|
|
||||||
/// <summary>
|
|
||||||
/// 为用户分配菜单
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="userId">用户ID</param>
|
|
||||||
/// <param name="menuIds">菜单ID列表</param>
|
|
||||||
/// <returns></returns>
|
|
||||||
[HttpPost]
|
|
||||||
public string AssignForUser(int userId, string menuIds)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var ids = JsonHelper.Instance.Deserialize<int[]>(menuIds);
|
|
||||||
_app.AssignForUser(userId, ids);
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
_bjuiResponse.statusCode = "300";
|
|
||||||
_bjuiResponse.message = e.Message;
|
|
||||||
}
|
|
||||||
return JsonHelper.Instance.Serialize(_bjuiResponse);
|
|
||||||
}
|
|
||||||
[HttpPost]
|
|
||||||
public string CancelForUser(int userId, string menuIds)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var ids = JsonHelper.Instance.Deserialize<int[]>(menuIds);
|
|
||||||
_app.CancelForUser(userId, ids);
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
_bjuiResponse.statusCode = "300";
|
|
||||||
_bjuiResponse.message = e.Message;
|
|
||||||
}
|
|
||||||
return JsonHelper.Instance.Serialize(_bjuiResponse);
|
|
||||||
}
|
|
||||||
|
|
||||||
public string LoadForUser(int userId, int moduleId)
|
|
||||||
{
|
|
||||||
return JsonHelper.Instance.Serialize(_app.LoadWithAccess("UserElement", userId, moduleId));
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -78,6 +78,29 @@ namespace OpenAuth.Mvc.Controllers
|
|||||||
return JsonHelper.Instance.Serialize(orgs);
|
return JsonHelper.Instance.Serialize(orgs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 分配菜单页面的树
|
||||||
|
/// <para>todo:key要用UserElement/RoleElement,会造成迷惑,后期优化</para>
|
||||||
|
/// </summary>
|
||||||
|
public string LoadTree(int firstId, string key)
|
||||||
|
{
|
||||||
|
var orgs = _app.LoadTree(firstId, key);
|
||||||
|
//添加根节点
|
||||||
|
orgs.Add(new Module
|
||||||
|
{
|
||||||
|
Id = 0,
|
||||||
|
ParentId = -1,
|
||||||
|
Name = "已拥有的模块",
|
||||||
|
CascadeId = "0"
|
||||||
|
});
|
||||||
|
return JsonHelper.Instance.Serialize(orgs);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 加载用户模块
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="userId">The user identifier.</param>
|
||||||
|
/// <returns>System.String.</returns>
|
||||||
public string LoadForUser(int userId)
|
public string LoadForUser(int userId)
|
||||||
{
|
{
|
||||||
var orgs = _app.LoadForUser(userId);
|
var orgs = _app.LoadForUser(userId);
|
||||||
@ -92,6 +115,11 @@ namespace OpenAuth.Mvc.Controllers
|
|||||||
return JsonHelper.Instance.Serialize(orgs);
|
return JsonHelper.Instance.Serialize(orgs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 加载角色模块
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="roleId">The role identifier.</param>
|
||||||
|
/// <returns>System.String.</returns>
|
||||||
public string LoadForRole(int roleId)
|
public string LoadForRole(int roleId)
|
||||||
{
|
{
|
||||||
var orgs = _app.LoadForRole(roleId);
|
var orgs = _app.LoadForRole(roleId);
|
||||||
|
@ -151,6 +151,7 @@
|
|||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Content Include="BllScripts\assignModuleElement.js" />
|
||||||
<Content Include="BllScripts\categoryManager.js" />
|
<Content Include="BllScripts\categoryManager.js" />
|
||||||
<Content Include="BllScripts\grid.js" />
|
<Content Include="BllScripts\grid.js" />
|
||||||
<Content Include="BllScripts\moduleElementMan.js" />
|
<Content Include="BllScripts\moduleElementMan.js" />
|
||||||
@ -160,8 +161,6 @@
|
|||||||
<Content Include="BllScripts\roleManager.js" />
|
<Content Include="BllScripts\roleManager.js" />
|
||||||
<Content Include="BllScripts\stockManager.js" />
|
<Content Include="BllScripts\stockManager.js" />
|
||||||
<Content Include="BllScripts\usermanager.js" />
|
<Content Include="BllScripts\usermanager.js" />
|
||||||
<Content Include="BllScripts\roleModuleElement.js" />
|
|
||||||
<Content Include="BllScripts\userModuleElement.js" />
|
|
||||||
<Content Include="BllScripts\assignRes.js" />
|
<Content Include="BllScripts\assignRes.js" />
|
||||||
<Content Include="BllScripts\userRoleManager.js" />
|
<Content Include="BllScripts\userRoleManager.js" />
|
||||||
<Content Include="Content\BJUI\images\captcha.jpeg" />
|
<Content Include="Content\BJUI\images\captcha.jpeg" />
|
||||||
@ -674,9 +673,8 @@
|
|||||||
<Content Include="Views\ModuleManager\LookupMultiForUser.cshtml" />
|
<Content Include="Views\ModuleManager\LookupMultiForUser.cshtml" />
|
||||||
<Content Include="Views\ModuleManager\LookupMultiForRole.cshtml" />
|
<Content Include="Views\ModuleManager\LookupMultiForRole.cshtml" />
|
||||||
<None Include="Views\Home\MenuHeader.cshtml" />
|
<None Include="Views\Home\MenuHeader.cshtml" />
|
||||||
<Content Include="Views\ModuleElementManager\AssignForUser.cshtml" />
|
|
||||||
<None Include="Views\ModuleElementManager\Index.cshtml" />
|
<None Include="Views\ModuleElementManager\Index.cshtml" />
|
||||||
<Content Include="Views\ModuleElementManager\AssignForRole.cshtml" />
|
<Content Include="Views\ModuleElementManager\AssignModuleElement.cshtml" />
|
||||||
<Content Include="Views\UserManager\Index.cshtml" />
|
<Content Include="Views\UserManager\Index.cshtml" />
|
||||||
<Content Include="Views\RoleManager\Index.cshtml" />
|
<Content Include="Views\RoleManager\Index.cshtml" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
@ -1,30 +0,0 @@
|
|||||||
<div class="bjui-pageHeader">
|
|
||||||
<div class="bjui-searchBar">
|
|
||||||
<input style="display: none" id="userId" value="@ViewBag.UserId" />
|
|
||||||
<div class="pull-right">
|
|
||||||
<div class="alert alert-info search-inline">
|
|
||||||
<i class="fa fa-info-circle"></i> 点击行为单选,点击复选框可多选统一授权
|
|
||||||
</div>
|
|
||||||
<button type="button" class="btn btn-green" data-num="1" data-icon="plus" id="btnAccess">
|
|
||||||
授权选中
|
|
||||||
</button>
|
|
||||||
<button type="button" class="btn btn-danger" data-num="1" data-icon="trash" id="btnDelAccess">
|
|
||||||
取消授权
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="bjui-pageContent tableContent">
|
|
||||||
<div class="clearfix">
|
|
||||||
<div style="float: left; width: 220px; overflow: auto;" class="table table-bordered">
|
|
||||||
<ul id="tree" class="ztree"></ul>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div style="margin-left: 225px;">
|
|
||||||
<table id="maingrid" class="table table-bordered table-hover table-striped table-top"></table>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<script src="~/BllScripts/grid.js"></script>
|
|
||||||
<script src="~/BllScripts/userModuleElement.js"></script>
|
|
@ -1,30 +1,31 @@
|
|||||||
<div class="bjui-pageHeader">
|
<div class="bjui-pageHeader">
|
||||||
<div class="bjui-searchBar">
|
<div class="bjui-searchBar">
|
||||||
<input style="display: none" id="roleId" value="@ViewBag.RoleId" />
|
<input style="display: none" id="firstId" value="@ViewBag.FirstId" />
|
||||||
<div class="pull-right">
|
<input style="display: none" id="moduleType" , value="@ViewBag.ModuleType" />
|
||||||
<div class="alert alert-info search-inline">
|
<div class="pull-right">
|
||||||
<i class="fa fa-info-circle"></i> 点击行为单选,点击复选框可多选统一授权
|
<div class="alert alert-info search-inline">
|
||||||
</div>
|
<i class="fa fa-info-circle"></i> 点击行为单选,点击复选框可多选统一授权
|
||||||
<button type="button" class="btn btn-green" data-num="1" data-icon="plus" id="btnAccess">
|
</div>
|
||||||
授权选中
|
<button type="button" class="btn btn-green" data-num="1" data-icon="plus" id="btnAccess">
|
||||||
</button>
|
授权选中
|
||||||
<button type="button" class="btn btn-danger" data-num="1" data-icon="trash" id="btnDelAccess">
|
</button>
|
||||||
取消授权
|
<button type="button" class="btn btn-danger" data-num="1" data-icon="trash" id="btnDelAccess">
|
||||||
</button>
|
取消授权
|
||||||
</div>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
<div class="bjui-pageContent tableContent">
|
|
||||||
<div class="clearfix">
|
<div class="bjui-pageContent tableContent">
|
||||||
<div style="float: left; width: 220px; overflow: auto;" class="table table-bordered">
|
<div class="clearfix">
|
||||||
<ul id="tree" class="ztree"></ul>
|
<div style="float: left; width: 220px; overflow: auto;" class="table table-bordered">
|
||||||
</div>
|
<ul id="tree" class="ztree"></ul>
|
||||||
|
</div>
|
||||||
<div style="margin-left: 225px;">
|
|
||||||
<table id="maingrid" class="table table-bordered table-hover table-striped table-top"></table>
|
<div style="margin-left: 225px;">
|
||||||
</div>
|
<table id="maingrid" class="table table-bordered table-hover table-striped table-top"></table>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<script src="~/BllScripts/grid.js"></script>
|
</div>
|
||||||
<script src="~/BllScripts/roleModuleElement.js"></script>
|
<script src="~/BllScripts/grid.js"></script>
|
||||||
|
<script src="~/BllScripts/assignModuleElement.js"></script>
|
Loading…
Reference in New Issue
Block a user