common.min.js 109 KB

1
  1. function Cmd(CmdStr){var a;try{eval("a = "+CmdStr+";")}catch(e){a=0,alert("表达式错误: "+CmdStr+"\n请在组态程序中修正后重新发布!")}return a}function getDateString(e){var t=e.getDate(),a=e.getMonth()+1;return e.getFullYear()+"/"+a+"/"+t+" "+e.getHours()+":"+e.getMinutes()+":"+e.getSeconds()}function GetDital(e,t){var a=e;if(null==a||void 0==a)return 0;var o=a.toString().split("."),n=o.length<2?0:o[1].length;return"number"==typeof a?isNaN(a)?0:t<0?n<=7?a:a.toFixed(7):(t>7&&(t=7),n<=t?a:a.toFixed(t)):"string"==typeof a?isNaN(a)?0:(a=parseFloat(a),t<0?n<=7?a:a.toFixed(7):(t>7&&(t=7),n<=t?a:a.toFixed(t))):!0===a?1:0}function submitAddSingle(e,t,a,o,n,i){isdowncontrol()&&("True"==isAuthEnable&&i>=0?getAuthInfoByGroupId(i,function(r){r&&sendRequest(e,t,a,o,n,i)}):"True"==isAuthEnable&&-1==i?sendRequest(e,t,a,o,n,i):sendRequest(e,t,a,o,n,i,!1))}function sendRequest(e,t,a,o,n,i,r){r=void 0===r||r;var l={TagName:e,Time:a,Value:t,Quality:o};""===l.Time&&(l.Time="1900-01-01 00:00:00");var s=JSON.stringify(l);$.ajax({url:"http://"+webServiceIP+":"+webServicePort+"/api/Snapshot/?isSingleData=True",type:"POST",data:s,contentType:"application/json; charset=utf-8",success:function(a){if((a||"True"==a)&&r&&addOpera(e,e.split(".")[0],t,i,n,o,function(e){}),"string"==typeof a&&a.constructor==String)"True"!==a&&GD.createErrorDialog(300,160,a);else{var l=a.ErrorList;null!=l&&l.length>0&&GD.createErrorDialog(300,160,l[0].ErrorMsg)}},error:function(e){""===e.responseText?GD.createErrorDialog(300,160,"网络链接错误"):GD.createErrorDialog(300,160,e.responseText)},complete:function(e,t){null}})}function getHisTrendData(e,t,a,o,n){var i=t.split("&");str="http://"+webServiceIP+":"+webServicePort+"/api/HistoryInterval?tagName=",str=str+encodeURIComponent(i[0])+"&"+i[1]+"&"+i[2]+"&"+i[3]+"&"+i[4],$.ajax({url:str,type:"GET",dataType:"json",cache:!1,success:function(t){if(null===t){var i=0,r={};for(tag in a){r[tag]=[],e.series[i]={},e.series[i].name=a[tag],e.series[i].type="line",e.series[i].showSymbol=!1,e.series[i].sampling="average",e.series[i].symbol="none",e.series[i].animation=!1,e.yAxis&&e.yAxis.length>1&&a[tag+"index"]&&(e.series[i].yAxisIndex=a[tag+"index"]),n&&(e.series[i].areaStyle={normal:{}});for(c=0;c<1;c++){var l=Date.now();r[tag][c]={name:l,value:[l,null]}}e.series[i].data=r[tag],i++}}else{var s=t,i=0,r={};if(null!=s)for(tag in s){r[tag]=[],e.series[i]={},e.series[i].name=a[tag],e.series[i].type="line",e.series[i].showSymbol=!1,e.series[i].sampling="average",e.series[i].symbol="none",e.series[i].animation=!1,e.yAxis&&e.yAxis.length>1&&a[tag+"index"]&&(e.series[i].yAxisIndex=a[tag+"index"]),n&&(e.series[i].areaStyle={normal:{}}),e.legend&&e.lengend[0]&&e.lengend[0].data.push(a[tag]);for(var c=0;c<s[tag].length;c++){var d=s[tag][c].Time,u=d.split(" ")[0].split("/");u[1]<10&&(d=d.replace("/"+u[1]+"/","/0"+u[1]+"/")),u[2]<10&&(d=d.replace("/"+u[2]+" ","/0"+u[2]+" ")),d=(d=(d=d.replace("/","-")).replace("/","-")).replace(" ","T");var h=moment(d).format(),g=parseFloat(s[tag][c].Value).toFixed(2);r[tag][c]={name:h,value:[h,g]}}e.series[i].data=r[tag],i++}}return o(e),r},complete:function(e,t){null},error:function(t){var n=0,i={};for(tag in a){i[tag]=[],e.series[n]={},e.series[n].name=a[tag],e.series[n].type="line",e.series[n].showSymbol=!1,e.series[n].sampling="average",e.series[n].symbol="none",e.series[n].animation=!1;for(var r=0;r<1;r++){var l=new Date;i[tag][r]={name:l,value:[l,null]}}e.series[n].data=i[tag],n++}return o(e),i}})}function getHisScatterData(e,t,a,o,n,i,r,l,s,c){function d(e,t,a,o,n){var i,r,l,s;if(o=o||.95,n=n||1.05,!f[a]&&!f[a].data)return!0;for(var c=1,d=f[a].data.length;c<d;c++)if(f[a].data[c-1][0]<=e&&f[a].data[c][0]>=e){r=f[a].data[c],l=f[a].data[c-1];break}return!(!r||!l)&&(i=(r[1]-l[1])/(r[0]-l[0])*(e-l[0])+l[1],(s=Math.abs(t/i))<=n&&s>=o)}function u(e){if(f[e])return{name:e,data:f[e].data,type:"line",symbolSize:5,smooth:!0,itemStyle:{normal:{color:f[e].color}},lineStyle:{normal:{width:2,type:"solid"}},zlevel:0,z:2,coordinateSystem:"cartesian2d",legendHoverLink:!0,hoverAnimation:!0,clipOverflow:!0,label:{normal:{position:"top"},emphasis:{position:"top"}},step:!1,smoothMonotone:null,symbol:"emptyCircle",symbolRotate:null,showSymbol:!0,showAllSymbol:!1,connectNulls:!1,sampling:"none",animationEasing:"linear",progressive:0,hoverLayerThreshold:null}}var h=a.split("&");str="http://"+webServiceIP+":"+webServicePort+"/api/HistoryInterval?tagName=",h[0]=encodeURIComponent(h[0]),str+=h.join("&");h[h.length-1].split("=")[1];var g={"UP1500-70":[[3,3.12],[3.5,21.87],[4,46.99],[4.5,76.41],[5,111.05],[5.5,153.66],[6,206.11],[6.5,268.91],[7,342.59],[7.5,427.81],[8,525.33],[8.5,638.43],[9,755.38],[9.5,880.36],[10,1007.83],[10.5,1136.81],[11,1259.98],[11.5,1375.27],[12,1477.2],[12.5,1500],[13,1500],[13.5,1500],[14,1500],[14.5,1500],[15,1500],[15.5,1500],[16,1500],[16.5,1500],[17,1500],[17.5,1500],[18,1500],[18.5,1500],[19,1500],[19.5,1500],[20,1500],[20.5,1500],[21,1500],[21.5,1500],[22,1500],[22.5,1500],[23,1500],[23.5,1500],[24,1500],[24.5,1500],[25,1500]],"UP1500-77":[[3,9.61],[3.5,32.66],[4,62.2],[4.5,98.55],[5,141.4],[5.5,194.47],[6,260.73],[6.5,338.4],[7,428.8],[7.5,535.47],[8,658.98],[8.5,794.86],[9,941.5],[9.5,1097.29],[10,1253.7],[10.5,1405.08],[11,1500],[11.5,1500],[12,1500],[12.5,1500],[13,1500],[13.5,1500],[14,1500],[14.5,1500],[15,1500],[15.5,1500],[16,1500],[16.5,1500],[17,1500],[17.5,1500],[18,1500],[18.5,1500],[19,1500],[19.5,1500],[20,1500],[20.5,1500],[21,1500],[21.5,1500],[22,1500],[22.5,1500],[23,1500],[23.5,1500],[24,1500],[24.5,1500],[25,1500]],"UP1500-82":[[3,13.45],[3.5,40.61],[4,75.35],[4.5,117.73],[5,167.55],[5.5,231.09],[6,305.77],[6.5,398.23],[7,506.15],[7.5,631.44],[8,775.54],[8.5,933.21],[9,1101.82],[9.5,1274.34],[10,1451.66],[10.5,1500],[11,1500],[11.5,1500],[12,1500],[12.5,1500],[13,1500],[13.5,1500],[14,1500],[14.5,1500],[15,1500],[15.5,1500],[16,1500],[16.5,1500],[17,1500],[17.5,1500],[18,1500],[18.5,1500],[19,1500],[19.5,1500],[20,1500],[20.5,1500],[21,1500],[21.5,1500],[22,1500],[22.5,1500],[23,1500],[23.5,1500],[24,1500],[24.5,1500],[25,1500]],"UP1500-86":[[3,15.25],[3.5,45.21],[4,82.31],[4.5,130.21],[5,185.47],[5.5,255.27],[6,337.94],[6.5,439.39],[7,558.02],[7.5,695.24],[8,852.84],[8.5,1022.71],[9,1200.46],[9.5,1384.56],[10,1500],[10.5,1500],[11,1500],[11.5,1500],[12,1500],[12.5,1500],[13,1500],[13.5,1500],[14,1500],[14.5,1500],[15,1500],[15.5,1500],[16,1500],[16.5,1500],[17,1500],[17.5,1500],[18,1500],[18.5,1500],[19,1500],[19.5,1500],[20,1500],[20.5,1500],[21,1500],[21.5,1500],[22,1500],[22.5,1500],[23,1500],[23.5,1500],[24,1500],[24.5,1500],[25,1500]],"UP1500-97":[[3,35.99],[3.5,70.24],[4,118.45],[4.5,189.36],[5,271.06],[5.5,373.13],[6,485.66],[6.5,618.62],[7,773.69],[7.5,938.57],[8,1134],[8.5,1325],[9,1500],[9.5,1500],[10,1500],[10.5,1500],[11,1500],[11.5,1500],[12,1500],[12.5,1500],[13,1500],[13.5,1500],[14,1500],[14.5,1500],[15,1500],[15.5,1500],[16,1500],[16.5,1500],[17,1500],[17.5,1500],[18,1500],[18.5,1500],[19,1500],[19.5,1500],[20,1500],[20.5,1500],[21,1500],[21.5,1500],[22,1500],[22.5,1500],[23,1500],[23.5,1500],[24,1500],[24.5,1500],[25,1500]],"UP2000-87":[[3,39.13],[3.5,69.2],[4,115.97],[4.5,169.56],[5,237.72],[5.5,322.17],[6,424.52],[6.5,543.48],[7,681.04],[7.5,839.33],[8,1017.78],[8.5,1218.45],[9,1434.4],[9.5,1664.34],[10,1901.03],[10.5,2e3],[11,2e3],[11.5,2e3],[12,2e3],[12.5,2e3],[13,2e3],[13.5,2e3],[14,2e3],[14.5,2e3],[15,2e3],[15.5,2e3],[16,2e3],[16.5,2e3],[17,2e3],[17.5,2e3],[18,2e3],[18.5,2e3],[19,2e3],[19.5,2e3],[20,2e3],[20.5,2e3],[21,2e3],[21.5,2e3],[22,2e3],[22.5,2e3],[23,2e3],[23.5,2e3],[24,2e3],[24.5,2e3],[25,2e3]],"UP2000-96":[[3,21.9],[3.5,50.77],[4,93.07],[4.5,152.92],[5,224.24],[5.5,313.3],[6,421.61],[6.5,549.9],[7,700.66],[7.5,873.8],[8,1072.22],[8.5,1296.27],[9,1535.54],[9.5,1776.91],[10,2e3],[10.5,2e3],[11,2e3],[11.5,2e3],[12,2e3],[12.5,2e3],[13,2e3],[13.5,2e3],[14,2e3],[14.5,2e3],[15,2e3],[15.5,2e3],[16,2e3],[16.5,2e3],[17,2e3],[17.5,2e3],[18,2e3],[18.5,2e3],[19,2e3],[19.5,2e3],[20,2e3],[20.5,2e3],[21,2e3],[21.5,2e3],[22,2e3],[22.5,2e3],[23,2e3],[23.5,2e3],[24,2e3],[24.5,2e3],[25,2e3]],"UP2000-103":[[3,25.84],[3.5,59.25],[4,110.59],[4.5,176.41],[5,256.57],[5.5,358.22],[6,480.73],[6.5,625.08],[7,793.84],[7.5,989.98],[8,1212.58],[8.5,1458.06],[9,1705.04],[9.5,1961.65],[10,2e3],[10.5,2e3],[11,2e3],[11.5,2e3],[12,2e3],[12.5,2e3],[13,2e3],[13.5,2e3],[14,2e3],[14.5,2e3],[15,2e3],[15.5,2e3],[16,2e3],[16.5,2e3],[17,2e3],[17.5,2e3],[18,2e3],[18.5,2e3],[19,2e3],[19.5,2e3],[20,2e3],[20.5,2e3],[21,2e3],[21.5,2e3],[22,2e3],[22.5,2e3],[23,2e3],[23.5,2e3],[24,2e3],[24.5,2e3],[25,2e3]],"UP2000-105":[[3,31.9],[3.5,67.13],[4,123.02],[4.5,190.82],[5,276.72],[5.5,384.98],[6,515.37],[6.5,669.48],[7,850.74],[7.5,1058.97],[8,1289.89],[8.5,1536.96],[9,1787.9],[9.5,2e3],[10,2e3],[10.5,2e3],[11,2e3],[11.5,2e3],[12,2e3],[12.5,2e3],[13,2e3],[13.5,2e3],[14,2e3],[14.5,2e3],[15,2e3],[15.5,2e3],[16,2e3],[16.5,2e3],[17,2e3],[17.5,2e3],[18,2e3],[18.5,2e3],[19,2e3],[19.5,2e3],[20,2e3],[20.5,2e3],[21,2e3],[21.5,2e3],[22,2e3],[22.5,2e3],[23,2e3],[23.5,2e3],[24,2e3],[24.5,2e3],[25,2e3]],"UP2000-111":[[3,41.47],[3.5,81.58],[4,140.27],[4.5,214.03],[5,309.1],[5.5,428.09],[6,571.28],[6.5,739.81],[7,937.01],[7.5,1165.17],[8,1408.25],[8.5,1645.76],[9,1882.77],[9.5,2e3],[10,2e3],[10.5,2e3],[11,2e3],[11.5,2e3],[12,2e3],[12.5,2e3],[13,2e3],[13.5,2e3],[14,2e3],[14.5,2e3],[15,2e3],[15.5,2e3],[16,2e3],[16.5,2e3],[17,2e3],[17.5,2e3],[18,2e3],[18.5,2e3],[19,2e3],[19.5,2e3],[20,2e3],[20.5,2e3],[21,2e3],[21.5,2e3],[22,2e3],[22.5,2e3],[23,2e3],[23.5,2e3],[24,2e3],[24.5,2e3],[25,2e3]],"UP2000-115":[[3,20.62],[3.5,86.52],[4,159.21],[4.5,245.16],[5,346.11],[5.5,463.73],[6,619.51],[6.5,786.99],[7,985.67],[7.5,1229],[8,1510],[8.5,1862],[9,2e3],[9.5,2e3],[10,2e3],[10.5,2e3],[11,2e3],[11.5,2e3],[12,2e3],[12.5,2e3],[13,2e3],[13.5,2e3],[14,2e3],[14.5,2e3],[15,2e3],[15.5,2e3],[16,2e3],[16.5,2e3],[17,2e3],[17.5,2e3],[18,2e3],[18.5,2e3],[19,2e3],[19.5,2e3],[20,2e3],[20.5,2e3],[21,2e3],[21.5,2e3],[22,2e3],[22.5,2e3],[23,2e3],[23.5,2e3],[24,2e3],[24.5,2e3],[25,2e3]],"UP2000-121":[[3,32.728],[3.5,102.384],[4,186.87],[4.5,290.566],[5,415.484],[5.5,550.916],[6,711.338],[6.5,893.586],[7,1068.206],[7.5,1249.736],[8,1462.6],[8.5,1731.828],[9,1911.05],[9.5,2e3],[10,2e3],[10.5,2e3],[11,2e3],[11.5,2e3],[12,2e3],[12.5,2e3],[13,2e3],[13.5,2e3],[14,2e3],[14.5,2e3],[15,2e3],[15.5,2e3],[16,2e3],[16.5,2e3],[17,2e3],[17.5,2e3],[18,2e3],[18.5,2e3],[19,2e3],[19.5,2e3],[20,2e3]],"UP2100-121":[[3,19.99],[3.5,52.61],[4,139.07],[4.5,245.15],[5,367.82],[5.5,515.07],[6,691.68],[6.5,900.32],[7,1144],[7.5,1424],[8,1745],[8.5,2100],[9,2100],[9.5,2100],[10,2100],[10.5,2100],[11,2100],[11.5,2100],[12,2100],[12.5,2100],[13,2100],[13.5,2100],[14,2100],[14.5,2100],[15,2100],[15.5,2100],[16,2100],[16.5,2100],[17,2100],[17.5,2100],[18,2100],[18.5,2100],[19,2100],[19.5,2100],[20,2100],[20.5,2100],[21,2100],[21.5,2100],[22,2100],[22.5,2100],[23,2100],[23.5,2100],[24,2100],[24.5,2100],[25,2100]],"UP3000-108":[[3,112.73],[3.5,192.94],[4,286.15],[4.5,397.02],[5,528.27],[5.5,683],[6,865.06],[6.5,1073.3],[7,1310.46],[7.5,1573.22],[8,1855.97],[8.5,2147.44],[9,2437.76],[9.5,2735.59],[10,2997.89],[10.5,2997.89],[11,2997.89],[11.5,2997.89],[12,2997.89],[12.5,2997.89],[13,2997.89],[13.5,2997.89],[14,2997.89],[14.5,2997.89],[15,2997.89],[15.5,2997.89],[16,2997.89],[16.5,2997.89],[17,2997.89],[17.5,2997.89],[18,2997.89],[18.5,2997.89],[19,2997.89],[19.5,2997.89],[20,2997.89],[20.5,2997.89],[21,2997.89],[21.5,2997.89],[22,2997.89],[22.5,2997.89],[23,2997.89],[23.5,2997.89],[24,2997.89],[24.5,2997.89],[25,2997.89]],"UP2000-129":[[3,39.46343239],[3.5,125.6432788],[4,219.4714609],[4.5,329.5487529],[5,457.4521127],[5.5,607.3637197],[6,787.3911529],[6.5,997.9767531],[7,1233.68128],[7.5,1463.094124],[8,1689.342548],[8.5,1895.26058],[9,2e3],[9.5,2e3],[10,2e3],[10.5,2e3],[11,2e3],[11.5,2e3],[12,2e3],[12.5,2e3],[13,2e3],[13.5,2e3],[14,2e3],[14.5,2e3],[15,2e3],[15.5,2e3],[16,2e3],[16.5,2e3],[17,2e3],[17.5,2e3],[18,2e3],[18.5,2e3],[19,2e3],[19.5,2e3],[20,2e3]],"UP3000-146":[[3,77.147],[3.5,185.877636],[4,293.9956907],[4.5,428.4692409],[5,594.4768116],[5.5,785.2404187],[6,1007.887492],[6.5,1258.856802],[7,1525.997884],[7.5,1808.595136],[8,2096.963],[8.5,2438.74932],[9,2667.47688],[9.5,2828],[10,2929.1],[10.5,2985],[11,3e3],[11.5,3e3],[12,3e3],[12.5,3e3],[13,3e3],[13.5,3e3],[14,3e3],[14.5,3e3],[15,3e3],[15.5,3e3],[16,3e3],[16.5,3e3],[17,3e3],[17.5,3e3],[18,3e3],[18.5,3e3],[19,3e3],[19.5,3e3],[20,3e3]],"UPT300-16":[[.7,0],[.8,3.21709],[.9,12.2613],[1,23.3403],[1.1,36.9281],[1.2,53.3618],[1.3,72.7074],[1.4,95.261],[1.5,121.28],[1.6,151.017],[1.7,184.635],[1.8,220.949],[1.9,259.063],[2,298.231],[3,300.023],[4,300.023]],ErrorData:[[.7,0],[.8,2.944],[.9,11.232],[1,20.324],[1.1,34.9281],[1.2,50.3618],[1.3,68.7074],[1.4,86.261],[1.5,113.28],[1.6,131.017],[1.7,166.635],[1.8,203.949],[1.9,235.063],[2,268.231],[2.1,268.231],[2.2,268.231],[2.3,268.231],[2.4,268.231],[2.5,268.231],[2.6,268.231],[2.7,268.231],[2.8,268.231],[2.9,268.231],[3,272.023],[3.1,272.023],[3.2,272.023],[3.3,272.023],[3.4,272.023],[3.5,272.023],[3.6,272.023],[3.7,272.023],[3.8,272.023],[3.9,272.023],[4,272.023]]},f=e._standerdData;$.ajax({url:str,type:"GET",dataType:"json",cache:!1,success:function(e){if(null===e);else{var a,o=e,u=0;!function(){var e;for(var t in f)if(f.hasOwnProperty(t)){e=t;break}"UPT"===e.substr(0,3)&&(a=e)}(),!a||"1"!==i[0]&&"0"!==i[0]||function(){var e;for(var t in f)if(f.hasOwnProperty(t)){e=t;break}var a,i=e?f[e].data||g.ErrorData:g.ErrorData,r=[],l=[];o={},a=moment(Date.now()).format("YYYY-MM-DD HH-mm-ss");for(var s=0,c=i.length;s<c;s++)r.push({Ms:0,Value:i[s][0],Time:a}),l.push({Ms:0,Value:i[s][1]-50*Math.random(),Time:a});for(var s=0,c=n.length;s<c;s++)o[n[s][0]+"trendX"]=r,o[n[s][1]+"trendY"]=l}();for(var h in o)for(var p=1,m=o[h].length;p<m;p++)"NaN"!==o[h][p-1].Value&&"NaN"===o[h][p].Value&&(o[h][p].Value=o[h][p-1].Value);for(p=0;p<n.length;p++){var v=[];v.length=0;var b=i[p];if("0"==b&&0==p){var w=o[n[p][0]],y=o[n[p][1]];if(void 0===w||"undifined"==typeof y)continue;if(w.length==y.length)for(C=0;C<w.length;C++)(T=[]).length=0,T.push(GetDital(parseFloat(w[C].Value),r)),T.push(GetDital(parseFloat(y[C].Value),r)),v.push(T)}else if("1"==b){var w=o[n[p][0]+"trendX"],y=o[n[p][1]+"trendY"];if(t.series[u].type="line",t.series[p].symbol="emptyCircle",void 0!==w&&"undefined"!=y&&w.length==y.length)for(C=0;C<w.length;C++)(T=[]).length=0,"NaN"!=w[C].Value&&"NaN"!=y[C].Value&&w[C].Value>=l&&w[C].Value<=s&&y[C].Value<=s&&y[C].Value>=l&&(T.push(GetDital(parseFloat(w[C].Value),r)),T.push(GetDital(parseFloat(y[C].Value),r)),v.push(T))}else{var w=o[n[p][0]+"purveX"],y=o[n[p][1]+"purveY"];c[n[p][0]];if(t.series[u].type="scatter",t.series[p].symbol="circle",void 0===w||"undifined"==typeof y)continue;if(w.length==y.length)for(var C=0;C<w.length;C++){var T=[];T.length=0,a?d(parseFloat(w[C].Value),parseFloat(y[C].Value),a,.95,1.1)&&(T.push(GetDital(parseFloat(w[C].Value),r)),T.push(GetDital(parseFloat(y[C].Value),r)),v.push(T)):(T.push(GetDital(parseFloat(w[C].Value),r)),T.push(GetDital(parseFloat(y[C].Value),r)),v.push(T))}}t.series[u].data=v,u++}}},error:function(){console.log("error")},complete:function(a,o){var n,r=t.series;if(!e._hadSetStanderdData){e._standCurvalLine=e._standCurvalLine||[],e._standCurvalLine.length=0;for(var l in f)f.hasOwnProperty(l)&&(r&&r.push(u(l)),t.legend&&t.legend[0]&&t.legend[0].data&&-1===t.legend[0].data.indexOf(l)&&t.legend[0].data.unshift(l));e._standCurvalLine.push(l),e._hadSetStanderdData=!0}if(t.legend&&t.legend[0]&&(t.legend[0].selectedMode="multiple"),"1"!==i[0]&&"0"!==i[0]){t&&t.legend&&t.legend[0]&&(n=detectSelectedLegend(t.legend[0].selected,1));for(var s=0,c=e._standCurvalLine.length;s<c;s++)t.legend[0].selected.hasOwnProperty(e._standCurvalLine[s])&&(n[e._standCurvalLine[s]]=t.legend[0].selected[e._standCurvalLine[s]]);t.legend[0].selected=n}else t&&t.legend&&t.legend[0]&&(t.legend[0].selected=detectSelectedLegend(t.legend[0].selected,8));e.clear(),e.setOption(t,!0)}})}function detectSelectedLegend(e,t){var a={},o=0;for(var n in e)e[n]&&o++,a[n]=!(o>t)&&e[n];return a}function getPointsSelect(e,t,a,o,n,i){var r=(e-1)*t;str="http://"+webServiceIP+":"+webServicePort+"/api/Point?start="+r+"&count="+t+"&filter="+o+"&tabfilter="+a,str=encodeURI(str),$.ajax({url:str,type:"GET",dataType:"json",cache:!1,success:function(e){if(null!=e)if(pointpros=e.PointsPros,null!=pointpros){var a=Math.ceil(e.Count/t);i.v("pagecount",a.toString());for(var o=pointpros.length,r=0;r<o;r++)datas=new ht.Data,datas.setId(r+1),datas.a("index",(r+1).toString()),datas.a("configPointDesc",pointpros[r].Desc),datas.a("configPointName",pointpros[r].TagName),datas.a("pintunit",pointpros[r].Uint),datas.a("pointtype",pointpros[r].Type),datas.a("snapvalue",""),datas.a("timestamp",""),n.add(datas);n.sm().ss(e)}else i.v("pagecount","1")},complete:function(e,t){null}})}function getKeyFromDic(e,t){for(var a in e)if(e[a]==t)return a}function SetRotatPositionRelative(e,t,a){var o=e.getPosition().x-t.getPosition().x,n=e.getPosition().y-t.getPosition().y;e.setPosition(Math.cos(a)*o-Math.sin(a)*n+t.getPosition().x,Math.cos(a)*n+Math.sin(a)*o+t.getPosition().y)}function SetRotatPositionAbsolute(e,t,a,o){var n=e.getPosition().x-t,i=e.getPosition().y-a;e.setPosition(Math.cos(o)*n-Math.sin(o)*i+t,Math.cos(o)*i+Math.sin(o)*n+a)}function initPage(){dataModel=dataModel||new ht.DataModel,graphView=graphView||new ht.graph.GraphView(dataModel),view=view||graphView.getView(),graphView.enableFlow(),graphView.enableToolTip(),selectionModel=selectionModel||dataModel.getSelectionModel(),view.className="main",graphView.graphViewList=graphView.graphViewList||[],serialData=serialData||dataModel.serialize()}function hisRefresh(option,chart){str="http://"+webServiceIP+":"+webServicePort+"/api/Snapshot?tagName=demo.demo_ai001,demo.demo_ai002,demo.demo_ai003,demo.demo_ai004",$.ajax({url:str,type:"GET",dataType:"json",cache:!1,success:function(data){if(null!==data){var snapshots=eval(data);if(null!=snapshots){var newOption={},varList=testHisOption.legend.data,dataChanged=!1;newOption.series=option.series;for(var i=0;i<snapshots.length;i++){var index=varList.indexOf(snapshots[i].TagName);if(index>=0&&index<varList.length){var tagValue=parseFloat(snapshots[i].Value),tagTime=new Date(snapshots[i].Time),len=newOption.series[index].data.length;if(void 0==len||len<=0||newOption.series[index].data[len-1][0].toString()!==tagTime.toString()||newOption.series[index].data[len-1][1]!==tagValue){dataChanged=!0;var newData=[];newData.push(tagTime),newData.push(tagValue.toFixed(2)),newOption.series[index].data.push(newData),newOption.series[index].data.length>2e4&&newOption.series[index].data.splice(0,newOption.series[index].data.length-2e4)}}}dataChanged&&chart.setOption(newOption)}}},complete:function(e,t){null}})}function getDivText(e){return $(e).text()}function creatTree(e,t,a){var o=new ht.Data;if(o.setName(e.name),t.add(o),void 0!==a&&o.setParent(a),void 0!==e.child)for(var n=0;n<e.child.length;n++)creatTree(e.child[n],t,o);return o}function getTableHisData(paneNode,cmdStr,dm,columns,rows){var paras=cmdStr.split("&");str="http://"+webServiceIP+":"+webServicePort+"/api/HistoryInterval?tagName=",str=str+encodeURIComponent(paras[0])+"&"+paras[1]+"&"+paras[2]+"&"+paras[3]+"&"+paras[4]+"&"+paras[5]+"&"+paras[6],dm.clear(),$.ajax({url:str,type:"GET",dataType:"json",cache:!1,success:function(hisdata){if(null!==hisdata){var data=hisdata.Datas,pageCount=hisdata.PageCount;if(paneNode.v("pagecount",pageCount.toString()),null!==data){var hisValues=eval(data);if(null!=hisValues)var once=!1;var length=0;for(var key in hisValues)hisValues[key].length>length&&(length=hisValues[key].length);var tagInfos=getTagInfos(columns,rows),tagInfosArr=tagInfos.split(","),rowArr,rowCount,columnsArr,columnsCount;""==columns?(rowArr=rows.split(","),columnsArr=rowArr,rowCount=1,columnsCount=columnsArr.length):(rowArr=rows.split(","),rowCount=rowArr.length,columnsArr=columns.split(","),columnsCount=columnsArr.length);for(var i=0;i<length;i++){if(rowCount<=0)return;if(columnsCount>0)for(var index=0,data=new ht.Data,rowIndex=0,j=0;j<tagInfosArr.length;j++)if(""!=columns){var indicatorName=columnsArr[index].split(":")[0];if(void 0===hisValues[tagInfosArr[j]])data.a(indicatorName,"无");else{var value=hisValues[tagInfosArr[j]][i].Value;data.a(indicatorName,GetDital(value,2))}0==index?(""!=columns&&data.a("shebei",rowArr[rowIndex].split(":")[1]),hisValues[tagInfosArr[j]]&&(data.a("time",hisValues[tagInfosArr[j]][i].Time),index+=1)):index==columnsCount-1?("false"!=rowArr[rowIndex].split(":")[2]&&dm.add(data),index=0,rowIndex+=1,data=new ht.Data):index+=1}else{var indicatorName=columnsArr[j].split(":")[0];data.a("time")||data.a("time",hisValues[tagInfosArr[j]][i].Time);var value=hisValues[tagInfosArr[j]][i].Value;data.a(indicatorName,GetDital(value,2)),j==tagInfosArr.length-1&&dm.add(data)}}}}},complete:function(e,t){null}})}function getVarValue(e){if(void 0===e||null===e)return 0;if($.isNumeric(e))return e;if(void 0!==window[e])return window[e];var t=e.toLowerCase(),a=varListObj[t];if(varListObj.hasOwnProperty(t)){if(!Number(a)||Math.ceil(a)===a)return a;try{return a.toFixed(2)}catch(e){return 0}}return varList.push(e),VarValue.push(0),varListObj[t]=0,GD.throttle(GD.GetTagsProperty,3e3),0}function getColorValue(e,t,a){if(void 0!==window[t])return window[t];for(var o=0;o<varList.length;o++)if(t&&t.toLowerCase()===varList[o].toLowerCase()){if(!Number(VarValue[o])||Math.ceil(VarValue[o])===VarValue[o]){return alarmColorData[t.toLowerCase()]?'<span style="color:'+alarmColorData[t.toLowerCase()]+'">'+e+VarValue[o]+a+"</span>":"<span>"+e+VarValue[o]+a+"</span>"}try{return alarmColorData[t.toLowerCase()]?'<span style="color:'+alarmColorData[t.toLowerCase()]+'">'+e+VarValue[o].toFixed(2)+a+"</span>":"<span>"+e+VarValue[o].toFixed(2)+a+"</span>"}catch(e){return 0}}return t?(varList.push(t),VarValue.push(0),"<span>"+e+"0"+a+"</span>"):void 0}function checkNumber(e){return/^(-)?\d+(\.\d+)?$/.test(e)}function getControlValue(e,t){var a;return e.getSelectedItem&&(a=e.getSelectedItem()),e.getValue&&(a=e.getValue()),t?checkNumber(a)?a:0:a}function setShapeOpacity(e,t,a){var o,n,i,r,l,s;if(isTextComps(e)){if(!e.a("node.background"))return;(o=(l=e.a("node.background")||"").split(",")).length>=3&&(n=l.replace(o[3]||1,t+")"),e.a("node.background",n)),(i=(s=e.a("node.gradientcolor")||"").split(",")).length>=3&&(r=s.replace(i[3]||1,t+")"),e.a("node.gradientcolor",r))}else(o=(l=e.s("shape.background")||"").split(",")).length>=3&&(n=e.getStyle("shape.background").replace(o[3]||1,t+")"),e.s({"shape.background":n})),(i=(s=e.s("shape.gradient.color")||"").split(",")).length>=3&&(r=e.getStyle("shape.gradient.color").replace(i[3]||1,t+")"),e.s({"shape.gradient.color":r}))}function setBorderOpacity(e,t,a){var o,n;if(isTextComps(e)){if(!e.a("node.color"))return;(o=e.a("node.color").split(",")).length>=3&&(n=e.a("node.color").replace(o[3],t+")"),e.a("node.color",n))}else(o=e.s("shape.border.color").split(",")).length>=3&&(n=e.getStyle("shape.border.color").replace(o[3],t+")"),e.s({"shape.border.color":n}))}function setDashStyle(e,t,a,o){o&&(isTextComps(e)?getDashStyle(a).length>0?(e.a("node.borderwidth",o),e.a("node.borderPattern",getDashStyle(a))):e.a("node.borderwidth",0):getDashStyle(a).length>0?(e.s({"shape.border.width":o}),e.s({"shape.border.pattern":getDashStyle(a)})):e.s({"shape.border.width":0}))}function setColor(e,t,a,o){isTextComps(e)?"textBackColor"==o?e.a("node.background",a):"textForeColor"==o?e.a("node.gradientcolor",a):"textColor"==o?e.a("node.color",a):"backColor"==o?e.a("node.background",a):"foreColor"==o?e.a("node.gradientcolor",a):"lineColor"==o&&e.a("node.color",a):"backColor"==o?e.s("shape.background",a):"foreColor"==o?e.s("shape.gradient.color",a):"lineColor"==o&&e.s("shape.border.color",a)}function getDashStyle(e){return"Solid"===e?[0,0]:"LinePoint"===e?[3,3]:"LineSegment"===e?[8,8]:[]}function toScreenPosition(e){var t=graphView.tx(),a=graphView.ty(),o=graphview.getZoom();return{x:e.x*o+t,y:e.y*o+a}}function addNodeToContainer(e,t,a,o){if(!(o.length<=0)){for(var n,i,r,l,s=a.getDataModel(),c=[],d=!!t._allowChildScale,u=0;u<o.length;u++){i=(n=o[u]).childNodes,0,n.scalable=d;for(var h=0,g=i.length;h<g;h++)void 0!==(r=i[h])&&(r.scalable=d,d||resizeOneNodes(r,1/ratio.ratioX,1/ratio.ratioY,!0),"pieDoughnut"===r._nodeType&&((l=r.__background)&&e.remove(l),l&&s.add(l),r.addChild(l),(l=r.__text)&&e.remove(l),l&&s.add(l),r.addChild(l),(l=r.__pie)&&e.remove(l),l&&s.add(l),r.addChild(l)),e.remove(r),s.add(r));n.calcSize(),n.nodeList=i,c.push(n)}a.blockList=c,copyEventFromView(a,t)}}function copyEventFromView(e,t){var a,o,n,i;setTimeout(function(){a=view&&view.eventList||{};for(var r in a)a.hasOwnProperty(r)&&("contextMenu"===r?(i=a[r].beforeShow||function(){},a[r].beforeShow=function(t){e&&e.getDataAt(t)&&t.originEvent&&t.originEvent.stopPropagation(),i.call(this,t,e)},a[r].addTo(e.getView())):e.getView()["on"+r]=function(i){o=i.type,n=t.getPosition(),"function"==typeof a[o]&&a[o](i,e,{x:n.x-t.getWidth()/2,y:n.y-t.getHeight()/2}),i.preventDefault()})},800)}function nodesToMap(e,t,a,o,n){if(!(a.length<=0)){var i,r,l,s,c,d,u,h,g,f=e.getPosition();graphView.graphViewList=graphView.graphViewList||[],graphView.graphViewList.push(n);for(var p=0;p<a.length;p++)if(u=a[p]&&a[p].node,g=a[p]&&a[p].isFixed,u)for(var m=0,v=(u=u._baseClass&&u._baseClass.match("ht.lib.")?u.childNodes:[u]).length;m<v;m++)i=(d=u[m]).getPosition(),dataModel.remove(d),s=d.getWidth(),c=d.getHeight(),r=t.pixelToPoint({x:i.x-f.x,y:i.y-f.y}),l=t.pixelToPoint({x:i.x+s-f.x,y:i.y+c-f.y}),d.lonLat=r,d.diagonalPoint=l,d.isFixed=g,g&&(h=graphView.getZoom(),d.originPositionAndSize={x:(i.x-f.x+e.getWidth()/2)*h,y:(i.y-f.y+e.getHeight()/2)*h,w:d.getWidth(),h:d.getHeight()},d.lonLat=null,d.diagonalPoint=null),o.add(d);copyEventFromView(n,e)}}function resetPosition(e,t,a,o){a.tx(0),a.ty(0),t.each(function(t){var a,n,i,r,l,s;t instanceof ht.Node&&(t.lonLat&&!t.isFixed?(a=t.lonLat,n=e.pointToPixel(a),o&&(r=(i=e.pointToPixel(t.diagonalPoint)).x-n.x,l=i.y-n.y,t.setWidth(r),t.setHeight(l)),t.setPosition(n.x,n.y)):t.lonLat&&t.isFixed?(a=t.lonLat,n=e.pointToPixel(a),t.setPosition(n.x,n.y),t.lonLat=null):t.originPositionAndSize&&t.isFixed&&(s=graphView.getZoom(),n=t.originPositionAndSize,t.setPosition(n.x*s,n.y*s),t.setWidth(n.w*s),t.setHeight(n.h*s)))})}function createPageTooltip(e,t,a,o,n,i){switch(GD.hideTagInfo(),i=i||"def",e.setPosition(t+.5*e.getWidth(),a+.5*e.getHeight()),e.setHtml('<div class="tooltip" ><div class="tooltop" style="background-color:'+o.backColor+";color:"+o.fontColor+";font:"+o.fontSize+"px "+o.fontFamily+";padding:"+o.padding+';"><span></span><ul><li>'+o.value+'</li></ul></div><div class="toolcon" style="background-color:'+n.backColor+";color:"+n.fontColor+";font:"+n.fontSize+"px "+n.fontFamily+";padding:"+n.padding+';"><ul><li>'+n.value+"</li></ul></div></div>"),e.s("2d.visible",!0),e.tip=null,i.toLowerCase()){case"up":t-=e.getWidth()/2,a-=e.getHeight();break;case"down":t-=e.getWidth()/2,a+=e.getHeight()/2;break;case"left":t-=e.getWidth(),a-=e.getHeight()/2;break;case"right":t+=e.getWidth()/2,a-=e.getHeight()/2;break;case"leftup":t-=e.getWidth(),a-=e.getHeight();break;case"leftdown":t-=e.getWidth();break;case"rightup":a-=e.getHeight()}createDomToolTip(e,t,a)}function changeToolTipContent(e,t,a){if(void 0!==e&&!0===e.s("2d.visible")){var o='<div class="tooltop" style="background-color:'+t.backColor+";color:"+t.fontColor+";font:"+t.fontSize+"px "+t.fontFamily+";padding:"+t.padding+';"><span></span><ul><li>'+t.value+'</li></ul></div><div class="toolcon" style="background-color:'+a.backColor+";color:"+a.fontColor+";font:"+a.fontSize+"px "+a.fontFamily+";padding:"+a.padding+';"><ul><li>'+a.value+"</li></ul></div>";e.setHtml('<div class="tooltip">'+o+"</div>"),"function"==typeof e.getStyle&&e.getStyle("2d.visible")&&createDomToolTip(e,0,0,o)}}function changeToolTipContentColor(e,t,a){if(void 0!==e&&!0===e.s("2d.visible")){var o='<div class="tooltop" style="background-color:'+t.backColor+";color:"+t.fontColor+";font:"+t.fontSize+"px "+t.fontFamily+";padding:"+t.padding+';"><span></span><ul><li>'+t.value+'</li></ul></div><div class="toolcon" style="background-color:'+a.backColor+";color:"+a.fontColor+";font:"+a.fontSize+"px "+a.fontFamily+";padding:"+a.padding+';"><ul><li>'+a.value+"</li></ul></div>";e.setHtml('<div class="tooltip">'+o+"</div>"),"function"==typeof e.getStyle&&e.getStyle("2d.visible")&&createDomToolTip(e,0,0,o)}}function getAlarmDataColor(){null!=window.socket&&""!=window.socket&&socket.alarmPost("/alarm/GetTagState",varList,function(e){if(e&&e.success){var t=e.data;alarmColorData={};for(var a=0;a<t.length;a++)2!=t[a].state&&4!=t[a].state||(alarmColorData[t[a].name.toLowerCase()]=ARGB2HexString(t[a].color))}})}function createDomToolTip(e,t,a,o){var n=e.tip||$(e.getHtml());if(o)n.html(o);else{destoryDomToolTip();var i=$window.width(),r=$window.height(),l=e.getWidth(),s=e.getHeight();t+l>i&&(t-=l),a+s>r&&(a-=s),n.width("auto"),n.height("auto"),n.css({position:"absolute",top:a,left:t}),$("body").append(n),e.tip=n}}function destoryDomToolTip(){$(".tooltip").remove()}function canvasTextAutoLine(e,t,a,o,n,i,r,l,s,c,d){d.fillStyle=l,d.font=s,d.textAlign=r;var u=d;"number"==typeof e&&(e=e.toString()),"center"==r&&(t+=.5*o),"right"==r&&(t+=o);var h=u.measureText(e).width;a=(n-(Math.floor(h/o)+c-1)*i)/2;u.textBaseLine="top";var g=u.measureText("口").width,f=Math.floor(o/g),p=Math.ceil(e.length/f)*i;a=p>n?0:.5*(n-p),u.wrapFillText(e,t,a+i,o,i),d.closePath()}function drawRoundRect(e,t,a,o,n,i,r,l,s){var c=t,d=a,u=o,h=n;i<=0&&(i=1),r<=0&&(r=1),r*=2,(i*=2)>u&&(i=u),r>h&&(r=h),e.beginPath(),e.strokeStyle=l,e.lineWidth=s||1,e.ellipse(c+.5*i,d+.5*r,.5*i,.5*r,0,Math.PI,1.5*Math.PI),e.lineTo(c+u-.5*i,d),e.ellipse(c+u-.5*i,d+.5*r,.5*i,.5*r,0,1.5*Math.PI,2*Math.PI),e.lineTo(c+u,d+h-.5*r),e.ellipse(c+u-.5*i,d+h-.5*r,.5*i,.5*r,0,0,.5*Math.PI),e.lineTo(c+.5*i,d+h),e.ellipse(c+.5*i,d+h-.5*r,.5*i,.5*r,0,.5*Math.PI,Math.PI),e.closePath(),e.stroke()}function drawRect(e,t,a,o,n,i){e.beginPath(),e.moveTo(t,a),e.lineTo(o,a),e.lineTo(o,n),e.lineTo(t,n),e.closePath(),i&&(e.strokeStyle=i,e.stroke())}function getArrMatch(e,t){if(!(e.length<=0))for(var a=0;a<e.length;a++)if(t.indexOf(e[a])>0)return e[a]}function setSnapshotValue(e){for(var t=e._datas._as,a=0;a<t.length;a++){var o=e.getDataById(t[a]._id),n=o.a("configPointName");o.a("snapvalue",getVarValue(n)),o.a("timestamp",VarSnapshotTime[n.toLowerCase()])}}function exportCsv(e){e.title;var t=e.titleForKey,a=e.data,o=[];o.push(e.title.join(",")+"\n");for(var n=0;n<a.length;n++){for(var i=[],r=0;r<t.length;r++)i.push(a[n][t[r]]);o.push(i.join(",")+"\n")}var l="data:text/csv;charset=utf-8,"+encodeURIComponent(o.join("")),s=document.createElement("a");s.href=l,s.download="export"+moment(new Date).format("YYYYMDDTHHmmss")+".csv",document.body.appendChild(s),s.click(),document.body.removeChild(s)}function ARGB2HexString(e){if(e>0){var t=(e=parseInt(e,10)).toString(16);t.length<6&&(t+="00")}return"#"+t}function exportInterExcel(e,t,a,o,n){n||(n="");var i="beginTime="+e;i+="&endTime="+t,i+="&interval="+a,i+="&tagName="+encodeURIComponent(n),i+="&valueType="+o;var r=document.createElement("a");r.download="exportExcel",r.href="http://"+webServiceIP+":"+webServicePort+"/api/ExportToExcelInterpo?"+encodeURI(i),r.click()}function getPercentValue(e,t,a){return jQuery.isNumeric(Number(e))&&jQuery.isNumeric(Number(t))&&jQuery.isNumeric(Number(a))?(Number(e)-Number(t))/(Number(a)-Number(t))*100:0}function resizeAllNodes(e,t,a){t&&a&&(e.each(function(e){resizeOneNodes(e,t,a)}),e===dataModel&&_libModel.each(function(e){resizeOneNodes(e,t,a)}))}function resizeOneNodes(e,t,a,o){var n,i,r,l,s,c,d,u,h,g;(!1!==e.scalable&&!e.__parentLib&&!e.__blockChild||o)&&(t=t||graphView.ratioX,a=a||graphView.ratioY,g=e&&"function"==typeof e.getRotation?180*e.getRotation()/Math.PI:0,h=GD.getRatioWithRotation(g*Math.PI/180,t,a),e._zoomBy?"False"===e._zoomBy||"false"===e._zoomBy?(d=1,u=1):"Default"===e._zoomBy?(d=h.ratioX,u=h.ratioY):"X"===e._zoomBy?(d=h.ratioX,u=h.ratioX):"Y"===e._zoomBy&&(d=h.ratioY,u=h.ratioY):(d=h.ratioX,u=h.ratioY),n=e.getWidth(),i=e.getHeight(),r=(s=e.getPosition()).x+5,l=s.y+5,e.originWidth=e.originWidth||n,e.originHeight=e.originHeight||i,e.originPosition=e.originPosition||s,n*=d,i*=u,e.isEqualRatio&&(e.lastWidth=e.lastWidth||e.originWidth,e.lastHeight=e.lastHeight||e.originHeight,e.lastWidth*=d,e.lastHeight*=u,i=n=e.lastWidth>e.lastHeight?e.lastHeight:e.lastWidth),e.setWidth(n),e.setHeight(i),e.setPosition(r*t,l*a),e.originPositionAndSize&&((c=e.originPositionAndSize).x*=t,c.y*=a,c.w*=d,c.h*=u))}function drawEllipse(e,t,a,o,n){var i=o/2*.5522848,r=n/2*.5522848,l=t+o,s=a+n,c=t+o/2,d=a+n/2;e.beginPath(),e.moveTo(t,d),e.bezierCurveTo(t,d-r,c-i,a,c,a),e.bezierCurveTo(c+i,a,l,d-r,l,d),e.bezierCurveTo(l,d+r,c+i,s,c,s),e.bezierCurveTo(c-i,s,t,d+r,t,d),e.closePath()}function showPage(){graphView.tx(0),graphView.ty(0),graphView.setZoom(1),document.body.appendChild(view),setTimeout(function(){window.refreshAlarmInfoWindow&&refreshAlarmInfoWindow()},500)}function batchOpertation(e,t,a,o,n,i){if(!(e.length<=0)){var r=e.split(";");if(!(r.length<=0)){for(var l=[],i=i||0,s=0;s<r.length;s++){var c={TagName:r[s]+t,Time:"",Value:a,Quality:o};""===c.Time&&(c.Time="1900-01-01 00:00:00"),l.push(c)}"True"==isAuthEnable&&i>=0?getAuthInfoByGroupId(i,function(e){e&&submitBatch(l,n)}):(isAuthEnable,submitBatch(l,n))}}}function submitBatch(e,t){if(t=t||"",isdowncontrol()){var a=JSON.stringify(e);$.ajax({url:"http://"+webServiceIP+":"+webServicePort+"/api/Snapshot/",type:"POST",data:a,contentType:"application/json; charset=utf-8",success:function(a){if("string"==typeof a&&a.constructor==String)"True"!==a&&GD.createErrorDialog(360,160,a);else{var o=a.ErrorList;null!=o&&o.length>0?GD.createErrorDialog(360,160,o[0].ErrorMsg):function(){var a,o,n,i,r;n=GD.getParams("userGroup")||0;for(var l=0,s=e.length;l<s;l++)a=(i=e[l]).TagName||"",o=i.Value,r=i.Quality,addOpera(a,a.split(".")[0],o,n,t,r,function(e){})}()}},error:function(e){""===e.responseText?GD.createErrorDialog(360,160,"网络链接错误"):GD.createErrorDialog(360,160,e.responseText)},complete:function(e,t){null}})}}function convertNumberToIntAndFloat(e,t){var a,o={};return e=parseFloat(e),e=e||0,t=parseInt(t),t=t!==t?2:t,e=e.toFixed(t,10),a=e.split("."),o.int=a[0],o.float=a[1]||"0",o}function searchStrToObj(e){var t,a,o={};e=e||window.location.search;for(var n=0,i=(t=(e=-1===(e=decodeURIComponent(e)).indexOf("?")?e:e.substr(e.indexOf("?")+1)).split("&")).length;n<i;n++)-1!==t[n].indexOf("=")&&(a=t[n].split("="))[1]&&(o[a[0]]=a[1]);return o}function getRelativeDate(e,t,a){function o(e,t){var a=moment(e).format(i[t]||i.datetime);return"Invalid date"===a?e:a}var n=new Date,i={date:"YYYY-MM-DD",time:"HH:mm:ss",datetime:"YYYY-MM-DD HH:mm:ss",year:"YYYY",month:"YYYY-MM"};return"begin"===a?(n.setHours(0),n.setMinutes(0),n.setSeconds(0),n.setMilliseconds(0)):"end"===a&&(n.setHours(23),n.setMinutes(59),n.setSeconds(59),n.setMilliseconds(0)),""===e?o(n,t):(n=function(e,t){var a=parseInt(t);if(a!==a)return t;switch(t.substr(a.toString().length)){case"h":case"hour":e.setHours(e.getHours()-a);break;case"d":case"day":e.setDate(e.getDate()-a);break;case"m":case"month":e.setMonth(e.getMonth()-a);break;case"y":case"year":e.setFullYear(e.getFullYear()-a);break;default:e=t}return e}(n,e),o(n,t))}function createTab(e,t){var a=e.getTabModel(),o=new ht.Tab;o.setName(t.name),o.setTag(t.name),o.setView(t.view),o.a("currentData",t.currentData),o.a("curAlarmIndex",t.index),a.add(o),t.selected&&a.getSelectionModel().setSelection(o)}function createDialogWithTabView(e,t,a,o){var n=new ht.widget.Dialog,i=new ht.widget.TabView;t.forEach(function(e,t){createTab(i,e)}),i.setLabelColor(o.paneSysFontColor),i.setTabBackground(o.paneSysBackColor),i.onTabChanged=t.onTabChanged,e.content=i,n.setConfig(e),n.tabView=i,n.tabModel=i.getTabModel();var r=$(n.getView()).find(".dialog-container"),l=r.find(".dialog-container-title"),s=!1,c=r.height(),d=parseInt(r.css("top")),u=l.height()||24;r.css({zIndex:99,top:"",left:"",right:"5px",bottom:"28px"}),l.find("span").html("待确认故障<strong>10</strong>项"),n.$dialogTitle=l.find("span>strong");var h=$("<strong>—<strong>");return h.click(function(e){e.stopPropagation(),"—"===h.text()?(l.siblings().css("display","none"),h.text("+"),r.css({top:d+c-u,height:"auto"})):(r.css({top:d,height:c}),l.siblings().css("display",""),h.text("—"))}),l.find(".dialog-title-controls").html(h),setTimeout(function(){r.css("opacity",.3),r.off("mouseenter").on("mouseenter",function(e){e.stopPropagation(),r.css("opacity",1)}).off("mouseleave").on("mouseleave",function(e){e.stopPropagation(),r.css("opacity",.3)})},3e3),a&&setInterval(function(){var e=s?o.paneTitleChangeBackColor:o.paneTitleBackColor;l.css("backgroundColor",e),r.css("backgroundColor",e),s=!s},1e3),n}function createDialogAlarm(e,t,a,o,n){var i;(i=void 0===e?new ht.widget.Dialog:e).setConfig(t);var r=$(i.getView()).find(".dialog-container"),l=r.find(".dialog-container-title"),s=!1,c=r.height(),d=parseInt(r.css("top")),u=l.height()||28,h=parseInt(o.paneBtnWidth)||50,g=parseInt(o.paneBtnHeight)||26,f=r.find(".dialog-container-buttons");f.css("padding-bottom","10px"),f.css("padding-right",h/2+"px");var p=f.find(".dialog-button"),m=$("<div></div>");m.css({position:"absolute",width:h,height:g,lineHeight:g+"px",backgroundColor:o.paneBtnBackColor,textAlign:"center",fontSize:o.paneBtnFontSize+"px",color:o.paneBtnFontColor,fontFamily:o.paneBtnFontFamily,cursor:"pointer"}),m.text("确 认"),p.prepend(m).find("canvas").css({visibility:"hidden"}),r.css({zIndex:99,top:"",left:"",right:"5px",bottom:"28px"}),l.find("span").html(n),l.find("span").css("color",o.paneTitleFontColor),l.find("span").css("font",o.paneTitleFontSize+"px "+o.paneTitleFontFamily),i.$dialogTitle=l.find("span>strong");var v=$("<strong>—<strong>");return v.click(function(e){e.stopPropagation(),"—"===v.text()?(l.siblings().css("display","none"),v.text("+"),r.css({top:d+c-u,height:"auto"})):(r.css({top:d,height:c}),l.siblings().css("display",""),v.text("—"))}),l.find(".dialog-title-controls").html(v),setTimeout(function(){r.css("opacity",.78),r.off("mouseenter").on("mouseenter",function(e){e.stopPropagation(),r.css("opacity",1)}).off("mouseleave").on("mouseleave",function(e){e.stopPropagation(),r.css("opacity",.78)})},3e3),a&&setInterval(function(){var e=s?o.paneTitleChangeBackColor:o.paneTitleBackColor;l.css("backgroundColor",e),r.css("backgroundColor",e),s=!s},1e3),i}function loadScript(e,t){t=t||function(){};var a=document.createElement("script");a.type="text/javascript",a.readyState?a.onreadystatechange=function(){"loaded"!=a.readyState&&"complete"!=a.readyState||(a.onreadystatechange=null,t())}:(a.onload=function(){t()},a.onerror=function(e){GD.createErrorDialog(420,160,"页面不存在或路径设置有误,请查正后重新发布!")}),a.src=e,document.body.appendChild(a)}function loadScripts(e,t){t=t||function(){};var a=function(e,a){var o=document.createElement("script");o.type="text/javascript",o.src=e,o.onload=function(){o.onload=null,o.onerror=null,a()},o.onerror=function(){o.onload=null,o.onerror=null,t({message:e+"依赖未加载成功!"})},(document.getElementsByTagName("head")[0]||document.body).appendChild(o)};!function o(){e.length>0?a(e.shift(),o):t()}()}function clearDataModel(e){if(e.getHtml&&"function"==typeof e.getHtml){var t=e.getHtml();if(t._chart&&"function"==typeof t._chart.setOption&&(t._chart.setOption({},!0),t._chart.clear&&t._chart.clear(),t._chart=null),"function"==typeof t.getDataModel){var a=t.getDataModel();a.each(clearDataModel),a.clear()}}e.setHtml&&"function"==typeof e.setHtml&&e.setHtml(document.createElement("div")),e.__parent&&(e.__parent.childNodes&&(e.__parent.childNodes.length=0),e.__parentLib=null,e.__parent=null),e.localDynamicVar=null,e.hasOwnProperty("setImage")&&e.setImage(null),e._attrObj=null,e.setWidth=null,e.setHeight=null,e.refresh&&(e.refresh=null),e.refreshText&&(e.refreshText=null),e.setOption&&(e.setOption=null),e._initSize&&(e._initSize=null)}function destoryScript(){for(var e=0,t=intervalTimers.length;e<t;e++)clearInterval(intervalTimers[e]);intervalTimers.length=0,$(document.body).find("script").remove(),window.dataModel&&(dataModel.each(clearDataModel),dataModel.clear()),window._libModel&&window._libModel.clear(),$window.off("graphViewZoomEnded"),window.onkeydown=null,alarmColorData={},deleteCustomImage(),function(){var e,t;for(void 0!==graphView&&(graphView._focusData=null,graphView._lastHoverData=null,graphView._pageBackgroundNode=null,graphView.graphViewList&&(graphView.graphViewList.length=0)),window.view&&(view.eventList&&!GD.isEmptyObj(view.eventList)&&(view.eventList={},view.onkeydown=null),$(view).remove(),view._ht=null,view=null);window.contextMenuOnViewList&&(e=contextMenuOnViewList.shift());)e instanceof ht.widget.ContextMenu&&(e.afterShow=null,e.beforeShow=null,e.dispose(),e=null);if(window.globalVarNameList)for(;t=globalVarNameList.shift();)window[t]&&("function"==typeof window[t].getView&&$(window[t].getView()).remove(),window[t]=null);window.GD&&(GD.GetTagsProperty=null)}(),window.zoomNodeList&&(window.zoomNodeList.length=0),$("a.btn").off("mouseup, mousedown").remove(),$("div.ht-widget-contextmenu").remove(),$("div.tooltip").remove(),$("div.main").remove(),$('span[gcuielement="gcStringWidthSpan"]').remove()}function loadPage(e){if(e=e||location.hash,e=decodeURIComponent(e),e=e.match(/^#/)?e.substr(1):e,!(e=e.replace(/\\/g,"/")))return location.reload();if(!GD.isLogin()&&!GD.isFreeVisitPage(e)&&"False"!==isAuthEnable)return GD.createErrorDialog(300,160,"您还没有登录!页面将在3秒后自动跳转到登录页面!"),void setTimeout(function(){dialogTip.dialog&&dialogTip.dialog.hide();var e=GD.getFreeVisitPage();e?location.hash=e:GD.createErrorDialog(300,160,"请先配置登录页面!")},3e3);loadScript(PAGEROOTDIR+e+".js",function(){for(var t,a=GD&&GD.relationship&&GD.relationship[e]||[];t=intervalTimers.pop();)clearInterval(t);for(var o=0,n=a.length;o<n;o++)a[o]=PAGEROOTDIR+a[o];loadScripts(a,function(e){if(e)return destoryScript(),console.log(e.message);if("function"==typeof window.init)var t=setTimeout(function(){destoryScript(),init(),clearTimeout(t)},0)})});var t=e.split("/");document.title=t[t.length-1]}function deleteCustomImage(){var e=ht.Default.getImageMap();for(var t in e)t&&e.hasOwnProperty(t)&&"image_"===t.substr(0,6)&&(e[t]=null)}function resetPageToDefaultSizeAndPosition(e){(e=e||window.graphView)&&(e.setZoom(1),e.tx(0),e.ty(0),0!==e.tx()&&0!==e.ty()&&1!==e.getZoom()&&setTimeout(function(){resetPageToDefaultSizeAndPosition(e)},100))}function saveLocalParams(e){"object"==typeof e&&GD.setParams(e)}function createHisBackDialog(e){var t=0,a=new Date,o=a.getMonth()+1<10?"0"+(a.getMonth()+1):a.getMonth()+1,n=a.getDate()<10?"0"+a.getDate():a.getDate(),i=a.getHours()<10?"0"+a.getHours():a.getHours(),r=a.getMinutes()<10?"0"+a.getMinutes():a.getMinutes(),l=a.getSeconds()<10?"0"+a.getSeconds():a.getSeconds(),s=a.getFullYear()+"-"+o+"-"+n+"T"+i+":"+r+":"+l,c=s,d=1,u="",h=[],g="",f=[];h.push('<div id="content">'),h.push('<label for="startTime">起始时间:<input type="datetime-local" step=1 name="beginDate" id="beginDate" style = "padding-left:3px;width:180px;height:23px;font-size:12px;background-color:rgba(255,255,255,1);" value="'+s+'" /></label>&nbsp;&nbsp;&nbsp;'),h.push('<label for="endTime">结束时间:<input type="datetime-local" step=1 name="endDate" id="endDate" style = "padding-left:3px;width:180px;height:23px;font-size:12px;background-color:rgba(255,255,255,1);" value="'+c+'" /></label>'),h.push('<br/><input type="text" id="showTime" disabled="disabled" style="width:160px;height:23px;" name="showTime" value=""></input> x<span id="nowspeed">1</span>'),h.push('<input type="button" style="width:60px;height:23px;margin-right:5px;margin-left:60px;" id="palyTime" name="palyTime" value="播放"></input>'),h.push('<input type="button" style="width:60px;height:23px;margin-right:5px;" id="addSpeed" name="addSpeed" value="加速"></input>'),h.push('<input type="button" style="width:60px;height:23px;margin-right:5px;" id="slowSpeed" name="slowSpeed" value="减速"></input>'),h.push('<input type="button" style="width:60px;height:23px;margin-right:5px;" id="closeBtn" name="closeBtn" value="退出"></input>'),h.push("</div>"),u=$(h.join(""))[0],dialog.setConfig({title:"历史回放",closable:!0,draggable:!0,width:530,height:100,contentPadding:5,titleBackground:"#8DB6CD",content:u,buttons:[],buttonsAlign:"right"}),dialog.setModal(!1),dialog.show(),$("#palyTime").click(function(){if("播放"==$("#palyTime").val()){g=$("#beginDate").val().replace("T"," ");var e=$("#endDate").val().replace("T"," "),a=new Date(g).getTime(),o=new Date(e).getTime();0==t&&(clearInterval(intervalTimers[0]),intervalTimers.shift(intervalTimers[0]),t++),$("#palyTime").val("暂停");var n=setInterval(function(){if(a>o)clearInterval(f[0]),f.shift(f[0]),$("#palyTime").val("播放");else{if($("#showTime").val(moment(g).format("YYYY/MM/DD h:mm:ss")),varList.length<=0)return;for(var e="",t={},n="GET",i="http://"+webServiceIP+":"+webServicePort+"/api/History?tagName=",r=0;r<varList.length;r++)e+=encodeURIComponent(varList[r])+",";(i=i+(e=e.substring(0,e.length-1))+"&Time="+g).length>2e3&&(para=encodeURIComponent(e),i="http://"+webServiceIP+":"+webServicePort+"/api/History",t={tagname:e,time:g},n="POST"),$.ajax({url:i,type:n,dataType:"json",data:t,cache:!1,success:function(e){if(null!==e){var t=e;if(null!=t)for(var o in t)moment(g).format("YYYY-MM-DD h:mm:ss")==moment(t[o].Time).format("YYYY-MM-DD h:mm:ss")&&(parseFloat(t[o].Value).toString()==t[o].Value?(varListObj[o.toLowerCase()]=parseFloat(t[o].Value),VarSnapshotTime[o.toLowerCase()]=t[o].Time):(varListObj[o.toLowerCase()]=t[o].Value,VarSnapshotTime[o.toLowerCase()]=t[o].Time));g=getDateString(new Date(a+1e3*d)),a=new Date(g).getTime()}}})}},1e3);f.push(n)}else clearInterval(f[0]),f.shift(f[0]),$("#palyTime").val("播放")}),$("#addSpeed").click(function(){d>=128?d=128:d*=2,$("#nowspeed").html(d)}),$("#slowSpeed").click(function(){d<=1?d=1:d/=2,$("#nowspeed").html(d)}),$("#closeBtn").click(function(){clearInterval(f[0]),f.shift(f[0]),intervalTimers.unshift(setInterval(e,1e3)),dialog.hide()})}function savehtmlToJpg(){html2canvas(document.getElementsByClassName("main")[0]).then(function(e){document.body.appendChild(e)});var e=document.createElement("canvas");let t=document.getElementsByClassName("main")[0];var a=parseInt(window.getComputedStyle(t).width),o=parseInt(window.getComputedStyle(t).height);e.width=2*a,e.height=2*o,e.style.width=a+"px",e.style.height=o+"px",e.getContext("2d").scale(2,2),html2canvas(document.getElementsByClassName("main")[0],{canvas:e}).then(function(e){document.body.appendChild(e);var t=document.createElement("a"),a=base64Img2Blob(e.toDataURL("image/png")),o=document.createEvent("HTMLEvents");o.initEvent("click",!1,!1),t.download="下载图片.png",t.href=URL.createObjectURL(a),t.dispatchEvent(o),t.click()})}function base64Img2Blob(e){for(var t=e.split(";base64,"),a=t[0].split(":")[1],o=window.atob(t[1]),n=o.length,i=new Uint8Array(n),r=0;r<n;++r)i[r]=o.charCodeAt(r);return new Blob([i],{type:a})}var VarValue=[],VarSnapshotTime={},alarmColorData={},intervalTimers=[],PAGEROOTDIR=decodeURIComponent(location.href),$window=$window||$(window),_exchangeCount=0;!function(){var e=-1===PAGEROOTDIR.lastIndexOf("/Html5/")?-1===PAGEROOTDIR.lastIndexOf("/html5/")?-1:PAGEROOTDIR.lastIndexOf("/html5/"):PAGEROOTDIR.lastIndexOf("/Html5/");PAGEROOTDIR=-1!==e?PAGEROOTDIR.substr(0,e+7):(location.origin||location.protocol+"//"+location.host)+"/"}(),ht.Chart=function(e,t,a){var o=this,n=o._view=document.createElement("div");n.style.width=t+"px",n.style.height=a+"px",n.style.position="absolute",n.style.setProperty("box-sizing","border-box",null),o._option=e,o._chart=echarts.init(o.getView()),e&&o._chart.setOption(e),o._FIRST=!0},ht.Default.def("ht.Chart",Object,{ms_v:1,ms_fire:1,ms_ac:["chart","option","isFirst","view"],validateImpl:function(){var e=this;e._chart.resize(),e._FIRST&&(e._FIRST=!1)},setSize:function(e,t){var a=this._view;a.style.width=e+"px",a.style.height=t+"px"}}),ht.DataModel.prototype.isAutoAdjustIndex=function(){return!1};var dataModel,graphView,view,selectionModel,serialData,$view,dataAdapter={IP:webServiceIP,port:webServicePort,init:function(){this.IP=webServiceIP,this.port=webServicePort}},drawPoints=function(e,t,a){if(a&&a.length){for(var o,n,i,r,l=0,s=0,c=a.length;s<c;s++)1===(o=a[s])?(n=t[l++],e.moveTo(n.x,n.y)):2===o?(n=t[l++],e.lineTo(n.x,n.y)):3===o?(n=t[l++],i=t[l++],e.quadraticCurveTo(n.x,n.y,i.x,i.y)):4===o?(n=t[l++],i=t[l++],r=t[l++],e.bezierCurveTo(n.x,n.y,i.x,i.y,r.x,r.y)):5===o&&e.closePath();5!==o&&e.closePath()}else{var d,u,h,g=t.length;if(g>0){for(d=t[0],e.moveTo(d.x,d.y),u=1;u<g;u++)h=t[u],e.lineTo(h.x,h.y);e.closePath()}}},getCoorPosition=function(e,t){return{x:t*Math.cos(e)+t,y:t*Math.sin(e)+t}},getCoorList=function(e,t,a){var o=new ht.List;return o.add(getCoorPosition(e,a)),o.add(getCoorPosition(t,a)),o},getMaxValue=function(e,t,a){return e>t?t:e<a?a:e},createTableAttr=function(e,t,a,o,n,i,r,l,s,c,d,u){var h=new Object;return h.rowheight=e,h.rowlinevisible=t,h.rowaltercolor=a,h.isrowalter=o,h.headcolor=n,h.headGradientcolor=i,h.columnlinevisible=r,h.linecolor=l,h.backcolor=s,h.fontsize=c,h.fontcolor=d,h.fontfamily=u,h},setTableStyle=function(e,t){var a=e.getTableView(),o=e.getTableHeader();a.setRowHeight((t.rowheight||25)*ratio.ratioY),o.setHeight((t.headheight||25)*ratio.ratioY),a.setRowLineVisible(t.rowlinevisible),a.setColumnLineVisible(t.columnlinevisible),o.setColumnLineVisible(t.columnlinevisible),o.setColumnLineColor(t.linecolor),a.setColumnLineColor(t.linecolor),a.setRowLineColor(t.linecolor),o.setColumnLineColor(t.linecolor),a.setScrollBarColor(t.scrollBarColor||"rgba(122,122,122,0.7)"),a.getLabelColor=function(){return t.fontcolor},a.getLabelFont=function(){return t.bodyfontstyle+" "+t.fontsize*ratio.ratioY+"px "+t.fontfamily},o.getLabelColor=function(){return t.headFontColor},o.getLabelFont=function(){return t.headerfontstyle+" "+t.headerfontsize*ratio.ratioY+"px "+t.headerfontfamily},a.drawRowBackground=function(e,o,n,i,r,l,s){if(t.isrowalter){var c=a.getRowIndex(o);e.fillStyle=c%2==0?t.backcolor:t.rowaltercolor,e.beginPath(),e.rect(i,r,l,s),e.fill()}},t.headerbackimage?$(o.getView()).css({background:"url("+PAGEROOTDIR+t.headerbackimage+") no-repeat center center"}).addClass("back-size100"):o.getView().style.background="-webkit-linear-gradient("+t.headcolor+","+t.headGradientcolor+")"},isTextComps=function(e){return!e||!e.getImage||"node_image"!=e.getImage()},setPrimitiveGradientType=function(e,t,a){isTextComps(e)?"NoFill"==t?(e.a("node.background",""),e.a("node.gradient",""),e.a("node.gradientcolor","")):e.a("node.gradient",t):"NoFill"==t?(e.s("shape.gradient",""),e.s("shape.background",""),e.s("shape.gradient.color","")):e.s("shape.gradient",t)},setFillShapeColor=function(e,t,a,o,n,i,r){var l=e.borderFillwidth||0;e.a("node.isFill","true"),e.a("node.borderwidth",l),t>1&&(t=1),t<0&&(t=0);var s=e.getWidth(),c=e.getHeight(),d=0,u=0,h=[0,0,0,0],g=[0,0,0,0];"fromBottomToTop"===r?(h=[0,d=c*(1-t),s,u=c*t],g=[0,0,s,d]):"fromLeftToRight"===r?(h=[0,0,u=s*t,c],g=[u,0,d=s*(1-t),c]):"fromTopToBottom"===r?(h=[0,0,s,u=c*t],g=[0,u,s,d=c*(1-t)]):"fromRightToLeft"===r&&(h=[d=s*(1-t),0,u=s*t,c],g=[0,0,d,c]),null!=e.a("node.original")&&e.a("node.original",g),null!=e.a("node.fillrect")&&e.a("node.fillrect",h),"NoFill"==o?(e.a("node.fillbackcolor",""),e.a("node.fillgradient",""),e.a("node.fillgradientcolor","")):e.a("node.fillgradient",o),e.a("node.fillbackcolor",n),e.a("node.fillgradientcolor",i)},GraphPaneContainer=function(e,t,a,o,n,i){this._graphView=new ht.graph.GraphView(e);this._view=this._graphView.getView();var r=this._view.style;r.width=o+"px",r.height=n+"px",this.invalidate()};ht.Default.def(GraphPaneContainer,Object,{getView:function(){return this._view},getGraphView:function(){return this._graphView},invalidate:function(){},validate:function(){}}),function(e,t){t&&(t.HtNodeOverlay=function(e){this._htNode=e},t.HtNodeOverlay.prototype=new t.Overlay,t.HtNodeOverlay.prototype.initialize=function(e){var t,a,o,n,i,r,l,s;return t=e.getPanes().markerPane,this._map=e,s=this,a=new ht.DataModel,o=new ht.graph.GraphView(a),i=o.getView(),n=this._htNode,this._graphView=o,this._dataModel=a,this._view=i,r=n.getWidth(),l=n.getHeight(),n.setPosition(r/2+1,l/2+1),i.style.width=r+2+"px",i.style.height=l+2+"px",i.style.postion="absolute",i.style.overflow="visible",o.setEditable=function(e){this.setInteractors([])},o.setEditable(!1),t.appendChild(i),a.add(n),setTimeout(function(){s.resetPosition()},200),i},t.HtNodeOverlay.prototype.draw=function(){this.resetPosition()},t.HtNodeOverlay.prototype.resetPosition=function(){var e=this._htNode,t=this._map.pointToOverlayPixel(e.lonLat),a=e.getWidth(),o=e.getHeight(),n=(this._graphView,this._view);n.style.left=t.x-a/2+"px",n.style.top=t.y-o/2+"px"},t.HtNodeOverlay.prototype.show=function(){this._view.style.display=""},t.HtNodeOverlay.prototype.hide=function(){this._view.style.display="none"})}(window,window.BMap),void 0==CanvasRenderingContext2D.prototype.ellipse&&(CanvasRenderingContext2D.prototype.ellipse=function(e,t,a,o,n,i,r,l){this.save(),this.translate(e,t),this.rotate(n),this.scale(a,o),this.arc(0,0,1,i,r,l),this.restore()}),CanvasRenderingContext2D.prototype.wrapFillText||(CanvasRenderingContext2D.prototype.wrapFillText=function(e,t,a,o,n){var i=this,r=this.font,l=(ht&&ht.Default&&ht.Default.getTextSize||function(e,t){return{width:i.measureText(t).width+20,height:i.measureText("口").width+4}})(r,e)||{};if(l.width<o)i.fillText(e,t,a);else{n=n||l.height;for(var s,c,d=e.split(""),u="",h=(d.length,0),g=0;c=d[g];g++)s=u,u+=c,i.measureText(u).width>o&&(u.length<=1&&(s=c),i.fillText(s,t,a+h*n),u=u.substr(s.length),len=0,h++);u.length&&i.fillText(u,t,a+h*n)}}),function(e,t,a){a&&(a.widget=a.widget||{},a.widget.FrozenTable=function(e){e=e||new a.DataModel,this._borderPane=new a.widget.BorderPane,this._frozenTablePane=new a.widget.TablePane(e),this._normalTablePane=new a.widget.TablePane(e),this._frozenTableHeader=this._frozenTablePane.getTableHeader(),this._frozenTableView=this._frozenTablePane.getTableView(),this._normalTableHeader=this._normalTablePane.getTableHeader(),this._normalTableView=this._normalTablePane.getTableView(),this._dm=e,this._selectionModel=e.getSelectionModel(),this.init()},a.Default.def("ht.widget.FrozenTable",Object,{init:function(){var e=this.getFrozenTableView(),t=this.getNormalTableView();e.setScrollBarSize(0),this._borderPane.setLeftView(this._frozenTablePane,200),this._borderPane.setCenterView(this._normalTablePane),e.mp(function(e){"translateY"===e.property&&t.ty(e.newValue)}),t.mp(function(t){"translateY"===t.property&&e.ty(t.newValue)}),this._setColumnClickEvent(),this._setDrawColumnFunc(),this.setAutoHideScrollBar(!1)},getFrozenTableView:function(){return this._frozenTableView},getFrozenTableHeader:function(){return this._frozenTableHeader},setFrozentableScrollBarColor:function(e){this._normalTableView.setScrollBarColor(e)},getFrozentableScrollBarColor:function(){return this._normalTableView.getScrollBarColor()},setFrozentableScrollBarSize:function(e){this._normalTableView.setScrollBarSize(e)},getFrozentableScrollBarSize:function(){return this._normalTableView.getScrollBarSize()},getNormalTableView:function(){return this._normalTableView},getNormalTableHeader:function(){return this._normalTableHeader},getDataModel:function(){return this._normalTableView.getDataModel()},getSelectionModel:function(){return this._dm.getSelectionModel()},calcColumnWidthByDisplayName:function(e,t){t=t||12,t*=.5;var a=GD.getStrLength(e);return Math.ceil((a+4)*t)},addColumns:function(e){function t(e,t){return e.sortId>t.sortId?1:e.sortId<t.sortId?-1:0}for(var a=[],o=[],n=0,i=0,r=e.length;i<r;i++)e[i]&&(e[i].sortable=!1,e[i].width=e[i].width?e[i].width:this.calcColumnWidthByDisplayName(e[i].displayName),e[i].isFrozenColumn?(a.push(e[i]),e[i].visible&&(n+=e[i].width)):o.push(e[i]));a.sort(t),o.sort(t),n+=this._frozenTableView.isCheckMode()?this._frozenTableView.getCheckColumn().getWidth():0,this._frozenTableView.addColumns(a),this._normalTableView.addColumns(o),this._borderPane.setLeftWidth(n)},resetLeftPaneWidth:function(){var e=0;columnModel=this._frozenTableView.getColumnModel(),columnModel.each(function(t){t.isVisible()&&(e+=t.getWidth())}),this._borderPane.setLeftWidth(e)},getBorderPane:function(){return this._borderPane},isCheckMode:function(){return this._frozenTableView.isCheckMode()},setCheckMode:function(e,t){this._frozenTableView.setCheckMode(e)},selectAll:function(){this.getSelectionModel().selectAll()},invertSelection:function(){var e=this._dm,t=this.getSelectionModel();e.each(function(e){t.contains(e)?t.removeSelection(e):t.appendSelection(e)})},clearSelection:function(){this.getSelectionModel().clearSelection()},setRowHeight:function(e){this._frozenTableView.setRowHeight(e),this._normalTableView.setRowHeight(e),this._normalTableHeader.setHeight(e),this._frozenTableHeader.setHeight(e)},getRowHeight:function(){return this._normalTableView.getHeight()},setHeaderHeight:function(e){if(!t.isNumeric(e))return this;e+=0,this._frozenTableHeader.setHeight(e),this._normalTableHeader.setHeight(e)},getHeaderHeight:function(){return this._normalTableHeader.getHeight()},setBackground:function(e){this.getFrozenTableView().getView().style.background=e,this.getNormalTableView().getView().style.background=e},getCheckIcon:function(e,t){var a=this._selectionModel;this._selData=t,this._unSelData=e,this._frozenTableView.getCheckIcon=function(o){return a.contains(o)?t:e}},setHeaderGradientColor:function(e,t){this.getFrozenTableHeader().getView().style.background="-webkit-linear-gradient("+e+","+t+")",this.getNormalTableHeader().getView().style.background="-webkit-linear-gradient("+e+","+t+")"},getLabelColor:function(e){this.getFrozenTableHeader().getLabelColor=function(){return e},this.getNormalTableHeader().getLabelColor=function(){return e}},getLabelFont:function(e,t,a){this.getFrozenTableHeader().getLabelFont=function(){return a+" "+e*ratio.ratioY+"px "+t},this.getNormalTableHeader().getLabelFont=function(){return a+" "+e*ratio.ratioY+"px "+t}},setHeaderLabelFont:function(e,t,a){this._headerFontStyle=a,this._headerFontSize=e,this._headerFontFamily=t},setBodyLabelFont:function(e,t,a){this._bodyFontStyle=a,this._bodyFontSize=e,this._bodyFontFamily=t},getHeaderLabelFont:function(){return this._headerFontStyle+" "+this._headerFontSize*ratio.ratioY+"px "+this._headerFontFamily},getBodyLabelFont:function(){return this._bodyFontStyle+" "+this._bodyFontSize*ratio.ratioY+"px "+this._bodyFontFamily},setRowLineColor:function(e){this._frozenTableView.setRowLineColor(e),this._normalTableView.setRowLineColor(e)},getRowLineColor:function(){return this._normalTableView.getRowLineColor()},getColumnLineColor:function(){return this._normalTableHeader.getColumnLineColor()},setColumnLineColor:function(e){this._frozenTableHeader.setColumnLineColor(e),this._normalTableHeader.setColumnLineColor(e),this._frozenTableView.setColumnLineColor(e),this._normalTableView.setColumnLineColor(e)},isColumnLineVisible:function(){return this._normalTableHeader.isColumnLineVisible()},setColumnLineVisible:function(e){this._normalTableHeader.setColumnLineVisible(e),this._frozenTableHeader.setColumnLineVisible(e),this._frozenTableView.setColumnLineVisible(e),this._normalTableView.setColumnLineVisible(e)},setRowLineVisible:function(e){this.getFrozenTableView().setRowLineVisible(e),this.getNormalTableView().setRowLineVisible(e)},drawRowBackground:function(e,t,a,o){function n(n,i,r,l,s,c,d){var u=this.getRowIndex(i);n.fillStyle=t?u%2==0?e:a:e,r&&o&&(n.fillStyle=o),n.beginPath(),n.rect(l,s,c,d),n.fill()}var i,r=this;o=o||"rgba(100, 100, 100, 0.3)",r.getFrozenTableView().drawRowBackground=function(){i=r.getFrozenTableView(),n.apply(i,arguments)},r.getNormalTableView().drawRowBackground=function(){i=r.getNormalTableView(),n.apply(i,arguments)}},drawCell:function(e,t,o,n,i,r,l,s,c){var d,u,h=t._name+n._name,g=n.getName(),f=n[g]||{},p=t.a(g)||0,m=f.a("color")||"balck",v=f.a("fontStyle")||null,b=(f.a("selectedRowColor"),f.a("statusMap")||[]),w="";if(b.length>0){for(var y=0,C=b.length;y<C;y++){if(sk=b[y]||{},pt=parseFloat(p),"min"===sk.min&&pt<sk.max){w=sk;break}if(pt>=sk.min&&"max"===sk.max){w=sk;break}if(pt>=sk.min&&pt<sk.max||pt===sk.min&&pt===sk.max){w=sk;break}}d=i+.1*l,u=r+s/4,m=(w=w||{}).backColor||"rgba(0,0,0,0)",e.beginPath(),e.fillStyle=m,function(e,t,a,o,n,i){e.moveTo(t+i,a),e.lineTo(t+o-i,a),e.arc(t+o-i,a+i,i,1.5*Math.PI,2*Math.PI),e.lineTo(t+o,a+n-i),e.arc(t+o-i,a+n-i,i,0,.5*Math.PI),e.lineTo(t+i,a+n),e.arc(t+i,a+n-i,i,.5*Math.PI,Math.PI),e.lineTo(t,a+i),e.arc(t+i,a+i,i,Math.PI,1.5*Math.PI),e.closePath()}(e,d,u,.8*l,.5*s,4),e.fill()}m=f.a("color"),alarmColorData[h.toLowerCase()]&&(m=alarmColorData[h.toLowerCase()]),w&&(m=w.fontColor,p=w.text);var T=this.calcColumnWidthByDisplayName(p,this._bodyFontSize*ratio.ratioY);T>n.getWidth()&&(n.setWidth(T),this.resetLeftPaneWidth()),a.Default.drawText(e,p,v,m,i,r,l,s,"center")},refresh:function(e){var t,a=this.getFrozenTableView(),o=this.getNormalTableView(),n=a.getColumnModel(),i=o.getColumnModel();e&&e.each(function(e){(t=n.getDataByTag(e.a("name"))||i.getDataByTag(e.a("name"))).setVisible(e.a("visible"))}),a.redraw(),o.redraw()},redraw:function(){var e=this.getFrozenTableView(),t=this.getNormalTableView();e.redraw(),t.redraw()},addRowData:function(){var e=this.getCustomDM("columnDM"),t=this.getCustomDM("rowDM"),o=this.getDataModel();t.each(function(t){var n=t.a("name"),i=t.a("displayName"),r=new a.Data;e.each(function(e){var t=e.a("name"),a=""+n+t;r.a(t,getVarValue(a)),"device"===t&&r.a(t,i)}),r.setName(n),r.setTag(n),r.a("displayName",i),r.a("visible",t.a("visible")),r.a("name",n),o.add(r)})},refreshRowData:function(){var e,t;this.getDataModel().each(function(a){e=a.getAttrObject(),t=a.getName();for(var o in e)if(e.hasOwnProperty(o)){if("visible"===o||"device"===o||"displayName"===o||"name"===o)continue;a.a(o,getVarValue(t+o))}}),this.getFrozenTableView().invalidateModel(),this.getNormalTableView().invalidateModel()},refreshStyleRowData:function(e){var t,a,o=e;this.getDataModel().each(function(e){t=e.getAttrObject(),a=e.getName();for(var n=0;n<o.length;n++)if(t.name==o[n].name){e.a("visible",o[n].visible);break}for(var i in t)if(t.hasOwnProperty(i)){if("visible"===i||"device"===i||"displayName"===i||"name"===i)continue;e.a(i,getVarValue(a+i))}}),this.getFrozenTableView().invalidateModel(),this.getNormalTableView().invalidateModel()},addCustomDM:function(e,t){this["_"+e]||(t.constructor===a.DataModel?this["_"+e]=t:this["_"+e]=new a.DataModel)},getCustomDM:function(e){return this["_"+e]},setVisibleFunc:function(e){this.getNormalTableView().setVisibleFunc(e),this.getFrozenTableView().setVisibleFunc(e)},getFrozenColumnModel:function(){return this.getFrozenTableView().getColumnModel()},getNormalColumnModel:function(){return this.getNormalTableView().getColumnModel()},clear:function(){return this._dm.clear()},setAutoHideScrollBar:function(e){this._normalTableView.setAutoHideScrollBar(e)},defaultDisplayGridLine:function(e,t,o){if(e){for(var n=this.getDataModel(),i=0;i<t;i++){var r=new a.Data;n.add(r)}var l=[];for(i=0;i<o;i++){var s={};s.displayName="",s.width=100,s.width=100,s.align="center",0===i?(s.isFrozenColumn=!0,s.displayName="时间"):s.isFrozenColumn=!1,l.push(s)}this.addColumns(l)}},setDataModel:function(e){this._dm=e,this._normalTableView.setDataModel(e),this._frozenTableView.setDataModel(e)},sort:function(e,t){var o=new a.DataModel,n=this._dm._datas._as.length;if("default"===t)return this._defaultDM&&this._copyDM2DataModel(this._defaultDM),void(this._defaultDM=null);this._defaultDM||(this._defaultDM=new a.DataModel,this._defaultDM.deserialize(this._dm.serialize()));for(var i=0;i<n;i++)o.add(this.getOrderData(e,t));this._copyDM2DataModel(o)},getOrderData:function(e,a){for(var o,n,i=this._dm._datas._as,r=i[0],l=1,s=i.length;l<s;l++)o=r.a(e),n=i[l].a(e),t.isNumeric(o)&&(o-=0),t.isNumeric(n)&&(n-=0),"desc"===a||"Desc"===a||"DESC"===a?o<n&&(r=i[l]):o>n&&(r=i[l]);return this._dm.remove(r),r},_copyDM2DataModel:function(e,t){e&&((t=t||this.getDataModel()).clear(),t.deserialize(e.serialize()))},_setColumnClickEvent:function(){function e(e,a){var o=e.getName()||e.a("name")||e.getDisplayName()||e.a("displayName")||"",n=e.getSortOrder()||"asc";t.sort(o,n),t._clearColumnIcon(),"asc"===n?e.setSortOrder("desc"):"desc"===n?e.setSortOrder("default"):"default"===n&&e.setSortOrder("asc"),e._isCustomSortColumn=!0}var t=this;this.onColumnClicked=e,this._frozenTableView.onColumnClicked=e,this._normalTableView.onColumnClicked=e},_clearColumnIcon:function(){var e=this._frozenTableView.getColumnModel(),t=this._normalTableView.getColumnModel();e.each(function(e){e._isCustomSortColumn=!1,e.setSortOrder("asc")}),t.each(function(e){e._isCustomSortColumn=!1,e.setSortOrder("asc")})},_setDrawColumnFunc:function(e){var t=this;e=e||function(e,o,n,i,r,l){var s,c=o.getDisplayName()||o.a("displayName")||o.getName(),d=o.getColor()||o.a("color")||"black",u=t.getHeaderLabelFont()||null;if(o===t._frozenTableView.getCheckColumn())return s="uncheck"===t._frozenTableHeader._checkIcon?t._unSelData:t._selData,void a.Default.drawImage(e,s,n+.5*(r-s.width),i+.5*(l-s.height),s.width,s.height,o,t._normalTableView);a.Default.drawText(e,c,u,d,n,i,r,l,"center"),t._selectAllBtn&&t._selectAllBtn.setLabelFont(t.getHeaderLabelFont()),t._selectInvertBtn&&t._selectInvertBtn.setLabelFont(t.getHeaderLabelFont());var h;switch(o.hasOwnProperty("_sortOrder")?o._sortOrder:""){case"desc":h=t._normalTableHeader.getSortAscIcon();break;case"default":h=t._normalTableHeader.getSortDescIcon();break;case"asc":default:h=null}o._isCustomSortColumn||(h=null),a.Default.drawImage(e,h,n+r-14,i+.5*(l-16),16,16,o,t._normalTableView)},this._frozenTableHeader.drawColumn=e,this._normalTableHeader.drawColumn=e},validate:function(){this._frozenTableView.validate(),this._normalTableView.validate()}}))}(window,jQuery,ht),function(e,t,a){a&&(e.pageContainerFactory=function(e,o,n,i,r,l){var s,c=new a.HtmlNode;return s=t('<iframe src="'+l+'" name="pageContainer" width = '+n+" height = "+i+' frameborder="0" ></iframe>'),c.setScalable(!1),c.setPadding(0),c.setHtml(s[0]),c.setWidth(n),c.setHeight(i),c.setPosition(e,o),c.setRotation(r*Math.PI/180),c.s({"2d.selectable":!0,"2d.movable":!1}),c.__clickable=!1,c.changeSrc=function(e){e&&s.attr("src",e)},c.changeWidth=function(e){s.attr("width",e),c.setWidth(e)},c.changeHeight=function(e){s.attr("height",e),c.setHeight(e)},c.changeAttr=function(e,t,a){this.changeSrc(e),this.changeWidth(t),this.changeHeight(a)},c.refresh=function(){s.attr("src",s.attr("src"))},c.resizeContent=function(e,t,a){s.on("load",function(){s[0].contentWindow.postMessage({action:"resizeNodes",args:{ratioX:e,ratioY:t,zoom:a}},"*")})},c})}(window,jQuery,ht),function(e,t,a){a&&t&&(e.paginationFactory=function(e,a,o){var n=t('<ul class="pagination"></ul>');return t.jqPaginator(n,{totalPages:e,visiblePages:a||5,currentPage:o||1,prev:'<li class="prev"><a href="javascript:;">上一页</a></li>',next:'<li class="next"><a href="javascript:;">下一页</a></li>',page:'<li class="page"><a href="javascript:;">{{page}}</a></li>',onPageChange:function(e,t){"function"==typeof n.onPageChange&&n.onPageChange(e,t)}}),n})}(window,jQuery,ht),Object.prototype.watch||Object.defineProperty(Object.prototype,"watch",{enumerable:!1,configurable:!0,writable:!1,value:function(e,t){var a=this[e],o=a;delete this[e]&&Object.defineProperty(this,e,{get:function(){return o},set:function(n){return a=o,o=t.call(this,e,a,n)},enumerable:!0,configurable:!0})}}),Object.prototype.unwatch||Object.defineProperty(Object.prototype,"unwatch",{enumerable:!1,configurable:!0,writable:!1,value:function(e){var t=this[e];delete this[e],this[e]=t}});var getIndicatorAndSheBeiArr=function(e,t){for(var a,o={},n=[],i=[],r=[],l={},s=[],c=0;c<t.length;c++){var d=t[c].displayName||t[c].Desc;i.push(d),r.push(t[c].color)}for(h=0;h<e.length;h++)n.push(e[h].displayName);for(var c=0,u=e.length;c<u;c++)for(var h=0,g=t.length;h<g;h++){a=""+e[c].Name+t[h].Name,s.push(a);var f=t[h].statisticsType;if(f)switch(f.toLowerCase()){case"min":f="Min";break;case"max":f="Max";break;case"avg":case"calcavg":f="CalcAvg";break;case"difference":f="Difference";break;case"total":f="Total";break;case"poweravg":f="PowerAvg"}l[a]=f}return o.shebeiArr=n,o.indicatorArr=i,o.tagArr=s,o.colorArr=r,o.statisticsTypeObj=l,o},getIndicatorOrShebeiInfo=function(e,t,a){for(var o=[],n=0;n<t.length;n++){for(var i=[],r=0===t[n].DrawType?"bar":"line",l=2===t[n].DrawType,s=0;s<e.length;s++){var c=""+e[s].Name+t[n].Name;i.push(parseFloat(getVarValue(c)))}o.push({name:t[n].displayName||t[n].Desc,type:r,smooth:l,data:i,itemStyle:{normal:{shadowBlur:10,shadowOffsetX:10,shadowOffsetY:10,shadowColor:a.shadowColor},emphasis:{shadowBlur:10,shadowOffsetX:10,shadowOffsetY:10,shadowColor:a.shadowColor}}})}return o};!function(e,t){var a=t.pushState;t.pushState=function(){return"function"==typeof e.onpushstate&&e.onpushstate.apply(t,arguments),a.apply(t,arguments)}}(window,window.history),window.onload=function(){if(document.hasOwnProperty("ontouchstart")&&(istouched=!0),location.hash)return loadPage();PAGENAME&&(location.hash=PAGENAME)},window.onhashchange=function(e){if(++_exchangeCount>100)return _exchangeCount=0,this.location.reload();loadPage()};var LibModel=function(){this.libModelMap={},this.libModelArray=[]};LibModel.prototype={add:function(e,t){return t._baseClass&&t._baseClass.match("ht.lib.")&&(this.libModelMap[e]=t,this.libModelArray.push(t)),this},clear:function(){for(var e=0,t=this.libModelArray.length;e<t;e++)this.libModelArray[e]=null;for(var a in this.libModelMap)this.libModelMap.hasOwnProperty(a)&&(this.libModelMap[a]=null);this.libModelArray=[],this.libModelMap={}},getDataByKey:function(e){return this.libModelMap[e]},each:function(e){if("function"==typeof e)for(var t=0,a=this.libModelArray.length;t<a;t++)e(this.libModelArray[t],t)},remove:function(e){for(var t in this.libModelMap)this.libModelMap.hasOwnProperty(t)&&this.libModelMap[t]===e&&(this.libModelMap[t]=null);-1!=this.libModelArray.indexOf(e)&&this.libModelArray.splice(this.libModelArray.indexOf(e),1)},getDataAt:function(e){var t,a=e.x,o=e.y;return this.each(function(e){var n=e.getWidth(),i=e.getHeight(),r=e.getPosition();px=r.x,py=r.y,w2=.5*n,h2=.5*i,px-w2<a&&px+w2>a&&py+h2>o&&py-h2<o&&(t=e)}),t}};var _libModel=new LibModel;!function(e,t){function a(e){e=e||n;var a=t.getItem(e),o=!1;try{a=JSON.parse(a)}catch(e){console.log(e.message),o=!0}return o?{}:a}function o(e){e=e||n,t.removeItem(e)}var n="pageParams";e.GD=e.GD||{},GD.setParams=function(e,a){var o=!1;if(a=a||n,e)if("string"!=typeof e)if("object"!=typeof e)console.log("页面传递的参数不合法!"),t.setItem(a,"{}");else{try{e=JSON.stringify(e)}catch(e){console.log(e.message),t.setItem(a,"{}"),o=!0}if(o)return;t.setItem(a,e)}else t.setItem(a,e);else t.setItem(a,"{}")},GD.isLogin=function(){var e=localStorage.getItem("token");return!!(e&&e.length>100)},GD.getFreeVisitPage=function(){return window.__FVPAGE?__FVPAGE[0]:""},GD.isFreeVisitPage=function(e){return e=e||location.hash.substr(1),e=decodeURIComponent(e),!(!window.__FVPAGE||__FVPAGE[0]!==e)},GD.getParams=a,GD.useParams=function(e){var t=a(e=e||n);for(var i in t)t.hasOwnProperty(i)&&void 0!==window[i]&&(window[i]=t[i]);o(e)},GD.removeParams=o}(window,localStorage),function(e){function t(e,t){var a,o,n=Math.abs,i=Math.cos,r=Math.sin,l=Array.prototype.slice.call(arguments,0);if(2===l.length){if(!t)return{ratioX:1,ratioY:1};a=t.ratioX,o=t.ratioY}else l.length>=3&&(a=l[1],o=l[2]);if(0===e||!a||!o)return{ratioX:a,ratioY:o};e<0&&(e=e%(2*Math.PI)+2*Math.PI);var s,c,d=e%Math.PI;return s=n(i(e=d<.25*Math.PI?0:d<=.75*Math.PI?90*Math.PI/180:Math.PI)*a-r(e)*o),c=n(r(e)*a+i(e)*o),{ratioX:s,ratioY:c}}function a(e,t,n,i){if(o(),!($("div.tooltip div.tooltop").length>0)){var r=t&&t.toLowerCase&&t.toLowerCase(),l=$('<div class="tag-info"></div>'),s=$window.width(),c=$window.height(),d=e[r]||e[t];if(d){var u,h;u=n+300>=s-10?n-300:n+8,h=i+350>=c-10?i-350:i+8,l.css({minWidth:100,minHeight:100,maxWidth:300,maxHeight:350,top:h,left:u,position:"absolute",zIndex:99});var g=d.Desc,f=(d.LowLimit,d.HighLimit,"<ul>"+("<li><span>标签名称:</span><span>"+t+"</span></li>")+("<li><span>描述:</span><span>"+g+"</span></li>")+("<li><span>单位:</span><span>"+d.Unit+"</span></li>")+('<li><span>快照值:</span><span class="snapshot">'+getVarValue(r)+"</span></li>")+('<li><span>快照时间:</span><span class="snapshottime">'+moment(VarSnapshotTime[r]).format("YYYY/MM/DD HH:mm:ss")+"</span></li>")+"</ul>");l.html(f),$(document.body).append(l);var p=l.outerWidth(),m=l.outerHeight();u=n+p>=s-10?n-p-8:n+8,h=i+m>=c-10?i-m-8:i+8,l.css({top:h,left:u});var v=l.find(".snapshot"),b=l.find(".snapshottime");a.timer&&clearInterval(a.timer),a.timer=setInterval(function(){v.text(getVarValue(r)),b.text(moment(VarSnapshotTime[r]).format("YYYY/MM/DD HH:mm:ss"))},1e3)}}}function o(){$("div.tag-info").remove(),a.timer&&clearInterval(a.timer)}function n(){var e=$window.innerWidth(),t=$window.innerHeight();graphView.setScrollBarVisible(!1),backSize.width*ratio.ratioX>e+1?(graphView.setScrollBarVisible(!0),graphView.adjustTranslateX=function(t){var a=e-backSize.width*ratio.ratioX;return t>0&&(t=0),t<a&&a<0&&(t=a),t}):!window.PAGESCALABLE&&(graphView.adjustTranslateX=function(){return 0}),backSize.height*ratio.ratioY>t+1?(graphView.setScrollBarVisible(!0),graphView.adjustTranslateY=function(e){var a=t-backSize.height*ratio.ratioY;return e>0&&(e=0),e<a&&a<0&&(e=a),e}):!window.PAGESCALABLE&&(graphView.adjustTranslateY=function(){return 0}),graphView.isScrollBarVisible()?(graphView.setPannable(!0),graphView.setMovableFunc(function(e){return!0})):window.PAGESCALABLE||(graphView.setPannable(!1),graphView.setMovableFunc(function(e){return!1}))}function i(){var e,t,a,o,n,i=$window.innerHeight(),l=$window.innerWidth(),s=r(),c=graphView&&graphView._pageBackgroundNode;c&&(a=s.width<l-2?.5*l:.5*c.getWidth(),o=s.height<i-2?.5*i:.5*c.getHeight(),n=c.getPosition(),e=a-n.x,t=o-n.y,window.dataModel&&dataModel.each(function(a){if(!(a.__parentLib&&a.__parentLib.match(/^ht.lib/)||a.__blockChild)){var o=a.getPosition();a.setPosition(o.x+e,o.y+t)}}),window._libModel&&_libModel.each(function(a){var o=a.getPosition();a.setPosition(o.x+e,o.y+t)}))}function r(){var e={},t=graphView._pageBackgroundNode,a=t.getWidth(),o=t.getHeight();return e.width=a,e.height=o,e}var l=e.GD||{};l.getFullParams=function(e,t){return t?(t.__parent&&t.__parent.localVarObj&&$.extend(e,t.__parent.localVarObj),t.__parent&&"function"==typeof t.__parent.localDynamicVar&&$.extend(e,t.__parent.localDynamicVar()),"function"==typeof t.localDynamicVar&&$.extend(e,t.localDynamicVar()),e):e},l.createAlarmSoundConfigDialog=function(e,t,a,o,n,i){function r(e,t){var a=$('<div style="background-color: rgba(0,0,0,0.1); width: 100%; height: 100%; position: absolute; top:0;left:0"></div>'),o=e.getView();o.className="uploadbutton",e.setWidth(80),e.setBackground("rgba(0,0,0,0)"),e.setSelectBackground("rgba(0,0,0,0)"),e.setLabelColor(V),e.setLabelSelectColor(V),e.setBorderColor("rgba(0,0,0,0)"),$(o).css({overflow:"hidden",cursor:"pointer",backgroundColor:k}).off("click").on("click",function(){(t=t||function(){})()}).off("mousedown").on("mousedown",function(){$(this).css({backgroundColor:M})}).off("mouseup").on("mouseup",function(){$(this).css({backgroundColor:k})}).hover(function(){$(this).prepend(a).css({borderBottom:"1px solid "+V})},function(){a.remove(),$(this).css({border:"none"})})}function l(e){var t=$(e.getView()),a=e.getDropDownIcon();a.comps[0].borderColor=C,e.setDropDownIcon(a),t.css({borderColor:v}),e.setBackground(w),e.setLabelColor(b),e.setSelectBackground(y)}function s(e){var t=$(e.getElement());e.setBackground(_),t.css({border:"none",color:S,borderBottom:"1px solid "+D}),B===e&&t.css({textAlign:"center"}),R!==e&&A!==e||t.css({border:"none"})}function c(e){e.css({color:T,fontSize:x,fontFamily:P,fontWeight:400})}function d(e){e=e||function(){},socket.alarmPost("/alarm/GetFilesList",{},function(t){var a;t.success&&((a=t.data&&t.data.data||[]).length?(N.setValues(a),N.setValue(a[0])):R.setValue("您还没有上传过声音文件,请先上传!")),e(t.success)})}function u(e){e=e||function(){};var t={method:"GetLevels",param:{}};socket.alarmPost("/alarm/doservice?level",t,e)}function h(e,t){var a,o=e.length,n=0,i={method:"UpdateLevel"};t=t||function(){};for(var r=0;r<o;r++)a=e[r],i.param=a,socket.alarmPost("/alarm/doservice/?updatelevel",i,function(e){e.success&&++n>=o&&t()})}function g(e,t){setTimeout(function(){t.setValue("")},1e3*e)}function f(){u(function(e){e.success?(J=e.data&&e.data.data||[]).length?B.setValue(J[0].duration):R.setValue("请先配置报警级别!"):J=[]})}var p=(i=i||{}).comboboxValues||[],m=i.comboboxValue||"",v=i.comboboxBorderColor||"black",b=i.comboboxFontColor||"black",w=i.comboboxBackgroundColor||"white",y=i.comboboxSelectBackgroundColor||"gray",C=i.comboboxIconColor||"gray",T=i.labelColor||"black",x=i.labelFontSize||10,P=i.labelFontFamily||"Microsoft Yahei",D=i.inputBorderColor||"black",_=i.inputBackgroundColor||"rgba(0,0,0,0)",S=i.inputFontColor||"black",V=i.buttonLabelColor||"black",k=i.buttonBackgroundColor||"rgba(0,0,0,0)",M=i.buttonSelectBackgroundColor||"rgba(0,0,0,0)",F=i.paneBackgroundColor||"rgba(0,0,0,0)",H=document.createElement("input");H.type="file",H.style.display="none",H.accept=".mp3, .wav, .ogg",document.body.appendChild(H);var I=new ht.widget.BorderPane,L=new ht.widget.FormPane,N=new ht.widget.ComboBox;N.setValues(p),N.setValue(m);var z=new ht.widget.TextField,O=new ht.widget.TextField,R=new ht.widget.TextField,A=new ht.widget.TextField,B=new ht.widget.TextField,Y=new ht.widget.Button,E=new ht.widget.Button,G=new ht.widget.Button,W=$("<span>声音:</span>"),j=$("<span>支持格式:&nbsp;mp3,wav或其它支持的格式</span>"),X=$("<span>播放时长:</span>"),U=$("<span>S/次</span>"),J=[];Y.setLabel("上传"),E.setLabel("删除"),G.setLabel("保存"),d(),f(),L.addRow([N,null],[.85,.15]),L.addRow([R],[1]),L.addRow([W[0],z,null,Y,E],[50,.5,.1,40,40,.22]),L.addRow([null],[1]),L.addRow([j[0],null,null,"",""],[50,.5,.1,.05,.05,.22]),L.addRow([null],[1]),L.addRow([X[0],B,U[0],null,null],[60,60,.1,.4,40,.22]),L.addRow([A],[1]),L.addRow([null],[1]),L.addRow([null,G,null],[.5,40,.5]),r(Y,function(){H.click()}),r(E,function(){var e=z.getValue();e&&confirm("您确定要删除这个声音文件吗?")&&socket.alarmPost("/alarm/deletefile",{name:e},function(e){e.success&&e.data&&e.data.data?(R.setValue("删除文件成功!"),g(3,g),d()):(R.setValue("删除文件失败,请重试!"),g(3,g))})}),r(G,function(){var e,t=B.getValue(),a=z.getValue();if(!J.length)return A.setValue("请先设置完报警级别再配置报警声音!"),void g(3,A);if(!t)return A.setValue("请设置播放时长!"),void g(3,A);if(!$.isNumeric(t))return A.setValue("播放时长只能设置为整数!"),void g(3,A);if(t<=0)return A.setValue("播放时长只能设置为大于0的整数!"),void g(3,A);if(!a)return A.setValue("请选择或上传报警声音!"),void g(3,A);for(var o=0,n=J.length;o<n;o++){(e=J[o]).duration=t-0,e.wave_file=a;for(var i in e)e.hasOwnProperty(i)&&(e[i]={value:e[i]})}h(J,function(){A.setValue("保存成功!"),g(3,A),f()})}),l(N),s(z),z.setEditable(!1),s(R),R.setEditable(!1),s(A),A.setEditable(!1),s(O),s(B),c(W),c(j),c(X),c(U),$(I.getView()).css({background:F}),N.onValueChanged=function(){z.setValue(N.getValue())},$(H).off().on("change",function(){if("function"!=typeof FileReader)return R.setValue("您使用的浏览器版本太低,请更换高版本的浏览器!"),void g(3,R);var e=H.files&&H.files[0]||"",t=e.name||"",a=e.size,o=N.getValues();if(e){if(a>2097152)return R.setValue("您选择的声音文件太大了,请更换声音文件!"),void g(3,R);if(-1===o.indexOf(t)||confirm("您选择的文件名在服务器已保存的文件名冲突,继续上传将会覆盖原有的文件,是否继续?")){var n=new FileReader;n.onload=function(e){var a=this.result;socket.alarmPost("/alarm/UploadFile",{data:a,name:t},function(e){e.success?e.data&&e.data.data&&(R.setValue("上传成功!"),g(3,R),d(function(e){e&&N.setValue(t)})):(R.setValue("上传是发生错误,请重新上传!"),g(3,R))},20)},n.readAsDataURL(e)}}}),I.setCenterView(L);var q=new ht.HtmlNode;return I.setWidth(e),I.setHeight(t),q.setHtml(I),q.setPosition(a,o),q.setSize(e,t),q.setPadding(0),q.setScalable(!1),q.s({"2d.selectable":!0,"2d.moveable":!1}),q.setComboboxValues=function(e){N.setValues(e)},q.setComboboxValue=function(e){N.setValue(e)},dataModel.add(q),q},l.resetNodeBorderWidth=function(e,t){for(var a,o,n,i,r,l=0,s=(e=e||zoomNodeList).length;l<s;l++)n=(o=(a=e[l]).node).borderWidth,o.borderFillwidth,i=a.attr,r=n*t,o.a&&"function"==typeof o.a&&("true"===o.a("node.isFill")||!0===o.a("node.isFill")?o.borderFillwidth=r:(o.a(i,r),"roundrect"===o._nodeType&&(o._borderWidth=r)))},l.getRatioWithRotation=t,l.groupRotat=function(e,a,o,n){if(o&&e&&a){if(n=n||{ratioX:1,ratioY:1},!1===a.scalable)return SetRotatPositionRelative(a,e,o),void a.setRotation(o+a.getRotation());var i=e.getWidth(),r=e.getHeight(),s=e.getPosition(),c=t("function"==typeof e.getRotation?e.getRotation():0,n),d=a.getWidth(),u=a.getHeight(),h=a.getPosition(),g="function"==typeof a.getRotation?a.getRotation():0,f=t(g,n);"False"===a._zoomBy?(f.ratioX=1,f.ratioY=1):"X"===a._zoomBy?f.ratioY=f.ratioX:"Y"===a._zoomBy&&(f.ratioX=f.ratioY),e.setWidth(i/c.ratioX),e.setHeight(r/c.ratioY),e.setPosition(s.x/n.ratioX,s.y/n.ratioY),a.setWidth(d/f.ratioX),a.setHeight(u/f.ratioY),a.setPosition(h.x/n.ratioX,h.y/n.ratioY),SetRotatPositionRelative(a,e,o),a._baseClass&&a._baseClass.match("^ht.lib")?a.setRotation(o+g,{x:a.getPosition().x-e.getPosition().x,y:a.getPosition().y-e.getPosition().y}):a.setRotation(o+g);var p=l.getRatioWithRotation(o+g,n);"False"===a._zoomBy?(p.ratioX=1,p.ratioY=1):"X"===a._zoomBy?p.ratioY=p.ratioX:"Y"===a._zoomBy&&(p.ratioX=p.ratioY),e.setWidth(e.getWidth()*c.ratioX),e.setHeight(e.getHeight()*c.ratioY),e.setPosition(e.getPosition().x*n.ratioX,e.getPosition().y*n.ratioY),a.setWidth(a.getWidth()*p.ratioX),a.setHeight(a.getHeight()*p.ratioY),a.setPosition(a.getPosition().x*n.ratioX,a.getPosition().y*n.ratioY)}},l.showTagInfo=a,l.hideTagInfo=o,l.calcRotation=function(e){e<0&&(e=e%(2*Math.PI)+2*Math.PI);var t=e%Math.PI;return e=t<.25*Math.PI?0:t<=.75*Math.PI?90*Math.PI/180:Math.PI},l.setPageSizeWithRatio=function(e,t,a){var o,r,s,c,d,u;e&&(t=t||window.ratio||{},a=a||window.backSize||{},o=1/t.ratioX,r=1/t.ratioY,d=$window.innerWidth(),u=$window.innerHeight(),"adaptWidth"===e?c=s=d/a.width:"adaptHeight"===e?s=c=u/a.height:"adaptBrowser"===e?(s=d/a.width,c=u/a.height):"originSize"===e?(s=1,c=1):$.isNumeric(e)?s=c=e:"autoResize"===e&&(d=d<PageAdaptMode.minWidth?PageAdaptMode.minWidth:d,u=u<PageAdaptMode.minHeight?PageAdaptMode.minHeight:u,(s=d/a.width)>(c=u/a.height)?s=c:c=s),$.isNumeric(e)?(t.ratioX=t.originRatioX*e,t.ratioY=t.originRatioY*e,l.resizePage(t.ratioX*o,t.ratioY*r)):(t.ratioX=s,t.ratioY=c,t.originRatioX=s,t.originRatioY=c,l.resizePage(o*s,r*c)),i(),n(),setTimeout(function(){graphView.tx(0),graphView.ty(0),graphView.redraw()},0),l.setParams({value:e},"pageSizeRatioValue"))},l.autoToggleScrollBar=n,l.setPageToCenterOrLeftTop=i,l.resizePage=function(e,t){var a=window.innerHeight,o=window.innerWidth;e=e||o/browserSize.width,t=t||a/browserSize.height,browserSize.width=o,browserSize.height=a,$window.trigger("beforeResize"),resizeAllNodes(dataModel,e,t);for(var n=graphView&&graphView.graphViewList||[],i=0,r=n.length;i<r;i++)resizeAllNodes(n[i].getDataModel(),e,t);showPage(),$window.trigger("resizeOver")},l.calcRotationByStartAndEnd=function(e,t){var a,o,n,i,r,l,s=Array.prototype.slice.call(arguments,0),c=Math.atan;if(!s.length)return 0;if(2===s.length&&s[0]&&s[0].length&&s[1]&&s[1].length)a=s[0][0],o=s[0][1],n=s[1][0],i=s[1][1];else{if(4!==s.length)return 0;a=s[0],o=s[1],n=s[2],i=s[3]}return r=n-a,l=i-o,0===r&&l>0?Math.PI:0===r&&l<0?0:r>0&&0===l?.5*Math.PI:r<0&&0===l?.5*-Math.PI:r>0&&l>0?Math.PI-c(r/l):r>0&&l<0?c(r/-l):r<0&&l<0?-1*c(r/l):r<0&&l>0?c(-r/l)-Math.PI:void 0},e.GD=l}(window),function(e){function t(e,o,n,i,r,l,s,c,d,u){var h,g=t._messageDialog||new ht.widget.Dialog,n='<p class="dialog-content-custom">'+n+"</p>";l=l||"rgb(47, 131, 217)",c=c||"提示",s=s||[{label:"确认",className:"dialog-button-confirm"},{label:"取消",className:"dialog-button-cancel"}],g.isShowing()&&g.hide(),h=d&&u?{x:d,y:u}:"center",g.setConfig({title:c,titleAlign:"left",closable:!0,draggable:!0,position:h,width:e,height:o,content:n,contentPadding:20,buttons:s,buttonsAlign:"center",action:function(e,t){"确认"==e.label||"确定"===e.label?(i(),g.hide()):(r(),g.hide())}}),g.setModal(!1),t._messageDialog=g,a($(g.getView()),l,e,o),g.show()}function a(e,t,a,o){e.css({zIndex:100}).find(".dialog-container").css({border:"5px solid "+t,padding:0,borderRadius:5,minWidth:a,minHeight:o,boxShadow:"3px 3px 8px rgb(50,50,50)"}).find(".dialog-container-title").css({backgroundColor:t,height:30,boxShadow:"0 2px 6px rgb(50,50,50)",left:-5,top:-5,width:a,position:"absolute",padding:"0 20px 0 20px",borderRadius:5,lineHeight:"30px"}).find(".dialog-title-control").css({marginTop:2}).end().end().find(".dialog-container-buttons").css({bottom:5}).find(".dialog-button-confirm").css({background:t,marginRight:20})}var o=e.GD||{};o.getRectJSON=function(){var e={width:{value:100,func:"attr@node.width"},height:{value:100,func:"attr@node.height"},clip:function(e,t,a,o){drawRect(e,0,0,o.getWidth(),o.getHeight()),e.clip()},comps:[{type:{value:"rect",func:"attr@node.type"},rect:{value:[0,0,"",""],func:"attr@node.rect"},background:{value:"",func:"attr@node.background"},gradientColor:{value:"",func:"attr@node.gradientcolor"},gradient:{value:"",func:"attr@node.gradient"}},{type:"rect",rect:{value:[0,0,0,0],func:"attr@node.fillrect"},background:{value:"",func:"attr@node.fillbackcolor"},gradientColor:{value:"",func:"attr@node.fillgradientcolor"},gradient:{value:"",func:"attr@node.fillgradient"}},{type:{value:"rect",func:"attr@node.type"},rect:{value:[0,0,0,0],func:"attr@node.rect"},borderWidth:{value:2,func:"attr@node.borderwidth"},borderColor:{value:"",func:"attr@node.color"},borderPattern:{value:[0,0],func:"attr@node.borderPattern"}}]},t={width:{value:100,func:"attr@node.width"},height:{value:100,func:"attr@node.height"},clip:function(e,t,a,o){drawEllipse(e,0,0,o.getWidth(),o.getHeight()),e.clip()},comps:[{type:{value:"rect",func:"attr@node.type"},rect:{value:[0,0,0,0],func:"attr@node.rect"},background:{value:"",func:"attr@node.background"},gradientColor:{value:"",func:"attr@node.gradientcolor"},gradient:{value:"",func:"attr@node.gradient"},arcFrom:{value:0,func:"attr@node.arcFrom"},arcTo:{value:0,func:"attr@node.arcTo"},arcClose:{value:!1,func:"attr@node.arcClose"}},{type:"rect",rect:{value:[0,0,0,0],func:"attr@node.fillrect"},background:{value:"",func:"attr@node.fillbackcolor"},gradientColor:{value:"",func:"attr@node.fillgradientcolor"},gradient:{value:"",func:"attr@node.fillgradient"}},{type:{value:"rect",func:"attr@node.type"},rect:{value:[0,0,"",""],func:"attr@node.rect"},borderWidth:{value:2,func:"attr@node.borderwidth"},borderColor:{value:"",func:"attr@node.color"},borderPattern:{value:[0,0],func:"attr@node.borderPattern"},arcFrom:{value:0,func:"attr@node.arcFrom"},arcTo:{value:0,func:"attr@node.arcTo"},arcClose:{value:!1,func:"attr@node.arcClose"}}]},a={width:{value:100,func:"attr@node.width"},height:{value:100,func:"attr@node.height"},clip:function(e,t,a,o){},comps:[{type:{value:"rect",func:"attr@node.type"},rect:{value:[0,0,0,0],func:"attr@node.rect"},background:{value:"",func:"attr@node.background"},gradientColor:{value:"",func:"attr@node.gradientcolor"},gradient:{value:"",func:"attr@node.gradient"},arcFrom:{value:0,func:"attr@node.arcFrom"},arcTo:{value:0,func:"attr@node.arcTo"},arcClose:{value:!1,func:"attr@node.arcClose"},arcOval:{value:!0,func:"attr@node.arcOval"}},{type:"rect",rect:{value:[0,0,0,0],func:"attr@node.fillrect"},background:{value:"",func:"attr@node.fillbackcolor"},gradientColor:{value:"",func:"attr@node.fillgradientcolor"},gradient:{value:"",func:"attr@node.fillgradient"}},{type:{value:"rect",func:"attr@node.type"},rect:{value:[0,0,"",""],func:"attr@node.rect"},borderWidth:{value:2,func:"attr@node.borderwidth"},borderColor:{value:"",func:"attr@node.color"},borderPattern:{value:[0,0],func:"attr@node.borderPattern"},arcFrom:{value:0,func:"attr@node.arcFrom"},arcTo:{value:0,func:"attr@node.arcTo"},arcClose:{value:!1,func:"attr@node.arcClose"},arcOval:{value:!0,func:"attr@node.arcOval"}}]};return function(o,n,i,r,l,s){var c;return"oval"===i?c=t:"rect"===i?c=e:"arc"===i&&(c=a),c}}(),o.getTextJSON=function(){var e={width:{value:100,func:"attr@node.width"},height:{value:100,func:"attr@node.height"},comps:[{type:"rect",rect:{value:[0,0,0,0],func:"attr@node.rect"},borderWidth:{value:0,func:"attr@node.borderwidth"},borderColor:{value:"",func:"attr@node.bordercolor"},gradient:{value:"",func:"attr@node.gradient"},background:{value:"",func:"attr@node.background"},gradientColor:{value:"",func:"attr@node.gradientcolor"}},{type:"text",text:{value:"",func:"attr@node.text"},align:{value:"",func:"attr@node.textalign"},vAlign:{value:"",func:"attr@node.textvAlign"},rect:{value:[0,0,0,0],func:"attr@node.textrect"},color:{value:"",func:"attr@node.color"},font:{value:"",func:"attr@node.font"},visible:{value:!0,func:"attr@node.textvisible"}},{type:{value:function(){},func:"attr@node.textfunc"},visible:{value:!0,func:"attr@node.linefeed"}},{type:"shape",borderWidth:{value:1,func:"attr@node.underlineBorderWidth"},borderColor:{value:"",func:"attr@node.color"},points:{value:"",func:"attr@node.underlinepoints"},segments:[1,2],visible:{value:!0,func:"attr@node.underlinevisible"}}]};return function(t,a,o,n,i,r){return e}}(),o.getPolyLineJSON=function(){var e;return function(){return e=e||{width:{value:1,func:"attr@node.width"},height:{value:1,func:"attr@node.height"},comps:[{type:"shape",points:{value:[],func:"attr@node.points"},segments:{value:[],func:"attr@node.segments"},borderWidth:{value:1,func:"attr@node.borderwidth"},borderColor:{value:"rgb(0,0,0)",func:"attr@node.color"},closePath:!1,dash:!1,borderPattern:{value:getDashStyle(""),func:"attr@node.borderPattern"}},{type:"triangle",background:{value:"rgb(0,0,0)",func:"attr@node.background"},gradient:{value:"rgb(0,0,0)",func:"attr@node.gradient"},gradientColor:{value:"rgb(0,0,0)",func:"attr@node.gradientcolor"},rect:{value:[],func:"attr@node.endCompspts"},rotation:{value:0,func:"attr@node.endRotation"},offsetX:{value:0,func:"attr@node.offsetEndX"},offsetY:{value:0,func:"attr@node.offsetEndY"}},{type:"triangle",background:{value:"@backcolor@",func:"attr@node.background"},gradient:{value:"rgb(0,0,0)",func:"attr@node.gradient"},gradientColor:{value:"rgb(0,0,0)",func:"attr@node.gradientcolor"},rect:{value:[],func:"attr@node.startCompspts"},rotation:{value:0,func:"attr@node.startRotation"},offsetY:{value:0,func:"attr@node.offsetStartY"},offsetX:{value:0,func:"attr@node.offsetStartX"}}]}}}(),o.getPolyGonJSON=function(){var e;return function(){return e=e||{width:{value:10,func:"attr@node.width"},height:{value:10,func:"attr@node.height"},clip:{value:function(){},func:"attr@node.clip"},comps:[{type:{value:"rect",func:"attr@node.type"},points:{value:[],func:"attr@node.comsPoints"},segments:{value:[],func:"attr@node.segments"},closePath:{value:!0,func:"attr@node.closePath"},borderWidth:{value:1,func:"attr@node.borderwidth"},borderColor:{value:"rgb(0,0,0)",func:"attr@node.color"},background:{value:"rgb(0,0,0)",func:"attr@node.background"},gradient:{value:"",func:"attr@node.gradient"},gradientColor:{value:"rgb(0,0,0)",func:"attr@node.gradientcolor"},isFill:{value:"false",func:"attr@node.isFill"}},{type:"rect",rect:{value:[0,0,0,0],func:"attr@node.original"},background:{value:"rgb(0,0,0)",func:"attr@node.background"},gradient:{value:"",func:"attr@node.gradient"},gradientColor:{value:"rgb(0,0,0)",func:"attr@node.gradientcolor"}},{type:"rect",rect:{value:[0,0,0,0],func:"attr@node.fillrect"},background:{value:"rgb(0,0,0)",func:"attr@node.fillbackcolor"},gradient:{value:"",func:"attr@node.fillgradient"},gradientColor:{value:"rgb(0,0,0)",func:"attr@node.fillgradientcolor"}},{type:{value:"rect",func:"attr@node.type"},points:{value:[],func:"attr@node.comsPoints"},segments:{value:[],func:"attr@node.segments"},closePath:{value:!0,func:"attr@node.closePath"},borderWidth:{value:1,func:"attr@node.borderwidth"},borderColor:{value:"rgb(0,0,0)",func:"attr@node.color"},borderJoin:"miter",borderPattern:{value:"",func:"attr@node.borderPattern"}}]}}}(),o.getBowJSON=function(){var e;return function(){return e=e||{width:{value:10,func:"attr@node.width"},height:{value:10,func:"attr@node.height"},comps:[{type:"arc",rect:{value:[0,0,100,100],func:"attr@node.rect"},arcFrom:{value:0,func:"attr@node.arcFrom"},arcTo:{value:0,func:"attr@node.arcTo"},arcClose:!1,arcOval:!0,borderWidth:{value:1,func:"attr@node.borderwidth"},borderColor:{value:"rgb(0,0,0)",func:"attr@node.color"},background:{value:"rgb(0,0,0)",func:"attr@node.background"},dash:!1,gradient:{value:"",func:"attr@node.gradient"},gradientColor:{value:"rgb(0,0,0)",func:"attr@node.gradientcolor"},borderPattern:{value:"",func:"attr@node.borderPattern"}},{type:"shape",borderWidth:{value:1,func:"attr@node.borderwidth"},borderColor:{value:"rgb(0,0,0)",func:"attr@node.borderColor"},points:{value:[],func:"attr@node.points"},borderPattern:{value:getDashStyle("@borderPattern@"),func:"attr@node.borderPattern"},segments:[1,2]}]}}}(),function(e){var t={};o.createAlarmWindow=function(e){function a(e,t,a,o){return'<li data-target="item'+e+'" data-index="'+o+'" class="item'+e+" "+(t?"current":"")+'">'+a+"</li>"}function o(e,t,a){var o=[];return o.push('<li class="item'+e+" "+(t?"current":"")+'">'),o.push('<ul class="alarm-window-body-content-data">'),o.push('<li class="clearfix"><span>设备编号:</span> <p class="alarm-fannumber">'+a.alarmAreaName+"</p></li>"),o.push('<li class="clearfix"><span>故障名称:</span> <p class="alarm-name">'+a.alarmDesc+"</p></li>"),o.push('<li class="clearfix">'),o.push("<span>故障时间:</span>"),o.push("<p>"),o.push('<span class="alarm-date">'+a.alarmTime.split(" ")[0]+"</span>"),o.push('<span class="alarm-time">'+a.alarmTime.split(" ")[1]+"</span>"),o.push("</p></li></ul></li>"),o.join("")}function n(e){if(e){var n,i=t._$dom||$(t._dom),r=i.find(".alarm-window-tab-title-container"),l=i.find(".alarm-window-body-content-container"),s=t._$count||i.find(".alarm-count"),c=0;t.alarmData=e,r.children().remove(),l.children().remove();for(var d in e)if("count"!==d&&e.hasOwnProperty(d)){if(!(n=e[d]))continue;r.append($(a(c,!!n.isCurrent,n.systemName,d))),l.append($(o(c,!!n.isCurrent,n))),n.isCurrent&&(t.currentData=n),c++}s.text(e.count||0)}}function i(){var e=t._$dom||$(t._dom);t._isHide=!0,e.stop().hide()}return e=e||function(){},t._dom=t._dom||function(){var e=[];return e.push('<div class="alarm-window-container noselect">'),e.push('<div class="alarm-window-head">'),e.push('<h3><span>待确认故障</span><strong class="alarm-count">3</strong><span>项</span></h3>'),e.push('<div class="alarm-window-head-btns"><span data-state="max" class="alarm-window-head-btns-toggle">-</span></div>'),e.push("</div>"),e.push('<div class="alarm-window-body">'),e.push('<div class="alarm-window-body-tab">'),e.push('<ul class="alarm-window-tab-title-container">'),e.push("</ul>"),e.push("</div>"),e.push('<div class="alarm-window-body-content">'),e.push('<div data-flag="flag1" class="alarm-window-body-flag"></div>'),e.push('<ul class="alarm-window-body-content-container">'),e.push("</ul>"),e.push("</div>"),e.push('<div class="alarm-window-body-btns">'),e.push('<div><span class="alarm-window-confirmbtn">确认</span></div>'),e.push("</div></div></div>"),$(e.join(""))[0]}(),t.refreshData=function(e){e&&e.count?(n(e),t.isHide()&&t.alarmWindowShow()):t.alarmWindowHide()},t.alarmWindowMinify=function(){var e=t._$dom||$(t._dom);e.addClass("alarm-window-minify"),e.css({left:"auto",top:"auto"})},t.alarmWindowReduction=function(){(t._$dom||$(t._dom)).removeClass("alarm-window-minify")},t.alarmWindowDragable=function(e){if(e){var a,o,n=t._$dom||$(t._dom),i=n.find(".alarm-window-head"),r=i.find("h3"),l=$(document.body),s=$(window),c=function(e){var t=e.clientX,i=e.clientY,r=t-a,l=i-o,c=s.width(),d=s.height(),u=c-n.width(),h=d-n.height();r=r<=0?0:r,l=l<=0?0:l,r=r>=u?u:r,l=l>=h?h:l,n.css({left:r,top:l})};r.on("mousedown",function(e){e.stopPropagation()}),i.on("mousedown",function(e){e.stopPropagation(),a=e.offsetX,o=e.offsetY,l.on("mousemove",c)}),l.on("mouseup",function(e){l.off("mousemove",c)}).on("mouseleave",function(){l.off("mousemove",c)})}},t.alarmWindowShow=function(){var e=t._$dom||$(t._dom);t._isHide=!1,e.stop().show()},t.alarmWindowHide=i,t.addEventToDom=function(a){var o=$(a),n=o.find(".alarm-window-body-tab"),i=o.find(".alarm-window-body-content"),r=n.find("li"),l=i.find("li"),s=o.find(".alarm-window-confirmbtn"),c=o.find(".alarm-window-head-btns-toggle");r.off("click").on("click",function(){var e=$(this),a="."+e.data("target"),o=e.data("index");r.removeClass("current"),e.addClass("current"),l.removeClass("current").parent().find(a).addClass("current"),t.currentData=t.alarmData&&t.alarmData[o]}),c.off("click").on("click",function(){"max"===c.data("state")?(c.text("+"),c.data("state","min"),t.alarmWindowMinify()):(c.text("-"),c.data("state","max"),t.alarmWindowReduction())}).off("mousedown").on("mousedown",function(e){e.stopPropagation()}),s.off("click").on("click",function(){e()}),o.off("mouseenter").on("mouseenter",function(e){e.stopPropagation(),t.isHide()||o.stop().fadeTo(300,1)}).off("mouseleave").on("mouseleave",function(e){e.stopPropagation(),t.isHide()||o.stop().fadeTo(1e3,.3)})},t.isHide=function(){return t._isHide},t.delayFade=function(e){var a=t._$dom||$(t._dom);setTimeout(function(){t.isHide()||a.stop().fadeTo(500,.3)},e)},t.setFlagShaly=function(){var e=(t._$dom||$(t._dom)).find(".alarm-window-body-flag");t._timer&&clearInterval(t._timer),t._timer=setInterval(function(){"flag1"===e.data("flag")?(e.data("flag","flag2"),e.css({backgroundPosition:"right center"})):(e.data("flag","flag1"),e.css({backgroundPosition:"left center"}))},500)},t.delayFade(3e3),i(),t}}(),o.testSearchTime=function(e,t){return e&&t?!(+new Date(e)>=+new Date(t)&&(o.createErrorDialog(360,240,"开始时间应小于结束时间!"),1)):(o.createErrorDialog(360,240,"请先选择查询时间段!"),!1)},o.createPagenation=function(){new ht.widget.Tollbar,pageinputHis,width},o.setFrozentableStyle=function(e,t){var a=t.rowHeight||20,o=t.rowLineVisible,n=t.columnLineVisible,i=t.isRowAlter,r=t.rowAlterColor||"rgba(0,0,0,0)",l=t.selectedRowColor||"rgba(0,0,0,0)",s=t.backColor||"rgb(255,255,255)",c=t.headColor||"rgb(125, 125, 125)",d=t.headGradientColor||"rgb(125, 125, 125)",u=t.fontColor||"black",h=t.fontSize||12,g=t.fontFamily||'"Microsoft YaHei"',f=t.headerFontSize||14,p=t.headerFontFamily||'"Microsoft Yahei"',m=t.headerFontStyle||"normal",v=t.headerHeight||26,b=t.headerBackImage,w=t.bodyFontStyle||"normal",y=t.scrollBarColor||"rgba(100, 100, 100, 0.3)",C=t.lineColor;if(e.setRowHeight(a),e.setRowLineVisible(o),e.setColumnLineVisible(n),e.drawRowBackground("rgba(0,0,0,0)",i,r,l),e.setBackground(s),e.setHeaderGradientColor(c,d),e.getLabelColor(u),e.getLabelFont(h,g),e.setBodyLabelFont(h,g,w),e.setHeaderLabelFont(f,p,m),e.setHeaderHeight(v),e.setRowLineColor(C),e.setColumnLineColor(C),e.setFrozentableScrollBarColor(y),b){var T=$("<div></div>");T.css({height:v,left:0,right:0,top:0,position:"absolute",backgroundImage:"url("+PAGEROOTDIR+b+")",backgroundSize:"100% 100%",backgroundRepeat:"no-repeat",backgroundPosition:"center center"}),$(e.getBorderPane().getView()).css({overflow:"visible"}).prepend(T)}},o.setupDatePicker=function(e,t){var a,o=$(e);o.on("click",function(e){o.focus()}).on("keyup",function(e){t.hint(o.val()),13===e.keyCode&&(a=o.val(),$("span.laydate-btns-clear").trigger("click"),t.config.value=a,o.val(a),o.blur(),t._instance&&t._instance.checkDate())}).on("blur",function(e){o.val(a)}).on("focus",function(e){a=o.val()})},o.setDialogStyle=a,o.createMessageDialog=t,o.createErrorDialog=function(e,a,o,n,i){t(e,a,o,n=n||function(){},i=i||function(){},"rgb(207,145,38)",[{label:"确定",className:"dialog-button-confirm"}])},o.createButton=function(e,t,a,n,i,r){var l=new ht.HtmlNode,s=$('<a class="btn btn-default"><i></i></a>'),c=r.text||"Text",d=!!r.visible,u=r.backColor||"rgba(220,220,220,1)",h=r.fontSize||12,g=r.fontFamily||'"Microsoft YaHei"',f=r.fontColor||"rgba(255, 255, 255, 1)",p=r.textAlign||"center",m=r.borderRaidus||"2px",v=r.borderColor||"#ccc",b=r.shadowColor||"#333",w=r.hoverShadowColor||"#eee",y=!!r.bold,C=!!r.italic,T=(r.underline,r.deleteline,r.icon),x=r.backImage,P=(r.clickFunc,h*ratio.ratioY+"px "+g),D=$('<div class="button-mask"></div>');o.getRatioWithRotation(i,ratio);y&&(P="bold "+P),C&&(P="italic "+P);l.setWidth,l.setHeight;var _=new ht.widget.Button;return _.setLabel(c),_.setBackground("rgba(0,0,0,0)"),_.setSelectBackground("rgba(0,0,0,0)"),_.setBorderColor("rgba(0,0,0,0)"),_.setLabelFont(P),_.setLabelColor(f),T&&_.setIcon(PAGEROOTDIR+T),s=$(_.getView()),x?(x.match(/^http:|^https:/)||(x=PAGEROOTDIR+x),s.css({backgroundImage:"url("+x+")",backgroundPosition:"center center",backgroundRepeat:"no-repeat",backgroundSize:"100% 100%"})):s.css({background:u}),l._$btnView=s,l.setHtml(_),l.setScalable(!1),l.setPadding(0),l.setWidth(e),l.setHeight(t),l.setPosition(a,n),l.setRotation(i),l._btn=_,l.s({"2d.selectable":!1,"2d.movable":!1,"2d.visible":d}),l.setLabelColor=function(e){this._$btnView.css({color:e})},l.setLabel=function(e){this._btn.setLabel(e)},l.setLabelFont=function(e){this._btn.setLabelFont(e)},l.getLabelFont=function(){return this._btn.getLabelFont()},l.setBackground=function(e){this._$btnView.css({backgroundColor:e})},l.addEvent=function(e,t){s=l._$btnView,t="function"==typeof t?t:function(){},s.on(e,function(e){t.call(l,e)})},function(e,t,a,o){e.css({borderRadius:m,overflow:"hidden",padding:0,margin:0,textAlign:p,cursor:"pointer",borderColor:v,boxShadow:"0 0 5px "+b}).hover(function(){e.append(t).css({boxShadow:"0 0 5px "+w})},function(){t.remove(),e.css({boxShadow:"0 0 5px "+b})}).on("mousedown",function(){e.parent().css({padding:"1px 0 0 1px"})}).on("mouseup",function(){e.parent().css({padding:0})}).find("canvas").css({top:0,left:0}),r.clickFunc&&a.addEvent("click",r.clickFunc);var n=a.setHeight;a.setHeight=function(e){var t=h*ratio.ratioY+"px "+g;y&&(t="bold "+t),C&&(t="italic "+t),_.setLabelFont(t),n.call(a,e)}}(s,D,l),dataModel.add(l),l},e.GD=o}(window),function(e){var t=e.GD||{};t.getHisTrendData=function(e,t){var a,o=e.split("&");str="http://"+webServiceIP+":"+webServicePort+"/api/HistoryInterval?tagName=",str=str+encodeURIComponent(o[0])+"&"+o[1]+"&"+o[2]+"&"+o[3]+"&"+o[4],$.ajax({url:str,type:"GET",dataType:"json",cache:!1,success:function(e){a=e},complete:function(e,o){t(a)},error:function(e){a=null}})},e.GD=t}(window),function(e,t){function a(e,a){this._url=e,this._params=a,this.socketio=t(e,a),this._alarmPostCount=0,this._callbackDic={},this.init()}var o=e.GD||{};if(t){var n={success:!1,error:{code:408,detail:"请求超时",status:"Request Timeout"},api:""},i={success:!1,error:{code:401,detail:"用户未登录",status:"User Logout"},api:""};a.prototype={init:function(){var e,t=this;t.socketio.on("message",function(a){var o,n=(a=JSON.parse(a)).api;"alarmservice.call"==n?(o=a.body&&a.body.json&&a.body.json.split("{")[0],t._callbackDic["alarmservice.call"]&&"function"==typeof t._callbackDic[n][o]&&(t._callbackDic[n][o](t._depackAlarmData(a)),t._callbackDic[n][o]=null)):"alarmservice.sub"===n?(e=t._callbackDic["alarmservice.sub"]||function(){})(t._depackAlarmData(a)):"function"==typeof t._callbackDic[n]&&(t._callbackDic[n](a),t._callbackDic[n]=null),e=null})},on:function(e,t){t=t||function(){},this.socketio.on(e,function(a){var o;try{o=JSON.parse(a)}catch(t){o={success:!1,error:{code:"417",detail:"返回参数格式错误",status:"format error"},api:e}}t(o)})},alarmOn:function(e,t){var a=this;t=t||{},a.on(eventName,function(o){var n={};(n=o&&o.success?a._depackAlarmData(o):o).api=e,t(n)})},post:function(e,t,a,o){var r,l=this;if(!l.socketio.connected){if(!1===l.socketio.reconnection)return;return r=Array.prototype.slice.call(arguments,0),void function(e,t){setTimeout(function(){t.post.apply(t,e)},100)}(r,l)}o=o||8,"function"==typeof t?(a=t,t={}):(t=t||{},a=a||function(){});var s={},c={};if("auth.authenticate"!=e){var d=localStorage.getItem("token");if(!d)return i.api=e,void a(i);d=d.replace(/^\s+/g,"").replace(/\s+$/g,"").replace(/^"/g,"").replace(/"$/g,""),s.token=d,c.header=s}c.api=e,c.request=t,c=JSON.stringify(c),l._callbackDic[e]=a,l.socketio.emit("message",c,function(){});setTimeout(function(){n.api=e;var t;"function"==typeof(t=l._callbackDic[e])&&(t(n),l._callbackDic[e]=null)},1e3*o)},alarmPost:function(e,t,a,o){var n,r=this,l={};if(!r.socketio.connected){if(!1===r.socketio.reconnection)return;return n=Array.prototype.slice.call(arguments,0),void function(e,t){setTimeout(function(){t.alarmPost.apply(t,e)},100)}(n,r)}o=o||10,"function"==typeof t?(a=t,t={}):(t=t||{},a=a||function(){});var s,l={},c=e.split("?")[0],d="_";r._alarmPostCount+=1,r._alarmPostCount>100&&(r._alarmPostCount=1),d+=r._alarmPostCount,"/alarm/SubscribeNotify"===c?(l.json=d+JSON.stringify({data:t}),s="alarmservice.sub",r._callbackDic[s]=a):(l.json=d+JSON.stringify({data:t,url:c}),s="alarmservice.call",r._callbackDic[s]=r._callbackDic[s]||{},r._callbackDic[s][d]=a);var u=localStorage.getItem("token"),h={},g={};if(!u)return i.api=s,void a(i);u=u.replace(/^\s+/g,"").replace(/\s+$/g,"").replace(/^"/g,"").replace(/"$/g,""),h.token=u,g.header=h,g.api=s,g.request=l,g=JSON.stringify(g),r.socketio.send(g)},reconnect:function(e){e=e||function(){},this.socketio.reconnect(e)},disconnect:function(e){e=e||function(){},this.socketio.disconnect(e)},getNewToken:function(){},_depackAlarmData:function(e){var t,a,n={};try{"alarmservice.call"==e.api?(a=e.body.json.split("{")[0],"}"!=(t=o.deEscape(e.body.json.substring(e.body.json.indexOf("{"))))[t.length-1]&&(t+="}"),(n=JSON.parse(t)).flagnum=a):"alarmservice.sub"==e.api&&(t=o.deEscape(e.body.json),n=JSON.parse(t)),n.success=!0}catch(e){n.success=!1,n.data={},n.error={code:"",status:"",detail:e.message}}return n},_packAlarmData:function(){}},o.io=function(e,t){return new a(e,t)},e.GD=o}}(window,_io),function(e){var t=e.GD||{};t.exportElectricIndicates=function(e,t,a,o){var n="tags="+(a=a.join(","))+"&";n+="beginTime="+e+"&",n+="endTime="+t+"&",n+="valueType="+o.join(",");var i=document.createElement("a");i.download="exportExcel",i.href="http://"+webServiceIP+":"+webServicePort+"/api/ExportToExcelInterpo?"+encodeURIComponent(n),i.click()},t.exportArrToCsv=function(e,t){if(t=t||"data",e){for(var a,o=[],n=0,i=e.length;n<i;n++)o.push(e[n].join(","));a="\ufeff"+(a=o.join("\r\n"));var r=new Blob([a],{type:"text/csv;charset=UTF-8"});saveAs(r,t+Date.now()+".csv")}},t.getCurrentUserName=function(e){var a=t.getParams("user")||{};if(!e)return a.name||""},t.getCurrentUserGroup=function(e){return""},e.GD=t}(window),function(e){var t=e.GD||{},a=function(){var e=document.createElement("canvas").getContext("2d");return function(t,a){return e.font=a,e.measureText(t).width}}();t.eval=function(e){var t,a=new Function("return "+e);try{t=a()}catch(e){console.log(e.message),t=e}return t},t.isEmptyObj=function(e){for(var t in e)if(e.hasOwnProperty(t))return!1;return!0},t.deEscape=function(e){return e?e=unescape(e.replace(/\\(u[0-9a-fA-F]{4})/gm,"")):""},t.getRelativeDate=function(e,t,a){var o=new Date,n={date:"YYYY-MM-DD",time:"HH:mm:ss",datetime:"YYYY-MM-DD HH:mm:ss",year:"YYYY",month:"YYYY-MM"};e=$.trim(e);var i,r=parseInt(e);return i=function(t,a,o){switch(e.substr(r.toString().length)){case"h":case"hour":t.setHours(t.getHours()-r),"begin"===o&&(t.setMinutes(0),t.setSeconds(0),t.setMilliseconds(0)),"end"===o&&0!==r&&(t.setMinutes(59),t.setSeconds(59),t.setMilliseconds(0));break;case"d":case"day":t.setDate(t.getDate()-r),"begin"===o&&(t.setHours(0),t.setMinutes(0),t.setSeconds(0),t.setMilliseconds(0)),"end"===o&&0!==r&&(t.setHours(23),t.setMinutes(59),t.setSeconds(59),t.setMilliseconds(0));break;case"m":case"month":t.setMonth(t.getMonth()-r),"begin"===o&&(t.setDate(1),t.setHours(0),t.setMinutes(0),t.setSeconds(0),t.setMilliseconds(0)),"end"===o&&0!==r&&(t.setMonth(t.getMonth()+1),t.setDate(1),t.setHours(0),t.setMinutes(0),t.setSeconds(0),t.setMilliseconds(0),t=new Date(+new Date(t)-1e3));break;case"y":case"year":t.setFullYear(t.getFullYear()-r),"begin"===o&&(t.setMonth(0),t.setDate(1),t.setHours(0),t.setMinutes(0),t.setSeconds(0),t.setMilliseconds(0)),"end"===o&&0!==r&&(t.setFullYear(t.getFullYear()+1),t.setMonth(0),t.setDate(1),t.setHours(0),t.setMinutes(0),t.setSeconds(0),t.setMilliseconds(0),t=new Date(+new Date(t)-1e3));break;default:t=e}return t}(o,0,a),function(e,t){return moment(e).format(n[t]||n.datetime)}(i,n[t])},t.getMaxAndMinFromSeries=function(e){for(var t,a,o,n=min=0,i=0,r=e.length;i<r;i++)for(var l=0,s=(a=(t=e[i]).data||[]).length;l<s;l++)n=(o=a[l]-0)>n?o:n,min=o<min?o:min;return{max:n,min:min}},t.eascape=function(e){return e},t.getStrLength=function(e){return e?(e.toString&&(e=e.toString()),e.replace(/[^\x00-\xff]/g,"01").length):0},t.measureCanvasText=a,t.throttle=function(e,t){t=t||200,(e="function"==typeof e?e:function(){})._timer_&&clearTimeout(e._timer_);var a=Array.prototype.slice.call(arguments,2);e._timer_=setTimeout(function(){e._timer_=null,e.apply(null,a)},t)},t.getSearchObjFromUrl=function(e){var t,a,o,n={};t=-1===(e=e||location.href).indexOf("?")?0:e.indexOf("?")+1;for(var i=0,r=(a=e.substr(t).split("&")).length;i<r;i++)(o=a[i].split("="))[0]&&o[1]&&(n[o[0]]=o[1]);return n},t.removeRepeated=function(e,t){for(var a,o={},n=[],i=0,r=e.length;i<r;i++)o[a=e[i]]||(n.push(a),o[a]=!0);if(t)for(e.length=0,i=0,r=n.length;i<r;i++)e.push(n[i]);return n},e.GD=t}(window),$window.off("customEventJump").on("customEventJump",function(e,t){if(t&&t.hash){var a=window.location.hash||"#";a=a.substr(1),t.params&&saveLocalParams&&saveLocalParams(t.params),window.location.hash=t&&t.hash,a===t.hash&&loadPage(a)}}),$window.off("customEventSetPageSizeWithRatio").on("customEventSetPageSizeWithRatio",function(e,t){var a=t&&t.ratio;a&&window.GD&&GD.setPageSizeWithRatio(a)}),function(){var e=location.search;if(e){var t=searchStrToObj(e)||{};t.user&&localStorage.setItem("user",t.user),t.token&&localStorage.setItem("token",t.token),t.userGroup&&localStorage.setItem("userGroup",t.userGroup),t.userLevel&&localStorage.setItem("userLevel",t.userLevel),t.extra&&localStorage.setItem("extra",t.extra)}}();