<?xml version="1.0" encoding="UTF-8"?>

<!--
    $Author: huangtianyang
    $Date: 2018/7/9 下午7:43
    $Revision: 1.0
    动态
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application">
    <a:init-procedure/>
    <a:view template="default" package="leaf.ui.std">
        <link href="${/request/@context_path}/leafresource/leaf.ui.std/hap/hlscomponent/hlsfont/hls-font.css"
              rel="stylesheet"
              type="text/css"/>
        <link href="${/request/@context_path}/leafresource/leaf.ui.std/hap/hlscomponent/hls-all.css" rel="stylesheet"
              type="text/css"/>
        <link href="${/request/@context_path}/css/lon/gld-home-style.css" rel="stylesheet" type="text/css"/>

        <a:link id="widget_model_query" model="lon.lon_notice" modelaction="query"/>
        <style>

            html, body {
                width: 270px;
                height: 645px;
            }

            /*查询条件*/
            .queryOptions {
                margin-left: 5px;
            }

            /*通知栏部分*/
            .notice_row {
                width: 250px;
                min-height: 65px;
                margin: 0 auto;
                padding: 10px 10px;
                box-sizing: border-box;
            }

            .notice_row strong {
                font-size: 13px;
                font-weight: lighter;
                display: block;

            }

            .iremove {
                position: absolute;
                right: -16px;
                top: 24px;
                z-index: 999;
                cursor: pointer;
            }

            .notice-font {
                font-size: 12px;
                height: 40px;
                line-height: 40px;
                white-space: nowrap;
                overflow: hidden;
                text-overflow: ellipsis;
            }

            /*审批状态*/
            .status_new, .status_approving, .status_approved, .status_rejected {
                width: 60px;
                height: 20px;
                line-height: 20px;
                border-radius: 2px;
                max-height: 32px;
                text-align: center;
                color: #fff;
                display: inline-block;
                overflow: hidden;
            }

            .status_new {
                background-color: #00b3b3;
            }

            .status_approving {
                background-color: #FFCD55;
            }

            .status_approved {
                background-color: #8cc375;
            }

            .status_rejected {
                background-color: rgb(245, 123, 105);
            }

            /*查询框*/
            .conInfoInput {
                border: 1px solid #cccccc;
                width: 230px;
                height: 35px;
                margin-top: 10px;
                border-radius: 2px;
            }

            .conInfoInput > img {
                width: 15px;
                height: 15px;
                display: inline-block;
                margin-left: 2px;
            }

            .conInfoInput input {
                background: #fff;
                border: none;
                width: 205px;
                height: 27px;
            }

            /*投放统计图表*/
            .con-overdue-title {
                height: 40px;
                width: inherit;
                background-color: #FA6A4D;
                color: #FFF;
                line-height: 40px;
                vertical-align: middle;
            }

            .con-overdue-title-img {
                display: block;
                float: left;
                margin-left: 10px;
                width: 20px;
                height: 20px;
                margin-top: 10px;
                margin-right: 6px;

            }

            .con-overdue-title-content {
                float: left;
                color: #ffffff;
            }

            .co-body-title1-amt {
                margin-top: 5px;
                height: 25px;
                width: inherit;
                color: rgb(249, 112, 100);
                line-height: 25px;
                vertical-align: middle;
                margin-left: 20px;
            }

            .co-body-title1-name {
                font-size: 12px;
                height: 25px;
                width: inherit;
                color: #2cc2e3;
                line-height: 25px;
                vertical-align: middle;
                margin-left: 20px;
                margin-bottom: 25px;
            }

            /*提款统计环形图*/
            #circularChart_chart {
                margin-top: 10px;
                margin-bottom: 20px;
            }

            .hls-analyse-count-chart .other-orange-bgcolor {
                background-color: #FFCD55;
            }

            .hls-analyse-count-chart .new-blue-bgcolor {
                background-color: #8cc375;
            }

            .hls-analyse-count-chart .igreen {
                color: #8cc375;
            }

            .border-bottom-green {
                border-bottom: 4px solid #8cc375;
            }

            .nav-boxShadow-fontColor {
                box-shadow: 0px 3px 0px rgb(204, 204, 204);
            }

            .nav-no-boxShadow-fontColor {
                box-shadow: 0px 0px 0px rgb(204, 204, 204);
            }

            /*控制表格样式*/
            #contractInfoTable tr td:nth-child(1) {
                width: 11%
            }

            #contractInfoTable tr td:nth-child(2) {
                width: 10%
            }

            #contractInfoTable tr td:nth-child(3) {
                width: 23%
            }
        </style>

        <div></div>
        <script></script>
        <a:dataSets/>
        <div id="widget515_noticeBoard" class="section hls-block-x1"
             style="height: 645px; background-color: #FFF;">
            <div class="section-title global-font-size13 border-bottom-green">
                <img class="left-img" src="${/request/@context_path}/images/lon/notice.png"/>
                <span>动态</span>
            </div>
        </div>
        <script><![CDATA[


        function getNotice(contextPath, divName, url) {
            $jq.ajax({
                type: 'GET',
                url: url,
                async: false, //设为同步
                contentType: "application/json; charset=utf-8",
                success: function (rs) {
                    if (rs.success && rs.result.record) {
                        var datas;
                        if (!rs.result.record instanceof Array) {
                            datas = new Array(rs.result.record);
                        } else {
                            datas = rs.result.record;
                        }
                        var noticeObj = document.getElementById(divName);
                        if (!noticeObj) return false;
                        for (var i = 0; i < datas.length; i++) {
                            var outDiv = document.createElement("div");
                            var h = document.createElement("strong");
                            var innerDiv = document.createElement("div");
                            innerDiv.setAttribute("class", "notice-font");
                            outDiv.setAttribute("class", "notice_row border-bottom-1 postion-relative section-row-height");
                            h.innerHTML = datas[i].contract_name;
                            if (datas[i].notice_date_time) {
                                datas[i].notice_date_time = new Date(datas[i].notice_date_time);
                                var nowTime = new Date();
                                var interval = (nowTime - datas[i].notice_date_time) / 60000;
                                if (interval <= 1) {
                                    //时间小于1min
                                    datas[i].notice_date_time = "刚刚&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
                                } else if (interval > 1 && interval < 60) {
                                    //时间大于1min小于1H
                                    datas[i].notice_date_time = Number.parseInt(interval) + "分钟以前";
                                } else {
                                    datas[i].notice_date_time = datas[i].notice_date_time.getFullYear() + '-' + (datas[i].notice_date_time.getMonth() + 1) + '-' + datas[i].notice_date_time.getDate()

                                }
                            }
                            if (datas[i].notice_date_time.indexOf('-') !== -1) {
                                innerDiv.innerHTML =
                                    "<img style='height:15px;width:15px;' src=" + contextPath + "/images/lon/clock2.png />&nbsp;&nbsp;&nbsp;" + datas[i].notice_date_time + "&nbsp;&nbsp;&nbsp;&nbsp;" + datas[i].notice_message

                            } else {
                                innerDiv.innerHTML =
                                    "<img style='height:15px;width:15px;' src=" + contextPath + "/images/lon/clock1.png />&nbsp;&nbsp;&nbsp;" + datas[i].notice_date_time + "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" + datas[i].notice_message

                            }
                            outDiv.appendChild(h);
                            outDiv.appendChild(innerDiv);
                            noticeObj.appendChild(outDiv);
                        }
                    }
                }
            });
        }

        getNotice('${/request/@context_path}', "widget515_noticeBoard", $('widget_model_query').getUrl() + '?pagenum=1&pagesize=7');


        ]]></script>
        <a:screenBody style="display:none;"/>
    </a:view>
</a:screen>