修复BUG:角色页面指定菜单时,已经授权的没有打勾
This commit is contained in:
parent
06bd77308d
commit
b1ecea9999
|
@ -244,8 +244,9 @@
|
||||||
function success(result) {
|
function success(result) {
|
||||||
if ($.isFunction(data.callback)) {
|
if ($.isFunction(data.callback)) {
|
||||||
if ($.isArray(result)) {
|
if ($.isArray(result)) {
|
||||||
var html = data.html(result);
|
var formatData = result;
|
||||||
data.callback(html);
|
if ($.isFunction(data.html)) formatData = data.html(result);
|
||||||
|
data.callback(formatData);
|
||||||
$('div.checkbox label.tooltips').tooltip();
|
$('div.checkbox label.tooltips').tooltip();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -335,15 +336,10 @@
|
||||||
//Menus
|
//Menus
|
||||||
Menu = {
|
Menu = {
|
||||||
url: '../api/Menus/',
|
url: '../api/Menus/',
|
||||||
title: "授权菜单",
|
title: "授权菜单"
|
||||||
html: function (result) {
|
|
||||||
return $.map(result, function (element, index) {
|
|
||||||
return $.format(htmlTemplateForMenu, element.ID, element.Name, element.Active);
|
|
||||||
}).join('');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Menu.getMenusByRoleId = function (roleId, callback) {
|
Menu.getMenusByRoleId = function (roleId, callback) {
|
||||||
processData.call(this, { Id: roleId, callback: callback, remote: false });
|
processData.call(this, { Id: roleId, callback: callback, data: { type: "role" } });
|
||||||
};
|
};
|
||||||
Menu.saveMenusByRoleId = function (roleId, menuIds, callback) {
|
Menu.saveMenusByRoleId = function (roleId, menuIds, callback) {
|
||||||
processData.call(this, { Id: roleId, callback: callback, method: "PUT", data: { type: "role", menuIds: menuIds } });
|
processData.call(this, { Id: roleId, callback: callback, method: "PUT", data: { type: "role", menuIds: menuIds } });
|
||||||
|
|
|
@ -53,6 +53,13 @@
|
||||||
Menu.getMenusByRoleId(row.ID, function (data) {
|
Menu.getMenusByRoleId(row.ID, function (data) {
|
||||||
$(".menu-content .modal-header .modal-title").text($.format('{0}-菜单授权窗口', row.RoleName));
|
$(".menu-content .modal-header .modal-title").text($.format('{0}-菜单授权窗口', row.RoleName));
|
||||||
$('.menu-content button:last').data('type', 'menu');
|
$('.menu-content button:last').data('type', 'menu');
|
||||||
|
// set checkbox status
|
||||||
|
var menus = $('#nestable_menu').find('input:checkbox');
|
||||||
|
menus.removeProp('checked');
|
||||||
|
$.each(data, function (index, item) {
|
||||||
|
var selector = $.format('[value={0}]', item.ID);
|
||||||
|
menus.filter(selector).prop('checked', 'checked');
|
||||||
|
});
|
||||||
$('#dialogMenu').modal('show');
|
$('#dialogMenu').modal('show');
|
||||||
$('.menu-content').show();
|
$('.menu-content').show();
|
||||||
$('div.dd3-content :radio').hide();
|
$('div.dd3-content :radio').hide();
|
||||||
|
|
|
@ -166,7 +166,7 @@ namespace Bootstrap.DataAccess
|
||||||
List<Menu> Menus = new List<Menu>();
|
List<Menu> Menus = new List<Menu>();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
string sql = "select n.ID,n.ParentId, n.Name,n.[Order],n.Icon,n.Url,n.Category, case nr.NavigationID when n.ID then 'active' else '' end [status] from Navigations n left join NavigationRole nr on n.ID = nr.NavigationID and RoleID = @RoleID";
|
string sql = "select NavigationID from NavigationRole where RoleID = @RoleID";
|
||||||
using (DbCommand cmd = DBAccessManager.SqlDBAccess.CreateCommand(CommandType.Text, sql))
|
using (DbCommand cmd = DBAccessManager.SqlDBAccess.CreateCommand(CommandType.Text, sql))
|
||||||
{
|
{
|
||||||
cmd.Parameters.Add(DBAccessManager.SqlDBAccess.CreateParameter("@RoleID", roleId, ParameterDirection.Input));
|
cmd.Parameters.Add(DBAccessManager.SqlDBAccess.CreateParameter("@RoleID", roleId, ParameterDirection.Input));
|
||||||
|
@ -176,14 +176,7 @@ namespace Bootstrap.DataAccess
|
||||||
{
|
{
|
||||||
Menus.Add(new Menu()
|
Menus.Add(new Menu()
|
||||||
{
|
{
|
||||||
ID = (int)reader[0],
|
ID = (int)reader[0]
|
||||||
ParentId = (int)reader[1],
|
|
||||||
Name = (string)reader[2],
|
|
||||||
Order = (int)reader[3],
|
|
||||||
Icon = LgbConvert.ReadValue(reader[4], string.Empty),
|
|
||||||
Url = LgbConvert.ReadValue(reader[5], string.Empty),
|
|
||||||
Category = (string)reader[6],
|
|
||||||
Active = (string)reader[7] == "" ? "" : "checked"
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue