一、分页
factory('dividePage', function (dir_load) { function init(parameters) { this.method=parameters.method||'post', this.url=parameters.url||'', this.isUseFilterOptions=false,//是否使用过滤条件 this.isShowTableImg = false, this.toServerPageKey=parameters.localPageKey||'pageNo', this.toServerOtherKey=parameters.localOtherKey||{}, this.toLocalKey={ datasKey:parameters.datasKey||'rows', currentPageNumberKey:parameters.currentPageNumberKey||'pageNo', allPagesNumberKey:parameters.allPagesNumberKey||'totalPage', everyPageItemsNumberKey:parameters.everyPageItemsNumberKey||'pageSize', allPagesItemsNumberKey:parameters.allPagesItemsNumberKey||'total', }, this.filterOptions={}, this.toggleShowFilterOptions=function (callback) { this.isUseFilterOptions = false; this.isShowFilterOptions = !this.isShowFilterOptions; if (!this.isShowFilterOptions) { angular.isFunction(callback) ? callback() : angular.noop(); } }, this.start_filter= function () { this.isUseFilterOptions = true; that.reload(1); }; this.emptyFilterOptions=function (){ var that = this; angular.forEach(that.filterOptions, function (value, key) { that.filterOptions[key] = ''; }); this.reload(1); }, this.loadingImg=function(imgType){ var that = this; var whichImg={}; function tableImg(boolen) { that.isShowTableImg = boolen;//<dir-tableload show="pagin_init.isShowTableImg"></dir-tableload> }; function overAllImg(boolen) { dir_load.show = boolen;//在全局页面上加上<dir-load></dir-load> }; if (imgType === 'tableImg') { whichImg.TableImg = TableImg; } if (imgType === 'overAllImg') { whichImg.overAllImg = overAllImg; } return whichImg; } }; return { init: init }; });