var gridObj;
var pagingObj;
$(function () {
gridObj = $.fn.bsgrid.init('searchTable', {
url: prjContextPath+"/permissionsAction!query.action",
pageSizeSelect: true,
stripeRows: true,
pageSize: thisPageSize,//当前页显示行数
otherParames:{"perPage":thisPageSize,"position":0,"deptid":0},//
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 operate(record, rowIndex, colIndex, options) {
return ''+"
"+''
+' '+"
"+''
+' '+"
"+'';
}
var user_win_handle;
//功能区修改按钮
function data_update(userid,id,loginname){
//根据登陆账号是否为空判断
if(loginname=="undefined"||loginname==null||loginname=="")
{
//增加页面
var url = prjContextPath+"/system/permissions/lygbUser_add.jsp?userid="+userid;
user_win_handle = openWindow(url,450,200,'用户管理增加页面',this.window);
}else {
//修改页面
var url = prjContextPath+"/system/permissions/lygbUser_update.jsp?id="+id;
user_win_handle = openWindow(url,450,200,'用户管理修改页面',this.window);
}
}
//功能区-修改按钮
function data_delete(dataid){
if(dataid==""){
user_win_handle=openSecondMessageWindow('您选择的数据尚未创建账号,请先创建账号!',prjContextPath);
return false;
}
parent._confirm_msg_show( '是否要删除此信息?' , this.window.name+'.deleteCarManagerCall(1,'+dataid+')');
}
//删除操作,用户做选择后回调函数
function deleteCarManagerCall(btn,dataid){
//如果点击确定
if(btn == '1')
{
$.post(prjContextPath+"/permissionsAction!delete.action",{id:dataid},callBackFunFileDel);
}else{
gridObj.refreshPage();//刷新当前页
}
}
function callBackFunFileDel(json){
if(json.success==1){
user_win_handle=openSecondMessageWindow('删除成功!',prjContextPath);
// close_handle(1);
}else if(json.success==0){
user_win_handle=openSecondMessageWindow('删除失败,请查看此账户是否已被分配角色!',prjContextPath);
}
}
//增加按钮调用方法
function add_data(){
//暂时失效
}
//编辑单条数据
function updateNewRow(userid,id,loginname){
if(loginname=="undefined"||loginname==null||loginname=="")
{
user_win_handle=openSecondMessageWindow('您选择的数据尚未创建账号,请先创建账号!',prjContextPath);
return false;
}else {
var url=prjContextPath+'/system/permissions/userRoleRange.jsp?id='+id+'&userid='+userid;
user_win_handle = openWindow(url,420,340,'用户分配角色页面',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(user_win_handle!=null||user_win_handle=="undefined"){
user_win_handle.reset();
}
}
//关闭消息框
function closeSysMes(){
if(user_win_handle!=null){
user_win_handle.reset();
}
close_handle(1);
}
//弹出窗口关闭
function closeWindow(){
gridObj.firstPage();
if(user_win_handle!=null){
parent.win_handle();
}
}