<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <title>电度数据导出</title>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport"
          content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no"/>
    <link rel="stylesheet" href="${ctx}/css/plugin/bootstrap/bootstrap.css">
    <link rel="stylesheet"
          href="${ctx}/css/plugin/datatimepicker/bootstrap-datetimepicker.css">
    <link rel="stylesheet" href="${ctx}/css/plugin/jquery/jquery-ui.css">
    <link rel="stylesheet"
          href="${ctx}/css/plugin/metroStyle/metroStyle.css">
    <link rel="stylesheet" href="${ctx}/js/plugin/layui/css/layui.css"
          media="all">
    <link rel="stylesheet" href="${ctx}/css/basic.css">
    <style>
        html, body {
            background-color: #F9F9F9 !important;
            font-size: 12px;
            overflow: hidden;
        }

        .form-control {
            font-size: 12px;
            padding: 4px 12px;
        }

        .btn {
            font-size: 12px
        }

        .picDiv {
            clear: both;
            background-color: #fff;
            overflow-y: auto;
        }

        a {
            color: #003078;
        }

        .newslist div {
            margin-top: 10px;
            position: relative;
            height: 100%;
            line-height: 30px;
            font-size: 14px;
        }
    </style>
</head>
<body>
<div class="container-fluid fr">
    <div class="form-inline header" style="margin-top:2px;position: relative;z-index: 99">
        <%@include file="../../include/time.jsp" %>
        <%--导出--%>
        <button type="button" class="btn btn-primary" id="uploadCsv" title="导出电度数据">
            <i class="glyphicon glyphicon-share"></i>
        </button>
    </div>
</div>
<div style="padding: 10px;">
    <form class="layui-form" action="/pqs9000/plate/getCreaExcelResult" id="download_form" method="post">
        <div id="rightContent"
             style="position: absolute;left:20px;right: 20px; top: 65px; bottom: 0; z-index: 1;">
            <table class="table layui-layout-body" id="jcd" frame="border" rules="groups"
                   style="font-size: 14px; border-collapse: initial;overflow-y: scroll;">
                <tr>
                    <td align="center" colspan="2">
                        <div class="title_1 fr">
                            所选监测点：<a href="#" id="lineName" style="color: black;">暂未选中监测点</a>
                        </div>
                    </td>
                </tr>
                <tr>
                    <td align="center">
                        <div class="title">三相总有功电能</div>
                    </td>
                    <td align="left">
                        <input type="checkbox" id="zxygdn" title="正向有功电能" lay-skin="primary">
                        <input type="checkbox" id="fxygdn" title="反向有功电能" lay-skin="primary">
                        <input type="checkbox" id="zhygdn" title="组合有功电能" lay-skin="primary">
                    </td>
                </tr>
                <tr>
                    <td align="center">
                        <div class="title">三相总无功电能</div>
                    </td>
                    <td align="left">
                        <input type="checkbox" title="I象限无功电能" lay-skin="primary" id="oneXxwgdn">
                        <input type="checkbox" title="II象限无功电能" lay-skin="primary" id="twoXxwgdn">
                        <input type="checkbox" title="III象限无功电能" lay-skin="primary" id="threeXxwgdn">
                        <input type="checkbox" title="IV象限无功电能" lay-skin="primary" id="fourXxwgdn">
                        <input type="checkbox" title="组合1无功电能" lay-skin="primary" id="oneComXxwgdn">
                        <input type="checkbox" title="组合2无功电能" lay-skin="primary" id="twoComXxwgdn">
                    </td>
                </tr>
                <tr>
                    <td align="center">
                        <div class="title">三相总视在电能</div>
                    </td>
                    <td align="left">
                        <input type="checkbox" id="zxszdn" title="正向视在电能" lay-skin="primary">
                        <input type="checkbox" id="fxszdn" title="反向视在电能" lay-skin="primary">
                    </td>
                </tr>
                <tr>
                    <td align="center">
                        <div class="title">三相总基波有功电能</div>
                    </td>
                    <td align="left">
                        <input type="checkbox" id="jbzxygdn" title="正向基波有功电能" lay-skin="primary">
                        <input type="checkbox" id="jbfxygdn" title="反向基波有功电能" lay-skin="primary">
                        <input type="checkbox" id="jbzhygdn" title="组合基波有功电能" lay-skin="primary">
                    </td>
                </tr>
                <tr>
                    <td align="center">
                        <div class="title">三相总基波无功电能</div>
                    </td>
                    <td align="left">
                        <input type="checkbox" title="I象限基波无功电能" lay-skin="primary" id="oneXxjbwgdn">
                        <input type="checkbox" title="II象限基波无功电能" lay-skin="primary" id="twoXxjbwgdn">
                        <input type="checkbox" title="III象限基波无功电能" lay-skin="primary" id="threeXxjbwgdn">
                        <input type="checkbox" title="IV象限基波无功电能" lay-skin="primary" id="fourXxjbwgdn">
                        <input type="checkbox" title="组合1基波无功电能" lay-skin="primary" id="oneComXxjbwgdn">
                        <input type="checkbox" title="组合2基波无功电能" lay-skin="primary" id="twoComXxjbwgdn">
                    </td>
                </tr>
                <tr>
                    <td align="center">
                        <div class="title">三相总谐波有功电能</div>
                    </td>
                    <td align="left">
                        <input type="checkbox" id="zxxbygdn" title="正向谐波有功电能" lay-skin="primary">
                        <input type="checkbox" id="fxxbygdn" title="反向谐波有功电能" lay-skin="primary">
                        <input type="checkbox" id="zhxbygdn" title="组合谐波有功电能" lay-skin="primary">
                    </td>
                </tr>
                <tr>
                    <td align="center">
                        <div class="title">三相总谐波无功电能</div>
                    </td>
                    <td align="left">
                        <input type="checkbox" title="I象限谐波无功电能" lay-skin="primary" id="oneXxxbwgdn">
                        <input type="checkbox" title="II象限谐波无功电能" lay-skin="primary" id="twoXxxbwgdn">
                        <input type="checkbox" title="III象限谐波无功电能" lay-skin="primary" id="threeXxxbwgdn">
                        <input type="checkbox" title="IV象限谐波无功电能" lay-skin="primary" id="fourXxxbwgdn">
                        <input type="checkbox" title="组合1谐波无功电能" lay-skin="primary" id="oneComXxxbwgdn">
                        <input type="checkbox" title="组合2谐波无功电能" lay-skin="primary" id="twoComXxxbwgdn">
                    </td>
                </tr>
            </table>
        </div>
        <input type="hidden" id="page_data" class="layui-inline" name="userList">
    </form>
</div>
<script src="${ctx}/js/plugin/jquery.min.js"></script>
<script src="${ctx}/js/plugin/bootstrap/bootstrap.min.js"></script>
<script src="${ctx}/js/plugin/layui/layer.js"></script>
<script src="${ctx}/js/plugin/ztree/jquery.ztree.core.js"></script>
<script src="${ctx}/js/plugin/layui/layui.js"></script>
<script src="${ctx}/js/plugin/bootstrap/bootstrap-datetimepicker.js"></script>
<script src="${ctx}/js/plugin/bootstrap/bootstrap-datetimepicker.zh-CN.js"></script>
<script src="${ctx}/js/basic.js"></script>
<script src="${ctx}/jspJS/utils/timeControl.js"></script>
<script src="${ctx}/jspJS/utils/loading.js"></script>
<script src="${ctx}/jspJS/utils/judgeAjaxStatus.js"></script>
<%--<script src="${ctx}/jspJS/assessmentsis/plateReport.js"></script>--%>
<script>
    layui.use('form', function () {
        var form = layui.form;
    });
    $("#interval option[value='自定义']").remove();
    $("#interval option[value='周']").remove();
    $("#interval").val("月份");
    $("#lineName").text(parent.jcdxq);
    var lineIndex = parent.$("#lineIndex").val();
    $("#uploadCsv").click(function () {
        var startTime = $("#startTime").val() + ' 00:00:00';// 起始时间
        var endTime = $("#endTime").val() + ' 23:59:59';// 结束时间
        var intervalNum;
        if ($("#interval").val() == "月份") {
            intervalNum = 1;
        } else if($("#interval").val() == "季度"){
            intervalNum = 2;
        }else {
            intervalNum = 3;
        }
        var jsonArr;
        var condition = [];//指标
        var conditionyg = [], conditionwg = [], conditionsz = [], conditionjbyg = [], conditionjbwg = [],
            conditionxbyg = [], conditionxbwg = [];
        var valueYGTypeNum = [], valueWGTypeNum = [], valueSZTypeNum = [], valueJBYGTypeNum = [], valueJBWGTypeNum = [],
            valueXBYGTypeNum = [], valueXBWGTypeNum = [];
        <%--三相总有功电能--%>
        if ($("#zxygdn").is(":checked")) {
            valueYGTypeNum.push(1);
        }
        if ($("#fxygdn").is(":checked")) {
            valueYGTypeNum.push(2);
        }
        if ($("#zhygdn").is(":checked")) {
            valueYGTypeNum.push(3);
        }
        if (valueYGTypeNum.length > 0) {
            conditionyg = {
                id: '111',
                valueTypeNum: valueYGTypeNum
            }
            condition.push(conditionyg);
        }
        <%--三相总无功电能--%>
        if ($("#oneXxwgdn").is(":checked")) {
            valueWGTypeNum.push(1);
        }
        if ($("#twoXxwgdn").is(":checked")) {
            valueWGTypeNum.push(2);
        }
        if ($("#threeXxwgdn").is(":checked")) {
            valueWGTypeNum.push(3);
        }
        if ($("#fourXxwgdn").is(":checked")) {
            valueWGTypeNum.push(4);
        }
        if ($("#oneComXxwgdn").is(":checked")) {
            valueWGTypeNum.push(5);
        }
        if ($("#twoComXxwgdn").is(":checked")) {
            valueWGTypeNum.push(6);
        }
        if (valueWGTypeNum.length > 0) {
            conditionwg = {
                id: '121',
                valueTypeNum: valueWGTypeNum
            }
            condition.push(conditionwg);
        }
        <%--三相总视在电能--%>
        if ($("#zxszdn").is(":checked")) {
            valueSZTypeNum.push(1);
        }
        if ($("#fxszdn").is(":checked")) {
            valueSZTypeNum.push(2);
        }
        if (valueSZTypeNum.length > 0) {
            conditionsz = {
                id: '131',
                valueTypeNum: valueSZTypeNum
            }
            condition.push(conditionsz);
        }
        <%--三相总基波有功电能--%>
        if ($("#jbzxygdn").is(":checked")) {
            valueJBYGTypeNum.push(1);
        }
        if ($("#jbfxygdn").is(":checked")) {
            valueJBYGTypeNum.push(2);
        }
        if ($("#jbzhygdn").is(":checked")) {
            valueJBYGTypeNum.push(3);
        }
        if (valueJBYGTypeNum.length > 0) {
            conditionjbyg = {
                id: '141',
                valueTypeNum: valueJBYGTypeNum
            }
            condition.push(conditionjbyg);
        }
        <%--三相总基波无功电能--%>
        if ($("#oneXxjbwgdn").is(":checked")) {
            valueJBWGTypeNum.push(1);
        }
        if ($("#twoXxjbwgdn").is(":checked")) {
            valueJBWGTypeNum.push(2);
        }
        if ($("#threeXxjbwgdn").is(":checked")) {
            valueJBWGTypeNum.push(3);
        }
        if ($("#fourXxjbwgdn").is(":checked")) {
            valueJBWGTypeNum.push(4);
        }
        if ($("#oneComXxjbwgdn").is(":checked")) {
            valueJBWGTypeNum.push(5);
        }
        if ($("#twoComXxjbwgdn").is(":checked")) {
            valueJBWGTypeNum.push(6);
        }
        if (valueJBWGTypeNum.length > 0) {
            conditionjbwg = {
                id: '151',
                valueTypeNum: valueJBWGTypeNum
            }
            condition.push(conditionjbwg);
        }
        <%--三相总谐波有功电能--%>
        if ($("#zxxbygdn").is(":checked")) {
            valueXBYGTypeNum.push(1);
        }
        if ($("#fxxbygdn").is(":checked")) {
            valueXBYGTypeNum.push(2);
        }
        if ($("#zhxbygdn").is(":checked")) {
            valueXBYGTypeNum.push(3);
        }
        if (valueXBYGTypeNum.length > 0) {
            conditionxbyg = {
                id: '161',
                valueTypeNum: valueXBYGTypeNum
            }
            condition.push(conditionxbyg);
        }
        <%--三相总谐波无功电能--%>
        if ($("#oneXxxbwgdn").is(":checked")) {
            valueXBWGTypeNum.push(1);
        }
        if ($("#twoXxxbwgdn").is(":checked")) {
            valueXBWGTypeNum.push(2);
        }
        if ($("#threeXxxbwgdn").is(":checked")) {
            valueXBWGTypeNum.push(3);
        }
        if ($("#fourXxxbwgdn").is(":checked")) {
            valueXBWGTypeNum.push(4);
        }
        if ($("#oneComXxxbwgdn").is(":checked")) {
            valueXBWGTypeNum.push(5);
        }
        if ($("#twoComXxxbwgdn").is(":checked")) {
            valueXBWGTypeNum.push(6);
        }
        if (valueXBWGTypeNum.length > 0) {
            conditionxbwg = {
                id: '171',
                valueTypeNum: valueXBWGTypeNum
            }
            condition.push(conditionxbwg);
        }

        jsonArr = {
            startTime: startTime,
            endTime: endTime,
            intervalNum: intervalNum,
            lineIndex: lineIndex,
            condition: condition
        }
        $('#page_data').val(JSON.stringify(jsonArr));
        $("#download_form").submit();
    })
</script>
</body>
</html>
