var lineId;
function getPointData(index) {
    $.ajax({
        method: "post",
        url: "/pqs9000/getPointInfo",
        data: {
            pointIndex: index
        },
        success: function (data) {
            if (data == null || data.code === 500) {
                layer.msg('监测点详情加载失败', {icon: 2, time: 1000});
            } else {
                initPointTable(data.body);
                lineId = index
            }
        }
    });
}

function initPointTable(data) {
    $("#jcdxx").text(data.pName + "_" + data.name);
    $("#jcxl").text(data.bdName);
    $("#tyrq").text(data.strDate);
    $("#cj").text(data.factory);
    $("#xh").text(data.devType);
    $("#wlcs").text(data.ip);
    $("#txzt").text(data.state);
    $("#loadtype").text(data.loadType);
    $("#lineOnject").text(data.objName == null ? '/':data.objName);
    $("#dydj").text(data.voltageClasses);
    $("#pt").text(data.pt1 + "/" + data.pt2);
    $("#ct").text(data.ct1 + "/" + data.ct2);
    $("#jzdl").text(data.jzcmp + "MVA");
    $("#mxdl").text(data.dlcmp + "MVA");
    $("#ydrl").text(data.xycmp + "MVA");
    $("#gdrl").text(data.devcmp + "MVA");
    if(data.devType.indexOf("CLD")>0){
    	$("#onlycld").removeAttr("hidden");
    	$("#baseFlow").text(data.baseFlow);
    	$("#extendFlow").text(data.extendFlow);
    	$("#useFlow").text(data.useFlow);
    }else{
        $("#onlycld").attr("hidden","true");
    }

    $("#owner").text(data.owner == null ?'/':data.owner);
    $("#ownerDuty").text(data.ownerDuty == null ?'/':data.ownerDuty);
    $("#ownerTel").text(data.ownerTel == null ?'/':data.ownerTel);
    $("#businessType").text(data.businessType);


}


$("#demo1").click(function () {
    $.ajax({
        type: 'POST',
        url: '/pqs9000/device/queryWiringDiagram',
        data: {
            lineId:lineId
        },
        success: function (data) {
            if(data.code === 200){
                layer.open({
                    type: 1,
                    title: '主接线图预览',
                    shadeClose: true,
                    area: ['100%', '100%'],
                    maxmin : false,
                    content: '<div style="padding: 10px 150px;width: 100%;height: 100%"><img style="width: 100%;height: 100%" src="'+data.body+'"></div>', //iframe的url
                    scrollbar: true,
                    end:function(){

                    }
                });
            }else {
                layer.msg(data.message, {icon: 2, time: 2000});
            }
        }
    })




})
