<%@ 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: #d9b589;
        color: #FFF;
    }

    .count-box li > div {
        height: 104px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        margin-right: 10px;
        padding: 0 10px;
        border-radius: 10px
    }
    @media screen and (min-width: 1366px) and (max-width: 1920px) {
        .count-box li > div {
            height: 105px;
        }
    }
    @media screen and (min-width: 1920px) and (max-width: 3840px) {
        .count-box li > div {
            height: 93%;
        }
    }

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

    .count-box li h3 {
        font-size: 18px;
        display: inline-block;
        margin-left: 10px;
        width: 90px;
        padding-right: 20px;
        text-align: right;
    }

    .count-box li p {
        font-size: 29px;
        display: inline-block;
        vertical-align: middle;
        width: 104px;
        text-align: right;
        overflow: hidden;
        line-height: 30px;
    }
    @media screen and (min-width: 1366px) and (max-width: 1920px) {
        .count-box li p {
            width: 104px;
        }
    }
    @media screen and (min-width: 1920px) and (max-width: 3840px) {
        .count-box li p {
            width: 150px;;
        }
    }

    .note-box li {
        position: relative;
        padding-left: 30px;
    }

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

    .note-head, .note-body {
        display: flex;
        align-items: center;
        justify-content: space-between
    }

    .note-head {
        height: 30px;
        margin-top: 10px;
    }

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

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

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

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

    .no-read .note-head h3 {
        color: #231815;
        display: flex;
        width: 90%;
        align-items: center;
    }
    .title-row{
        white-space: nowrap;
        text-overflow: ellipsis;
        overflow: hidden;
        margin-right: 10px;
    }

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

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

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

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

    .note-type {
        display: inline-block;
        font-size: 12px;
        color: #dc6617;
        background-color: #fff3eb;
        border-radius: 3px;
        width: 62px;
        height: 22px;
        line-height: 22px;
        text-align: center;
        padding: 0;
    }

    .dbsx-box li {
        border-left: 1px solid #f4f6f9;
        border-bottom: 1px solid #f4f6f9
    }

    .dbsx-box li:nth-of-type(3n+1) {
        border-left: none;
    }

    .dbsx-box li:nth-child(10), .dbsx-box li:nth-child(11), .dbsx-box li:nth-child(12) {
        border-bottom: none;
    }

    .dbsx-box li a {
        height: 56px;
        text-align: center;
        color: #333333;
        font-size: 14px;
        display: block;
        padding-top: 15px;
        border: 1px solid #FFF
    }

    .dbsx-box li a:hover {
        background-color: #fdfbf7;
        border-radius: 5px;
        color: #d9b589;
        font-weight: 800;
        border: solid 1px #117fbc;
    }

    .note-body div {
        height: 30px;
    }

    .wltj-box li {
        height: 100px;
        margin-bottom: 10px;
        background-color: #f4f6f9;
        border-radius: 5px;
        border: solid 1px #117fbc;
        display: flex;
        padding: 0 49px;
        align-items: center;
        font-size: 16px;
        color: #a5a6a7;
    }

    .wltj-box li span.wltj-tit {
        display: inline-block;
        font-size: 25px;
        color: #a5a6a7;
        margin-left: 20px;
        width: 180px
    }

    .wltj-box li span.wltj-num {
        color: #d5a282;
        font-size: 40px;
        vertical-align: middle;
        margin-left: 20px
    }

    .count-box h3 {
        float: left
    }
</style>
<body>

<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <!--数据总揽-->
        <div class="layui-col-md12">
            <div class="layui-card-header dztj-title"><span>数据总览</span>
                <div>
                    <div class="layui-form layui-inline assemblyListSelect">
                        <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">
                        <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 ">
                        <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">
                        <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">
                                <c:if test="${!status.last}">
                                    <option value="${time}">${time}</option>
                                </c:if>

                                <c:if test="${status.last}">
                                    <option value="${time}" selected>${time}</option>
                                </c:if>
                            </c:forEach>
                        </select>
                    </div>
                </div>
            </div>
            <div class="layui-row" style="background: #FFF; display: flex; height:calc(47vh - 30px); min-height: 355px">
                <div class="layui-col-xs6" style="display: inline-block; min-width: 399px; height:calc(47vh - 35px);">
                    <div class="layui-card" style="height: 100%">
                        <div class="layui-card-body" style="padding-right: 0; height: 100%">
                            <ul class="layui-row layui-col-space10 text-c count-box" style="display: flex; flex-wrap: wrap; justify-content: space-between;
    height: 100%;">
                                <li class="layui-col-xs6">
                                    <div style="background-color: #f4f6f9;">
                                        <div style="width: 90%">
                                            <p style="color: #d9b589;" class="allCount">0</p>
                                            <h3>电站容量</h3>
                                        </div>
                                        <img src="${ctxPlugin}/static/imgs/totalEntry.png"/>
                                    </div>
                                </li>
                                <li class="layui-col-xs6">
                                    <div style="background-color: #f4f6f9;">
                                        <div style="width: 90%">
                                            <p style="color: #d9b589;" class="ywcCount">0</p>
                                            <h3>安装容量</h3>
                                        </div>
                                        <img src="${ctxPlugin}/static/imgs/yansl.png"/>
                                    </div>
                                </li>
                                <li class="layui-col-xs6">
                                    <div style="background-color: #f4f6f9;">
                                        <div style="width: 90%">
                                            <p style="color: #d9b589;" class="wazCount">0</p>
                                            <h3>验收容量</h3>
                                        </div>
                                        <img src="${ctxPlugin}/static/imgs/wazImg.png"/>
                                    </div>
                                </li>
                                <li class="layui-col-xs6">
                                    <div style="background-color: #f4f6f9;">
                                        <div style="width: 90%">
                                            <p style="color: #d9b589;" class="dysCount">0</p>
                                            <h3>验收率</h3>
                                        </div>
                                        <img src="${ctxPlugin}/static/imgs/wysImg.png"/>
                                    </div>
                                </li>
                                <li class="layui-col-xs6">
                                    <div style="background-color: #f4f6f9;">
                                        <div style="width: 90%">
                                            <p style="color: #d9b589;" class="wbwCount">0</p>
                                            <h3>并网容量</h3>
                                        </div>
                                        <img src="${ctxPlugin}/static/imgs/wbwImg.png"/>
                                    </div>
                                </li>
                                <li class="layui-col-xs6">
                                    <div style="background-color: #f4f6f9;">
                                        <div style="width: 90%">
                                            <p style="color: #d9b589;" class="wysCount">0</p>
                                            <h3>并网率</h3>
                                        </div>
                                        <img src="${ctxPlugin}/static/imgs/ybwwysImg.png"/>
                                    </div>
                                </li>
                            </ul>
                        </div>
                    </div>
                </div>
                <div class="layui-col-xs6" style="display: inline-block; flex: 1; height: calc(100% - 14px);">
                    <div style="background: #f4f6f9; border-radius: 5px; margin: 10px; padding: 15px; height: calc(100% - 40px);">
                        <div id="pieBox" style="height: calc(100% + 30px); margin-top: -25px "></div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div class="layui-row layui-col-space15">
        <!--项目电站统计-->
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-body">
                    <div data-anim="fade" lay-filter="LAY-index" style="height: calc(50vh - 50px);">
                        <div id="LAY-index" style="width: 100%; height: 100%;"></div>
                    </div>
                </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 serviceType = '${order.serviceType}';
    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("readMark");
                }
            });
        })


        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');
            $.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,
                "provinceList": provinceList,
                "cityList": cityList,
                "productLine": '1'
            }
            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');
            $.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,
                "provinceList": provinceList,
                "cityList": cityList,
                "productLine": '1'
            }
            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 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,
                "provinceList": provinceList,
                "cityList": cityList,
                "productLine": '1'
            }
            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 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,
                "provinceList": provinceList,
                "cityList": cityList,
                "productLine": '1'
            }
            echartsAppend(date)
            echartsPieAppend(date)
        }, true);


        $(".addressListSelect").hide();
        var keysd = [];
        var keycom = [];
        traderList(keysd);
        projectCompany(keycom);
        var dates = {"productLine": '1'}
        echartsAppend(dates)
        echartsPieAppend(dates)


        $(".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;
                }
            });

        });
    });

    //饼图
    function echartsPieAppend(dati) {

        $.post('${ctx}/sys/toHomerPager/homerPagerPancake', dati, function (data) {
            var c = (data.yanshouCount / data.anzhuangCount);
            var b = (data.bingwangCouont / data.yanshouCount);
            console.log(data)
            if (data.anzhuangCount == 0) {
                c = 0;
            }
            if (data.yanshouCount == 0) {
                b = 0;
            }
            $(".allCount").html(NumFormat(data.designCapacity));
            $(".ywcCount").html(NumFormat(data.anzhuangCount));
            $(".wazCount").html(NumFormat(data.yanshouCount));
            $(".dysCount").html(Math.floor(c * 100) + "%");
            $(".wbwCount").html(NumFormat(data.bingwangCouont));
            $(".wysCount").html(Math.floor(b * 100) + "%");

        }, "json")

    }

    function echartsAppend(dati) {
        var myChart = echarts.init(document.getElementById('LAY-index'));
        var myChartBzt = echarts.init(document.getElementById('pieBox'));
        $.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: 'cross',
                        label: {
                            backgroundColor: '#6a7985'
                        }
                    }
                },
                legend: {data: ["已完成", "未安装", "已安装未验收", "未并网", "已并网未验收"]},
                grid: {
                    left: '3%',
                    right: '4%',
                    bottom: '3%',
                    containLabel: true
                },
                xAxis: {data: ["设计审核", "赊销下单", "电站安装", "安装验收", "电站并网", "合同签署", "并网验收", "已完成", "电站整改"]},
                yAxis: {
                    type: 'value',
                    axisTick: {
                        inside: true,
                    },
                    splitLine: {
                        show: false
                    },
                    axisLine: {
                        show: true,
                        lineStyle: {
                            color: "#999", //最左侧Y轴颜色
                        },
                    },
                    z: 10
                },
                series: [
                    {
                        name: '电站数量',
                        type: 'bar',
                        barWidth: '20%',
                        areaStyle: {
                            normal: {
                                color: "#3472ff"
                            }

                        }, label: {
                            show: true,
                            position: 'top'
                        },
                        itemStyle: {
                            normal: {
                                color: new echarts.graphic.LinearGradient(1, 0, 0, 1, [
                                    {
                                        offset: 0,
                                        color: '#008faf',
                                    },
                                    {
                                        offset: 0.5,
                                        color: '#008faf',
                                    },
                                    {
                                        offset: 1,
                                        color: '#4c96b6',
                                    },

                                ]),
                            }
                        },
                        data: data.echarts
                    }
                ]
            });

            myChartBzt.setOption(option = {
                tooltip: {
                    trigger: 'item'
                },
                legend: {
                    bottom: '-5',
                    left: 'center'
                },
                graphic: {       //图形中间文字
                    type: "text",
                    left: "center",
                    top: "center",
                    style: {
                        text: data.totalCount,
                        textAlign: "center",
                        fill: "#070707",
                        fontSize: 30,
                    }
                },
                series: [
                    {

                        type: 'pie',
                        radius: ['40%', '70%'],
                        top: '0',
                        avoidLabelOverlap: false,
                        label: {
                            alignTo: 'labelLine',
                            width: 200,
                            textStyle: {
                                color: '#7e7e7e',
                                fontWeight: 'normal',
                                fontSize: 14
                            },
                            show: true,
                            formatter: function (param) {
                                return param.name + '(' + param.value + ')';
                            }
                        },
                        labelLine: {//线的颜色
                            lineStyle: {
                                color: '#009abe'
                            },
                        },
                        emphasis: {
                            label: {
                                show: true,
                                fontSize: 14,
                                fontWeight: 'bold'
                            },
                            itemStyle:{
                                color: 'inherit', //取消高亮
                            }
                        },
                        itemStyle: {
                            borderRadius: 10,
                            borderColor: '#fff',
                            borderWidth: 2,
                            normal: {
                                color: function (colors) {
                                    let colorList = [
                                        '#e7fbff',
                                        '#afefff',
                                        '#40cbec',
                                        '#009abe',
                                        '#0081a0',

                                    ];
                                    return colorList[colors.dataIndex];
                                },
                            },
                        },
                        data: [
                            {value: data.ysjCount, name: '已设计'},
                            {value: data.yazCount, name: '已安装'},
                            {value: data.yysCount, name: '已验收'},
                            {value: data.ybwCount, name: '已并网'},
                            {value: data.ywcCount, name: '已完成'},

                        ]
                    }
                ]
            });


        }, "json")
        window.addEventListener("resize", function () {
            myChart.resize();
            myChartBzt.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 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
        }
    }

</script>
</body>
</html>

