/** * 热力区域组件 */ function windowToCanvas(e) { var x = e.x || e.clientX, y = e.y || e.clientY, bbox = canvas.getBoundingClientRect(); return { x: x - bbox.left * (canvas.width / bbox.width), y: y - bbox.top * (canvas.height / bbox.height) }; } //热力区域点击时间 function drawBeauty(){ context.save(); context.drawImage(beauty, 0, 0, width, height); //点击获取坐标 canvas.onmousedown = function (e) { var loc = windowToCanvas(e); e.preventDefault(); // prevent cursor change var lnglat = new Array; lnglat[0]=loc.x; lnglat[1]=loc.y; var id = ""; var type = ""; if(dataAll != null && dataAll != undefined && dataAll != ''){ for(var i=0;i Math.min(p1[0], p2[0]) && checkPoint[0] <= Math.max(p1[0], p2[0]) ) { if (checkPoint[1] <= Math.max(p1[1], p2[1])) { if (p1[0] != p2[0]) { xinters = ((checkPoint[0] - p1[0]) * (p2[1] - p1[1])) / (p2[0] - p1[0]) + p1[1]; if (p1[1] == p2[1] || checkPoint[1] <= xinters) { counter++; } } } } p1 = p2; } return !(counter % 2 == 0); } function selectAssembly_Heat(efficiencyOverviewMpConfigure) { var colors = ["RGBA(251,255,205,0.8)","RGBA(250,232,126,0.8)", "RGBA(252,203,84,0.8)", "RGBA(251,169,97,0.8)", "RGBA(232,75,34,0.8)","RGBA(175,0,18,0.8)"]; var data=efficiencyOverviewMpConfigure; var lnglats= eval("["+data.lnglats+"]"); var scale = 1 var count = data.showParmValue; if(count==null || count== undefined || count==''){ count=100; } var color="RGBA(175,0,18,0.8)"; //根据数据与最大值比例选择区域颜色 if(count>8){ color = colors[5]; }; if(count>6 && count<=8){ color = colors[4]; } if(count>4 && count<=6){ color = colors[3]; } if(count>2 && count<=4){ color = colors[1]; } if(count<=2){ color = colors[0]; } //绘制区域颜色 context.fillStyle = color; context.strokeStyle = "RGBA(232,75,34,0.6)"; context.lineWidth=3; //绘制区域开始 context.beginPath(); if(data.lnglats!=null && data.lnglats!=undefined && data.lnglats!=''){ for(var a=0;a0&&width>0){ divHtml="
"+mpdata.mpname+":"+parmValue+""+unit+"
"; }else{//未设置长宽,则自适应显示 divHtml+="
"; divHtml+=""; divHtml+="
"; } }else if(signaltype=='DI'){ var showColor="#000000"; if(ledtype=='1'){//运行点 if(ledcolor=='1'){//红开绿停 if(Number(parmValue)==0){ showColor='green'; }else if(Number(parmValue)==1){ showColor='red'; }else if(Number(parmValue)==2){ showColor='yellow'; } }else if(ledcolor=='0'){//绿开红停 if(Number(parmValue)==0){ showColor='red'; }else if(Number(parmValue)==1){ showColor='green'; }else if(Number(parmValue)==2){ showColor='yellow'; } } }else if(ledtype=='0'){//故障点 //透明正常黄故障 if(Number(parmValue)==0){ showColor='transparent'; }else if(Number(parmValue)==1){ showColor='yellow'; } } divHtml+="
"; divHtml+="" divHtml+=""; divHtml+="" divHtml+="
"; } }else{ divHtml="
"; } return divHtml; } function selectAssembly_mpdata_show(mpdata){ var divHtml=""; if(mpdata.mPoint!=null){ var signaltype=mpdata.mPoint.signaltype;//AI DI var ledtype=mpdata.mPoint.ledtype;//DI的情况下类别状态 1运行点0故障点 var ledcolor=mpdata.mPoint.ledcolor;//颜色状态 1红开绿停0绿开红停;黄色永远表示故障 // var directtype=mpdata.mPoint.directtype;//判断是否信号接反 1正常,0反过来 var unit=""; var parmValue=""; if(mpdata.showUnit!=''){ unit="("+mpdata.showUnit+")"; } if(mpdata.showParmValue!=''&&mpdata.showParmValue!=null){ parmValue=mpdata.showParmValue; } if(signaltype=='AI'){ var height=mpdata.height; var width=mpdata.width; if(height>0&&width>0){ divHtml+="
"; divHtml+=""+mpdata.mpname+":"; divHtml+=""+parmValue+""+unit+""; divHtml+="
"; }else{//未设置长宽,则自适应显示 divHtml+="
"; divHtml+=""; divHtml+="
"; } }else if(signaltype=='DI'){ var showColor="#000000"; if(ledtype=='1'){//运行点 if(ledcolor=='1'){//红开绿停 if(Number(parmValue)==0){ showColor='green'; }else if(Number(parmValue)==1){ showColor='red'; }else if(Number(parmValue)==2){ showColor='yellow'; } }else if(ledcolor=='0'){//绿开红停 if(Number(parmValue)==0){ showColor='red'; }else if(Number(parmValue)==1){ showColor='green'; }else if(Number(parmValue)==2){ showColor='yellow'; } } }else if(ledtype=='0'){//故障点 //透明正常黄故障 if(Number(parmValue)==0){ showColor='transparent'; }else if(Number(parmValue)==1){ showColor='yellow'; } } divHtml+="
"; divHtml+="" divHtml+=""; divHtml+="" divHtml+="
"; } }else{ divHtml="
"; } return divHtml; } /** * 电力表组件 */ function selectAssembly_meter(mpdata){ var divHtml=""; if(mpdata.mPoint!=null){ var unit=""; var parmValue=""; if(mpdata.showUnit!=''){ unit="("+mpdata.showUnit+")"; } if(mpdata.showParmValue!=''&&mpdata.showParmValue!=null){ parmValue=mpdata.showParmValue; } divHtml+="
"; divHtml+="
"+mpdata.mpname+"
"; divHtml+="
"+parmValue+""+unit+"
"; divHtml+="
"; }else{ divHtml+="
"; divHtml+="
"; divHtml+="
"; divHtml+="
"; } return divHtml; } function selectAssembly_meter_show(mpdata){ var divHtml=""; if(mpdata.mPoint!=null){ var unit=""; var parmValue=""; if(mpdata.showUnit!=''){ unit="("+mpdata.showUnit+")"; } if(mpdata.showParmValue!=''&&mpdata.showParmValue!=null){ parmValue=mpdata.showParmValue; } divHtml+="
"; divHtml+="
"+mpdata.mpname+"
"; divHtml+="
"+parmValue+""+unit+"
"; divHtml+="
"; }else{ divHtml+="
"; divHtml+="
"; divHtml+="
"; divHtml+="
"; } return divHtml; } /** * 数据框组件 */ function selectAssembly_dataFrame(mpdata){ var divHtml=""; if(mpdata.mPoint!=null){ var unit=""; var parmValue=""; if(mpdata.showUnit!=''){ unit="("+mpdata.showUnit+")"; } if(mpdata.showParmValue!=''&&mpdata.showParmValue!=null){ parmValue=mpdata.showParmValue; } var height=mpdata.height; var width=mpdata.width; if(height>0&&width>0){ divHtml="
"+parmValue+""+unit+"
"; }else{//未设置长宽,则自适应显示 divHtml+="
"; divHtml+=""; divHtml+="
"; } }else{ divHtml="
"; } return divHtml; } function selectAssembly_dataFrame_show(mpdata){ var divHtml=""; if(mpdata.mPoint!=null){ var unit=""; var parmValue=""; if(mpdata.showUnit!=''){ unit="("+mpdata.showUnit+")"; } if(mpdata.showParmValue!=''&&mpdata.showParmValue!=null){ parmValue=mpdata.showParmValue; } var height=mpdata.height; var width=mpdata.width; if(height>0&&width>0){ divHtml+="
"; divHtml+=""+parmValue+""+unit+""; divHtml+="
"; }else{//未设置长宽,则自适应显示 divHtml+="
"; divHtml+=""; divHtml+="
"; } }else{ divHtml="
"; } return divHtml; } /** * 展示界面附属数据 */ function showDetailData(id,parmname) { var index = layer.open({ type: 1, title: false, closeBtn: 0, area: '30%', // offset:"auto", fixed: false, skin: 'bgfff', //没有背景色 shadeClose: true, content: '
', success:function(){ $.post(ext.contextPath + "/efficiency/efficiencyOverviewMpConfigure/getList.do",{picId:id,unitId:unitId}, function(data) { var jsonData=data.rows; // console.log(jsonData); var html=""; html+=""; html+=""; html+=""; html+=""; html+=""; html+=""; html+=""; html+=""; html+=""; if(jsonData!=''){ for(var i=0;i"; html+=""; html+=""; html+=""; } }else{ html+=""; html+=""; html+=""; } $('#detailData').html(html); },'json'); }, end:function(){ layer.closeAll(); }, }); } /** * 展示界面打开界面 */ function showDetail(id,mpid){ stopBubbleDefaultEvent(); $.post(ext.contextPath + '/efficiency/efficiencyOverview/showDetailView.do', {id:id,mpid:mpid} , function(data) { $("#subDiv").html(data); openModal('subModal'); }); }
   "+parmname+"
测量点名称当前值单位
"+jsonData[i].showParmValue+""+jsonData[i].showUnit+"
无关联测量点