From e22fd0bac62d20d94e58409ea15049c67f6ff1eb Mon Sep 17 00:00:00 2001 From: 81041 <81041@192.168.10.26> Date: 星期四, 13 十二月 2018 10:33:35 +0800 Subject: [PATCH] 修改 --- gx_tieta/WebRoot/pages/js/mylayui.js | 79 +++++++++++++++++++++++++++++++++++++++ 1 files changed, 78 insertions(+), 1 deletions(-) diff --git a/gx_tieta/WebRoot/pages/js/mylayui.js b/gx_tieta/WebRoot/pages/js/mylayui.js index de98aef..b760837 100644 --- a/gx_tieta/WebRoot/pages/js/mylayui.js +++ b/gx_tieta/WebRoot/pages/js/mylayui.js @@ -9,6 +9,7 @@ // 璁剧疆option鐨勬枃鏈�/灞炴�у��/data鍊� option.text(_list.txt); option.val(_list.val); + option.attr('selected', _list.selected); option.data('data', _list.data); Object.keys(_list.attr).forEach(function(key){ var val = _list.attr[key]; @@ -19,7 +20,7 @@ } // 鏋勯�犵敓鎴恠elect鍒楄〃鐨勫璞℃暟缁� -function getLayuiSelect(txt, val, attr, data) { +function getLayuiSelect(txt, val, attr, data, isSelected) { var obj = { val: '', txt: '', @@ -32,7 +33,83 @@ obj.txt = txt; // option鐨勬枃鏈�� obj.attr = attr; // option鐨勮嚜瀹氫箟鐨勫睘鎬� obj.data = data; // option鐨刣ata鍊� + obj.selected = isSelected?true:false; // 杩斿洖鏋勯�犵殑瀵硅薄 return obj; +} + +//鏍煎紡鍖栨椂闂� +Date.prototype.format =function(format) +{ + var o = { + "M+" : this.getMonth()+1, //month + "d+" : this.getDate(), //day + "h+" : this.getHours(), //hour + "m+" : this.getMinutes(), //minute + "s+" : this.getSeconds(), //second + "q+" : Math.floor((this.getMonth()+3)/3), //quarter + "S" : this.getMilliseconds() //millisecond + }; + if(/(y+)/.test(format)) format=format.replace(RegExp.$1, + (this.getFullYear()+"").substr(4- RegExp.$1.length)); + for(var k in o)if(new RegExp("("+ k +")").test(format)) + format = format.replace(RegExp.$1, + RegExp.$1.length==1? o[k] : + ("00"+ o[k]).substr((""+ o[k]).length)); + return format; +}; + +// 椤甸潰涓垎椤典俊鎭璞� +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