修复BUG:角色页面指定菜单时,已经授权的没有打勾
This commit is contained in:
parent
06bd77308d
commit
b1ecea9999
|
@ -244,8 +244,9 @@
|
|||
function success(result) {
|
||||
if ($.isFunction(data.callback)) {
|
||||
if ($.isArray(result)) {
|
||||
var html = data.html(result);
|
||||
data.callback(html);
|
||||
var formatData = result;
|
||||
if ($.isFunction(data.html)) formatData = data.html(result);
|
||||
data.callback(formatData);
|
||||
$('div.checkbox label.tooltips').tooltip();
|
||||
return;
|
||||
}
|
||||
|
@ -335,15 +336,10 @@
|
|||
//Menus
|
||||
Menu = {
|
||||
url: '../api/Menus/',
|
||||
title: "授权菜单",
|
||||
html: function (result) {
|
||||
return $.map(result, function (element, index) {
|
||||
return $.format(htmlTemplateForMenu, element.ID, element.Name, element.Active);
|
||||
}).join('');
|
||||
}
|
||||
title: "授权菜单"
|
||||
}
|
||||
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) {
|
||||
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-content .modal-header .modal-title").text($.format('{0}-菜单授权窗口', row.RoleName));
|
||||
$('.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');
|
||||
$('.menu-content').show();
|
||||
$('div.dd3-content :radio').hide();
|
||||
|
|
|
@ -166,7 +166,7 @@ namespace Bootstrap.DataAccess
|
|||
List<Menu> Menus = new List<Menu>();
|
||||
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))
|
||||
{
|
||||
cmd.Parameters.Add(DBAccessManager.SqlDBAccess.CreateParameter("@RoleID", roleId, ParameterDirection.Input));
|
||||
|
@ -176,14 +176,7 @@ namespace Bootstrap.DataAccess
|
|||
{
|
||||
Menus.Add(new Menu()
|
||||
{
|
||||
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"
|
||||
ID = (int)reader[0]
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue