代码部分记录

<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%--
  Created by IntelliJ IDEA.
  User: huangshunyi
  Date: 17-8-14
  Time: 下午16:18
--%>

<html>
<head>
    <title>空压机设备详情</title>

    <%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %>
    <%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
    <%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
    <%@ taglib uri="http://www.springframework.org/tags" prefix="spring" %>
    <%@ taglib uri="http://www.springframework.org/tags/form" prefix="form" %>
    <%@taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name=”viewport” content=”width=device-width, initial-scale=1.0, minimum-scale=0.5, maximum-scale=2.0, user-scalable=yes” />
    <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
    <meta name="HandheldFriendly" content="true">
    <c:set var="basePath" value="${pageContext.request.contextPath}"/>
    <%--<link href="${basePath}/resources/zheng-admin/plugins/bootstrap-3.3.0/css/bootstrap.min.css" rel="stylesheet"/>
    <link href="${basePath}/resources/zheng-admin/plugins/multiselect/css/style.css">--%>
    <link type="text/css" rel="stylesheet" href="${basePath}/resources/Component/Navigation/css/style.css">


    <link rel="stylesheet" href="${basePath}/resources/deviceList/assets/css/bootstrap.css">
    <link rel="stylesheet" href="${basePath}/resources/deviceList/assets/css/bootstrap-switch.css">
    <link rel="stylesheet" href="${basePath}/resources/deviceList/assets/css/bootstrap-tagsinput.css">
    <link rel="stylesheet" href="${basePath}/resources/deviceList/app/main.css?t=20180302">
    <link rel="stylesheet" href="${basePath}/resources/deviceList/app/main_en.css?t=20171128">
    <link rel="stylesheet" href="${basePath}/resources/deviceList/assets/css/easyui.css" />
    <link rel="stylesheet" href="${basePath}/resources/deviceList/powerDetails/css/powerDetails.css">
    <link rel="stylesheet" href="${basePath}/resources/deviceList/personalWork/css/personalWork.css">

    <link rel="stylesheet" href=" ${basePath}/resources/deviceList/assets/css/easyui.css" />
    <%--<link rel="stylesheet" href="${basePath}/resources/deviceList/powerDetails/css/jq22.css">--%>



    <script>var BASE_PATH = '${basePath}';</script>
    <script src="${basePath}/resources/iioss-admin/plugins/jquery.1.12.4.min.js"></script>
    <style>
        .col-md-1 {
            width: 13.333333%;

        }
        .div-text-padding{
            padding: 0 0;
        }

        /*.div-text-margrin{
            margin-left: 9%;
        }*/
        .div-margin{
            margin-left: 10%;
        }
        .div-width{
            height: 987px;
        }
        .dateValue{
            height:30px;
            width:100px;
            position: absolute;
            top: -50px;left:61%;
            text-align: center
        }
        .pwervStart{
            display: block;
            width: 30px;
            height: 30px;
            position: absolute;
            top: -50px;left: 57%;
            cursor:pointer;
            background: none;
            border: none;
            outline: none;
        }
        .nextStart{
            display: block;
            width: 30px;
            height: 30px;
            position: absolute;
            top: -50px;left: 72.6%;
            cursor:pointer;
            background: none;
            border: none;
            outline: none;
        }
        .col-height{
            height: 1065px;
        }
        .col-padding{
            padding: 0 30px;
        }
        .div-eliminate-padding{
            padding: 0;
        }
        .panel-eliminate-padding{
            padding: 15px 0px;
        }
        .padding-left{
            padding-left:12px;
        }

        @-webkit-keyframes animate-positive{
            0% { width: 0; }
        }
        @keyframes animate-positive{
            0% { width: 0; }
        }
        @media (min-width: 767px){
            .mynavigation {
                background:#296DB2;
            }
            .mynavigation>ul>li {
                background: #296DB2;
            }
        }
        #power {
            height: 935px;
        }
        @media screen and (max-width: 1920px){
            .pwervStart{
                left: 56%;
            }
            .nextStart{
                left: 76.7%;
            }
            .running-state {
                padding-left: 4px;
            }
            .panel-padding{
                padding: 0;
            }
            .margin-bottom{
                margin-bottom: 0;
            }
           /* #power {
                height: 799px;
                }*/
            .div-width {
                height: 992px;
            }
            .col-height {
                height: 1106px;
            }
            .col-padding{
                padding: 0 0;
            }
        }
        @media screen and (max-width: 1366px){
            /*.div-text-margrin{
                margin-left: 12%;
            }*/
            .margin-bottom{
                margin-bottom: 0;
            }
            .padding-left{
                padding-left:6px;
            }
            .height{
                height:11%;
            }
            /*#power {*/
            /*height: 684px;*/
            /*}*/
            .div-width{
                height: 963px;
            }
            .col-height{
                height: 1118px;
            }
            .col-padding{
                padding: 0 0;
            }

            .pwervStart {
                left: 58.5%;
            }
            .dateValue {
                left: 65%;
            }
            .nextStart {
                left: 84.7%;
            }
            .col-md-2 {
                    width: 14.666667%;
            }

            .running-state {
                padding-right: 18px;
                padding-left: 18px;
            }

        }
        @media screen and (max-width: 768px){
            .div-text-margrin {
                margin-left: 0;
            }
            .col-width {
                width: 50%;
            }
            .div-margin{
                margin-left: 12%;
            }
            .col-md-1 {
                width: 44.333333%;
            }
            .col-margin{
                margin-left: 11%;
            }
            .div-width{
                height: 300px;
            }
            .pwervStart {
                left: 50%;
            }
            .dateValue {
                 left: 60%;
             }
            .nextStart {
                left: 90.7%;
            }
            #power {
                height: 520px;
            }
            .running-state {
                padding-right: 0;
                padding-left: 15px;
            }
            .margin-bottom{
                margin-bottom: 0;
            }

        }
        @media (max-width: 767px){
            .mynavigation>ul>li {
                display: inline-block;
                height:23px;
                line-height: 39px;
                margin: 0;
                font-size: 11px;
                background: #455EC5;
            }
        }




    </style>
    <script>
        $(document).ready(function() {
            var timeDate = new Date();
            var year = timeDate.getFullYear();
            var month = timeDate.getMonth() + 1;
            if (month < 10) {
                month = "0" + month;
            }
            var day = timeDate.getDate();
            if (day < 10) {
                day = "0" + day;
            }
            var date = year + "-" + month + "-" + day;
            var dateWithoutDay = year + "-" + month;
            $("#starttime").val(date);
            $("#monthDate").val(dateWithoutDay);
            $("#yearDate").val(year);
            $("#sumDate").val("2010-2030");
            $("#starttimeid").val(date);

            $("#myDailyGenerationtime").val(date);
            $("#myGrossGenerationtime").val(date);
        })

    </script>
</head>
<body>
<div class="mynavigation" id="mynavigation">
    <ul>
        <li >
            <a class="mytitle" style="font-size: 16px;text-shadow: 5px 5px 5px #2C3B7D;font-weight:900;text-decoration: none" id="showPowerstation"  href="${basePath}/manage/lease/index/${companyId}">${companyName}</a>
        </li>
        <li >
            <a  href="${basePath}/manage/leaseDetail/index/${companyId}/${companyName}">信息详情</a>
        </li>
        <li>
            <a style="text-decoration: none" href="${basePath}/manage/compressorcabintList/index/${companyId}/${companyName}">机柜列表</a>
        </li>
<%--        <li>
            <select style="color: #fff;appearance:none;-moz-appearance:none;-webkit-appearance:none;border: 0; outline: none;background: #296DB2;" id="listInverterBase">
                <c:forEach var="compressorCabinet" items="${compressorCabinets}">
                        <option value="${compressorCabinet.compressorcabintId}" >${compressorCabinet.anotherName}</option>
                </c:forEach>
            </select>
            <span>
                <img style="width: 15px;height: 13px" src="${basePath}/resources/powerstationImage/stationDetail/dropList.png"/>
            </span>
        </li>--%>

        <li>
            <a style="text-decoration: none" href="${basePath}/manage/airCompressorDetail/index/${companyId}/${companyName}/${gatewayId}/${airCompressorName}">${airCompressorName}</a>
        </li>

        <li>
            <a id="self" style="text-decoration: none" href="${basePath}/manage/compressorHomepage/index/${gatewayId}/${deviceSn}/${deviceType}?companyId=${companyId}&companyName=${companyName}">压缩机:${gatewayId}-${deviceSn}</a>
        </li>
    </ul>
</div>

<div class="al-main" style="margin:0% 2%;padding: 25px 0 0;">
    <div ui-view="" autoscroll="true">
        <%--<div class="al-content al-content-padding"></div>--%>
        <div class="widgets">
            <div class="row">
                <div class="col-xs-12 col-md-12 list_item">
                    <div class="col-xs-12  col-md-12 list_item">
                        <div class="panel animated">
                            <div class="panel-body datalist panel-padding">
                                <div class="col-xs-12 col-sm-12 col-md-12 device_item">
                                    <div class="div-list col-md-2 col-xs-2 div-text div-text-padding  div-repayment-margin div-padding1  div-text-margrin col-width" >
                                        <img src="${basePath}/resources/deviceList/assets/img/pressure.png" alt="" class=" image ">
                                        <span class="running-state">
                                                    气压
                                                <span class="offline "><span id="dailyConservation" class="span">${pressure}</span> MPa</span>
                                                </span>
                                    </div>
                                    <div class="div-list col-md-2 col-xs-2 div-text div-text-padding  div-repayment-margin div-padding1 col-width " >
                                        <img src="${basePath}/resources/deviceList/assets/img/ExhaustTemperature.png" alt="" class=" image ">
                                        <span class="running-state">
                                                排气温度
                                                <span class="offline "  id="grossGeneration">${exhaustTemperature} °C</span>
                                                </span>
                                    </div>
                                    <div class="div-list col-md-2 col-xs-2 div-text div-text-padding  div-repayment-margin div-padding1 col-width">
                                        <img src="${basePath}/resources/deviceList/assets/img/ExhaustTemperature.png" alt="" class=" image ">
                                        <span class="running-state">
                                                泵头外壳温度
                                                <span class="offline " id="grossPower">${pumpHeadTemperature} °C</span>
                                                </span>

                                    </div>
                                    <div class="div-list col-md-2 col-xs-2 div-text div-text-padding  div-repayment-margin div-padding1 col-width">
                                        <img src="${basePath}/resources/deviceList/assets/img/ElectricCurrent.png" alt="" class=" image ">
                                        <span class="running-state">
                                                电流
                                                <span class="offline " id="nowPower">${electricity}  A</span>
                                                </span>

                                    </div>
                                    <div class="div-list col-md-2 col-xs-2 div-text div-text-padding  div-repayment-margin div-padding1 col-width">
                                        <img src="${basePath}/resources/deviceList/assets/img/Voltage.png" alt="" class=" image ">
                                        <span class="running-state">
                                                   电压
                                                <span class="offline " id="dailyProfit">${voltage} V</span>
                                               </span>

                                    </div>

                                   <div class="div-list col-md-2 col-xs-2 div-text div-text-padding  div-repayment-margin div-padding1 col-width">
                                        <img src="${basePath}/resources/deviceList/assets/img/RunningSpeed.png" alt="" class=" image ">
                                        <span class="running-state">
                                                    运行转速
                                                <span class="offline " id="grossProfit">${speed} rpm</span>
                                                </span>

                                    </div>

                                   <%-- <div class="div-list col-md-2 col-xs-2 div-text div-text-padding  div-repayment-margin div-padding1 col-margin" style="cursor:pointer;color: #0e90d2" onclick="location='/manage/costHistory/index/1'">
                                        <img src="${basePath}/resources/deviceList/assets/img/charging.png" alt="" class=" image ">
                                        <span class="running-state">
                                                    计费
                                                <span class="offline "  style="color: #0e90d2"><span id="charging" class="span" style="color: #0e90d2">2000</span>元</span>
                                                </span>

                                    </div>--%>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="col-xs-12  col-md-8 list_item">
                    <div class="panel animated">
                        <div class="panel-body datalist">
                            <div class="col-xs-12 col-sm-12 col-md-12 device_item">
                                <div id="myTabContent" class="tab-content">
                                    <div class="tab-pane fade in active" id="power">
                                        <div style="width: 100%;position: relative;display: none">
                                            <button  id="pervStarttimeDate" class="pwervStart"  type="button"></button>
                                            <input type="text" id="starttime">
                                            <button id="nextStarttimeDate" class="nextStart" type="button"></button>
                                        </div>
                                        <div id="powerTime" style="height: 80%"><h3>正在加载中...</h3></div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                    <div class="col-xs-12  col-md-4  list_item">
                        <div class="panel animated  ">
                            <div class="panel-body " style="    padding: 0;">
                                <div class="horizontal-scroll  powerHorizontal div-width" <%--style="height: 840px"--%>>
                                    <div class="col-xs-12 col-sm-12 col-md-12 device_item div-text-padding  " >
                                        <div class="panel-heading clearfix" >
                                            <h3 style="color:#00b7ee;">
                                                告警显示
                                            </h3>
                                        </div>
                                        <div class="panel-body datalist" style="min-height: 230px; ">
                                            <%--<div class="tabcontent">--%>
                                                <%--<div style="display: block;">--%>
                                                    <table class="table device_list_table "  id="tableBox" >
                                                        <thead>
                                                        <tr class="black-muted-bg  ">
                                                            <th>告警开始时间</th>
                                                            <th>
                                                                告警结束时间

                                                            </th>
                                                            <th>
                                                                告警状态
                                                            </th>
                                                            <th >
                                                                告警信息
                                                            </th>

                                                        </tr>
                                                        </thead>
                                                        <tbody id="alarmulNumBox">
                                                        <tr  class="sortMoveover  " data="1 ">

                                                        </tr>
                                                        </tbody>
                                                    </table>
                                                <%--</div>--%>
                                                <%--<div>
                                                    <table class="table device_list_table "  id="tableBoxes" >
                                                        <thead>
                                                        <tr class="black-muted-bg  ">
                                                            <th>告警时间</th>
                                                            <th   >
                                                                告警设备

                                                            </th>
                                                            <th >
                                                                告警信息
                                                            </th>

                                                        </tr>
                                                        </thead>
                                                        <tbody id="alarmulBox">
                                                        <tr  class="sortMoveover  " data="1 ">
                                                        </tr>
                                                        </tbody>
                                                    </table>
                                                </div>--%>
                                            <%--</div>--%>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
               <%-- <div class="col-xs-12 col-md-4 list_item">
                    <div class="panel animated">
                        <div class="panel-heading clearfix">
                            <h3>
                                压缩机列表
                            </h3>
                        </div>
                        <div class="panel-body datalist panel-eliminate-padding" style="padding: 15px 0px;">
                            <div class="horizontal-scroll  powerHorizontal col-height" &lt;%&ndash;style="height: 840px"&ndash;%&gt;>
                                <div class="col-xs-12 col-sm-12 col-md-12 device_item   div-eliminate-padding"   >
                                    <div class="col-xs-12 col-sm-12 col-md-12 div-eliminate-padding" id="headerContent">
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>--%>
            </div>
        </div>
    </div>
</div>




</body>

<script>var BASE_PATH = '${basePath}';</script>


<script src="${basePath}/resources/deviceList/lib/jquery.js"></script>
<script src="${basePath}/resources/deviceList/lib/jquery-ui.js"></script>
<script src="${basePath}/resources/deviceList/lib/jquery.easyui.min.js"></script>
<script src="${basePath}/resources/deviceList/lib/jquery.slimscroll.js"></script>
<script src="${basePath}/resources/deviceList/lib/bootstrap.min.js"></script>
<script src="${basePath}/resources/deviceList/lib/bootstrap-switch.js"></script>
<script src="${basePath}/resources/deviceList/lib/bootstrap-tagsinput.js"></script>
<script src="${basePath}/resources/deviceList/lib/bootbox.min.js"></script>
<script src="${basePath}/resources/deviceList/lib/jsrsasign-4.1.4-all-min.js"></script>
<script src="${basePath}/resources/deviceList/lib/json-sans-eval-min.js"></script>
<script src="${basePath}/resources/deviceList/lib/jquery.pagination.min.js"></script>
<script src="${basePath}/resources/deviceList/lib/echarts.js"></script>
<script src="${basePath}/resources/iioss-admin/plugins/fullPage/jquery.fullPage.min.js"></script>
<script type="text/javascript" src="${basePath}/resources/Component/Navigation/js/index.js"></script>
<%--<script src="${basePath}/resources/deviceList/lib/tab.js" type="text/javascript" charset="utf-8"></script>--%>

<script>

    $(function() {
        // 初始化内容
        $("#listInverterBase option").each(function(){
            if($(this).val() == ${airCompressorId}){
                $(this).attr("selected",true)
            }
        });
    });


    $("#listInverterBase").change(function(){
        var compressorcabintId= $(this).children('option:selected').val();
        var anotherName= $(this).children('option:selected').text();
        var curr=${airCompressorId};
        if(compressorcabintId!=curr){
            window.location.href="${basePath}/manage/airCompressorDetail/index/${companyId}/${companyName}/"+compressorcabintId+"/"+anotherName;
        };

    })

    var width;
    var compressList;
    var equipmentAlarm;
    var myChart;


   $(document).ready(function () {
        width = $('#myTabContent').width();
       selectionTime();
       equipmentAlarmInformation();
    });

    //对传入的数据进行四舍五入处理以及保存两位小数
    function toDecimal(x) {
        var result = parseFloat(x);
        if (isNaN(result)) {
            return 0;
        }
        result = Math.round(x * 100) / 100;
        var s_x = result.toString();
        var pos_decimal = s_x.indexOf('.');
        if (pos_decimal < 0) {
            pos_decimal = s_x.length;
            s_x += '.';
        }
        while (s_x.length <= pos_decimal + 2) {
            s_x += '0';
        }
        return s_x;
    }

    function selectionTime(){
       var startTime = $('#starttime').val();
        $.ajax({
            url: "${basePath}/manage/airCompressorDetail/getAriCompressorData",
            type: "POST",
            async:true,
            data:{"startTime":startTime,"gatewayId":${airCompressorId},"deviceSn":"${deviceSn}"},
            success:function(obj) {
                var temp = eval(obj);
                buildPower(temp.data, temp.start , temp.end);
            }
        })
    }

    //切换的日的按钮
    $('#pervStarttimeDate').click(function(){
        var timewer = $('#starttime').val();
        var formatTimeS = new Date(timewer).getTime();
        var  tempTime=formatTimeS-(24*60*60*1000);
        var oDate = new Date(tempTime),
            tempyear = oDate.getFullYear(),
            tempMonth = oDate.getMonth()+1,
            tempDay = oDate.getDate()
        tempTimes = tempyear+"-"+getzf(tempMonth) +'-'+ getzf(tempDay);//最后拼接时间
        $('#starttime').val(tempTimes);
        selectionTime();
    });

    function getzf(num){
        if(parseInt(num) < 10){
            num = '0'+num;
        }
        return num;
    }
    $('#nextStarttimeDate').click(function(){
        var timewer = $('#starttime').val();
        var formatTimeS = new Date(timewer).getTime();
        var  tempTime=formatTimeS+(24*60*60*1000);
        var oDate = new Date(tempTime),
            tempyear = oDate.getFullYear(),
            tempMonth = oDate.getMonth()+1,
            tempDay = oDate.getDate()
        tempTimes = tempyear+"-"+getzf(tempMonth) +'-'+ getzf(tempDay);//最后拼接时间
        $('#starttime').val(tempTimes);
        selectionTime();
    });

    function buildPower(data, start, end) {
        var topHeight=0;
        var choiceTop=0;
        if(window.screen.width<767){
            topHeight=-7;
            choiceTop=15;
        }else {
            topHeight=0;
            choiceTop=0;
        }
        var dataTime = $("#starttime").val();
        var temperatureList = [];
        var pressureList = [];
        var electricityList = [];
        var aPhaseCurrentList = [];
        var bPhaseCurrentList = [];
        var cPhaseCurrentList = [];
        for(var i=0;i<data.length;i++){
            temperatureList.push([
                data[i].date,
                toDecimal(data[i].temperature)
            ]);
            electricityList.push([
                data[i].date,
                toDecimal(data[i].electricity/1000)
            ]);
            pressureList.push([
                data[i].date,
                toDecimal(data[i].pressure/1000000)
            ]);
            aPhaseCurrentList.push([
                data[i].date,
                toDecimal(data[i].aPhaseCurrent/1000)
            ]);
            bPhaseCurrentList.push([
                data[i].date,
                toDecimal(data[i].bPhaseCurrent/1000)
            ]);
            cPhaseCurrentList.push([
                data[i].date,
                toDecimal(data[i].cPhaseCurrent/1000)
            ]);
        }
        $('#powerTime').css('width', width).css('height', $('#power').height());
        if (myChart != null && myChart != "" && myChart != undefined) {
            myChart.dispose();
        }
        // 基于准备好的dom,初始化echarts实例
        myChart = echarts.init(document.getElementById('powerTime'));
        var option = {
            noDataLoadingOption: {
                text: '暂无数据',
                effect: 'bubble',
                effectOption: {
                    effect: {
                        n: 0
                    }
                }
            },
            title: {
                text: dataTime + ' 电流/压力/温度曲线图',
               /* subtext: '采集数据',*/
                x: 'center',
                top:topHeight

            },
            tooltip: {
                trigger: 'axis',
                axisPointer: {
                    animation: false
                },
                formatter:function(params){
                    var data0 = params[0];
                    var data1 = params[1];
                    var data2 = params[2];
                    var data3 = params[3];
                    var data4 = params[4];
                    var data5 = params[5];
                    var series0 = data0.seriesName.split("/");
                    var series1 = data1.seriesName.split("/");
                    var series2 = data2.seriesName.split("/");
                    var series3 = data3.seriesName.split("/");
                    var series4 = data4.seriesName.split("/");
                    var series5 = data5.seriesName.split("/");
                    var date = new Date(data0.axisValue);
                    var result = "时间: "+getzf(date.getHours())+":"+getzf(date.getMinutes())+":"+getzf(date.getSeconds()) +"<br/>";
                    result += series0[0]+": "+data0.value[1]+" "+series0[1]+"<br/>";
                    result += series1[0]+": "+data1.value[1]+" "+series1[1]+"<br/>";
                    result += series2[0]+": "+data2.value[1]+" "+series2[1]+"<br/>";
                    result += series3[0]+": "+data3.value[1]+" "+series3[1]+"<br/>";
                    result += series4[0]+": "+data4.value[1]+" "+series4[1]+"<br/>";
                    result += series5[0]+": "+data5.value[1]+" "+series5[1];
                    return result;
            },
            legend: {
                data:['电流/A','压力/MPa','泵头温度/℃'],
                x: 'left',
                top:choiceTop
            },
            toolbox: {
                top: choiceTop,
                feature: {
                    myTool1:{
                        show:true,
                        title:'前一天',
                        icon:'M230.8608 544l198.8096 198.8096a32 32 0 0 1-45.2608 45.2608l-249.856-249.856a37.12 37.12 0 0 1 0-52.48l249.856-249.8048a32 32 0 0 1 45.2608 45.2608L230.8608 480H870.4a32 32 0 1 1 0 64H230.8608z',
                        onclick: function (){
                            $("#pervStarttimeDate").trigger('click');
                        }
                    },
                    myTool2:{
                        show:true,
                        title:'后一天',
                        icon:'M793.1392 544l-198.8096 198.8096a32 32 0 0 0 45.2608 45.2608l249.856-249.856a37.12 37.12 0 0 0 0-52.48l-249.856-249.8048a32 32 0 0 0-45.2608 45.2608l198.8096 198.8096H153.6a32 32 0 1 0 0 64h639.5392z',
                        onclick:function() {
                            $("#nextStarttimeDate").trigger('click');
                        }
                    },
                    dataZoom: {
                        yAxisIndex: 'none'
                    },
                    restore: {},
                    saveAsImage: {},
                }
            },
            axisPointer: {
                link: {xAxisIndex: 'all'}
            },
            dataZoom: [
                {
                    show: true,
                    //realtime: true,
                    start: 30,
                    end: 70,
                    xAxisIndex: [0, 1, 2]
                },
                {
                    type: 'inside',
                    //realtime: true,
                    start: 30,
                    end: 70,
                    xAxisIndex: [0, 1, 2]
                },
                {
                    type: 'inside',
                    //realtime: true,
                    start: 30,
                    end: 70,
                    xAxisIndex: [0, 1, 2]
                }
            ],
            xAxis : [
                {
                    type : 'time',
                    boundaryGap : false,
                    axisLine: {onZero: true},
                    axisLabel: {
                        interval: 0,
                        formatter:function(value,index) {
                            var date = new Date(value);
                            var time = getzf(date.getMonth() + 1) + '-'
                                + getzf(date.getDate()) + ' '
                                + getzf(date.getHours()) + ':'
                                + getzf(date.getMinutes());
                            return time;
                        }
                    },
                    min: new Date(start),
                    max: new Date(end)
                },
                {
                    gridIndex: 1,
                    type : 'time',
                    boundaryGap : false,
                    axisLine: {onZero: true},
                    position: 'top',
                    axisLabel: {
                        //interval: 0,
                        formatter:function(value,index) {
                            var date = new Date(value);
                            var time = getzf(date.getMonth() + 1) + '-'
                                + getzf(date.getDate()) + ' '
                                + getzf(date.getHours()) + ':'
                                + getzf(date.getMinutes());
                            return time;
                        }
                    },
                    min: new Date(start),
                    max: new Date(end)
                },
                {
                    gridIndex: 2,
                    type : 'time',
                    boundaryGap : false,
                    axisLine: {onZero: true},
                    position: 'top',
                    axisLabel: {
                        //interval: 0,
                        formatter:function(value,index) {
                            var date = new Date(value);
                            var time = getzf(date.getMonth() + 1) + '-'
                                + getzf(date.getDate()) + ' '
                                + getzf(date.getHours()) + ':'
                                + getzf(date.getMinutes());
                            return time;
                        }
                    },
                    min: new Date(start),
                    max: new Date(end)
                }
            ],
            yAxis : [
                {
                    name : '电流/A',
                    type : 'value',
                },
                {
                    gridIndex: 1,
                    nameGap:30,
                    name : '压力/MPa',
                    type : 'value',
                    inverse: false
                },
                {
                    gridIndex: 2,
                    nameGap:30,
                    name : '泵头温度/℃',
                    type : 'value',
                    inverse: false
                }
            ],
            grid: [{
                left: 50,
                right: 50,
                height: '25%'
            }, {
                left: 50,
                right: 50,
                top: '39%',
                height: '25%'
            },{
                left: 50,
                right: 50,
                top: '70%',
                height: '25%'
            }],
            series : [
                {
                    name : '电流/A',
                    type:'line',
                    symbolSize: 4,
                    smooth:true,
                    hoverAnimation: false,
                    data:electricityList
                },{
                    name : 'A相电流/A',
                    type:'line',
                    symbolSize: 4,
                    smooth:true,
                    hoverAnimation: false,
                    data:aPhaseCurrentList
                },{
                    name : 'B相电流/A',
                    type:'line',
                    symbolSize: 4,
                    smooth:true,
                    hoverAnimation: false,
                    data:bPhaseCurrentList
                },{
                    name : 'C相电流/A',
                    type:'line',
                    symbolSize: 4,
                    smooth:true,
                    hoverAnimation: false,
                    data:cPhaseCurrentList
                },
                {
                    name:'压力/MPa',
                    type:'line',
                    xAxisIndex: 1,
                    yAxisIndex: 1,
                    symbolSize: 4,
                    smooth:true,
                    hoverAnimation: false,
                    data: pressureList
                },
                {
                    name : '泵头温度/℃',
                    type:'line',
                    xAxisIndex: 2,
                    yAxisIndex: 2,
                    symbolSize: 4,
                    smooth:true,
                    hoverAnimation: false,
                    data: temperatureList
                }
            ]}
        }
        myChart.setOption(option);
        getDataDetail(electricityList,pressureList,temperatureList,aPhaseCurrentList,bPhaseCurrentList,cPhaseCurrentList);
    }

    function getDataDetail(electricityList,pressureList,temperatureList,aPhaseCurrentList,bPhaseCurrentList,cPhaseCurrentList) {
        var timer;
        setInterval(function () {
            if(timer !== undefined){
                clearInterval(timer);
            }
            $.ajax({
                url:"${basePath}/manage/airCompressorDetail/requestDetail",
                type: "POST",
                async:true,
                contentType:"application/x-www-form-urlencoded",
                data:{"compressorCabinetId":"${airCompressorId}","airCompressorId":"${deviceSn}","mark":mark},
                success:function(obj){
                    var json = eval(obj);
                    if(json.result){
                        timer = setInterval(function () {
                            $.ajax({
                                url:"${basePath}/manage/airCompressorDetail/getAriCompressorDetail",
                                type: "POST",
                                async:true,
                                contentType:"application/x-www-form-urlencoded",
                                data:{"compressorCabinetId":"${airCompressorId}","airCompressorId":"${deviceSn}","mark":mark},
                                success:function(obj){
                                    var json = eval(obj);
                                    var data = json.data;
                                    for(var i=0;i<data.length;i++){
                                        temperatureList.push([
                                            data[i].date,
                                            toDecimal(data[i].temperature)
                                        ]);
                                        electricityList.push([
                                            data[i].date,
                                            toDecimal(data[i].electricity/1000)
                                        ]);
                                        pressureList.push([
                                            data[i].date,
                                            toDecimal(data[i].pressure/1000000)
                                        ]);
                                        aPhaseCurrentList.push([
                                            data[i].date,
                                            toDecimal(data[i].aPhaseCurrent/1000)
                                        ]);
                                        bPhaseCurrentList.push([
                                            data[i].date,
                                            toDecimal(data[i].bPhaseCurrent/1000)
                                        ]);
                                        cPhaseCurrentList.push([
                                            data[i].date,
                                            toDecimal(data[i].cPhaseCurrent/1000)
                                        ]);
                                    }
                                    myChart.setOption({
                                        series: [{
                                            data: electricityList
                                        }, {
                                            data: aPhaseCurrentList
                                        }, {
                                            data: bPhaseCurrentList
                                        }, {
                                            data: cPhaseCurrentList
                                        }, {
                                            data: pressureList
                                        }, {
                                            data:temperatureList
                                        }]
                                    });
                                }
                            });
                        }, 10*1000);
                    }
                }
            })
        },65*1000);
    }
</script>
<script>

    //告警选项卡
 /*   $(".tab").tab({
        type: 'click'
    });
*/
   //设备告警信息
    function equipmentAlarmInformation() {
        $.ajax({
            url: "${basePath}/manage/compressorHomepage/equipmentAlarm/${airCompressorId}/${deviceSn}",
            type: "GET",
            async: true,
            success: function(obj){
                if(obj != null||obj !=" "){


                    equipmentAlarm = obj;
                    poweralarmul(equipmentAlarm);
                }else {
                    $("#alarmulNumBox").html("<div>设备一切都正常运行中</div>")
                }

            }
        });
    }
    function poweralarmul(equipmentAlarm) {

        for(var i=0;i<equipmentAlarm.length;i++){
            var equipmentAlarmOne = equipmentAlarm[i];
            $('#alarmulNumBox').append(
                "<tr  class='sortMoveover' data='1 ' style='border-bottom: 1px solid #ddd;    height: 10%;'>" +
                "     <td style='color: red'>" + equipmentAlarmOne.alarmStartTime + "</td>" +
                "     <td style='color: red'>"+equipmentAlarmOne.alarmEndTime+ "</td>" +
                "     <td style='color: red'>" + equipmentAlarmOne.status + "</td>" +
                "     <td style='color: red'>" + equipmentAlarmOne.alarmMessage + "</td>" +
                "</tr>"
            );
        }
    }

    //对日期进行转化
    function dateTransformation(date) {
        var y = date.getFullYear();
        var m = date.getMonth() + 1;
        m = m < 10 ? ('0' + m) : m;
        var d = date.getDate();
        d = d < 10 ? ('0' + d) : d;
        var h = date.getHours();
        h = h < 10 ? ('0' + h) : h;
        var minute = date.getMinutes();
        minute = minute < 10 ? ('0' + minute) : minute;
        var second = date.getSeconds();
        second = second < 10 ? ('0' + second) : second;
        return y + '-' + m + '-' + d + ' ' + h + ':' + minute + ':' + second;
    };

</script>





猜你喜欢

转载自blog.csdn.net/weixin_42911069/article/details/83016167
今日推荐