有一个版本权限配置存在bug。分配好按钮权限和数据权限且保存成功后,没有获得正确的权限,再次刷新也没有选中相应选项。
问题原因是扩展JS有问题,更新下面两个表单扩展JS解决问题。
1、按钮权限表单扩展JS
$("#searchBtnWrap").hide();
$(".wrap_search").hide();
dgOptions.pageSize=1000;
dgOptions.pagination=false;
window.parent.getDgSelections = function() {
return datagrid.datagrid("getSelections");
}
dgOptions.onLoadSuccess = selectAuthRow;
function selectAuthRow() {
var btnIds = window.parent.getCurrMenuBtns();
var rows = datagrid.datagrid("getData").rows;
if(btnIds && rows.length > 0) {
$.each(rows, function(i, item) {
$.each(btnIds, function(j, btnId) {
if(item.id == btnId) {
datagrid.datagrid("selectRow", i);
}
});
});
}
//如果无数据,则显示一键生成
if(rows.length == 0) {
genAuthBtnBatch();
}
}
//显示一键生成
function genAuthBtnBatch() {
$("<button id='genAuthBtnBatchBtn' style='position: fixed; top: 120px; left: 50%; margin-left: -30px; padding: 2px;'>一键生成<button>")
.linkbutton().click(function() {
$.post("../../role/genAuthBtnBatch", {menuId: $("#menu_id").val()}, function() {
$("#genAuthBtnBatchBtn").remove();
showMsg("生成成功!");
datagrid.datagrid("reload");
});
}).appendTo("body");
}
$("#searchBtnWrap").hide();
$(".wrap_search").hide();
dgOptions.pageSize=1000;
dgOptions.pagination=false;
window.parent.getDgSelections2 = function() {
return datagrid.datagrid("getSelections");
}
dgOptions.onLoadSuccess = selectAuthRow;
function selectAuthRow() {
var dataruleIds = window.parent.getCurrMenuDatarules();
var rows = datagrid.datagrid("getData").rows;
if(dataruleIds && rows.length > 0) {
$.each(rows, function(i, item) {
$.each(dataruleIds, function(j, dataruleId) {
if(item.id == dataruleId) {
datagrid.datagrid("selectRow", i);
}
});
});
}
}