From 28dc7fc1a014617c6db614a8801c91e97290cd08 Mon Sep 17 00:00:00 2001 From: hdw <496960745@qq.com> Date: 星期二, 04 十二月 2018 09:03:24 +0800 Subject: [PATCH] 添加分页信息对象 用于计算分页数据 --- gx_tieta/WebRoot/pages/js/mylayui.js | 56 +++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 55 insertions(+), 1 deletions(-) diff --git a/gx_tieta/WebRoot/pages/js/mylayui.js b/gx_tieta/WebRoot/pages/js/mylayui.js index 5aa35d8..b760837 100644 --- a/gx_tieta/WebRoot/pages/js/mylayui.js +++ b/gx_tieta/WebRoot/pages/js/mylayui.js @@ -58,4 +58,58 @@ RegExp.$1.length==1? o[k] : ("00"+ o[k]).substr((""+ o[k]).length)); return format; -}; \ No newline at end of file +}; + +// 椤甸潰涓垎椤典俊鎭璞� +var TblPage = function() { + this.size = 10; + this.curr = 1; + this.all = 0; + this.num = 1; +}; + +// 鍒濆鍖栧垎椤典俊鎭璞� +TblPage.prototype.init = function() { + this.size = 10; + this.curr = 1; + this.all = 0; + this._setNum(); +}; + +// 璁剧疆鍒嗛〉淇℃伅瀵硅薄 +TblPage.prototype.set = function(curr, all, size) { + this.size = size; + this.curr = curr; + this.all = all; + this._setNum(); +}; +TblPage.prototype.getPage = function() { + var temp = { + pageSize: this.size + ,pageCurr: this.curr + ,pageAll: this.all + }; + + return temp; +}; +// 璁剧疆鍒嗛〉淇℃伅鐨勫綋鍓嶉〉 +TblPage.prototype.setCurr = function(curr) { + this.curr = curr; +}; + +//璁剧疆鍒嗛〉淇℃伅鐨勬瘡椤垫樉绀虹殑鏉℃暟 +TblPage.prototype.setSize = function(size) { + this.size = size; + this._setNum(); +}; + +//璁剧疆鍒嗛〉淇℃伅鐨勬�绘潯鏁� +TblPage.prototype.setAll = function(all) { + this.all = all; + this._setNum(); +}; + +// 璁剧疆鍏辨湁澶氬皯椤� +TblPage.prototype._setNum = function() { + this.num = Math.ceil(this.all/this.size); +} \ No newline at end of file -- Gitblit v1.9.1