<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp" %>
<!DOCTYPE HTML>
<html>
<head>
    <link rel="stylesheet" href="${ctxPlugin}/lib/layuiAdmin/dist/layuiadmin/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="${ctxPlugin}/lib/layuiAdmin/dist/layuiadmin/style/admin.css" media="all">
    <link rel="stylesheet" href="${ctxPlugin}/static/css/reset.css">
    <link rel="stylesheet" href="${ctxPlugin}/lib/layuiAdmin/dist/layuiadmin/style/formSelects-v4.css" media="all">
</head>
<style>
    .layui-fluid {
        padding: 10px
    }

    .layui-card-header {
        font-size: 14px;
        font-weight: 600
    }

    .layui-card-header.dztj-title {
        margin-bottom: 0;
        background: #FFF;
        display: flex;
        justify-content: space-between;
        align-items: center;
        white-space: nowrap;
    }

    .layui-card-header.dztj-title > div {
        font-weight: 500; text-align: right;
    }

    .dztj {
        text-align: right
    }

    .dztj > div {
        display: inline-block;
    }

    .dztj-tabs {
        font-size: 0;
        margin-right: 10px
    }

    .dztj-tabs span {
        height: 37px;
        line-height: 37px;
        display: inline-block;
        padding: 0 20px;
        border-right: 1px solid #CCC;
        border-top: 1px solid #e3e7ed;
        border-right: 1px solid #e3e7ed;
        border-bottom: 1px solid #e3e7ed;
        font-size: 14px;
        text-align: center
    }

    .dztj-tabs span:first-child {
        border-left: 1px solid #e3e7ed;
        border-radius: 3px 0px 0px 3px;
    }

    .dztj-tabs span:last-child {
        border-radius: 0px 3px 3px 0px;
    }

    .dztj-tabs span.actived {
        background-color: #e8380d;
        color: #FFF;
    }

    .count-box li > div {
        height: 75px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        margin-right: 10px;
        padding: 0 10px;
        border-radius: 10px
    }

    .count-box li img {
        width: 50px;
        height: 50px
    }

    .count-box li h3 {
        font-size: 14px; text-align: left;
    }

    .count-box li p {
        font-size: 20px; text-align: left;
    }
    .note-box li {
        position: relative;
        padding: 10px 10px 10px 30px;
    }
    .note-box li:nth-child(2n){
        background: #fbfcfd;
    }

    .note-box li .dot {
        position: absolute;
        width: 10px;
        height: 10px;
        display: inline-block;
        background: #d1d1d1;
        left: 6px;
        top: 30px;
        border-radius: 50%
    }

    .note-head, .note-body {
        display: flex;
        align-items: center;
        position: relative;
    }

    .note-head h3 {
        font-size: 18px;
        color: #666666;
    }

    .note-body {
        font-size: 12px;
        color: #666666;
        margin-top: 5px;
    }

    .note-body div {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        flex: 1;
        height: 26px;
    }

    .note-body span {
        width: 150px;
        text-align: right
    }

    .no-read .note-head h3 {
        color: #231815;
        max-width: calc(100% - 120px);
        padding-right: 5px;
        overflow: hidden;
        white-space: nowrap;
        text-overflow: ellipsis;
    }
    .no-read .note-head img {
        margin-right: 4px;
    }

    .no-read .note-head > span {
        color: #999999;
        position: absolute;
        right: 0;
        top: 0;
    }

    .no-read .note-head > span.actived {
        color: #e8380d;
    }

    .note-box .no-read .dot {
        background: #d1d1d1;
    }

    .note-box .no-read .dot.actived {
        background: #e8380d;
    }

    .note-type {
        display: inline-block;
        padding: 3px 8px;
        font-size: 14px;
        color: #dc6617;
        background-color: #fff3eb;
        border-radius: 3px;
    }
    .layui-col-space10 > *{padding: 8px 5px;}

    .dbsx-list-box{height: 350px; overflow: hidden}
    .list-row{display: flex; justify-content: space-between; margin-bottom: 5px}
    .list-row li:first-child{flex: 1; white-space: nowrap;text-overflow: ellipsis;overflow: hidden;}
    .list-row li:last-child{width: 90px; text-align: right; white-space: nowrap; text-overflow: ellipsis; overflow: hidden;}
</style>
<body>

<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <!--项目电站统计-->
        <div class="layui-col-md8">
            <div class="layui-card-header dztj-title"><span>数据总览</span>
                <div>
                    <div class="layui-form layui-inline assemblyListSelect" style="width: 20%">
                        <select lay-filter="addressList" name="addressList" class="addressList " xm-select="addressList" xm-select-type="1" xm-select-height="25px" xm-select-show-count="6" lay-search>
                            <option value="">搜索全国区域</option>
                            <c:forEach var="pro" items="${pros}">
                                <option value="${pro.columns.ProvinceName}">${pro.columns.ProvinceName}</option>
                                <c:forEach var="city" items="${citys}">
                                    <c:if test="${city.columns.ProvinceId eq pro.columns.ProvinceID}">
                                        <option value="${city.columns.CityName}">&nbsp;&nbsp;&nbsp;${city.columns.CityName}</option>
                                    </c:if>
                                </c:forEach>
                            </c:forEach>
                        </select>
                    </div>
                    <div class="layui-form layui-inline assemblyListSelect" style="width: 20%">
                        <select lay-filter="assemblyList" name="assemblyList" class="assemblyList"
                                xm-select="assemblyList" xm-select-type="1" xm-select-height="25px"
                                xm-select-show-count="6" xm-select-search>
                            <option value="">代理商</option>
                        </select>
                    </div>
                    <div class="layui-form layui-inline " style="width: 20%">
                        <select lay-filter="projectList" name="projectList" class="projectList"
                                xm-select="projectList" xm-select-type="1" xm-select-height="25px"
                                xm-select-show-count="6" xm-select-search>
                            <option value="">按产品</option>
                        </select>
                    </div>
                    <div class="layui-form layui-inline " style="width: 20%">
                        <select lay-filter="companyList" name="companyList" class="companyList"
                                xm-select="companyList" xm-select-type="1" xm-select-height="25px"
                                xm-select-show-count="6" xm-select-search>
                            <option value="">项目公司</option>
                        </select>
                    </div>
<%--                    <div class="layui-form layui-inline" style="width: 19%">--%>
<%--                        <select lay-filter="timeList" name="timeList" class="timeList" xm-select="timeList"--%>
<%--                                xm-select-type="1" xm-select-height="25px" xm-select-show-count="6" xm-select-search>--%>

<%--                            <option value="">时间</option>--%>
<%--                            <c:forEach var="time" items="${timelist}" varStatus="status">--%>

<%--                                <option value="${time}">${time}</option>--%>

<%--                                &lt;%&ndash;    <c:if test="${status.last}">--%>
<%--                                        <option value="${time}" selected>${time}</option>--%>
<%--                                    </c:if>&ndash;%&gt;--%>
<%--                            </c:forEach>--%>
<%--                        </select>--%>
<%--                    </div>--%>
                </div>
            </div>
            <div class="layui-card">
                <div class="layui-card-header" style="margin-bottom: 0;">项目电站统计</div>
                <div class="layui-card-body">

                    <div data-anim="fade" lay-filter="LAY-index">
                        <div id="LAY-index" style="width: 100%; height: 267px;"></div>
                    </div>
                </div>
            </div>
        </div>
        <!--数据总揽-->
        <div class="layui-col-md4">

            <div class="layui-row" style="background: #FFF; display: flex">
                <div style="display: inline-block;">
                    <div class="layui-card">
                        <div class="layui-card-body" style="padding-right: 0">
                            <ul class="layui-row layui-col-space10 text-c count-box">
                                <li class="layui-col-xs6">
                                    <div style="background-color: #f4f6f9;">
                                        <div>
                                            <h3>资格预审通过</h3>
                                            <p style="color: #e8380d;" class="allCount">0</p>
                                        </div>
                                        <img src="${ctxPlugin}/static/imgs/yushentongguo.png"/>
                                    </div>
                                </li>
                                <li class="layui-col-xs6">
                                    <div style="background-color: #f4f6f9;">
                                        <div>
                                            <h3>预估容量(kW)</h3>
                                            <p style="color: #e8380d;" class="ywcCount">0</p>
                                        </div>
                                        <img src="${ctxPlugin}/static/imgs/yugurongliang.png"/>
                                    </div>
                                </li>
                                <li class="layui-col-xs6">
                                    <div style="background-color: #f4f6f9;">
                                        <div>
                                            <h3>设计审核通过</h3>
                                            <p style="color: #e8380d;" class="wazCount">0</p>
                                        </div>
                                        <img src="${ctxPlugin}/static/imgs/shenhetongguo.png"/>
                                    </div>
                                </li>
                                <li class="layui-col-xs6">
                                    <div style="background-color: #f4f6f9;">
                                        <div>
                                            <h3>设计容量(kW)</h3>
                                            <p style="color: #e8380d;" class="dysCount">0</p>
                                        </div>
                                        <img src="${ctxPlugin}/static/imgs/shejirongliang.png"/>
                                    </div>
                                </li>
                                <li class="layui-col-xs6">
                                    <div style="background-color: #f4f6f9;">
                                        <div>
                                            <h3>安装验收通过</h3>
                                            <p style="color: #e8380d;" class="wbwCount">0</p>
                                        </div>
                                        <img src="${ctxPlugin}/static/imgs/anzhuangystg.png"/>
                                    </div>
                                </li>
                                <li class="layui-col-xs6">
                                    <div style="background-color: #f4f6f9;">
                                        <div>
                                            <h3>安装容量(kW)</h3>
                                            <p style="color: #e8380d;" class="wysCount">0</p>
                                        </div>
                                        <img src="${ctxPlugin}/static/imgs/anzhuangrongliang.png"/>
                                    </div>
                                </li>
                                <li class="layui-col-xs6">
                                    <div style="background-color: #f4f6f9;">
                                        <div>
                                            <h3>并网验收通过</h3>
                                            <p style="color: #e8380d;" class="bwysCount">0</p>
                                        </div>
                                        <img src="${ctxPlugin}/static/imgs/bwyanshoutg.png"/>
                                    </div>
                                </li>
                                <li class="layui-col-xs6">
                                    <div style="background-color: #f4f6f9;">
                                        <div>
                                            <h3>并网容量(kW)</h3>
                                            <p style="color: #e8380d;" class="yibwCount">0</p>
                                        </div>
                                        <img src="${ctxPlugin}/static/imgs/bingwangrongliang.png"/>
                                    </div>
                                </li>
                            </ul>
                        </div>
                    </div>
                </div>
                <%--  <div style="display: inline-block; flex: 1;">
                      <div id="pieBox"
                           style="height: 304px; background: #f4f6f9; border-radius: 5px; margin: 10px; padding: 15px"></div>
                  </div>--%>
            </div>
        </div>

    </div>
    <div class="layui-row layui-col-space15">

        <!--通知公告-->
        <div class="layui-col-md8">
            <div class="layui-card" style="height: 422px;">
                <div class="layui-card-header">通知公告<a class="f-r applyList" data-type="通知公告"
                                                      style=" font-size: 12px;cursor: pointer;">更多>></a></div>
                <div class="layui-card-body" style="padding: 0 10px;">
                    <ul class="note-box">
                        <c:forEach items="${announce}" var="ann">
                            <li class="no-read lookNotice">
                                <input hidden value="${ann.columns.id}">
                                <c:if test="${empty ann.columns.bid}">
                                    <i class="dot actived"></i>
                                </c:if>
                                <c:if test="${not empty ann.columns.bid}">
                                    <i class="dot"></i>
                                </c:if>
                                <div class="note-head">
                                    <h3>
                                        <c:if test="${empty ann.columns.bid}">
                                            <img class="newico" src="${ctxPlugin}/static/imgs/newImg.png"/>
                                        </c:if>
                                            ${ann.columns.title}
                                    </h3>
                                    <c:choose>
                                        <c:when test="${ann.columns.obj_type == 1}">
                                            <%--                                                <span class="note-type">用户公告</span>--%>
                                            <img src="${ctxPlugin}/static/imgs/userAnnounce.png"/>
                                        </c:when>
                                        <c:when test="${ann.columns.obj_type == 2}">
                                            <%--                                                <span class="note-type" style="color: #FFF; background-color: #cd2323;">服务通知</span>--%>
                                            <img src="${ctxPlugin}/static/imgs/fwAnnounce.png"/>
                                        </c:when>
                                        <c:when test="${ann.columns.obj_type == 3}">
                                            <%--                                                <span class="note-type" style="color: #FFF; background-color: #cd2323;">通知公告</span>--%>
                                            <img src="${ctxPlugin}/static/imgs/announce.png"/>
                                        </c:when>
                                    </c:choose>
                                    <c:if test="${empty ann.columns.bid}">
                                        <span class="markRead actived">  未读</span>
                                    </c:if>
                                    <c:if test="${not empty ann.columns.bid}">
                                        <span class="markRead">  已读</span>
                                    </c:if>
                                </div>
                                <div class="note-body">
                                    <div>${ann.columns.html}</div>
                                    <span>${ann.columns.createTime}</span>
                                </div>
                            </li>
                        </c:forEach>
                    </ul>
                </div>
            </div>
        </div>
        <!--待办事项-->
        <div class="layui-col-md4">
            <div class="layui-card">
                <div class="layui-card-header">待办事项
<%--                    <a class="f-r waitDealItem" data-type="待处理" style="font-size: 12px;cursor: pointer;">更多>></a>--%>
                </div>
                <div class="layui-card-body dbsx-list-box" id="waitDeal" style="overflow:auto">

                </div>
            </div>
        </div>
    </div>
</div>

<script src="${ctxPlugin}/lib/layuiAdmin/dist/layuiadmin/layui/layui.js"></script>
<script src="${ctxPlugin}/lib/layuiAdmin/dist/layuiadmin/lib/extend/echarts.min.js"></script>
<script src="${ctxPlugin}/lib/layuiAdmin/dist/layuiadmin/lib/formSelects-v4.js"></script>
<script>
    //图片查看效果
    var imgsCount = 0;
    var $;
    var reg = /^(?:[1-9]\d*|0)(?:\.\d+)?$/;
    var number = /^[1-9]\d*$/;//非0正整数正则
    var plan_html = "<option value=''>请选择</option>";
    var plan_type_html = "<option value=''>请选择</option>";
    var formSelects;
    layui.config({
        base: '${ctxPlugin}/lib/layuiAdmin/dist/layuiadmin/' //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['index', 'form', 'layedit', 'laydate', 'jquery', 'layer', 'layim', 'formSelects'], function () {
        $ = layui.$
            , element = layui.element
            , form = layui.form
            , layer = layui.layer;
        formSelects = layui.formSelects;

        waitApply();

        $(".lookNotice").on('click', function () {
            var id = $(this).find("input").val();
            $(this).find(".newico").remove();
            $(this).find(".note-head .markRead").addClass("readMark");
            layer.open({
                type: 2,
                content: "${ctx}/msg/center/announceShowDetail?id=" + id //这里content是一个DOM，注意：最好该元素要存放在body最外层，否则可能被其它的相对元素所影响
                , title: "公告详情"
                , area: ['51%', '75%']
                , end: function () {
                    $(".readMark").text("已读");
                    $(".markRead").removeClass("actived");
                    $(".dot").removeClass("actived");
                }
            });
        })


        formSelects.on('projectList', function (id, vals, val, isAdd, isDisabled) {
            var timeList = formSelects.value('timeList', 'valStr')
            var assemblyList = "";
            var companyList ="";
            var provinceList = "";
            var cityList = "";
            companyList = formSelects.value('companyList', 'valStr')
            assemblyList = formSelects.value('assemblyList', 'valStr')
            var addlist = formSelects.value('addressList', 'all');
            $.each(addlist, function (n, value) {
                if (value.name.indexOf("&nbsp;") >= 0) {
                    if (isBlank(cityList)) {
                        cityList = value.value;
                    }else if(cityList.indexOf(value.value) >= 0){

                    } else {
                        cityList = cityList + "," + value.value;
                    }
                } else {
                    if (isBlank(provinceList)) {
                        provinceList = value.value;
                    } else if(provinceList.indexOf(value.value) >= 0){

                    }else {
                        provinceList = provinceList + "," + value.value;
                    }
                }

            })
            var projectList = formSelects.value('projectList', 'valStr')
            var date = {
                "timeList": timeList,
                "traderList": assemblyList,
                "companyList": companyList,
                "projectList": projectList,
                "provinceList": provinceList,
                "cityList": cityList
            }
            echartsAppend(date)
            echartsPieAppend(date)
        }, true);

        formSelects.on('companyList', function (id, vals, val, isAdd, isDisabled) {
            var timeList = formSelects.value('timeList', 'valStr')
            var assemblyList = "";
            var provinceList = "";
            var cityList = "";
            assemblyList = formSelects.value('assemblyList', 'valStr')
            var addlist = formSelects.value('addressList', 'all');
            var projectList = formSelects.value('projectList', 'valStr')
            $.each(addlist, function (n, value) {
                if (value.name.indexOf("&nbsp;") >= 0) {
                    if (isBlank(cityList)) {
                        cityList = value.value;
                    }else if(cityList.indexOf(value.value) >= 0){

                    } else {
                        cityList = cityList + "," + value.value;
                    }
                } else {
                    if (isBlank(provinceList)) {
                        provinceList = value.value;
                    } else if(provinceList.indexOf(value.value) >= 0){

                    }else {
                        provinceList = provinceList + "," + value.value;
                    }
                }

            })
            var companyList = formSelects.value('companyList', 'valStr')
            var date = {
                "timeList": timeList,
                "traderList": assemblyList,
                "companyList": companyList,
                "projectList": projectList,
                "provinceList": provinceList,
                "cityList": cityList
            }
            echartsAppend(date)
            echartsPieAppend(date)
        }, true);




        formSelects.on('assemblyList', function (id, vals, val, isAdd, isDisabled) {
            var timeList = formSelects.value('timeList', 'valStr')
            var assemblyList = "";
            var provinceList = "";
            var cityList = "";
            assemblyList = formSelects.value('assemblyList', 'valStr')
            var addlist = formSelects.value('addressList', 'all');
            var projectList = formSelects.value('projectList', 'valStr')
            $.each(addlist, function (n, value) {
                if (value.name.indexOf("&nbsp;") >= 0) {
                    if (isBlank(cityList)) {
                        cityList = value.value;
                    }else if(cityList.indexOf(value.value) >= 0){

                    } else {
                        cityList = cityList + "," + value.value;
                    }
                } else {
                    if (isBlank(provinceList)) {
                        provinceList = value.value;
                    } else if(provinceList.indexOf(value.value) >= 0){

                    }else {
                        provinceList = provinceList + "," + value.value;
                    }
                }

            })
            var companyList = formSelects.value('companyList', 'valStr')
            var date = {
                "timeList": timeList,
                "traderList": assemblyList,
                "companyList": companyList,
                "projectList": projectList,
                "provinceList": provinceList,
                "cityList": cityList
            }
            echartsAppend(date)
            echartsPieAppend(date)
        }, true);

        formSelects.on('addressList', function (id, vals, val, isAdd, isDisabled) {

            var timeList = formSelects.value('timeList', 'valStr')
            var assemblyList = "";
            var provinceList = "";
            var cityList = "";
            assemblyList = formSelects.value('assemblyList', 'valStr')
            var projectList = formSelects.value('projectList', 'valStr')
            var addlist = formSelects.value('addressList', 'all');
            $.each(addlist, function (n, value) {
                if (value.name.indexOf("&nbsp;") >= 0) {
                    if (isBlank(cityList)) {
                        cityList = value.value;
                    }else if(cityList.indexOf(value.value) >= 0){

                    } else {
                        cityList = cityList + "," + value.value;
                    }
                } else {
                    if (isBlank(provinceList)) {
                        provinceList = value.value;
                    } else if(provinceList.indexOf(value.value) >= 0){

                    }else {
                        provinceList = provinceList + "," + value.value;
                    }
                }

            })
            var companyList = formSelects.value('companyList', 'valStr')
            var date = {
                "timeList": timeList,
                "traderList": assemblyList,
                "companyList": companyList,
                "projectList": projectList,
                "provinceList": provinceList,
                "cityList": cityList
            }
            echartsAppend(date)
            echartsPieAppend(date)
        }, true);
        formSelects.on('timeList', function (id, vals, val, isAdd, isDisabled) {

            var timeList = formSelects.value('timeList', 'valStr')
            var assemblyList = "";
            var provinceList = "";
            var cityList = "";
            assemblyList = formSelects.value('assemblyList', 'valStr')
            var projectList = formSelects.value('projectList', 'valStr')
            var addlist = formSelects.value('addressList', 'all');
            $.each(addlist, function (n, value) {
                if (value.name.indexOf("&nbsp;") >= 0) {
                    if (isBlank(cityList)) {
                        cityList = value.value;
                    }else if(cityList.indexOf(value.value) >= 0){

                    } else {
                        cityList = cityList + "," + value.value;
                    }
                } else {
                    if (isBlank(provinceList)) {
                        provinceList = value.value;
                    } else if(provinceList.indexOf(value.value) >= 0){

                    }else {
                        provinceList = provinceList + "," + value.value;
                    }
                }

            })
            var companyList = formSelects.value('companyList', 'valStr')
            var date = {
                "timeList": timeList,
                "traderList": assemblyList,
                "companyList": companyList,
                "projectList": projectList,
                "provinceList": provinceList,
                "cityList": cityList
            }
            echartsAppend(date)
            echartsPieAppend(date)
        }, true);


        $(".addressListSelect").hide();
        var keysd = [];
        var keycom = [];
        var keypro = [];
        traderList(keysd);
        projectCompany(keycom);
        projectList(keypro);
        echartsAppend()
        echartsPieAppend()


        /*   $(".temporaryOrder span").click(function (data) {
               var keys = [];
               $(".temporaryOrder span").removeClass("actived");
               $(this).addClass("actived");
               var index = $(this).index();
               $(".addressListSelect").hide();
               $(".assemblyListSelect").show();
               if (index == 0) {
                   traderList(keys);
               } else if (index == 1) {
                   //
                   $(".assemblyListSelect").hide();
                   $(".addressListSelect").show();
               } else if (index == 2) {
                   //按项目
                   projectList(keys);
               } else if (index == 3) {
                   //按项目公司
                   projectCompany(keys);
               }
               echartsAppend();

           })*/

        $(".applyList").on('click', function () {
            var dd = $(this).attr('data-type');
            $(window.parent.document).find("#LAY-system-side-menu").find(".nav").each(function (index) {
                var tabsName = $(this).text();
                if (dd === tabsName) {
                    var i = index;
                    <c:if test="${type eq '1' || type eq '2'||type eq '4' || type eq '5'||type eq '6'||type eq '7'||type eq '8'||type eq '9'||type eq 'a'}">
                    i = i + 1;
                    </c:if>
                    $(".nav", window.parent.document)[i].click();
                    return false;
                }
            });

        });

        $(".waitDealItem").on('click', function () {
            let dd = $(this).attr('data-type');
            $(window.parent.document).find("#LAY-system-side-menu").find(".nav").each(function (index) {
                let tabsName = $(this).text();
                if (dd === tabsName) {
                    $(".nav", window.parent.document)[index].click();
                    return false;
                }
            });
        });

        searchWaitDeal();
    });



    function echartsAppend(dati) {
        var myChart = echarts.init(document.getElementById('LAY-index'));

        $.post('${ctx}/sys/toHomerPager/homerPager', dati, function (data) {
            myChart.setOption(option = {
                // title: {
                //     text: '项目电站统计',
                //     textStyle: {
                //         color: '#231815',
                //         // fontWeight : 'normal',
                //         fontSize: 14
                //     },
                // },
                tooltip: {
                    trigger: 'axis',
                    axisPointer: {
                        type: 'none',
                        label: {
                            backgroundColor: '#f45e5e'
                        }
                    }
                },
                legend: {data: ["已完成", "未安装", "已安装未验收", "未并网", "已并网未验收"]},
                grid: {
                    left: '3%',
                    right: '4%',
                    bottom: '3%',
                    containLabel: true
                },
                xAxis: {data: ["信息登记", "待踏勘设计","设计审核", "电站安装", "安装验收", "电站并网","并网验收", "已完成"]},
                yAxis: {
                    type: 'value',
                    minInterval: 1,
                    axisTick: {
                        inside: true
                    },
                    splitLine: {
                        show: false
                    },

                    z: 10
                },
                series: [
                    {
                        name: '电站数量',
                        type: 'bar',
                        barWidth: '20%',
                        areaStyle: {
                            normal: {
                                color: "#3472ff"
                            }

                        },
                        itemStyle: {
                            normal: {
                                color: new echarts.graphic.LinearGradient(1, 0, 0, 1, [
                                    {
                                        offset: 0,
                                        color: '#0071af',
                                    },
                                /*    {
                                        offset: 0.5,
                                        color: '#0071af',
                                    },*/
                                    {
                                        offset: 1,
                                        color: '#009a92',
                                    },

                                ]),
                            }
                        },
                        data: data.echarts
                    }
                ]
            });
        }, "json")
        window.addEventListener("resize",function(){
            myChart.resize();

        });
    }


    function traderList(keys) {
        $.ajax({
            url: "${ctx}/trader/findTraderListByProvince",
            type: "POST",
            data: {}
            , success: function (result) {
                $(".assemblyList").empty();
                var length = result.length;
                /*  var plan_name_html = "{'name':请选择,'value':''}";
                  keys.push(plan_name_html);*/
                for (var i = 0; i < length; i++) {
                    var temp = {"name": result[i].columns.name, "value": result[i].columns.id}
                    keys.push(temp);
                }
                formSelects.data('assemblyList', 'local', {
                    arr: keys
                });
            }
        })
    }
    function projectList(keys) {
        $.ajax({
            url: "${ctx}/sysSettings/projectInfoSetting/getProjectList",
            type: "POST",
            data: {}
            , success: function (result) {
                $(".projectList").empty();
                var length = result.length;
                for (var i = 0; i < length; i++) {
                    var temp = {"name": result[i].columns.name, "value": result[i].columns.id}
                    keys.push(temp);
                }
                formSelects.data('projectList', 'local', {
                    arr: keys
                });
            }
        })
    }
    function echartsPieAppend(dati) {

        $.post('${ctx}/sys/toHomerPager/homerPagerPancake', dati, function (data) {

            $(".allCount").html(NumFormat(data.ystoCount));  //资格预审通过
            $(".ywcCount").html(NumFormat(data.yuguCount*660/1000));  //预估容量
            $(".wazCount").html(NumFormat(data.sjtoCount));//设计审核通过
            $(".dysCount").html(NumFormat(data.sjCount/1000)); //设计容量
            $(".wbwCount").html(NumFormat(data.azystoCount)); //安装验收通过
            $(".wysCount").html(NumFormat(data.azysCount/1000)); //安装容量
            $(".bwysCount").html(NumFormat(data.bwtoCount));  //并网验收通过
            $(".yibwCount").html(NumFormat(data.ybwCount/1000));  //并网容量

        }, "json")

    }

    function projectCompany(keys) {
        $.ajax({
            url: "${ctx}/projectCompany/getProjectCompany",
            type: "POST",
            data: {}
            , success: function (result) {
                $(".companyList").empty();
                var length = result.length;
                for (var i = 0; i < length; i++) {
                    var temp = {"name": result[i].columns.name, "value": result[i].columns.id}
                    keys.push(temp);
                }
                formSelects.data('companyList', 'local', {
                    arr: keys
                });
            }
        })
    }


    function waitApply() {
        $.ajax({
            type: "POST",
            url: "${ctx}/sys/toHomerPager/staticApplyCount",
            success: function (data) {
                if (data.code == '200') {
                    var applyCount = data.data
                    $("#apply1").text(applyCount.apply01);
                    $("#apply2").text(applyCount.apply02);
                    $("#apply3").text(applyCount.apply06);
                    $("#apply4").text(applyCount.apply08);
                    $("#apply5").text(applyCount.apply09);
                    $("#apply6").text(applyCount.apply12);
                    $("#apply7").text(applyCount.apply11);
                    $("#apply8").text(applyCount.apply10);
                    $("#apply9").text(applyCount.apply04);
                    $("#apply10").text(applyCount.apply05);
                    $("#apply11").text(applyCount.apply03);
                    $("#apply12").text(applyCount.apply07);
                }
            }
        })
    }

    function isBlank(val) {
        if (val == null || val == '' || val == undefined) {
            return true;
        }
        return false;
    }

    /**
     * 对数字进行三位分割
     * @param {*} value  需要进行分割的数字
     * @returns  返回分割后的数字串
     */
// 小数部分只显示两位小数

    function NumFormat(value) {
        if (!value) return '0'
        var intPart = Number(value).toFixed(0) // 获取整数部分
        var intPartFormat = intPart.toString()
            .replace(/(\d)(?=(?:\d{3})+$)/g, '$1,') // 将整数部分逢三一断
        var floatPart = '.00' // 预定义小数部分
        var value2Array = value.toString().split('.')
        // =2表示数据有小数位
        if (value2Array.length === 2) {
            floatPart = value2Array[1].toString() // 拿到小数部分
            if (floatPart.length === 1) {
                // 补0
                return intPartFormat + '.' + floatPart + '0'
            } else {
                return intPartFormat + '.' + floatPart
            }
        } else {
            return intPartFormat
        }
    }

    function searchWaitDeal() {
        $.ajax({
            type: "GET",
            url: "${ctx}/itemManagement/getWaitDealListForHomePage?limit=2147483647",
            data: {},
            success: function (result) {
                let html = '';
                for (let i = 0; i < result.length; i++) {
                    html += '<ul class="list-row" style="cursor: pointer;" onclick="showDetail(\'' + result[i].id + '\',\'' + result[i].formkey + '\')">';
                    html += '<li>【' + result[i].type + '】' + result[i].name + '</li>';
                    html += '<li>' + result[i].createName + '</li>';
                    html += '</ul>';
                }
                $("#waitDeal").empty().html(html);
            }
        })
    }

    function showDetail(applicationId, formKey) {
        if (formKey === '01') {
            //代理商准入申请
            layer.open({
                type: 2,
                title: '审批',
                content: '${ctx}/flowpath/traderApply/traderApplyDetail?from=audit&id=' + applicationId,
                area: ['90%', '90%'],
                end: function () {
                    searchWaitDeal();
                }
            });
        } else if (formKey === '02') {
            //供应商准入申请
            layer.open({
                type: 2,
                title: '审批',
                content: '${ctx}/flowpath/supplySupplierApply/supplierApplyDetail?from=audit&id=' + applicationId,
                area: ['80%', '90%'],
                end: function () {
                    searchWaitDeal();
                }
            });
        } else if (formKey === '03') {
            //保证金调整申请
            layer.open({
                title: '审批',
                type: 2,
                area: ["70%", "80%"],
                content: '${ctx}/apply/bondAdjustment/bondAdjustmentApplyDetail?id=' + applicationId + '&from=audit',
                end: function () {
                    searchWaitDeal();
                }
            })
        } else if (formKey === '04') {
            //授信额调整申请
            layer.open({
                title: '审批',
                type: 2,
                area: ["70%", "80%"],
                content: '${ctx}/apply/distributionGoods/ApplyDistributionGoods?id=' + applicationId + '&from=audit',
                end: function () {
                    searchWaitDeal();
                }
            })
        } else if (formKey === '05') {
            //质保金调整申请
            layer.open({
                title: '审批',
                type: 2,
                area: ["70%", "80%"],
                content: '${ctx}/apply/warrantyDeposit/applyWarrantyDeposit?id=' + applicationId + '&from=audit',
                end: function () {
                    searchWaitDeal();
                }
            })
        } else if (formKey === '06') {
            //分包标准价申请
            layer.open({
                title: '审批',
                type: 2,
                area: ["70%", "80%"],
                content: '${ctx}/apply/standardPrice/standardPriceApplyDetailPage?id=' + applicationId + '&from=audit',
                end: function () {
                    searchWaitDeal();
                }
            })
        } else if (formKey === '07') {
            //结算额调整申请
            layer.open({
                title: '审批',
                type: 2,
                area: ["70%", "80%"],
                content: '${ctx}/apply/settlementAmount/settlementAmountApplyDetail?id=' + applicationId + '&from=audit',
                end: function () {
                    searchWaitDeal();
                }
            })
        } else if (formKey === '08') {
            //赊销下单申请
            layer.open({
                title: '审批',
                type: 2,
                area: ['100%', '100%'],
                content: '${ctx}/material/order/supplyMaterialOrderAudit?id=' + applicationId + '&from=audit',
                end: function () {
                    searchWaitDeal();
                }
            })
        } else if (formKey === '09') {
            //采购申请
            layer.open({
                type: 2,
                title: '审批',
                content: '${ctx}/supplyOrder/purchaseAudit/auditPurchaseOrderPage?id=' + applicationId + '&from=audit',
                area: ['80%', '90%'],
                end: function () {
                    searchWaitDeal();
                }
            });
        } else if (formKey === '10') {
            //盘点单申请
            layer.open({
                type: 2,
                title: '审批',
                content: '${ctx}/inventory/toInventoryOrderDetailForm?mode=audit&id=' + applicationId + '&from=audit',
                area: ['80%', '80%'],
                end: function () {
                    searchWaitDeal();
                }
            });
        } else if (formKey === '11') {
            //调拨单申请
            layer.open({
                title: '审批',
                type: 2,
                area: ['80%', '75%'],
                fixed: false,
                content: '${ctx}/allocation/examineAllocationOrderPage?model=audit&id=' + applicationId,
                end: function () {
                    searchWaitDeal();
                }
            })
        } else if (formKey === '12') {
            //请款申请
            layer.open({
                title: '审批',
                type: 2,
                area: ["100%", "100%"],
                content: '${ctx}/apply/outCash/cashOutDetailPage?id=' + applicationId + '&from=audit',
                end: function () {
                    searchWaitDeal();
                }
            })
        } else if (formKey === '13') {
            //仓库申请
            layer.open({
                title: '审批',
                type: 2,
                area: ["70%", "80%"],
                content: '${ctx}/apply/warehouseApply/warehouseApplyDetail?id=' + applicationId + '&from=audit',
                end: function () {
                    searchWaitDeal();
                }
            })
        } else if (formKey === '14') {
            //零售价系数申请
            layer.open({
                title: '审批',
                type: 2,
                area: ["80%", "80%"],
                content: '${ctx}/apply/priceCoefficient/priceCoefficientApplyDetail?id=' + applicationId + '&from=audit',
                end: function () {
                    searchWaitDeal();
                }
            })
        } else if (formKey === '15') {
            //备货申请
            layer.open({
                type: 2,
                title: '审批',
                content: '${ctx}/fittingStockUp/fittingStockUpDetailPage?id=' + applicationId + '&from=audit',
                area: ['80%', '90%'],
                end: function () {
                    searchWaitDeal();
                },
            });
        } else if (formKey === '17') {
            //现金下单申请
            layer.open({
                title: '审批',
                type: 2,
                area: ['100%', '100%'],
                content: '${ctx}/material/order/supplyMaterialOrderAudit?id=' + applicationId + '&from=audit',
                end: function () {
                    searchWaitDeal();
                }
            })
        } else if (formKey === '18') {
            //保证金额度申请
            layer.open({
                title: '审批',
                type: 2,
                area: ["70%", "80%"],
                content: '${ctx}/apply/bondLimitApply/bondLimitApplyDetail?id=' + applicationId + '&from=audit',
                end: function () {
                    searchWaitDeal();
                }
            })
        } else if (formKey === '91') {
            //设计审核
            layer.open({
                type: 2,
                content: "${ctx}/customerEntry/toExamineForm?type=2&entryId=" + applicationId,
                area: ['100%', '100%'],
                title: '审核信息', //不显示标题栏
                end: function () {
                    searchWaitDeal();
                }
            });
        } else if (formKey === '92') {
            //档案审核
            layer.open({
                type: 2,
                content: "${ctx}/customer/org/files/toFileReviewForm?entryId="+applicationId,
                area: ['100%', '100%'],
                title: '档案审核'
            });
        } else if (formKey === '93') {
            //安装验收
            layer.open({
                type: 2,
                title: '验收',
                content: '${ctx}/customerEntry/toCheckAccept?id=' + applicationId,
                area: ['100%', '100%'],
                end: function () {
                    searchWaitDeal();
                }
            });
        } else if (formKey === '94') {
            //并网验收
            layer.open({
                type: 2,
                title: '验收报告',
                content: '${ctx}/customerEntry/toMergeAccept?opt=TwoMergeAccept&id=' + applicationId,
                area: ['100%', '100%'],
                end: function () {
                    searchWaitDeal();
                }
            });
        }else if(formKey =='95'){   //勘测信息变更
            layer.open({
                type: 2
                , title: '审核'
                , content: '${ctx}/customer/entry/change/survey/surveyAudit/' + applicationId
                , area: ['100%', '100%']
                ,end: function () {
                    searchWaitDeal();
                }
            });
        }else if(formKey =='96'){  //完工信息变更
            layer.open({
                type: 2
                , title: '审核'
                , content: '${ctx}/completion/change/audit/' + applicationId
                , area: ['100%', '100%']
                , end: function () {
                    searchWaitDeal();
                }
            });
        }else if(formKey =='97'){   //设计信息变更
            layer.open({
                type: 2
                , title: '审核'
                , content: '${ctx}/entryChanges/designInfo/toAuditPage/' + applicationId
                , area: ['100%', '100%']
                , end: function () {
                    searchWaitDeal();
                }
            });
        }else if(formKey =='98'){   //客户信息变更
            layer.open({
                title:'审核',
                type: 2,
                area: ["100%", "100%"],
                content: '${ctx}/entryChanges/customerInformationChange/toChangeAudit?id='+applicationId,
                end: function () {
                    searchWaitDeal();
                }
            })
        }else if(formKey =='99'){   //物料信息变更
            layer.open({
                type: 2
                , title: '审核'
                , content: '${ctx}/entryChanges/materialInformationChange/materialAudit/' + applicationId
                , area: ['100%', '100%']
                , end: function () {
                    searchWaitDeal();
                }
            });
        }
    }
</script>
</body>
</html>

