123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141 |
- 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 '<input type="checkbox" value="' + gridObj.getColumnValue(rowIndex, gridObj.getColumnAttr(colIndex, options.settings.colsProperties.indexAttr)) + '"/>';
- }
- /*获取勾选的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 '<a href="#" onclick="updateNewRow(\'' + gridObj.getRecordIndexValue(record, 'userid') + '\',\''+gridObj.getRecordIndexValue(record, 'id')+'\',\''+gridObj.getRecordIndexValue(record, 'loginname')+'\');">'+"<img src='../../jqcase/builds/images/icons/system-config-boot.png' alt='权限'>"+'</a>'
- +' <a href="#" onclick="data_update(\'' + gridObj.getRecordIndexValue(record, 'userid') + '\',\''+gridObj.getRecordIndexValue(record, 'id')+'\',\''+gridObj.getRecordIndexValue(record, 'loginname')+'\');">'+"<img src='../../jqcase/builds/images/icons/page-edit.png' alt='编辑'>"+'</a>'
- +' <a href="#" onclick="data_delete(\'' + gridObj.getRecordIndexValue(record, 'id') + '\');">'+"<img src='../../jqcase/builds/images/icons/edit-delete-6.png' alt='删除'>"+'</a>';
- }
- 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();
- }
- }
|