var gridObj;
var pagingObj;
$(function () {
gridObj = $.fn.bsgrid.init('searchTable', {
url: prjContextPath+"/roleAction!query.action",
pageSizeSelect: true,
stripeRows: true,
pageSize: thisPageSize,//当前页显示行数
otherParames:{"perPage":thisPageSize},//
pageSizeSelect:false,
displayBlankRows: false, // single grid setting
displayPagingToolbarOnlyMultiPages: true, // single grid setting
complete:set_pageCon_end() //执行完成后回调函数
});
// 表格的checkbox选择
if($('#searchTable thead tr th:eq(0) input[type=checkbox]').length == 1) {
$('#searchTable thead tr th:eq(0) input[type=checkbox]').change(function () {
var checked = $.bsgrid.adaptAttrOrProp($(this), 'checked') ? true : false;
$.bsgrid.adaptAttrOrProp($('#searchTable tbody tr td:nth-child(1)>input[type=checkbox]'), 'checked', checked);
});
}
});
function checkbox(record, rowIndex, colIndex, options) {
return '';
}
/*获取勾选的checkbox值*/
function getCheckedIds() {
var records = getCheckedRecords();
var ids = '';
for(var i = 0; i < records.length; i++) {
ids += ',' + gridObj.getRecordIndexValue(records[i], 'WANGGE_ID');
}
alert(ids.length > 0 ? ids.substring(1) : '');
}
/*获取勾选checkbox对象*/
function getCheckedRecords() {
var records = new Array();
$('#searchTable tbody tr').each(function() {
if($(this).find('td:eq(0)>input:checked').length == 1){
records[records.length] = gridObj.getRowRecord($(this));
}
});
return records;
}
/*执行完成后回调函数*/
function set_pageCon_end(){
}
/*获取选中行主键*/
function get_choose_row(){
var chooseRowId=gridObj.getRecordIndexValue(gridObj.getRowRecord(gridObj.getSelectedRow()), 'WANGGE_ID');
alert(chooseRowId);
}
/*功能区按钮*/
function operate(record, rowIndex, colIndex, options) {
return ''+"
"+''
+' '+"
"+'';
}
function my_test(){
var url = prjContextPath+"/jCaseAction!exe_pro.action";
$.post(url, null, null);
}
var win_handle;
//增加按钮
function role_add(){
var url = prjContextPath+"/system/role/lygbRole_add.jsp";
role_winHandle = openWindow(url,450,200,'角色管理增加页面',this.window);
}
//功能区-修改按钮
function role_update(roleid){
var url = prjContextPath+"/system/role/lygbRole_update.jsp?roleid="+roleid;
role_winHandle = openWindow(url,450,200,'角色管理修改页面',this.window);
}
//功能区-修改按钮
function role_delete(roleid){
parent._confirm_msg_show( '是否删除此信息?' , this.window.name+'.deleteCarManagerCall(1,'+roleid+')');
}
//删除操作,用户做选择后回调函数
function deleteCarManagerCall(btn,roleid){
//如果点击确定
if(btn == '1')
{
$.post(prjContextPath+"/roleAction!delete.action",{roleid:roleid},callBackFunFileDel);
}else{
gridObj.refreshPage();//刷新当前页
}
}
var role_winHandle
function callBackFunFileDel(json){
if(json.success==1){
role_winHandle=openSecondMessageWindow('删除成功!',prjContextPath);
// close_handle(1);
if(gridObj.options.curPageRowsNum==1){
if(gridObj.options.curPage==1){
gridObj.refreshPage();
}else{
gridObj.prevPage();
}
}else{
gridObj.refreshPage();
}
}else if(json.success==0){
role_winHandle=openSecondMessageWindow('删除失败,请查看此角色是否已被赋予权限!',prjContextPath);
// close_handle(1);
}
}
//权限按钮调用方法
function authority_add(){
var rowid=gridObj.getRecordIndexValue(gridObj.getRowRecord(gridObj.getSelectedRow()), 'roleid');
if(rowid==null||rowid==""){
role_winHandle=openSecondMessageWindow('请选择要维护的数据!',prjContextPath);
}else{
var url = prjContextPath+"/system/role/lygbroleModule.jsp?roleid="+rowid;
role_winHandle = openWindow(url,420,310,'设置角色模块',this.window);
}
}
//关闭窗口
function close_handle(flg){
//flg:0 刷新到首页(增加);flg:1 刷新当前页(修改、删除)
if(flg==0){
if(gridObj.options.curPage!=1)
gridObj.firstPage();
else
gridObj.refreshPage();
}else{
gridObj.refreshPage();
}
if(role_winHandle!=null||win_handle=="undefined"){
role_winHandle.reset();
}
}
//关闭消息框
function closeSysMes(){
if(role_winHandle!=null){
role_winHandle.reset();
}
close_handle(1);
}
//弹出窗口关闭
function closeWindow(){
gridObj.firstPage();
if(role_winHandle!=null){
parent.win_handle();
}
}