444 lines
24 KiB
JavaScript
444 lines
24 KiB
JavaScript
|
||
/**
|
||
* 热力区域组件
|
||
*/
|
||
|
||
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<dataAll.length;i++){
|
||
var data = dataAll[i];
|
||
var lnglats= eval("["+data.lnglats+"]");
|
||
var res = checkHeatCanvas(lnglat,lnglats);
|
||
if(res){
|
||
var assembly =data.efficiencyOverviewConfigureAssembly;
|
||
if(assembly.type!=null && assembly.type!=''){
|
||
type = assembly.type;
|
||
}
|
||
id = data.id;
|
||
break;
|
||
}
|
||
}
|
||
if(type=='heat'){
|
||
editps(id);
|
||
}
|
||
}
|
||
};
|
||
}
|
||
function checkHeatCanvas(checkPoint, polygonPoints) {
|
||
var counter = 0;
|
||
var i;
|
||
var xinters;
|
||
var p1, p2;
|
||
var pointCount = polygonPoints.length;
|
||
p1 = polygonPoints[0];
|
||
|
||
for (i = 1; i <= pointCount; i++) {
|
||
p2 = polygonPoints[i % pointCount];
|
||
if (
|
||
checkPoint[0] > 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;a<lnglats.length;a++){
|
||
if(a==0){
|
||
//绘制区域初始坐标点
|
||
context.moveTo(lnglats[a][0]*scale, lnglats[a][1]*scale);
|
||
}else{
|
||
//绘制区域后续坐标点
|
||
context.lineTo(lnglats[a][0]*scale, lnglats[a][1]*scale);
|
||
}
|
||
}
|
||
}
|
||
//绘制区域结束
|
||
context.closePath();
|
||
context.fill();
|
||
context.stroke();
|
||
}
|
||
|
||
/**
|
||
* 测量点组件
|
||
*/
|
||
function selectAssembly_mpdata(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="<div class=\"moveDiv\" style=\"font-size:"+mpdata.txtsize+"px;color:"+mpdata.textcolor+";position:absolute;top:"+(mpdata.y)+"px;left:"+mpdata.x+"px;background-color: "+(mpdata.bkcolor)+";width:"+(mpdata.width)+"px;height:"+(mpdata.height)+"px;border: 1px solid #E8EBEC;border-radius: 6px;cursor: move;text-align:center;line-height:"+(mpdata.height)+"px;overflow: hidden;text-overflow:ellipsis; white-space: nowrap;\" id=\""+mpdata.id+"\" name=\""+mpdata.id+"\" ondblclick=\"editps('"+mpdata.id+"');\">"+mpdata.mpname+":"+parmValue+""+unit+"</div>";
|
||
}else{//未设置长宽,则自适应显示
|
||
divHtml+="<div class=\"moveDiv\" style=\"font-size:"+mpdata.txtsize+"px;color:"+mpdata.textcolor+";position:absolute;top:"+(mpdata.y)+"px;left:"+mpdata.x+"px;background-color: "+(mpdata.bkcolor)+";border: 1px solid #E8EBEC;border-radius: 6px;cursor: move;text-align:center;overflow: hidden;text-overflow:ellipsis; white-space: nowrap;\" id=\""+mpdata.id+"\" name=\""+mpdata.id+"\" ondblclick=\"editps('"+mpdata.id+"');\">";
|
||
divHtml+="<label style='padding:5px;cursor: move;font-weight:400;'>"+mpdata.mpname+":"+parmValue+""+unit+"</label>";
|
||
divHtml+="</div>";
|
||
}
|
||
}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+="<div class=\"moveDiv\" style=\"position:absolute;top:"+(mpdata.y)+"px;left:"+mpdata.x+"px;cursor:move;overflow: hidden;\" id=\""+mpdata.id+"\" name=\""+mpdata.id+"\" ondblclick=\"editps('"+mpdata.id+"');\">";
|
||
divHtml+="<span style='position:relative;padding:5px;'>"
|
||
divHtml+="<i style='padding:5px;display:block;background:"+showColor+";border-radius:50%;width:8px;height:8px;top:8px;right:0px;position:absolute;'></i>";
|
||
divHtml+="</span>"
|
||
divHtml+="</div>";
|
||
}
|
||
}else{
|
||
divHtml="<div class=\"moveDiv\" style=\"font-size:"+mpdata.txtsize+"px;color:"+mpdata.textcolor+";position:absolute;top:"+(mpdata.y)+"px;left:"+mpdata.x+"px;background-color: "+(mpdata.bkcolor)+";width:"+(mpdata.width)+"px;height:"+(mpdata.height)+"px;border: 1px solid #E8EBEC;border-radius: 6px;cursor: move;text-align:center;line-height:"+(mpdata.height)+"px;overflow: hidden;text-overflow:ellipsis; white-space: nowrap;\" id=\""+mpdata.id+"\" name=\""+mpdata.id+"\" ondblclick=\"editps('"+mpdata.id+"');\"></div>";
|
||
}
|
||
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+="<div style=\"font-size:"+mpdata.txtsize+"px;color:"+mpdata.textcolor+";position:absolute;top:"+(mpdata.y)+"px;left:"+mpdata.x+"px;background-color: "+(mpdata.bkcolor)+";width:"+(mpdata.width)+"px;height:"+(mpdata.height)+"px;border: 1px solid #E8EBEC;border-radius: 6px;cursor: pointer;text-align:center;line-height:"+(mpdata.height)+"px;overflow: hidden;text-overflow:ellipsis; white-space: nowrap;\" id=\""+mpdata.id+"\" name=\""+mpdata.id+"\" >";
|
||
divHtml+="<span onclick=\"showDetailData('"+mpdata.id+"','"+mpdata.mPoint.parmname+"');\">"+mpdata.mpname+":</span>";
|
||
divHtml+="<span onclick=\"showDetail('"+mpdata.id+"','"+mpdata.mpid+"');\">"+parmValue+""+unit+"</span>";
|
||
divHtml+="</div>";
|
||
}else{//未设置长宽,则自适应显示
|
||
divHtml+="<div style=\"font-size:"+mpdata.txtsize+"px;color:"+mpdata.textcolor+";position:absolute;top:"+(mpdata.y)+"px;left:"+mpdata.x+"px;background-color: "+(mpdata.bkcolor)+";border: 1px solid #E8EBEC;border-radius: 6px;cursor: pointer;text-align:center;overflow: hidden;text-overflow:ellipsis; white-space: nowrap;\" id=\""+mpdata.id+"\" name=\""+mpdata.id+"\" >";
|
||
divHtml+="<label style='padding:5px;cursor: move;font-weight:400;'>"+mpdata.mpname+":"+parmValue+""+unit+"</label>";
|
||
divHtml+="</div>";
|
||
}
|
||
}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+="<div style=\"position:absolute;top:"+(mpdata.y)+"px;left:"+mpdata.x+"px;cursor:pointer;overflow: hidden;\" id=\""+mpdata.id+"\" name=\""+mpdata.id+"\" >";
|
||
divHtml+="<span style='position:relative;padding:5px;'>"
|
||
divHtml+="<i style='padding:5px;display:block;background:"+showColor+";border-radius:50%;width:8px;height:8px;top:8px;right:0px;position:absolute;'></i>";
|
||
divHtml+="</span>"
|
||
divHtml+="</div>";
|
||
}
|
||
}else{
|
||
divHtml="<div style=\"font-size:"+mpdata.txtsize+"px;color:"+mpdata.textcolor+";position:absolute;top:"+(mpdata.y)+"px;left:"+mpdata.x+"px;background-color: "+(mpdata.bkcolor)+";width:"+(mpdata.width)+"px;height:"+(mpdata.height)+"px;border: 1px solid #E8EBEC;border-radius: 6px;cursor: pointer;text-align:center;line-height:"+(mpdata.height)+"px;overflow: hidden;text-overflow:ellipsis; white-space: nowrap;\" id=\""+mpdata.id+"\" name=\""+mpdata.id+"\" ></div>";
|
||
}
|
||
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+="<div class=\"moveDiv\" style=\"font-size:"+mpdata.txtsize+"px;position:absolute;top:"+(mpdata.y)+"px;left:"+mpdata.x+"px;background-color:#CDCCCC;width:"+(mpdata.width)+"px;height:"+(mpdata.height)+"px;border: 5px solid #CDCCCC;border-radius: 6px;cursor: move;text-align:center;overflow: hidden;text-overflow:ellipsis; white-space: nowrap;\" id=\""+mpdata.id+"\" name=\""+mpdata.id+"\" ondblclick=\"editps('"+mpdata.id+"');\">";
|
||
divHtml+="<div style='float:left;width:40%;height:100%;line-height:"+(mpdata.height-10)+"px;background-color:#9BE2FF;border-radius: 6px;box-shadow:inset 1px 1px 8px 0px #000;color:#000000;font-weight:bold;'>"+mpdata.mpname+"</div>";
|
||
divHtml+="<div style='float:left;width:60%;height:100%;line-height:"+(mpdata.height-10)+"px;background-color:#1B1B1B;border-left: 5px solid #CDCCCC;border-radius: 6px;box-shadow:inset 1px 1px 3px 0px #CDCCCC;color:#F6E660;font-weight:bold;'>"+parmValue+""+unit+"</div>";
|
||
divHtml+="</div>";
|
||
}else{
|
||
divHtml+="<div class=\"moveDiv\" style=\"font-size:"+mpdata.txtsize+"px;position:absolute;top:"+(mpdata.y)+"px;left:"+mpdata.x+"px;background-color:#CDCCCC;width:"+(mpdata.width)+"px;height:"+(mpdata.height)+"px;border: 5px solid #CDCCCC;border-radius: 6px;cursor: move;text-align:center;overflow: hidden;text-overflow:ellipsis; white-space: nowrap;\" id=\""+mpdata.id+"\" name=\""+mpdata.id+"\" ondblclick=\"editps('"+mpdata.id+"');\">";
|
||
divHtml+="<div style='float:left;width:40%;height:100%;line-height:"+(mpdata.height)+"px;background-color:#9BE2FF;border-radius: 6px;box-shadow:inset 1px 1px 8px 0px #000;'></div>";
|
||
divHtml+="<div style='float:left;width:60%;height:100%;line-height:"+(mpdata.height)+"px;background-color:#1B1B1B;border-left: 5px solid #CDCCCC;border-radius: 6px;box-shadow:inset 1px 1px 3px 0px #CDCCCC;'></div>";
|
||
divHtml+="</div>";
|
||
}
|
||
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+="<div style=\"font-size:"+mpdata.txtsize+"px;position:absolute;top:"+(mpdata.y)+"px;left:"+mpdata.x+"px;background-color:#CDCCCC;width:"+(mpdata.width)+"px;height:"+(mpdata.height)+"px;border: 5px solid #CDCCCC;border-radius: 6px;cursor: pointer;text-align:center;overflow: hidden;text-overflow:ellipsis; white-space: nowrap;\" id=\""+mpdata.id+"\" name=\""+mpdata.id+"\" >";
|
||
divHtml+="<div onclick=\"showDetailData('"+mpdata.id+"','"+mpdata.mPoint.parmname+"');\" style='float:left;width:40%;height:100%;line-height:"+(mpdata.height-10)+"px;background-color:#9BE2FF;border-radius: 6px;box-shadow:inset 1px 1px 8px 0px #000;color:#000000;font-weight:bold;'>"+mpdata.mpname+"</div>";
|
||
divHtml+="<div onclick=\"showDetail('"+mpdata.id+"','"+mpdata.mpid+"');\" style='float:left;width:60%;height:100%;line-height:"+(mpdata.height-10)+"px;background-color:#1B1B1B;border-left: 5px solid #CDCCCC;border-radius: 6px;box-shadow:inset 1px 1px 3px 0px #CDCCCC;color:#F6E660;font-weight:bold;'>"+parmValue+""+unit+"</div>";
|
||
divHtml+="</div>";
|
||
}else{
|
||
divHtml+="<div style=\"font-size:"+mpdata.txtsize+"px;position:absolute;top:"+(mpdata.y)+"px;left:"+mpdata.x+"px;background-color:#CDCCCC;width:"+(mpdata.width)+"px;height:"+(mpdata.height)+"px;border: 5px solid #CDCCCC;border-radius: 6px;cursor: pointer;text-align:center;overflow: hidden;text-overflow:ellipsis; white-space: nowrap;\" id=\""+mpdata.id+"\" name=\""+mpdata.id+"\" >";
|
||
divHtml+="<div style='float:left;width:40%;height:100%;line-height:"+(mpdata.height)+"px;background-color:#9BE2FF;border-radius: 6px;box-shadow:inset 1px 1px 8px 0px #000;'></div>";
|
||
divHtml+="<div style='float:left;width:60%;height:100%;line-height:"+(mpdata.height)+"px;background-color:#1B1B1B;border-left: 5px solid #CDCCCC;border-radius: 6px;box-shadow:inset 1px 1px 3px 0px #CDCCCC;'></div>";
|
||
divHtml+="</div>";
|
||
}
|
||
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="<div class=\"moveDiv\" style=\"font-size:"+mpdata.txtsize+"px;color:"+mpdata.textcolor+";position:absolute;top:"+(mpdata.y)+"px;left:"+mpdata.x+"px;background-color: "+(mpdata.bkcolor)+";width:"+(mpdata.width)+"px;height:"+(mpdata.height)+"px;border: 1px solid #E8EBEC;border-radius: 6px;cursor: move;text-align:center;line-height:"+(mpdata.height)+"px;overflow: hidden;text-overflow:ellipsis; white-space: nowrap;\" id=\""+mpdata.id+"\" name=\""+mpdata.id+"\" ondblclick=\"editps('"+mpdata.id+"');\">"+parmValue+""+unit+"</div>";
|
||
}else{//未设置长宽,则自适应显示
|
||
divHtml+="<div class=\"moveDiv\" style=\"font-size:"+mpdata.txtsize+"px;color:"+mpdata.textcolor+";position:absolute;top:"+(mpdata.y)+"px;left:"+mpdata.x+"px;background-color: "+(mpdata.bkcolor)+";border: 1px solid #E8EBEC;border-radius: 6px;cursor: move;text-align:center;overflow: hidden;text-overflow:ellipsis; white-space: nowrap;\" id=\""+mpdata.id+"\" name=\""+mpdata.id+"\" ondblclick=\"editps('"+mpdata.id+"');\">";
|
||
divHtml+="<label style='padding:5px;cursor: move;font-weight:400;'>"+parmValue+""+unit+"</label>";
|
||
divHtml+="</div>";
|
||
}
|
||
}else{
|
||
divHtml="<div style=\"font-size:"+mpdata.txtsize+"px;color:"+mpdata.textcolor+";position:absolute;top:"+(mpdata.y)+"px;left:"+mpdata.x+"px;background-color: "+(mpdata.bkcolor)+";width:"+(mpdata.width)+"px;height:"+(mpdata.height)+"px;border: 1px solid #E8EBEC;border-radius: 6px;cursor: pointer;text-align:center;line-height:"+(mpdata.height)+"px;overflow: hidden;text-overflow:ellipsis; white-space: nowrap;\" id=\""+mpdata.id+"\" name=\""+mpdata.id+"\" ondblclick=\"editps('"+mpdata.id+"');\"></div>";
|
||
}
|
||
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+="<div style=\"font-size:"+mpdata.txtsize+"px;color:"+mpdata.textcolor+";position:absolute;top:"+(mpdata.y)+"px;left:"+mpdata.x+"px;background-color: "+(mpdata.bkcolor)+";width:"+(mpdata.width)+"px;height:"+(mpdata.height)+"px;border: 1px solid #E8EBEC;border-radius: 6px;cursor: pointer;text-align:center;line-height:"+(mpdata.height)+"px;overflow: hidden;text-overflow:ellipsis; white-space: nowrap;\" id=\""+mpdata.id+"\" name=\""+mpdata.id+"\" >";
|
||
divHtml+="<span onclick=\"showDetail('"+mpdata.id+"','"+mpdata.mpid+"');\">"+parmValue+""+unit+"</span>";
|
||
divHtml+="</div>";
|
||
}else{//未设置长宽,则自适应显示
|
||
divHtml+="<div style=\"font-size:"+mpdata.txtsize+"px;color:"+mpdata.textcolor+";position:absolute;top:"+(mpdata.y)+"px;left:"+mpdata.x+"px;background-color: "+(mpdata.bkcolor)+";border: 1px solid #E8EBEC;border-radius: 6px;cursor: pointer;text-align:center;overflow: hidden;text-overflow:ellipsis; white-space: nowrap;\" id=\""+mpdata.id+"\" name=\""+mpdata.id+"\" >";
|
||
divHtml+="<label style='padding:5px;cursor: move;font-weight:400;'>"+parmValue+""+unit+"</label>";
|
||
divHtml+="</div>";
|
||
}
|
||
}else{
|
||
divHtml="<div style=\"font-size:"+mpdata.txtsize+"px;color:"+mpdata.textcolor+";position:absolute;top:"+(mpdata.y)+"px;left:"+mpdata.x+"px;background-color: "+(mpdata.bkcolor)+";width:"+(mpdata.width)+"px;height:"+(mpdata.height)+"px;border: 1px solid #E8EBEC;border-radius: 6px;cursor: pointer;text-align:center;line-height:"+(mpdata.height)+"px;overflow: hidden;text-overflow:ellipsis; white-space: nowrap;\" id=\""+mpdata.id+"\" name=\""+mpdata.id+"\" ></div>";
|
||
}
|
||
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: '<div id="detailData" style="height:400px;overflow:auto;"></div>',
|
||
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+="<table style='width: 100%;border-collapse: collapse; padding:2px;'>";
|
||
html+="<tr style='height:35px;font-size: 14px;color: #61798f;text-align:center;background:#ffffff;border:1px solid #ddd;' >";
|
||
html+="<th colspan='3'> "+parmname+"</th>";
|
||
html+="</tr>";
|
||
html+="<tr style='height:45px;font-size: 14px;color: #61798f;text-align:center;background:#ECF0F5;border:1px solid #ddd;' >";
|
||
html+="<td >测量点名称</td>";
|
||
html+="<td width='20%'>当前值</td>";
|
||
html+="<td width='20%'>单位</td>";
|
||
html+="</tr>";
|
||
if(jsonData!=''){
|
||
for(var i=0;i<jsonData.length;i++){
|
||
if(i%2==0){
|
||
html+="<tr style='height:45px;font-size: 14px;color: #61798f;text-align:center;background:#ffffff;border:1px solid #ddd;' >";
|
||
}else{
|
||
html+="<tr style='height:45px;font-size: 14px;color: #61798f;text-align:center;background:#ECF0F5;border:1px solid #ddd;' >";
|
||
}
|
||
html+="<td style='border:1px solid #ddd;'>"+jsonData[i].mPoint.parmname+"</td>";
|
||
html+="<td style='border:1px solid #ddd;'>"+jsonData[i].showParmValue+"</td>";
|
||
html+="<td style='border:1px solid #ddd;'>"+jsonData[i].showUnit+"</td>";
|
||
html+="</tr>";
|
||
}
|
||
}else{
|
||
html+="<tr style='height:45px;font-size: 14px;color: #61798f;text-align:center;background:#ffffff;border:1px solid #ddd;' >";
|
||
html+="<td >无关联测量点</td>";
|
||
html+="</tr>";
|
||
}
|
||
$('#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');
|
||
});
|
||
}
|