IntelligentRecognition/ah-jjsp-web/.svn/pristine/b3/b34b9704aafc616ec54f0b41b66...

1 line
12 KiB
Plaintext
Raw Permalink Normal View History

2024-05-24 16:09:40 +08:00
"use strict";function isEmpty(e){return null==e||""==(e=String(e)).trim()}function specialCharacter(e){return!!isEmpty(e)||!/^[a-zA-Z0-9_\u4e00-\u9fa5]{1,800}$/.test(e)}function inputCustomInt(e){return!!isEmpty(e)||!/^[0-9]{1,800}$/.test(e)}function setResourceTreeFontCss(e,a){return isEmpty(a)||("1"==a.isGroup?a.iconSkin="resource-node-icon":"1"==a.status?""!=a.devType&&(a.iconSkin="device-on-node-icon"):""!=a.devType&&(a.iconSkin="device-off-node-icon")),{}}function searchTreeNode(e){cube.publishTopic("searchTree",{devCode:e})}function getGridPageSize(e,a){a=a||10;return isEmpty(e)||"function"!=typeof e.parent||isEmpty(e.parent())||"function"!=typeof e.parent().height||isEmpty(e.parent().height())||isNaN(e.parent().height())||(e=parseInt((e.parent().height()-30)/31),!isNaN(e)&&0<e&&(a=e)),a}function inputCustomConfig(a,s,e,r){var c;isEmpty(a)||("function"==typeof a.on&&(c="","specialCharacter"==s?c=/[^`~!@#$^&*()=|{}:;,\\\[\]\.<>\/?~@#¥……&*()——|{}\-·‘’“”《》%_\+【】;:""。,、?]$/:"int"==s?c=/[0-9]$/:"number"==s?c=/[0-9.\-]$/:"ipv4"==s?c=/[0-9.]$/:"ipv6"==s?c=/[0-9A-Fa-f:]$/:"ip"==s?c=/[0-9.A-Fa-f:]$/:"prov"==s&&(c=/[0-9a-zA-Z!@]$/),""!=c&&(a.on("keydown",function(e){return!!(e.ctrlKey||8==e.keyCode||16==e.keyCode||isEmpty(e.key)||c.test(e.key))}),a.on("keyup",function(e){return isEmpty(a.val())||("specialCharacter"==s?a.val(a.val().replace(/[`~!@#$^&*()=|{}':;',\\\[\]\.<>\/?~@#¥……&*()——|{}\-·‘’“”《》%_\+【】'""'。,、?]/g,"")):"int"==s?a.val(a.val().replace(/[^0-9]/g,"")):"number"==s?a.val(a.val().replace(/[^0-9.-]/g,"")):"ipv4"==s?a.val(a.val().replace(/[^0-9.]/g,"")):"ipv6"==s?a.val(a.val().replace(/[^0-9A-Fa-f:]/g,"")):"ip"==s?a.val(a.val().replace(/[^0-9.A-Fa-f:]/g,"")):"prov"==s&&a.val(a.val().replace(/[^0-9a-zA-Z!@]/g,""))),!1}))),"function"==typeof a.attr&&(isEmpty(e)||a.attr("placeholder",e),isEmpty(r)||(isNaN(parseInt(r))?console.log("输入框最大长度参数不合法"):a.attr("maxLength",r))))}function checkResponseData(e,a){var s=!1,r="";return e?e.successful?s=!0:r=isEmpty(e.error)?e.resultHint||a||"":(console.log(e.error),"服务端无响应,请联系管理员"):r=a||"",""!=r&&alert(r),s}function sendRestRequest(e,a,s,r,c,b,k,t){var n;isEmpty(e)?alert("请求客户端为空"):isEmpty(s)?alert("请求类型为空"):(n=cube.gatewayURL+a,isEmpty(t)||2!=t||(n=cube.commonUrl+a),showLoading(!0),"GET"==s.toUpperCase()?e.get(n,r,function(e){checkResponseData(e,c)?isEmpty(b)||"function"!=typeof b||b(e):isEmpty(k)||"function"!=typeof k||k(e),showLoading(!1)}):"POST"==s.toUpperCase()?e.post(n,JSON.stringify(r),function(e){checkResponseData(e,c)?isEmpty(b)||"function"!=typeof b||b(e):isEmpty(k)||"function"!=typeof k||k(e),showLoading(!1)}):"PUT"==s.toUpperCase()?e.put(n,JSON.stringify(r),function(e){checkResponseData(e,c)?isEmpty(b)||"function"!=typeof b||b(e):isEmpty(k)||"function"!=typeof k||k(e),showLoading(!1)}):"DELETE"==s.toUpperCase()?e.remove(n,r,function(e){checkResponseData(e,c)?isEmpty(b)||"function"!=typeof b||b(e):isEmpty(k)||"function"!=typeof k||k(e),showLoading(!1)}):(alert("请求类型不识别"),showLoading(!1)))}function getOcxErrorString(e){e+="";var a="";if(4==e.length)switch(e.substring(0,1)){case"1":a="HTTP协议-",e=e.substring(1,e.length);break;case"2":a="SIP协议-",e=e.substring(1,e.length);break;case"3":a="RTSP协议-",e=e.substring(1,e.length);break;case"4":a="RTP协议-",e=e.substring(1,e.length);break;case"5":a="SDP库-",e=e.substring(1,e.length)}switch(e){case"166":a+="请求超时";break;case"162":a+="解码器不存在";break;case"163":a+="解码器打开失败";break;case"160":a+="无效指针";break;case"167":a+="摄像头已打开";break;case"168":a+="拒绝访问";break;case"169":a+="访问对象不存在";break;case"170":a+="服务器内部错误";break;case"171":a+="超过最大负荷";break;case"172":a+="流媒体不存在";break;case"173":a+="流媒体返回的错误";break;case"174":a+="设备不在线";break;case"175":a+="设备返回的错误";break;case"176":a+="权限低,资源已被