123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165 |
- var gridObj;
- var pagingObj;
- $(function () {
- gridObj = $.fn.bsgrid.init('searchTable', {
- url: prjContextPath+"/employeeAction!query.action",
- pageSizeSelect: true,
- stripeRows: true,
- pageSize: thisPageSize,//当前页显示行数
- otherParames:{"perPage":thisPageSize,"position":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)) + '"/>';
- }
- 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(){
- }
- /*功能区按钮*/
- function operate(record, rowIndex, colIndex, options) {
- return '<a href="#" onclick="data_query(\'' + gridObj.getRecordIndexValue(record, 'id') + '\');">'+"<img src='../../jqcase/builds/images/icons/system-search-6.png' alt='查看'>"+'</a>'
- +' <a href="#" onclick="data_update(\'' + gridObj.getRecordIndexValue(record, 'id') + '\');">'+"<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 person_win_handle;
- //功能区查询按钮
- function data_query(jigouid){
- var url = prjContextPath+"/system/person/lygbperson_query.jsp?zuzhijigouid="+jigouid;
- person_win_handle = openWindow(url,450,200,'人员管理查看页面',this.window);
- }
- //功能区修改按钮
- function data_update(dataid){
- var url = prjContextPath+"/system/person/lygbperson_update.jsp?dataid="+dataid;
- person_win_handle = openWindow(url,450,200,'人员管理修改页面',this.window);
- }
- //增加按钮调用方法
- function add_data(){
- var zuzhijigouid=tree.getSelectedItemId();//获取数据库中主键
- if(!checkIsNotEmpty(zuzhijigouid)){
- winHandle=openSecondMessageWindow('请选择左侧组织机构中节点!',prjContextPath);
- return false;
- }
- // var a=tree.getAllFatItems().split(",");
- var a=tree.getUserData(tree.getSelectedItemId(), tree.getSelectedItemId()).split(",,,");
- var bumenid=a[0];//获取此岗位的部门ID
- var type=tree.getUserData(tree.getSelectedItemId(), tree.getSelectedItemId()).split(",,,");
- //alert(type[9]); //此元素代表当前选中节点的节点类型:科室,教师,学生等。
- //根据userdata中数据取出jigoutype
- if(type[3]!=0){
- //jigoutype为0,表示岗位
- var url = prjContextPath+"/system/person/lygbperson_add.jsp?zuzhijigouid="+zuzhijigouid+"&bumenid="+bumenid;
- person_win_handle = openWindow(url,450,200,'人员管理增加页面',this.window);
- }else{
- person_win_handle=openSecondMessageWindow('请选择岗位!',prjContextPath);
- return;
- }
- }
- function data_delete(dataid){
- parent._confirm_msg_show( '是否删除此信息?' , this.window.name+'.deleteCarManagerCall(1,'+dataid+')');
- }
- //删除操作,用户做选择后回调函数
- function deleteCarManagerCall(btn,dataid){
- var id=dataid;
- //如果点击确定
- if(btn == '1')
- {
- //删除人员前校验此人员是否被分配用户callBackForSelCout
- $.post(prjContextPath+"/employeeAction!selCouFroPer.action",{id:id},function callBackForSelCout(json){
- //如果此人员被分配用户,则不允许直接删除
- if(json.data[0]>0){
- person_win_handle=openSecondMessageWindow('此人员已被分配用户,请先删除被分配的用户!',prjContextPath);
- }else{
- $.post(prjContextPath+"/employeeAction!delete.action",{id:id},callBackFunFileDel);
- }
- });
- }else{
- gridObj.refreshPage();//刷新当前页
- }
- }
- 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();
- }
- }
|