From 6d7aa039af7bc7e7c1f4ef3a75b42ee3036f895a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=A3=E5=9C=A3=E5=8D=8E?= <752718920@qq.com> Date: Sun, 5 Nov 2017 21:40:22 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=9A=E8=B4=A6=E6=88=B7=E5=8D=95=E4=B8=AA?= =?UTF-8?q?=E9=87=91=E9=A2=9D=E4=B8=AD=E7=9A=84=E6=95=B0=E5=80=BC=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/webapp/js/common/common.js | 446 ++++++++++--------- src/main/webapp/js/pages/materials/in_out.js | 15 +- 2 files changed, 254 insertions(+), 207 deletions(-) diff --git a/src/main/webapp/js/common/common.js b/src/main/webapp/js/common/common.js index 945e6ee0..18a8d648 100644 --- a/src/main/webapp/js/common/common.js +++ b/src/main/webapp/js/common/common.js @@ -1,227 +1,263 @@ -$(function() -{ - domresize(); -}); -//========================页面高度自动调节================================ -var heightInfo; -var widthInfo; -var initPageSize; -var initPageNum; -var webH; -var webW; -//改变表格宽高 -function domresize() -{ - webH = document.documentElement.clientHeight; - webW = document.documentElement.offsetWidth; - widthInfo = $("body").outerWidth() -27; - var mtopH = $("#searchTable").outerHeight(); - var positionH = $("#position").outerHeight(); - heightInfo = webH - mtopH - 86; - - //分页信息修改成 15条 - if(heightInfo > 450) + $(function() { - initPageSize = 15; - initPageNum = [15,30,50]; - } - else + domresize(); + }); + //========================页面高度自动调节================================ + var heightInfo; + var widthInfo; + var initPageSize; + var initPageNum; + var webH; + var webW; + //改变表格宽高 + function domresize() { - initPageSize = 10; - initPageNum = [10,20,30,50]; + webH = document.documentElement.clientHeight; + webW = document.documentElement.offsetWidth; + widthInfo = $("body").outerWidth() -27; + var mtopH = $("#searchTable").outerHeight(); + var positionH = $("#position").outerHeight(); + heightInfo = webH - mtopH - 86; + + //分页信息修改成 15条 + if(heightInfo > 450) + { + initPageSize = 15; + initPageNum = [15,30,50]; + } + else + { + initPageSize = 10; + initPageNum = [10,20,30,50]; + } } -} -//========================页面高度自动调节================================ + //========================页面高度自动调节================================ -//判断浏览器的类型 -function getOs() -{ - if(navigator.userAgent.indexOf("MSIE")>0) - { - return "MSIE"; - } - else if(isFirefox=navigator.userAgent.indexOf("Firefox")>0) - { - return "Firefox"; - } - else if(isSafari=navigator.userAgent.indexOf("Safari")>0) - { - return "Safari"; - } - else if(isCamino=navigator.userAgent.indexOf("Camino")>0) - { - return "Camino"; - } - else if(isMozilla=navigator.userAgent.indexOf("Gecko/")>0) - { - return "Gecko"; - } -} + //判断浏览器的类型 + function getOs() + { + if(navigator.userAgent.indexOf("MSIE")>0) + { + return "MSIE"; + } + else if(isFirefox=navigator.userAgent.indexOf("Firefox")>0) + { + return "Firefox"; + } + else if(isSafari=navigator.userAgent.indexOf("Safari")>0) + { + return "Safari"; + } + else if(isCamino=navigator.userAgent.indexOf("Camino")>0) + { + return "Camino"; + } + else if(isMozilla=navigator.userAgent.indexOf("Gecko/")>0) + { + return "Gecko"; + } + } -/** - * js生成唯一ID值 32位值随机值 - * @returns 生成的字符串 - */ -function uuid() -{ - var s = []; - var hexDigits = "0123456789abcdef"; - for (var i = 0; i < 36; i++) - s[i] = hexDigits.substr(Math.floor(Math.random() * 0x10), 1); - s[14] = "4"; // bits 12-15 of the time_hi_and_version field to 0010 - s[19] = hexDigits.substr((s[19] & 0x3) | 0x8, 1); // bits 6-7 of the clock_seq_hi_and_reserved to 01 - s[8] = s[13] = s[18] = s[23] = ""; - return s.join(""); -} -/** - * js获取浏览器的地址参数 - * @param name 地址参数 - * @return - */ -function getUrlParam(name) { - var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); //构造一个含有目标参数的正则表达式对象 - var r = window.location.search.substr(1).match(reg); //匹配目标参数 - if (r != null) return unescape(r[2]); return null; //返回参数值 -} + /** + * js生成唯一ID值 32位值随机值 + * @returns 生成的字符串 + */ + function uuid() + { + var s = []; + var hexDigits = "0123456789abcdef"; + for (var i = 0; i < 36; i++) + s[i] = hexDigits.substr(Math.floor(Math.random() * 0x10), 1); + s[14] = "4"; // bits 12-15 of the time_hi_and_version field to 0010 + s[19] = hexDigits.substr((s[19] & 0x3) | 0x8, 1); // bits 6-7 of the clock_seq_hi_and_reserved to 01 + s[8] = s[13] = s[18] = s[23] = ""; + return s.join(""); + } + /** + * js获取浏览器的地址参数 + * @param name 地址参数 + * @return + */ + function getUrlParam(name) { + var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); //构造一个含有目标参数的正则表达式对象 + var r = window.location.search.substr(1).match(reg); //匹配目标参数 + if (r != null) return unescape(r[2]); return null; //返回参数值 + } -/** - * 获取按钮的权限 - */ -function getBtnStr() { - var funId = window.parent.window.funId; //功能id - var btnStrList = window.parent.window.winBtnStrList; //按钮功能列表 JSON字符串 - var btnEnableList =""; //按钮列表 - if(funId && btnStrList) { - btnStrList = JSON.parse(btnStrList); - for(var i=0; i= 1 && month <= 9) { + month = "0" + month; } + if (strDate >= 0 && strDate <= 9) { + strDate = "0" + strDate; + } + if (strHours >= 0 && strHours <= 9) { + strHours = "0" + strHours; + } + if (strMinutes >= 0 && strMinutes <= 9) { + strMinutes = "0" + strMinutes; + } + if (strSeconds >= 0 && strSeconds <= 9) { + strSeconds = "0" + strSeconds; + } + var currentdate = date.getFullYear() + seperator1 + month + seperator1 + strDate + + " " + strHours + seperator2 + strMinutes + + seperator2 + strSeconds; + return currentdate; } - return btnEnableList; -} -/** - * js获取当前时间, 格式“yyyy-MM-dd HH:MM:SS” - */ -function getNowFormatDateTime() { - var date = new Date(); - var seperator1 = "-"; - var seperator2 = ":"; - var month = date.getMonth() + 1; - var strDate = date.getDate(); - var strHours = date.getHours(); - var strMinutes = date.getMinutes(); - var strSeconds = date.getSeconds(); - if (month >= 1 && month <= 9) { - month = "0" + month; + /** + * js获取当前时间, 格式“yyyy-MM” + */ + function getNowFormatMonth() { + var date = new Date(); + var seperator1 = "-"; + var month = date.getMonth() + 1; + if (month >= 1 && month <= 9) { + month = "0" + month; + } + var currentdate = date.getFullYear() + seperator1 + month; + return currentdate; } - if (strDate >= 0 && strDate <= 9) { - strDate = "0" + strDate; - } - if (strHours >= 0 && strHours <= 9) { - strHours = "0" + strHours; - } - if (strMinutes >= 0 && strMinutes <= 9) { - strMinutes = "0" + strMinutes; - } - if (strSeconds >= 0 && strSeconds <= 9) { - strSeconds = "0" + strSeconds; - } - var currentdate = date.getFullYear() + seperator1 + month + seperator1 + strDate - + " " + strHours + seperator2 + strMinutes - + seperator2 + strSeconds; - return currentdate; -} -/** - * js获取当前时间, 格式“yyyy-MM” - */ -function getNowFormatMonth() { - var date = new Date(); - var seperator1 = "-"; - var month = date.getMonth() + 1; - if (month >= 1 && month <= 9) { - month = "0" + month; + /** + * js获取当前时间, 格式“yyyy-MM-dd” + */ + function getNowFormatDate() { + var date = new Date(); + var seperator1 = "-"; + var seperator2 = ":"; + var month = date.getMonth() + 1; + var strDate = date.getDate(); + if (month >= 1 && month <= 9) { + month = "0" + month; + } + if (strDate >= 0 && strDate <= 9) { + strDate = "0" + strDate; + } + var currentdate = date.getFullYear() + seperator1 + month + seperator1 + strDate; + return currentdate; } - var currentdate = date.getFullYear() + seperator1 + month; - return currentdate; -} -/** - * js获取当前时间, 格式“yyyy-MM-dd” - */ -function getNowFormatDate() { - var date = new Date(); - var seperator1 = "-"; - var seperator2 = ":"; - var month = date.getMonth() + 1; - var strDate = date.getDate(); - if (month >= 1 && month <= 9) { - month = "0" + month; + /** + * js获取当前时间, 格式“yyyyMMdd” + */ + function getNowFormatDateTwo() { + var date = new Date(); + var month = date.getMonth() + 1; + var strDate = date.getDate(); + if (month >= 1 && month <= 9) { + month = "0" + month; + } + if (strDate >= 0 && strDate <= 9) { + strDate = "0" + strDate; + } + var currentdate = date.getFullYear() + month.toString() + strDate.toString(); + return currentdate; } - if (strDate >= 0 && strDate <= 9) { - strDate = "0" + strDate; - } - var currentdate = date.getFullYear() + seperator1 + month + seperator1 + strDate; - return currentdate; -} -/** - * js获取当前时间, 格式“yyyyMMdd” - */ -function getNowFormatDateTwo() { - var date = new Date(); - var month = date.getMonth() + 1; - var strDate = date.getDate(); - if (month >= 1 && month <= 9) { - month = "0" + month; + /** + * js根据时间生成编号, 格式“yyyyMMddHHMMSS” + */ + function getNowFormatDateNum() { + var date = new Date(); + var seperator1 = "-"; + var seperator2 = ":"; + var month = date.getMonth() + 1; + var strDate = date.getDate(); + var strHours = date.getHours(); + var strMinutes = date.getMinutes(); + var strSeconds = date.getSeconds(); + if (month >= 1 && month <= 9) { + month = "0" + month; + } + if (strDate >= 0 && strDate <= 9) { + strDate = "0" + strDate; + } + if (strHours >= 0 && strHours <= 9) { + strHours = "0" + strHours; + } + if (strMinutes >= 0 && strMinutes <= 9) { + strMinutes = "0" + strMinutes; + } + if (strSeconds >= 0 && strSeconds <= 9) { + strSeconds = "0" + strSeconds; + } + var currentdate = date.getFullYear() + month.toString() + strDate.toString() + strHours + + strMinutes + strSeconds; + return currentdate; } - if (strDate >= 0 && strDate <= 9) { - strDate = "0" + strDate; - } - var currentdate = date.getFullYear() + month.toString() + strDate.toString(); - return currentdate; -} -/** - * js根据时间生成编号, 格式“yyyyMMddHHMMSS” - */ -function getNowFormatDateNum() { - var date = new Date(); - var seperator1 = "-"; - var seperator2 = ":"; - var month = date.getMonth() + 1; - var strDate = date.getDate(); - var strHours = date.getHours(); - var strMinutes = date.getMinutes(); - var strSeconds = date.getSeconds(); - if (month >= 1 && month <= 9) { - month = "0" + month; + function encode(name){ + return encodeURI(encodeURI(name)); } - if (strDate >= 0 && strDate <= 9) { - strDate = "0" + strDate; - } - if (strHours >= 0 && strHours <= 9) { - strHours = "0" + strHours; - } - if (strMinutes >= 0 && strMinutes <= 9) { - strMinutes = "0" + strMinutes; - } - if (strSeconds >= 0 && strSeconds <= 9) { - strSeconds = "0" + strSeconds; - } - var currentdate = date.getFullYear() + month.toString() + strDate.toString() + strHours - + strMinutes + strSeconds; - return currentdate; -} -function encode(name){ - return encodeURI(encodeURI(name)); -} \ No newline at end of file + /** + * 将数组单个金额中的数值转为正数 + * @param arr + * @returns {Array} + */ + function changeListFmtPlus(arr) { + var newArr = new Array(); + for(var i=0; i