/** * @author: xgc-whj * @date: 2018-02-05 * @version: v1.6 * @description: 请务必保留作者、日期及版本号 */ (function(a){$.fn.extend({whjPaging:function(b,j,c){var g=$(this);if(b==="getPage"){return[g.get(0).pageText.currPage,g.get(0).pageText.totalPage,g.get(0).pageText.pageSize]}else{if(b==="setPage"){g.get(0).pageText.currPage=j;g.get(0).pageText.totalPage=c;if(g.get(0).pageText.pageSize!=null){g.get(0).pageText.totalSize=c*g.get(0).pageText.pageSize}}else{if(g.get(0).pageText==null){var m=[{value:5,text:"5条/页",selected:true},{value:10,text:"10条/页"},{value:15,text:"15条/页"},{value:20,text:"20条/页"}];if(b.pageSizeOpt!=null){m=b.pageSizeOpt}var p=m[0].value;for(var t in m){if(m[t].selected){p=m[t].value;break}}var d="whj_jqueryPaginationCss-1";if(b.css!=null){switch(b.css){case"css-1":d="whj_jqueryPaginationCss-1";break;case"css-2":d="whj_jqueryPaginationCss-2";break;case"css-3":d="whj_jqueryPaginationCss-3";break;case"css-4":d="whj_jqueryPaginationCss-4";break;case"css-5":d="whj_jqueryPaginationCss-5";break;default:d=b.css;break}}g.get(0).pageText={css:d,pageSizeOpt:m,totalPage:b.totalPage,showPageNum:b.showPageNum!=null?b.showPageNum:5,firstPage:b.firstPage!=null?b.firstPage:"首页",previousPage:b.previousPage!=null?b.previousPage:"上一页",nextPage:b.nextPage!=null?b.nextPage:"下一页",lastPage:b.lastPage!=null?b.lastPage:"尾页",skip:b.skip!=null?b.skip:"跳至",confirm:b.confirm!=null?b.confirm:"确认",refresh:b.refresh!=null?b.refresh:"刷新",totalPageText:b.totalPageText!=null?b.totalPageText:"共{}页",isShowFL:b.isShowFL==false?false:true,isShowPageSizeOpt:b.isShowPageSizeOpt==false?false:true,isShowSkip:b.isShowSkip==false?false:true,isShowRefresh:b.isShowRefresh==false?false:true,isShowTotalPage:b.isShowTotalPage==false?false:true,isResetPage:b.isResetPage==true?true:false,callBack:b.callBack,currPage:1,totalSize:p*(b.totalPage!=null?b.totalPage:0),pageSize:(b.isShowPageSizeOpt==false?false:true)?p:null,staticCurrPage:1,staticTotalPage:b.totalPage,staticPageSize:(b.isShowPageSizeOpt==false?false:true)?p:null}}}}if(g.get(0).pageText.totalPage==null||g.get(0).pageText.totalPage<1){g.html("");return}if(g.get(0).pageText.currPage<1){g.get(0).pageText.currPage=1}else{if(g.get(0).pageText.currPage>g.get(0).pageText.totalPage){g.get(0).pageText.currPage=g.get(0).pageText.totalPage}}g.get(0).pageText.staticCurrPage=g.get(0).pageText.currPage;g.get(0).pageText.staticPageSize=g.get(0).pageText.pageSize;g.get(0).pageText.staticTotalPage=g.get(0).pageText.totalPage;var h=g.get(0).pageText.currPage<2?"whj_hoverDisable":"whj_hover";var e=g.get(0).pageText.currPage>=g.get(0).pageText.totalPage?"whj_hoverDisable":"whj_hover";var o=0;var f=0;var u=parseInt(g.get(0).pageText.showPageNum/2);if(g.get(0).pageText.showPageNum<2){f=g.get(0).pageText.currPage}else{if(g.get(0).pageText.totalPage<=parseInt(g.get(0).pageText.showPageNum)){f=1}else{if(g.get(0).pageText.currPage+u>g.get(0).pageText.totalPage){f=g.get(0).pageText.totalPage-g.get(0).pageText.showPageNum+1}else{if(g.get(0).pageText.currPage-u<1){f=1}else{f=g.get(0).pageText.currPage-u}}}}var q='
';if(g.get(0).pageText.isShowFL){q+='
'+g.get(0).pageText.firstPage+"
"}q+='
'+g.get(0).pageText.previousPage+"
";if(g.get(0).pageText.showPageNum>0){for(var l=f;l<=g.get(0).pageText.totalPage;l++){o++;var s=g.get(0).pageText.currPage==l?"whj_checked":"whj_hover";q+='
'+l+"
";if(o>=g.get(0).pageText.showPageNum){break}}}q+='
'+g.get(0).pageText.nextPage+"
";if(g.get(0).pageText.isShowFL){q+='
'+g.get(0).pageText.lastPage+"
"}if(g.get(0).pageText.isShowPageSizeOpt){q+='"}if(g.get(0).pageText.isShowSkip){q+='
'+g.get(0).pageText.skip+'
'+g.get(0).pageText.confirm+"
"}if(g.get(0).pageText.isShowRefresh){q+='
'+g.get(0).pageText.refresh+"
"}if(g.get(0).pageText.isShowTotalPage){var n=g.get(0).pageText.totalPageText.replace("{}",g.get(0).pageText.totalPage);q+='
'+n+"
"}q+="
";g.html(q);if(g.get(0).pageText.isShowFL){if(h=="whj_hover"){g.find("div[name='whj_firstPage']").click(function(){if(g.get(0).pageText.isResetPage){g.get(0).pageText.pageSize=g.get(0).pageText.staticPageSize}g.get(0).pageText.currPage=1;r()})}if(e=="whj_hover"){g.find("div[name='whj_lastPage']").click(function(){if(g.get(0).pageText.isResetPage){g.get(0).pageText.pageSize=g.get(0).pageText.staticPageSize;g.get(0).pageText.currPage=g.get(0).pageText.staticTotalPage}else{g.get(0).pageText.currPage=g.get(0).pageText.totalPage}r()})}}if(h=="whj_hover"){g.find("div[name='whj_previousPage']").click(function(){if(g.get(0).pageText.isResetPage){g.get(0).pageText.pageSize=g.get(0).pageText.staticPageSize;g.get(0).pageText.currPage=g.get(0).pageText.staticCurrPage-1}else{g.get(0).pageText.currPage=g.get(0).pageText.currPage-1}r()})}if(e=="whj_hover"){g.find("div[name='whj_nextPage']").click(function(){if(g.get(0).pageText.isResetPage){g.get(0).pageText.pageSize=g.get(0).pageText.staticPageSize;g.get(0).pageText.currPage=g.get(0).pageText.staticCurrPage+1}else{g.get(0).pageText.currPage=g.get(0).pageText.currPage+1}r()})}if(g.find("div[name='whj_page']").length>0){g.find("div[name='whj_page']").click(function(){if(!$(this).hasClass("whj_checked")){if(g.get(0).pageText.isResetPage){g.get(0).pageText.pageSize=g.get(0).pageText.staticPageSize}g.get(0).pageText.currPage=+$(this).data("page");r()}})}if(g.get(0).pageText.isShowPageSizeOpt){g.find("select[name='whj_pageSize']").change(function(){var x=+$(this).val();if(g.get(0).pageText.isResetPage){$(this).find("option[value='"+g.get(0).pageText.staticPageSize+"']").prop("selected",true)}var y=parseInt(g.get(0).pageText.totalSize/x);if(y*x0){i=+i;if(i<1){i=1}else{if(i>g.get(0).pageText.totalPage){i=g.get(0).pageText.totalPage}}if(g.get(0).pageText.isResetPage){g.get(0).pageText.pageSize=g.get(0).pageText.staticPageSize}g.get(0).pageText.currPage=i;r()}})}if(g.get(0).pageText.isShowRefresh){g.find("div[name='whj_refresh']").click(function(){if(g.get(0).pageText.isResetPage){g.get(0).pageText.pageSize=g.get(0).pageText.staticPageSize;g.get(0).pageText.currPage=g.get(0).pageText.staticCurrPage}r()})}function r(){if(!g.get(0).pageText.isResetPage){g.whjPaging()}g.get(0).pageText.callBack(g.get(0).pageText.currPage,g.get(0).pageText.pageSize)}}})})(window);