var gridObj;
var gridObj1;
var pagingObj;
$(function () {
$("#condition_div1").hide();
$("#condition_div").show();
gridObj = $.fn.bsgrid.init('searchTable', {
url: prjContextPath+"/xxbsAction!querySy.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 '';
}
//渲染字典项-栏目名称
function render_lmname(record, rowIndex, colIndex, options){
return ''+gridObj.getRecordIndexValue(record, 'xxbs_lmname') +'';
}
function lmname(xxbs_lmid){
$("#sTable_pt_outTab").hide();
$("#condition_div").hide();
$("#condition_div1").show();
gridObj1 =$.fn.bsgrid.init('sTable' , {
url: prjContextPath+"/xxbsAction!query.action",
pageSizeSelect: true,
stripeRows: true,
pageSize: thisPageSize,//当前页显示行数
otherParames:{"perPage":thisPageSize,"xxbs_lmid":xxbs_lmid},
pageSizeSelect:false,
displayBlankRows: false,// single grid setting
displayPagingToolbarOnlyMultiPages: false // single grid setting
});
}
function show_mess_clo(){
if(winhandle!=null){
winhandle.reset();
}
}
var winHandle;
/*获取勾选的checkbox值*/
function getCheckedIds() {
var records = getCheckedRecords();
var ids = '';
for(var i = 0; i < records.length; i++) {
ids += ',' + gridObj.getRecordIndexValue(records[i], '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(){
}
var person_win_handle;
//临时跳转到信息审核页面 按钮调用方法
//点击菜单提交
function jump_xxsh(){
/*var url = prjContextPath+"/system/person/lygbperson_query.jsp?zuzhijigouid="+jigouid;
person_win_handle = openWindow(url,450,200,'信息报送查看页面',this.window); */
parent.sumbitMen('/lyxxbs/xxsh/xxsh.jsp');
}
function neirong(xxbs_id,xxbs_zt){
// alert(xxbs_id);
// alert(xxbs_zt);
// if(){
//
// }
//parent.sumbitMen('/lyxxbs/xxbs/xxbs_neirong.jsp?xxbs_id='+xxbs_id+'&xxbs_zt='+xxbs_zt);
var url = prjContextPath+'/lyxxbs/xxbs/xxbs_neirong.jsp?xxbs_id='+xxbs_id+'&xxbs_zt='+xxbs_zt;
person_win_handle = openWindow(url,1200,380,'信息报送内容编辑页面',this.window);
}
//查看按钮调用方法
function data_query(jigouid){
var url = prjContextPath+"/system/person/lygbperson_query.jsp?zuzhijigouid="+jigouid;
person_win_handle = openWindow(url,450,200,'信息报送查看页面',this.window);
}
//上报按钮调用方法
function sb_data(dataid){
var data_id=gridObj.getRecordIndexValue(gridObj.getRowRecord(gridObj.getSelectedRow()), "xxbs_id");
var xxbs_zt=gridObj.getRecordIndexValue(gridObj.getRowRecord(gridObj.getSelectedRow()), "xxbs_zt");
if(data_id==""||data_id==null){
winHandle=openSecondMessageWindow('请选择一条数据!',prjContextPath);
return;
}
if(xxbs_zt!="0"){
winHandle=openSecondMessageWindow('只能上报“新建”状态的数据!',prjContextPath);
return;
}
$.post(prjContextPath+"/xxbsAction!shangbao.action",{xxbs_zt:"1",xxbs_id:data_id},function(json){
if(json.success==1){
winHandle=openSecondMessageWindow('上报成功!',prjContextPath);
if(gridObj.options.curPageRowsNum==1){
if(gridObj.options.curPage==1){
gridObj.refreshPage();
}else{
gridObj.prevPage();
}
}else{
gridObj.refreshPage();
}
}else{
winHandle=openSecondMessageWindow('操作失败,请联系管理员!',prjContextPath);
}
});
}
//修改按钮调用方法
function upd_data(dataid){
var data_id=gridObj.getRecordIndexValue(gridObj.getRowRecord(gridObj.getSelectedRow()), "xxbs_id");
if(data_id==""||data_id==null){
winHandle=openSecondMessageWindow('请选择一条数据!',prjContextPath);
return;
}
var xxbs_zt=gridObj.getRecordIndexValue(gridObj.getRowRecord(gridObj.getSelectedRow()), "xxbs_zt");
if(xxbs_zt!="0"){
winHandle=openSecondMessageWindow('只能上报“新建”状态的数据!',prjContextPath);
return;
}
var url = prjContextPath+"/lyxxbs/xxbs/xxbs_upd.jsp?data_id="+data_id;
person_win_handle = openWindow(url,750,380,'信息报送修改页面',this.window);
}
//查看按钮调用方法
function sel_data(dataid){
var data_id=gridObj.getRecordIndexValue(gridObj.getRowRecord(gridObj.getSelectedRow()), "xxbs_id");
if(data_id==""||data_id==null){
winHandle=openSecondMessageWindow('请选择一条数据!',prjContextPath);
return;
}else{
var url = prjContextPath+"/lyxxbs/xxbs/xxbs_sel.jsp?data_id="+data_id;
person_win_handle = openWindow(url,750,380,'信息报送查看页面',this.window);
}
}
//增加按钮调用方法
function add_data(){
var zuzhijigouid=tree.getSelectedItemId();//获取数据库中主键
if(!checkIsNotEmpty(zuzhijigouid)){
winHandle=openSecondMessageWindow('请选择左侧的栏目!',prjContextPath);
return false;
}
var url = prjContextPath+"/lyxxbs/xxbs/xxbs_add.jsp?lmid="+zuzhijigouid;
person_win_handle = openWindow(url,750,380,'信息报送增加页面',this.window);
}
function del_data(dataid){
var data_id=gridObj.getRecordIndexValue(gridObj.getRowRecord(gridObj.getSelectedRow()), 'xxbs_id');
var data_zt=gridObj.getRecordIndexValue(gridObj.getRowRecord(gridObj.getSelectedRow()), 'xxbs_zt');
if(data_id==""||data_id==null){
winHandle=openSecondMessageWindow('请选择一条数据!',prjContextPath);
return;
}
if(data_zt!="0"){
winHandle=openSecondMessageWindow('只能删除“新建”状态的数据!',prjContextPath);
return;
}
parent._confirm_msg_show( '是否删除此信息?' , this.window.name+'.deleteCarManagerCall(1,'+data_id+')');
}
//删除操作,用户做选择后回调函数
function deleteCarManagerCall(btn,dataid){
//如果点击确定
if(btn == '1')
{
//删除人员前校验此人员是否被分配用户
$.post(prjContextPath+"/xxbsAction!delete.action",{xxbs_id:dataid},function(json){
if(json.success==1){
winHandle=openSecondMessageWindow('删除成功!',prjContextPath);
if(gridObj.options.curPageRowsNum==1){
if(gridObj.options.curPage==1){
gridObj.refreshPage();
}else{
gridObj.prevPage();
}
}else{
gridObj.refreshPage();
}
}else{
winHandle=openSecondMessageWindow('操作失败,请联系管理员!',prjContextPath);
}
});
}else{
gridObj.refreshPage();//刷新当前页
}
}
function callBackForSelCout(json){
//如果此人员被分配用户,则不允许直接删除
if(json.success>0){
person_win_handle=openSecondMessageWindow('此人员已被分配用户,请先删除被分配的用户!',prjContextPath);
}else{
$.post(prjContextPath+"/employeeAction!delete.action",{id:json.dataid},callBackFunFileDel);
}
}
function callBackFunFileDel(json){
if(json.success==1){
winHandle=openSecondMessageWindow('删除成功!',prjContextPath);
if(gridObj.options.curPageRowsNum==1){
if(gridObj.options.curPage==1){
gridObj.refreshPage();
}else{
gridObj.prevPage();
}
}else{
gridObj.refreshPage();
}
}else{
winHandle=openSecondMessageWindow('删除失败,请联系管理员!',prjContextPath);
}
}
//弹出窗口关闭
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(person_win_handle!=null){
person_win_handle.reset();
}
}
//关闭消息框
function closeSysMes(){
if(winHandle!=null){
winHandle.reset();
}
close_handle(1);
}
//弹出窗口关闭
function closeWindow(){
gridObj.firstPage();
if(person_win_handle!=null){
parent.person_win_handle();
}
}