Index: ssts-web/src/main/webapp/js/common.js =================================================================== diff -u -r31340 -r31678 --- ssts-web/src/main/webapp/js/common.js (.../common.js) (revision 31340) +++ ssts-web/src/main/webapp/js/common.js (.../common.js) (revision 31678) @@ -18,7 +18,7 @@ extObject.Ajax.request({ url: WWWROOT + '/system/serverTimeAction!getServerDateTime.do', params: { dateformat: format }, - success: function(response, options) { + success: function (response, options) { var result = extObject.decode(response.responseText); if (result.success) { var serverTime = result.serverTime; @@ -32,7 +32,7 @@ } } }, - failure: function(response, options) { + failure: function (response, options) { alert('获取服务器时间失败'); } }); @@ -44,7 +44,7 @@ extObject.Ajax.request({ url: WWWROOT + '/system/serverTimeAction!getServerDateTime2.do', // params : {dateformat : format}, - success: function(response, options) { + success: function (response, options) { var result = extObject.decode(response.responseText); if (result.success) { var timeInMillis = result.timeInMillis; @@ -53,7 +53,7 @@ extObject.getCmp(datefieldId).setValue(date); } }, - failure: function(response, options) { + failure: function (response, options) { alert('获取服务器时间失败'); } }); @@ -73,7 +73,7 @@ if (!datefieldValue) { //如果没传时间的值,就取服务器的当前时间 DWREngine.setAsync(false); - ServerTimeTableManager.getServerDateTime(format, function(config) { + ServerTimeTableManager.getServerDateTime(format, function (config) { datefieldValue = config; }); DWREngine.setAsync(true); @@ -83,7 +83,7 @@ if (refreshFrequency && !isNaN(refreshFrequency)) { //需要定时刷新时间 var lastTime = extObject.getCmp(datefieldId).getValue().getTime(); - var timerHandle = setInterval(function() { + var timerHandle = setInterval(function () { var time = extObject.getCmp(datefieldId).getValue().getTime(); if (time == lastTime) { lastTime = time + refreshFrequency; @@ -99,20 +99,20 @@ //表单验证是否通过 function isFormValid(form) { - var fields = form.getForm().items.items; - var arr = []; + var fields = form.getForm().items.items; + var arr = []; - for(var i=0;i 0) { closeSelf(); @@ -350,7 +350,7 @@ window.opener.focus(); window.opener.location = window.opener.location; - } catch (e) {} + } catch (e) { } } function openNewWindow(pageUrl) { @@ -520,12 +520,12 @@ function isFieldNotNull(objField, alertMsg) { if (objField !== null && objField !== '') { - if (typeof(objField[0]) == "object") { + if (typeof (objField[0]) == "object") { objField = objField[0]; } } - if (typeof(objField) == "object") { + if (typeof (objField) == "object") { if (objField !== null && objField !== '') { if (objField.value.Trim() == "") { @@ -568,7 +568,7 @@ } function isAmount(s) { - if (typeof(s) == 'undefined') { + if (typeof (s) == 'undefined') { return false; } if (s == null) { @@ -655,19 +655,19 @@ return (d1 - d2 == 0); } -String.prototype.Trim = function() { +String.prototype.Trim = function () { return this.replace(/(^\s*)|(\s*$)/g, ""); }; -String.prototype.lenB = function() { +String.prototype.lenB = function () { return this.replace(/[^\x00-\xff]/g, "**").length; }; function setFieldFocus(objField) { try { objField.focus(); - } catch (e) {} + } catch (e) { } } function defaultFieldFocus(objFieldId) { @@ -721,7 +721,7 @@ popwin.moveTo(0, 0); popwin.resizeTo(screen.availWidth, screen.availHeight); popwin.focus(); - } catch (e) {} + } catch (e) { } return popwin; } @@ -782,7 +782,7 @@ var temText = selectElement.options[intIndex + 1].text; var temValue = selectElement.options[intIndex + 1].value; var temId = selectElement.options[intIndex + 1].id; - + selectElement.options[intIndex + 1].text = selectElement.options[intIndex].text; selectElement.options[intIndex + 1].value = selectElement.options[intIndex].value; selectElement.options[intIndex + 1].id = selectElement.options[intIndex].id; @@ -1136,12 +1136,12 @@ if (items.Trim() == "") return false; - if (typeof(sparator) == "undefined") { + if (typeof (sparator) == "undefined") { sparator = ";"; } var itemsArray = items.split(sparator); - if (typeof(itemsArray) == "undefined" || typeof(itemsArray.length) == "undefined") { + if (typeof (itemsArray) == "undefined" || typeof (itemsArray.length) == "undefined") { return false; } @@ -1162,8 +1162,8 @@ function selectAllCheckBox(chkBoxName, selfobj) { var obj = document.getElementsByName(chkBoxName); - if (typeof(obj) != "undefined") { - if (typeof(obj.length) == "undefined") + if (typeof (obj) != "undefined") { + if (typeof (obj.length) == "undefined") obj.checked = selfobj.checked; for (var i = 0; i < obj.length; i++) { obj[i].checked = selfobj.checked; @@ -1220,7 +1220,7 @@ function $Id(elemId) { return document.getElementById(elemId); } function removeStartAndEndCharacter(fildIdArr) { - if (typeof(fildIdArr) != "undefined") { + if (typeof (fildIdArr) != "undefined") { for (var i = 0; i < fildIdArr.length; i++) { removeStartAndEndToken(fildIdArr[i]); } @@ -1230,7 +1230,7 @@ function removeStartAndEndToken(fildId) { var start_end_str = ";"; var obj = $Id(fildId); - if (typeof(obj) != "undefined") { + if (typeof (obj) != "undefined") { var str = obj.value.Trim(); if (str.indexOf(start_end_str) == 0) { str = str.substr(1); @@ -1278,7 +1278,7 @@ try { var fieldObj = document.getElementById(fieldId); fieldObj.value = fieldObj.value.Trim(); - } catch (e) {} + } catch (e) { } } function chekSelectItems(fieldId, msg) { @@ -1333,24 +1333,24 @@ function suckerfish(type, tag, parentId) { if (window.attachEvent) { window.attachEvent("onload", - function() { + function () { var sfEls = (parentId == null) ? document.getElementsByTagName(tag) : document.getElementById(parentId).getElementsByTagName(tag); type(sfEls); } ); } } -sfFocus = function(sfEls) { +sfFocus = function (sfEls) { for (var i = 0; i < sfEls.length; i++) { if (!(sfEls[i].form != null && (sfEls[i].id == "topSearchInput" || sfEls[i].id == "noteContent" || sfEls[i].id == "otherCostPercent" || sfEls[i].id == "planGainPercent" || sfEls[i].id == "constructionFeeInput" || (sfEls[i].form.name == "contractForm" && sfEls[i].id == "startDate") || (sfEls[i].form.name == "contractForm" && sfEls[i].id == "expireDate") || (sfEls[i].form.name == "accountReceivableForm" && sfEls[i].id == "receivableDate") || (sfEls[i].form.name == "accountReceivableForm" && sfEls[i].id == "gatherDate") || (sfEls[i].form.name == "marketForm" && sfEls[i].id == "expectEndDate") || (sfEls[i].form.name == "customerForm" && sfEls[i].id == "birthday") || (sfEls[i].form.name == "yiSalesBillForm" && sfEls[i].id == "saleDate") || (sfEls[i].form.name == "yiSalesBillForm" && sfEls[i].id == "receivableDate") || (sfEls[i].form.name == "advertContractForm" && sfEls[i].id == "startDate") || (sfEls[i].form.name == "advertContractForm" && sfEls[i].id == "expireDate") || (sfEls[i].form.name == "advertAccountReceivableForm" && sfEls[i].id == "receivableDate") || (sfEls[i].form.name == "advertAccountReceivableForm" && sfEls[i].id == "gatherDate") || (sfEls[i].form.name == "advertForm" && sfEls[i].id == "advertDate") || (sfEls[i].form.name == "advertForm" && sfEls[i].id == "receivableDate") || (sfEls[i].form.name == "advertForm" && sfEls[i].id == "draftDate") || (sfEls[i].form.name == "receptionForm" && sfEls[i].id == "advertDate") || (sfEls[i].form.name == "receptionForm" && sfEls[i].id == "acceptDate") || (sfEls[i].form.name == "appearnewsForm" && sfEls[i].id == "advertDate") || (sfEls[i].form.name == "appearnewsForm" && sfEls[i].id == "receivableDate") || sfEls[i].form.name == "projectMaterialPurchaseForm" || sfEls[i].form.name == "projectMaterialForm" || (sfEls[i].form.name == "yiPersonalCustomerForm" && sfEls[i].id == "homeAddress") || (sfEls[i].form.name == "vehicleApplicationForm" && sfEls[i].id == "licensePlate") || (sfEls[i].form.name == "paymentForm" && sfEls[i].id == "payDate") || (sfEls[i].form.name == "paymentForm" && sfEls[i].id == "gatherDate") || (sfEls[i].id == "contractMoney" || sfEls[i].id == "managementFeesRate" || sfEls[i].id == "advance" || sfEls[i].id == "progressMoneyTotal") || isExceptionEle(sfEls[i].id)))) { - sfEls[i].onfocus = function() { + sfEls[i].onfocus = function () { if (this.readOnly == false && (this.type == "text" || this.type == "textarea" || this.type == "password")) { this.className += " form_textfieldonfocus"; } }; - sfEls[i].onblur = function() { + sfEls[i].onblur = function () { if (this.id != "topSearchInput") { this.className = this.className.replace(new RegExp(" form_textfieldonfocus\\b"), ""); } @@ -1359,7 +1359,7 @@ } }; -Array.prototype.contains = function(value) { +Array.prototype.contains = function (value) { for (var i = 0; i < this.length; i++) { if (arguments.length == 1) { if (this[i].toString() == value) return true; @@ -1372,7 +1372,7 @@ return false; }; -Array.prototype.indexof = function(value) { +Array.prototype.indexof = function (value) { if (StringUtils.isBlank(value)) { return -1; } @@ -1382,7 +1382,7 @@ return -1; }; -Array.prototype.containsArray = function(arr) { +Array.prototype.containsArray = function (arr) { for (var i = 0; i < this.length; i++) { var cv = this[i]; if (arr.contains(cv)) { @@ -1408,7 +1408,7 @@ function setATagHidFocus() { var aTags = document.getElementsByTagName("a"); - if (aTags != null || typeof(aTags) == "undefined" || typeof(aTags.length) == "undefined") { + if (aTags != null || typeof (aTags) == "undefined" || typeof (aTags.length) == "undefined") { for (var i = 0; i < aTags.length; i++) { aTags[i].hideFocus = true; } @@ -1525,11 +1525,11 @@ //将destination中用分隔符分开的字符串不重复的在source中移除, function destinationAddToSourceAndRetrunString(source, destination, seperator) { - if (typeof(seperator) == "undefined" || seperator == "") + if (typeof (seperator) == "undefined" || seperator == "") seperator = ","; - if (typeof(source) == "undefined" || source == "") + if (typeof (source) == "undefined" || source == "") return destination; - if (typeof(destination) == "undefined" || destination == "") + if (typeof (destination) == "undefined" || destination == "") return source; var sourceArr = source.split(seperator); @@ -1550,11 +1550,11 @@ //将destination中用分隔符分开的字符串不重复的添加到source中去, function sourceMinusToDestinationAndRetrunString(source, destination, seperator) { - if (typeof(seperator) == "undefined" || seperator == "") + if (typeof (seperator) == "undefined" || seperator == "") seperator = ","; - if (typeof(source) == "undefined" || source == "") + if (typeof (source) == "undefined" || source == "") return source; - if (typeof(destination) == "undefined" || destination == "") + if (typeof (destination) == "undefined" || destination == "") return source; var returnArr = new Array(); @@ -1617,9 +1617,11 @@ seed_array[2] = "a b c d e f g h i j k l m n o p q r s t u v w x y z"; seed_array[3] = "0 1 2 3 4 5 6 7 8 9"; - if (!str_1 && !str_2 && !str_3) { str_1 = true; + if (!str_1 && !str_2 && !str_3) { + str_1 = true; str_2 = true; - str_3 = true; } + str_3 = true; + } if (str_1) { seed_array[0] += seed_array[1]; } if (str_2) { seed_array[0] += " " + seed_array[2]; } @@ -1680,7 +1682,7 @@ } } -String.prototype.startWith = function(str) { +String.prototype.startWith = function (str) { if (str == null || str == "" || this.length == 0 || str.length > this.length) { return false; } @@ -1746,8 +1748,10 @@ function transform(value) { var num; var dig; - if (value.indexOf(".") == -1) { num = value; - dig = ""; } else { + if (value.indexOf(".") == -1) { + num = value; + dig = ""; + } else { num = value.substr(0, value.indexOf(".")); dig = value.substr(value.indexOf(".") + 1, value.length); } @@ -1789,30 +1793,30 @@ return str; } -function StringUtils() {} +function StringUtils() { } -StringUtils.isNotBlank = function(stringValue) { +StringUtils.isNotBlank = function (stringValue) { if (stringValue != null && ((stringValue + '').Trim() != '')) { return true; } return false; }; -StringUtils.isBlank = function(stringValue) { +StringUtils.isBlank = function (stringValue) { if (stringValue != null && ((stringValue + '').Trim() != '')) { return false; } return true; }; -StringUtils.defaultIfEmpty = function(str, defaultStr) { +StringUtils.defaultIfEmpty = function (str, defaultStr) { if (StringUtils.isBlank(str)) { return defaultStr; } return str; }; -String.prototype.startWith = function(str) { +String.prototype.startWith = function (str) { if (StringUtils.isBlank(str)) { return true; } @@ -1822,7 +1826,7 @@ return false; }; -Date.getDateByString = function(dateStr) { +Date.getDateByString = function (dateStr) { if (StringUtils.isBlank(dateStr)) { return null; } @@ -1856,7 +1860,7 @@ } }; -Date.prototype.toCommonStr = function() { +Date.prototype.toCommonStr = function () { var returnStr = ''; var year = this.getFullYear(); var month = this.getMonth(); @@ -1878,7 +1882,7 @@ //例子: //(new Date()).Format("yyyy-MM-dd hh:mm:ss.S") ==> 2006-07-02 08:09:04.423 //(new Date()).Format("yyyy-M-d h:m:s.S") ==> 2006-7-2 8:9:4.18 -Date.prototype.Format = function(fmt) { //author: meizz +Date.prototype.Format = function (fmt) { //author: meizz var o = { "M+": this.getMonth() + 1, //月份 "d+": this.getDate(), //日 @@ -1894,7 +1898,7 @@ return fmt; } -Date.prototype.addMonth = function(m) { +Date.prototype.addMonth = function (m) { if (StringUtils.isBlank(m)) { return; } @@ -2144,7 +2148,7 @@ } function callModifyFun(v, data) { - if (typeof(isShowPrintBtn) != "undefined") { + if (typeof (isShowPrintBtn) != "undefined") { isShowPrintBtn = false; } //var record = Ext.util.JSON.decode(r); @@ -2172,24 +2176,24 @@ */ function testPasswordReg(pwd, loginUser) { /*simon:update needBeStrongPwdWhenModifyPwd当修改密码时,密码是否一定为强密码*/ - //needBeStrongPwdWhenModifyPwd :{'minPwdLength':8,'containLetter':true,'containUppercaseLetter':false,'containLowerCaseLetter':false,'containSpecialChar':true,'containNumber':true,'passwordNotContainLoginName':true} - var pwdConfig = sstsConfig.needBeStrongPwdWhenModifyPwd; - var msg = "密码必须包含字母和数字,长度最小为8位!"; - var obj = {"success":false, "msg":msg}; - - if ( !isUndefinedOrNullOrEmpty(pwdConfig)) { - var minPwdLength = pwdConfig.minPwdLength; - var containLetter = pwdConfig.containLetter; - var containUppercaseLetter = pwdConfig.containUppercaseLetter; - var containLowerCaseLetter = pwdConfig.containLowerCaseLetter; - var containSpecialChar = pwdConfig.containSpecialChar; - var containNumber = pwdConfig.containNumber; + //needBeStrongPwdWhenModifyPwd :{'minPwdLength':8,'containLetter':true,'containUppercaseLetter':false,'containLowerCaseLetter':false,'containSpecialChar':true,'containNumber':true,'passwordNotContainLoginName':true} + var pwdConfig = sstsConfig.needBeStrongPwdWhenModifyPwd; + var msg = "密码必须包含字母和数字,长度最小为8位!"; + var obj = { "success": false, "msg": msg }; + + if (!isUndefinedOrNullOrEmpty(pwdConfig)) { + var minPwdLength = pwdConfig.minPwdLength; + var containLetter = pwdConfig.containLetter; + var containUppercaseLetter = pwdConfig.containUppercaseLetter; + var containLowerCaseLetter = pwdConfig.containLowerCaseLetter; + var containSpecialChar = pwdConfig.containSpecialChar; + var containNumber = pwdConfig.containNumber; var passwordNotContainLoginName = pwdConfig.passwordNotContainLoginName; //密码复杂度要求1,该要求包含以下三类字符中的二类字符:(QYSRMYY-27) var passwordComplexityReq1 = pwdConfig.passwordComplexityReq1; //密码复杂度要求2,该要求包含以下四类字符中的三类字符:(QYSRMYY-27) var windowsPasswordComplexityReq = pwdConfig.windowsPasswordComplexityReq; - + minPwdLength = isUndefinedOrNullOrEmpty(minPwdLength) ? 6 : minPwdLength; //包含数字,大写,小写 @@ -2210,29 +2214,29 @@ var tempPwd = pwd.toLowerCase(); var tempLoginUser = loginUser.toLowerCase(); - if(pwd.length < minPwdLength){ + if (pwd.length < minPwdLength) { obj.msg = "密码长度最小为" + minPwdLength + "位!"; - }else if(containNumber && !/[0-9]+/.test(pwd)){ + } else if (containNumber && !/[0-9]+/.test(pwd)) { obj.msg = "密码必须包含数字!"; - }else if(containLetter && !/[a-zA-Z]+/.test(pwd)){ + } else if (containLetter && !/[a-zA-Z]+/.test(pwd)) { obj.msg = "密码必须包含字母!"; - }else if(containUppercaseLetter && !/[A-Z]+/.test(pwd)){ + } else if (containUppercaseLetter && !/[A-Z]+/.test(pwd)) { obj.msg = "密码必须包含大写字母!"; - }else if(containLowerCaseLetter && !/[a-z]+/.test(pwd)){ + } else if (containLowerCaseLetter && !/[a-z]+/.test(pwd)) { obj.msg = "密码必须包含小写字母!"; - }else if(containSpecialChar && !/[^A-Za-z0-9]/.test(pwd)){ + } else if (containSpecialChar && !/[^A-Za-z0-9]/.test(pwd)) { obj.msg = "密码必须包含特殊字符!"; - }else if(passwordNotContainLoginName && tempPwd.indexOf(tempLoginUser) >= 0){ + } else if (passwordNotContainLoginName && tempPwd.indexOf(tempLoginUser) >= 0) { obj.msg = "密码不可以包含账号!"; - }else if(windowsPasswordComplexityReq && !regExp1.test(pwd) && !regExp2.test(pwd) && !regExp3.test(pwd) && !regExp4.test(pwd)){ + } else if (windowsPasswordComplexityReq && !regExp1.test(pwd) && !regExp2.test(pwd) && !regExp3.test(pwd) && !regExp4.test(pwd)) { obj.msg = "密码强度不够,至少包含大写字母,小写字母、数字、特殊字符的其中三种"; - }else if(passwordComplexityReq1 && !regExp5.test(pwd) && !regExp6.test(pwd) && !regExp7.test(pwd)){ + } else if (passwordComplexityReq1 && !regExp5.test(pwd) && !regExp6.test(pwd) && !regExp7.test(pwd)) { obj.msg = "密码强度不够,至少包含英文字母、数字、特殊字符的其中两种!"; - }else{ + } else { obj.success = true; } } else { - obj.success = true; + obj.success = true; } return obj; } @@ -2280,36 +2284,36 @@ /*****************获取js值的函数,本来定义在configUtils.js中,但是此文件被很多jsp引用,暂时copy一份,以后再考虑调整引用关系*****/ //从js文件获取某个boolean配置 /*function getBoolValueFromJs(p,defValue){ - var retValue = defValue; - var value = getValueFromJs(p); - if(value == undefined ){ - return retValue; - } + var retValue = defValue; + var value = getValueFromJs(p); + if(value == undefined ){ + return retValue; + } - try{ - retValue = Boolean(value); - }catch(e){ - - } - //alert('p='+p); - //alert('retValue='+retValue); - return retValue; + try{ + retValue = Boolean(value); + }catch(e){ + + } + //alert('p='+p); + //alert('retValue='+retValue); + return retValue; } function getValueFromJs(p){ - var retValue = undefined; - if(typeof(p) == undefined ){ - return retValue; - } - if(p == null || p == ''){ - return retValue; - } - try{ - retValue = eval(p); - }catch(e){ - - } - //alert('retValue='+retValue); - return retValue; + var retValue = undefined; + if(typeof(p) == undefined ){ + return retValue; + } + if(p == null || p == ''){ + return retValue; + } + try{ + retValue = eval(p); + }catch(e){ + + } + //alert('retValue='+retValue); + return retValue; }*/ /*****************获取js值的函数,本来定义在configUtils.js中,但是此文件被很多jsp引用,暂时copy一份,以后再考虑调整引用关系*****/ // jeff li 2015/6/26 @@ -2376,29 +2380,29 @@ function ForgonKeyValueSettings() { } -ForgonKeyValueSettings.prototype.addkeyValueFromLocalFile = function(type, fileName, overWriteExistingItem) { - if (!type || !fileName) { - return; - } - var forgonKeyValueMap = this[type]; - if (!forgonKeyValueMap) { - forgonKeyValueMap = this[type] = new ForgonKeyValueMap(); - } - forgonKeyValueMap.addkeyValueFromLocalFile(fileName, overWriteExistingItem); +ForgonKeyValueSettings.prototype.addkeyValueFromLocalFile = function (type, fileName, overWriteExistingItem) { + if (!type || !fileName) { + return; } - //根据key获取字符串值 -ForgonKeyValueSettings.prototype.getStringValue = function(type, key, defaultValue) { - if (!type || !key) { - return defaultValue; - } - var forgonKeyValueMap = this[type]; - if (forgonKeyValueMap) { - return forgonKeyValueMap.getStringValue(key, defaultValue); - } - + var forgonKeyValueMap = this[type]; + if (!forgonKeyValueMap) { + forgonKeyValueMap = this[type] = new ForgonKeyValueMap(); + } + forgonKeyValueMap.addkeyValueFromLocalFile(fileName, overWriteExistingItem); +} +//根据key获取字符串值 +ForgonKeyValueSettings.prototype.getStringValue = function (type, key, defaultValue) { + if (!type || !key) { return defaultValue; } - // key-value形式的参数配置对象,支持从本地ini加载。 + var forgonKeyValueMap = this[type]; + if (forgonKeyValueMap) { + return forgonKeyValueMap.getStringValue(key, defaultValue); + } + + return defaultValue; +} +// key-value形式的参数配置对象,支持从本地ini加载。 var forgonKeyValueSettings = forgonKeyValueSettings || new ForgonKeyValueSettings(); // 从本地加载文件,并解析为key-value形式 @@ -2408,7 +2412,7 @@ } // 从本地文件添加keyValue -ForgonKeyValueMap.prototype.addkeyValueFromLocalFile = function(fileName, overWriteExistingItem) { +ForgonKeyValueMap.prototype.addkeyValueFromLocalFile = function (fileName, overWriteExistingItem) { if (fileName == undefined || fileName == null) { return undefined; } @@ -2481,24 +2485,24 @@ } // 根据key获取值 -ForgonKeyValueMap.prototype.getValue = function(key) { - if (key == undefined || key == null) { - return undefined; - } - return this.values[key]; +ForgonKeyValueMap.prototype.getValue = function (key) { + if (key == undefined || key == null) { + return undefined; } - //根据key获取字符串值 -ForgonKeyValueMap.prototype.getStringValue = function(key, defaultValue) { - if (key == undefined || key == null) { - return defaultValue; - } - var value = this.values[key]; - if (value != undefined) { - return value; - } + return this.values[key]; +} +//根据key获取字符串值 +ForgonKeyValueMap.prototype.getStringValue = function (key, defaultValue) { + if (key == undefined || key == null) { return defaultValue; } - // 初始化ini配置 + var value = this.values[key]; + if (value != undefined) { + return value; + } + return defaultValue; +} +// 初始化ini配置 var InikeyValueConfig = { types: [{ typeName: 'print', @@ -2531,13 +2535,13 @@ // 根据名字(大标签,小标签)获取打印机名称,如果没有配置,则返回null function getPrinterNameByType(type) { var printerName = null; - if (typeof(type) == undefined || type == null) { + if (typeof (type) == undefined || type == null) { return null; } //printerName = forgonKeyValueSettings.getStringValue(IniTypePrint,type+'.printerName',null); // 改为通过jason对象来获取,不用ini的方式了。 - if (typeof(printerNameMapping) != 'undefined' && printerNameMapping != null) { + if (typeof (printerNameMapping) != 'undefined' && printerNameMapping != null) { if (printerNameMapping[type] != undefined) { printerName = printerNameMapping[type]; } @@ -2566,12 +2570,12 @@ s.type = 'text/javascript'; document.body.appendChild(s); // alert('loadLocalJavascript,path='+filePath); - } catch (e) {} + } catch (e) { } } /////////////////////////// 加载本地js /////////////////////////// function isUndefinedOrNull(value) { - if (typeof(value) == 'undefined') { + if (typeof (value) == 'undefined') { return true; } if (value == null) { @@ -2581,7 +2585,7 @@ } function isUndefinedOrNullOrEmpty(value) { - if (typeof(value) == 'undefined') { + if (typeof (value) == 'undefined') { return true; } if (value == null) { @@ -2598,16 +2602,16 @@ var root = params.root || WWWROOT; var isDom = params.isDom; var arg = {}; - arg.userIds = isDom?userIdsElement.value:userIdsElement.getValue(); - arg.userNames = isDom?userNamesElement.value:userNamesElement.getValue(); + arg.userIds = isDom ? userIdsElement.value : userIdsElement.getValue(); + arg.userNames = isDom ? userNamesElement.value : userNamesElement.getValue(); var ids = []; - if(arg.userIds.split(";").length > 0){ - for(var i=0;i 0) { + for (var i = 0; i < arg.userIds.split(";").length; i++) { var item = arg.userIds.split(";")[i]; - if(item !== ''){ - if(item.indexOf('USERID_') == -1){ - ids.push('USERID_'+item); - }else { + if (item !== '') { + if (item.indexOf('USERID_') == -1) { + ids.push('USERID_' + item); + } else { ids.push(item); } } @@ -2617,18 +2621,18 @@ arg.userNamesArray = arg.userNames.split(";"); arg.action = params.action || 'includeUsers'; //GGSRMYY-129修改了参数的提交方式 - sessionStorage.setItem('arg',JSON.stringify(arg)); + sessionStorage.setItem('arg', JSON.stringify(arg)); var selectedUsersArray = openModalWindow(root + '/common/selPersonByOrgUnitByExt.jsp', {}, '700', '430'); var userIds = []; var userNames = []; if (selectedUsersArray == undefined) { return; - }else if(isIE() && selectedUsersArray[0] == undefined){ - if(isDom){ + } else if (isIE() && selectedUsersArray[0] == undefined) { + if (isDom) { userIdsElement.value = ''; userNamesElement.value = ''; - }else { - if(params.action !== 'principal'){ + } else { + if (params.action !== 'principal') { userIdsElement.setValue(''); } userNamesElement.setValue(''); @@ -2639,28 +2643,28 @@ var userStr = selectedUsersArray[i]; var name = userStr.split(';')[1]; var fullName = userStr.split(';')[2]; - if(params.action == 'principal'){ + if (params.action == 'principal') { userNames.push(fullName); - }else if(params.action == 'leader'){ + } else if (params.action == 'leader') { userIds.push("USERID_" + name); userNames.push(fullName); - }else { + } else { userIds.push("USERID_" + name); userNames.push(fullName); } } - if(isDom){ + if (isDom) { userIdsElement.value = userIds.join(';'); - userNamesElement.value = userNames.join(';'); - }else { - if(params.action !== 'principal'){ + userNamesElement.value = userNames.join(';'); + } else { + if (params.action !== 'principal') { userIdsElement.setValue(userIds.join(';')); } userNamesElement.setValue(userNames.join(';')); } } } else { - var loop = setInterval(function() { + var loop = setInterval(function () { if (selectedUsersArray.closed) { clearInterval(loop); var returnValue = selectedUsersArray.returnValue; @@ -2669,31 +2673,31 @@ var userStr = returnValue[i]; var name = userStr.split(';')[1]; var fullName = userStr.split(';')[2]; - if(params.action == 'principal'){ + if (params.action == 'principal') { userNames.push(fullName); - }else if(params.action == 'leader'){ + } else if (params.action == 'leader') { userIds.push("USERID_" + name); userNames.push(fullName); - }else { + } else { userIds.push("USERID_" + name); userNames.push(fullName); } } - if(isDom){ + if (isDom) { userIdsElement.value = userIds.join(';'); userNamesElement.value = userNames.join(';'); - }else { - if(params.action !== 'principal'){ + } else { + if (params.action !== 'principal') { userIdsElement.setValue(userIds.join(';')); } userNamesElement.setValue(userNames.join(';')); } - }else if(returnValue && returnValue.length == 0){ - if(isDom){ + } else if (returnValue && returnValue.length == 0) { + if (isDom) { userIdsElement.value = ''; userNamesElement.value = ''; - }else { - if(params.action !== 'principal'){ + } else { + if (params.action !== 'principal') { userIdsElement.setValue(''); } userNamesElement.setValue(''); @@ -2862,11 +2866,11 @@ */ function setFocus(id, delayTime) { var dt = delayTime || 300; - setTimeout(function() { + setTimeout(function () { try { var ipt = document.getElementById(id); ipt.focus(); - } catch (e) {} + } catch (e) { } }, dt); } @@ -2882,7 +2886,7 @@ var ext = extObj || top.Ext4; if (!ext.isEmpty(data)) { //注:(这个方法只支持Ext4Js) - ext.Object.each(setValueObj, function(id, value) { + ext.Object.each(setValueObj, function (id, value) { ext.getCmp(id).setValue(data.get(value)); }); } @@ -2935,10 +2939,10 @@ e = b.toString(); try { c += d.split(".")[1].length; - } catch (f) {} + } catch (f) { } try { c += e.split(".")[1].length; - } catch (f) {} + } catch (f) { } return Number(d.replace(".", "")) * Number(e.replace(".", "")) / Math.pow(10, c); } @@ -2948,10 +2952,10 @@ f = 0; try { e = a.toString().split(".")[1].length; - } catch (g) {} + } catch (g) { } try { f = b.toString().split(".")[1].length; - } catch (g) {} + } catch (g) { } return c = Number(a.toString().replace(".", "")), d = Number(b.toString().replace(".", "")), mul(c / d, Math.pow(10, f - e)); } @@ -2972,7 +2976,7 @@ //按下Backspace键 if (ev.keyCode == 8) { var tagName = obj.nodeName //标签名称 - //如果标签不是input或者textarea则阻止Backspace + //如果标签不是input或者textarea则阻止Backspace if (tagName != 'INPUT' && tagName != 'TEXTAREA') { return stopIt(ev); } @@ -3142,7 +3146,7 @@ combo.setValue(combo.getCheckedValue()); } else { var isAllChoosed = true; - combo.store.each(function(thisRecord) { + combo.store.each(function (thisRecord) { if (thisRecord.get(nameOfFiled) != ('全部') && !thisRecord.get(combo.checkField)) { isAllChoosed = false; } @@ -3160,21 +3164,21 @@ combo.deselectAll(); } } -function windowLocalStorage(itemType,title,value){ - if(window.localStorage){ - if(itemType == 'set'){ - window.localStorage.setItem(title,value); - }else if(itemType == 'get'){ +function windowLocalStorage(itemType, title, value) { + if (window.localStorage) { + if (itemType == 'set') { + window.localStorage.setItem(title, value); + } else if (itemType == 'get') { return window.localStorage.getItem(title); - }else if(itemType == 'remove'){ + } else if (itemType == 'remove') { window.localStorage.removeItem(title); } - }else { + } else { window.UserData = function (file_name) { if (!file_name) { file_name = "user_data_default"; } - + var dom = document.createElement('input'); dom.type = "hidden"; dom.addBehavior("#default#userData"); @@ -3202,501 +3206,501 @@ var now = new Date(); now = new Date(now.getTime() - 1); this.dom.expires = now.toUTCString(); - this.dom.save(this. file_name); + this.dom.save(this.file_name); } }; - try{ + try { window.localStorage = new window.UserData("local_storage"); - if(itemType == 'set'){ - window.localStorage.setItem(title,value); - }else if(itemType == 'get'){ + if (itemType == 'set') { + window.localStorage.setItem(title, value); + } else if (itemType == 'get') { window.localStorage.getItem(title); - }else if(itemType == 'remove'){ + } else if (itemType == 'remove') { window.localStorage.removeItem(title); } - }catch(e){ + } catch (e) { } } } -function newMap(){ +function newMap() { this.elements = new Array(); // 获取Map元素个数 - this.size = function() { -        return this.elements.length; + this.size = function () { + return this.elements.length; }, - // 判断Map是否为空 - this.isEmpty = function() { - return (this.elements.length < 1); - }, - // 删除Map所有元素 - this.clear = function() { - this.elements = new Array(); - }, - // 向Map中增加元素(key, value) - this.put = function(_key, _value) { - if (this.containsKey(_key) == true) { - if (this.containsValue(_value)) { - if (this.remove(_key) == true) { + // 判断Map是否为空 + this.isEmpty = function () { + return (this.elements.length < 1); + }, + // 删除Map所有元素 + this.clear = function () { + this.elements = new Array(); + }, + // 向Map中增加元素(key, value) + this.put = function (_key, _value) { + if (this.containsKey(_key) == true) { + if (this.containsValue(_value)) { + if (this.remove(_key) == true) { + this.elements.push({ + key: _key, + value: _value + }) + } + } else { this.elements.push({ - key : _key, - value : _value + key: _key, + value: _value }) } - }else { + } else { this.elements.push({ - key : _key, - value : _value + key: _key, + value: _value }) } - }else { - this.elements.push({ - key : _key, - value : _value - }) - } - }, - // 向Map中增加元素(key, value) - this.set = function(_key, _value) { - if (this.containsKey(_key) == true) { + }, + // 向Map中增加元素(key, value) + this.set = function (_key, _value) { + if (this.containsKey(_key) == true) { + var bln = false; + try { + for (i = 0; i < this.elements.length; i++) { + if (this.elements[i].key == _key) { + this.elements[i].value = _value; + return true; + } + } + } catch (e) { + bln = false; + } + return bln; + } else { + this.elements.push({ + key: _key, + value: _value + }); + } + }, + // 删除指定key的元素,成功返回true,失败返回false + this.remove = function (_key) { var bln = false; try { for (i = 0; i < this.elements.length; i++) { if (this.elements[i].key == _key) { - this.elements[i].value = _value; + this.elements.splice(i, 1); return true; } } } catch (e) { bln = false; } + return bln; - }else { - this.elements.push({ - key : _key, - value : _value - }); - } - }, - // 删除指定key的元素,成功返回true,失败返回false - this.remove = function(_key) { - var bln = false; - try { - for (i = 0; i < this.elements.length; i++) { - if (this.elements[i].key == _key) { - this.elements.splice(i, 1); - return true; + }, + // 删除指定key的元素,成功返回true,失败返回false + this.deletes = function (_key) { + var bln = false; + try { + for (i = 0; i < this.elements.length; i++) { + if (this.elements[i].key == _key) { + this.elements.splice(i, 1); + return true; + } } + } catch (e) { + bln = false; } - } catch (e) { - bln = false; - } - return bln; - }, - // 删除指定key的元素,成功返回true,失败返回false - this.deletes = function(_key) { - var bln = false; - try { - for (i = 0; i < this.elements.length; i++) { - if (this.elements[i].key == _key) { - this.elements.splice(i, 1); - return true; + return bln; + }, + // 获取指定key的元素值value,失败返回null + this.get = function (_key) { + try { + for (i = 0; i < this.elements.length; i++) { + if (this.elements[i].key == _key) { + return this.elements[i].value; + } } + } catch (e) { + return null; } - } catch (e) { - bln = false; - } - - return bln; - }, - // 获取指定key的元素值value,失败返回null - this.get = function(_key) { - try { - for (i = 0; i < this.elements.length; i++) { - if (this.elements[i].key == _key) { - return this.elements[i].value; + }, + // set指定key的元素值value + this.setValue = function (_key, _value) { + var bln = false; + try { + for (i = 0; i < this.elements.length; i++) { + if (this.elements[i].key == _key) { + this.elements[i].value = _value; + return true; + } } + } catch (e) { + bln = false; } - } catch (e) { - return null; - } - }, - // set指定key的元素值value - this.setValue = function(_key, _value) { - var bln = false; - try { - for (i = 0; i < this.elements.length; i++) { - if (this.elements[i].key == _key) { - this.elements[i].value = _value; - return true; + + return bln; + }, + // 获取指定索引的元素(使用element.key,element.value获取key和value),失败返回null + this.element = function (_index) { + if (_index < 0 || _index >= this.elements.length) { + return null; + } + return this.elements[_index]; + }, + // 判断Map中是否含有指定key的元素 + this.containsKey = function (_key) { + var bln = false; + try { + for (i = 0; i < this.elements.length; i++) { + if (this.elements[i].key == _key) { + bln = true; + } } + } catch (e) { + bln = false; } - } catch (e) { - bln = false; - } - return bln; - }, - // 获取指定索引的元素(使用element.key,element.value获取key和value),失败返回null - this.element = function(_index) { - if (_index < 0 || _index >= this.elements.length) { - return null; - } - return this.elements[_index]; - }, - // 判断Map中是否含有指定key的元素 - this.containsKey = function(_key) { - var bln = false; - try { - for (i = 0; i < this.elements.length; i++) { - if (this.elements[i].key == _key) { - bln = true; + return bln; + }, + // 判断Map中是否含有指定key的元素 + this.has = function (_key) { + var bln = false; + try { + for (i = 0; i < this.elements.length; i++) { + if (this.elements[i].key == _key) { + bln = true; + } } + } catch (e) { + bln = false; } - } catch (e) { - bln = false; - } - return bln; - }, - // 判断Map中是否含有指定key的元素 - this.has = function(_key) { - var bln = false; - try { - for (i = 0; i < this.elements.length; i++) { - if (this.elements[i].key == _key) { - bln = true; + return bln; + }, + // 判断Map中是否含有指定value的元素 + this.containsValue = function (_value) { + var bln = false; + try { + for (i = 0; i < this.elements.length; i++) { + if (this.elements[i].value == _value) { + bln = true; + } } + } catch (e) { + bln = false; } - } catch (e) { - bln = false; - } - return bln; - }, - // 判断Map中是否含有指定value的元素 - this.containsValue = function(_value) { - var bln = false; - try { + return bln; + }, + // 获取Map中所有key的数组(array) + this.keys = function () { + var arr = new Array(); for (i = 0; i < this.elements.length; i++) { - if (this.elements[i].value == _value) { - bln = true; + arr.push(this.elements[i].key); + } + return arr; + }, + // 获取Map中所有value的数组(array) + this.values = function () { + var arr = new Array(); + for (i = 0; i < this.elements.length; i++) { + arr.push(this.elements[i].value); + } + return arr; + }, + // map遍历数组 + this.forEach = function forEach(callback, context) { + context = context || window; + var newAry = new Array(); + for (var i = 0; i < this.elements.length; i++) { + if (typeof callback === 'function') { + var val = callback.call(context, this.elements[i].value, this.elements[i].key, this.elements); + newAry.push(this.elements[i].value); } } - } catch (e) { - bln = false; + return newAry; } - - return bln; - }, - // 获取Map中所有key的数组(array) - this.keys = function() { - var arr = new Array(); - for (i = 0; i < this.elements.length; i++) { - arr.push(this.elements[i].key); - } - return arr; - }, - // 获取Map中所有value的数组(array) - this.values = function() { - var arr = new Array(); - for (i = 0; i < this.elements.length; i++) { - arr.push(this.elements[i].value); - } - return arr; - }, - // map遍历数组 - this.forEach = function forEach(callback,context){ - context = context || window; - var newAry = new Array(); - for(var i = 0; i < this.elements.length;i++) { - if(typeof  callback === 'function') { - var val = callback.call(context,this.elements[i].value,this.elements[i].key,this.elements); - newAry.push(this.elements[i].value); - } - } - return newAry; - } } //计算文字的宽度 -function textSize(fontSize,fontFamily,text){ - var span = document.createElement("span"); - var result = {}; - result.width = span.offsetWidth; - result.height = span.offsetHeight; - span.style.visibility = "hidden"; - span.style.fontSize = fontSize; - span.style.fontFamily = fontFamily; - span.style.display = "inline-block"; - document.body.appendChild(span); - if(typeof span.textContent != "undefined"){ - span.textContent = text; - }else{ - span.innerText = text; - } - if(window.getComputedStyle){ - result.width = parseInt(window.getComputedStyle(span).width) - result.width; - result.height = parseInt(window.getComputedStyle(span).height) - result.height; - }else{ - //针对IE9以下兼容 - result.width = parseInt(span.offsetWidth) - result.width; - result.height = parseInt(span.offsetHeight) - result.height; +function textSize(fontSize, fontFamily, text) { + var span = document.createElement("span"); + var result = {}; + result.width = span.offsetWidth; + result.height = span.offsetHeight; + span.style.visibility = "hidden"; + span.style.fontSize = fontSize; + span.style.fontFamily = fontFamily; + span.style.display = "inline-block"; + document.body.appendChild(span); + if (typeof span.textContent != "undefined") { + span.textContent = text; + } else { + span.innerText = text; } - return result; + if (window.getComputedStyle) { + result.width = parseInt(window.getComputedStyle(span).width) - result.width; + result.height = parseInt(window.getComputedStyle(span).height) - result.height; + } else { + //针对IE9以下兼容 + result.width = parseInt(span.offsetWidth) - result.width; + result.height = parseInt(span.offsetHeight) - result.height; + } + return result; } //打印材料清单(包含了装配页面,聚合包页面,器械包定义页面) -function printTousseDefinitionMaterial(ids){ - TousseDefinitionTableManager.getTousseDefinition(ids,function(jsonStr){ +function printTousseDefinitionMaterial(ids) { + TousseDefinitionTableManager.getTousseDefinition(ids, function (jsonStr) { var result = JSON.parse(jsonStr); - if(result.success){ - var tousses = result.tousseDefinitions; - if(tousses!=null && tousses.length > 0){ - top.Ext.Msg.show({ - title: '输入打印份数', - msg: '打印份数:', - width: 100, - buttons: Ext.MessageBox.OKCANCEL, - prompt : true, - fn: function(bu, txt) { - if(bu == 'ok'){ - if(isNaN(txt) == false){ - Ext.MessageBox.progress('打印中', '请稍候...'); - var curNumber = 0; - var count = Number(txt) * tousses.length; - for(var j = 0 ; j< Number(txt) ; j++){ - for(var i=0;i 0) { + top.Ext.Msg.show({ + title: '输入打印份数', + msg: '打印份数:', + width: 100, + buttons: Ext.MessageBox.OKCANCEL, + prompt: true, + fn: function (bu, txt) { + if (bu == 'ok') { + if (isNaN(txt) == false) { + Ext.MessageBox.progress('打印中', '请稍候...'); + var curNumber = 0; + var count = Number(txt) * tousses.length; + for (var j = 0; j < Number(txt); j++) { + for (var i = 0; i < tousses.length; i++) { + var toussedef = tousses[i]; + ++curNumber; + Ext.MessageBox.updateProgress((curNumber) / count, '第' + (curNumber) + '个,共' + count + '个'); + printTousseDefinitionMaterialsInTousseView(toussedef, 1); + } + } + hideMessageBox(false); + } else { + showResult("打印份数必须是数字,请重新输入!"); + } + } + }, + animEl: 'addAddressBtn', + value: '1' + }); + } + } + }); } //html转base64编码 (function (root, factory) { - if (typeof define === "function" && define.amd) { - define([], factory); - } else if (typeof module === "object" && module.exports) { - module.exports = factory(); - } else { - root.Base64 = factory(); - } + if (typeof define === "function" && define.amd) { + define([], factory); + } else if (typeof module === "object" && module.exports) { + module.exports = factory(); + } else { + root.Base64 = factory(); + } }(this, function () { - 'use strict'; + 'use strict'; - function Base64() { - // private property - this._keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; - } - //public method for encoding - Base64.prototype.encode = function (input) { - var output = "", chr1, chr2, chr3, enc1, enc2, enc3, enc4, i = 0; - input = this._utf8_encode(input); - while (i < input.length) { - chr1 = input.charCodeAt(i++); - chr2 = input.charCodeAt(i++); - chr3 = input.charCodeAt(i++); - enc1 = chr1 >> 2; - enc2 = ((chr1 & 3) << 4) | (chr2 >> 4); - enc3 = ((chr2 & 15) << 2) | (chr3 >> 6); - enc4 = chr3 & 63; - if (isNaN(chr2)) { - enc3 = enc4 = 64; - } else if (isNaN(chr3)) { - enc4 = 64; - } - output = output + - this._keyStr.charAt(enc1) + this._keyStr.charAt(enc2) + - this._keyStr.charAt(enc3) + this._keyStr.charAt(enc4); - } - return output; - } + function Base64() { + // private property + this._keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; + } + //public method for encoding + Base64.prototype.encode = function (input) { + var output = "", chr1, chr2, chr3, enc1, enc2, enc3, enc4, i = 0; + input = this._utf8_encode(input); + while (i < input.length) { + chr1 = input.charCodeAt(i++); + chr2 = input.charCodeAt(i++); + chr3 = input.charCodeAt(i++); + enc1 = chr1 >> 2; + enc2 = ((chr1 & 3) << 4) | (chr2 >> 4); + enc3 = ((chr2 & 15) << 2) | (chr3 >> 6); + enc4 = chr3 & 63; + if (isNaN(chr2)) { + enc3 = enc4 = 64; + } else if (isNaN(chr3)) { + enc4 = 64; + } + output = output + + this._keyStr.charAt(enc1) + this._keyStr.charAt(enc2) + + this._keyStr.charAt(enc3) + this._keyStr.charAt(enc4); + } + return output; + } - // public method for decoding - Base64.prototype.decode = function (input) { - var output = "", chr1, chr2, chr3, enc1, enc2, enc3, enc4, i = 0; - input = input.replace(/[^A-Za-z0-9\+\/\=]/g, ""); - while (i < input.length) { - enc1 = this._keyStr.indexOf(input.charAt(i++)); - enc2 = this._keyStr.indexOf(input.charAt(i++)); - enc3 = this._keyStr.indexOf(input.charAt(i++)); - enc4 = this._keyStr.indexOf(input.charAt(i++)); - chr1 = (enc1 << 2) | (enc2 >> 4); - chr2 = ((enc2 & 15) << 4) | (enc3 >> 2); - chr3 = ((enc3 & 3) << 6) | enc4; - output = output + String.fromCharCode(chr1); - if (enc3 != 64) { - output = output + String.fromCharCode(chr2); - } - if (enc4 != 64) { - output = output + String.fromCharCode(chr3); - } - } - output = this._utf8_decode(output); - return output; - } - // private method for UTF-8 encoding - Base64.prototype._utf8_encode = function (string) { - string = string.replace(/\r\n/g, "\n"); - var utftext = ""; - for (var n = 0; n < string.length; n++) { - var c = string.charCodeAt(n); - if (c < 128) { - utftext += String.fromCharCode(c); - } else if ((c > 127) && (c < 2048)) { - utftext += String.fromCharCode((c >> 6) | 192); - utftext += String.fromCharCode((c & 63) | 128); - } else { - utftext += String.fromCharCode((c >> 12) | 224); - utftext += String.fromCharCode(((c >> 6) & 63) | 128); - utftext += String.fromCharCode((c & 63) | 128); - } + // public method for decoding + Base64.prototype.decode = function (input) { + var output = "", chr1, chr2, chr3, enc1, enc2, enc3, enc4, i = 0; + input = input.replace(/[^A-Za-z0-9\+\/\=]/g, ""); + while (i < input.length) { + enc1 = this._keyStr.indexOf(input.charAt(i++)); + enc2 = this._keyStr.indexOf(input.charAt(i++)); + enc3 = this._keyStr.indexOf(input.charAt(i++)); + enc4 = this._keyStr.indexOf(input.charAt(i++)); + chr1 = (enc1 << 2) | (enc2 >> 4); + chr2 = ((enc2 & 15) << 4) | (enc3 >> 2); + chr3 = ((enc3 & 3) << 6) | enc4; + output = output + String.fromCharCode(chr1); + if (enc3 != 64) { + output = output + String.fromCharCode(chr2); + } + if (enc4 != 64) { + output = output + String.fromCharCode(chr3); + } + } + output = this._utf8_decode(output); + return output; + } + // private method for UTF-8 encoding + Base64.prototype._utf8_encode = function (string) { + string = string.replace(/\r\n/g, "\n"); + var utftext = ""; + for (var n = 0; n < string.length; n++) { + var c = string.charCodeAt(n); + if (c < 128) { + utftext += String.fromCharCode(c); + } else if ((c > 127) && (c < 2048)) { + utftext += String.fromCharCode((c >> 6) | 192); + utftext += String.fromCharCode((c & 63) | 128); + } else { + utftext += String.fromCharCode((c >> 12) | 224); + utftext += String.fromCharCode(((c >> 6) & 63) | 128); + utftext += String.fromCharCode((c & 63) | 128); + } - } - return utftext; - } + } + return utftext; + } - // private method for UTF-8 decoding - Base64.prototype._utf8_decode = function (utftext) { - var string = "", i = 0, c = 0, c1 = 0, c2 = 0, c3 = 0; - while (i < utftext.length) { - c = utftext.charCodeAt(i); - if (c < 128) { - string += String.fromCharCode(c); - i++; - } else if ((c > 191) && (c < 224)) { - c2 = utftext.charCodeAt(i + 1); - string += String.fromCharCode(((c & 31) << 6) | (c2 & 63)); - i += 2; - } else { - c2 = utftext.charCodeAt(i + 1); - c3 = utftext.charCodeAt(i + 2); - string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63)); - i += 3; - } - } - return string; - } + // private method for UTF-8 decoding + Base64.prototype._utf8_decode = function (utftext) { + var string = "", i = 0, c = 0, c1 = 0, c2 = 0, c3 = 0; + while (i < utftext.length) { + c = utftext.charCodeAt(i); + if (c < 128) { + string += String.fromCharCode(c); + i++; + } else if ((c > 191) && (c < 224)) { + c2 = utftext.charCodeAt(i + 1); + string += String.fromCharCode(((c & 31) << 6) | (c2 & 63)); + i += 2; + } else { + c2 = utftext.charCodeAt(i + 1); + c3 = utftext.charCodeAt(i + 2); + string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63)); + i += 3; + } + } + return string; + } - var Base64 = new Base64(); + var Base64 = new Base64(); - return Base64; + return Base64; })); //SZYK-27:提示上传设备运行物理参数 -function showPromptUploadDeviceParameterPicture(warningType){ +function showPromptUploadDeviceParameterPicture(warningType) { var params = {}; - if(warningType){ + if (warningType) { params = { - warningType:warningType + warningType: warningType } } - Ext.Ajax.request({ - url : WWWROOT + '/system/systemWarningAction!promptUploadDeviceParameterPicture.do', - method : 'POST', - params : params, - success : function someFn(response, request){ - var result = Ext.decode(response.responseText, true); - if(result.data.length > 0){ - var tipGrid = new Ext.grid.GridPanel({ - store: new Ext.data.Store({ - reader : new Ext.data.JsonReader({ - fields : ["content"] - }) - }), - columns: [ - {header: "提示内容", width: 600, dataIndex: 'content'} - ], - stripeRows: true, - viewConfig: { - forceFit:true - }, - hideHeaders:true, - height:200, - width:580 - }); - var data = []; - for(var i = 0;i < result.data.length;i++){ - //需要提示的告警类型 - var content = result.data[i]; - data.push({ - content:content - }); - } - tipGrid.getStore().loadData(data); - var tipWindow = new Ext.Window({ - autoHeight:true, - title : '提示信息', - width:600, - height:400, - draggable:true, - modal:true, - closeAction:'close', - items:[tipGrid] - }); - tipWindow.show(); - Ext.QuickTips.init(); - } + Ext.Ajax.request({ + url: WWWROOT + '/system/systemWarningAction!promptUploadDeviceParameterPicture.do', + method: 'POST', + params: params, + success: function someFn(response, request) { + var result = Ext.decode(response.responseText, true); + if (result.data.length > 0) { + var tipGrid = new Ext.grid.GridPanel({ + store: new Ext.data.Store({ + reader: new Ext.data.JsonReader({ + fields: ["content"] + }) + }), + columns: [ + { header: "提示内容", width: 600, dataIndex: 'content' } + ], + stripeRows: true, + viewConfig: { + forceFit: true + }, + hideHeaders: true, + height: 200, + width: 580 + }); + var data = []; + for (var i = 0; i < result.data.length; i++) { + //需要提示的告警类型 + var content = result.data[i]; + data.push({ + content: content + }); + } + tipGrid.getStore().loadData(data); + var tipWindow = new Ext.Window({ + autoHeight: true, + title: '提示信息', + width: 600, + height: 400, + draggable: true, + modal: true, + closeAction: 'close', + items: [tipGrid] + }); + tipWindow.show(); + Ext.QuickTips.init(); + } } - }); + }); } /** * 创建am4charts图形 * @param {参数} chartsData */ -function createCharts(doc,chartsData) { +function createCharts(doc, chartsData) { var dataArr = []; var w = doc.contentWindow.document.body.clientWidth; - for (var i = 0; i < chartsData.xAxisData.length; i++) { - var date = chartsData.xAxisData[i]; - var obj = {}; - obj['date'] = date; - dataArr[i] = obj; - for (var j = 0; j < chartsData.seriesData.length; j++) { - var data = chartsData.seriesData[j].data[i]; - obj[chartsData.seriesData[j].name] = data; - } - dataArr[i] = obj; + for (var i = 0; i < chartsData.xAxisData.length; i++) { + var date = chartsData.xAxisData[i]; + var obj = {}; + obj['date'] = date; + dataArr[i] = obj; + for (var j = 0; j < chartsData.seriesData.length; j++) { + var data = chartsData.seriesData[j].data[i]; + obj[chartsData.seriesData[j].name] = data; + } + dataArr[i] = obj; } doc.contentWindow.document.getElementById("echartJs").style.width = (w - 40) + 'px'; - doc.contentWindow.document.getElementById("chartData").value = JSON.stringify(dataArr); - doc.contentWindow.document.getElementById("legendData").value = JSON.stringify(chartsData.legendData); - doc.contentWindow.document.getElementById("chartType").value = chartsData.chartType; + doc.contentWindow.document.getElementById("chartData").value = JSON.stringify(dataArr); + doc.contentWindow.document.getElementById("legendData").value = JSON.stringify(chartsData.legendData); + doc.contentWindow.document.getElementById("chartType").value = chartsData.chartType; doc.contentWindow.document.getElementById("formatter").value = chartsData.formatter || ''; doc.contentWindow.document.getElementById("title").innerHTML = chartsData.title || ''; - doc.contentWindow.document.getElementById("reloadData").click(); + doc.contentWindow.document.getElementById("reloadData").click(); } //导出图表 function exportCharts(doc) { // excel的文件名称 - var fileName = doc.contentWindow.document.getElementById('title').innerHTML || ''; - if(fileName == ''){ + var fileName = doc.contentWindow.document.getElementById('title').innerHTML || ''; + if (fileName == '') { showResult('请先查询数据'); return } - var re=/([a-zA-Z]+\=)([#a-zA-Z0-9]+)/ig; + var re = /([a-zA-Z]+\=)([#a-zA-Z0-9]+)/ig; var jsFileName = "\\disinfectsystem\\reportforms\\js\\LZString.js"; var tableHtml = doc.contentWindow.document.getElementById('table').innerHTML; //兼容IE,IE获取table会过滤引号,把引号补上去 - tableHtml = tableHtml.replace(re,'$1"$2"'); + tableHtml = tableHtml.replace(re, '$1"$2"'); //兼容IE,IE获取table是大写,要转换小写 tableHtml = tableHtml.toLowerCase(); tableHtml = Base64.encode(encodeURIComponent(tableHtml));