WIDGET-PRJ-COUNT.lview 12.5 KB
Newer Older
niminmin's avatar
niminmin committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329
<?xml version="1.0" encoding="UTF-8"?>

<!--
    $Author:
    $Date: 2018/8/2
    $Revision: 1.0
    4.PRJ统计
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application">
    <a:init-procedure/>
    <a:view template="default" package="leaf.ui.std">
        <!--Beyond styles-->
        <link href="${/request/@context_path}/leafresource/hls/beyondChart/assets/css/beyond.min.css" rel="stylesheet" />
        <link href="${/request/@context_path}/leafresource/hls/beyondChart/assets/css/demo.min.css" rel="stylesheet" />
        <link href="${/request/@context_path}/leafresource/hls/beyondChart/assets/css/typicons.min.css" rel="stylesheet" />
        <link href="${/request/@context_path}/leafresource/hls/beyondChart/assets/css/animate.min.css" rel="stylesheet" />

        <!--Basic Scripts-->
        <script src="${/request/@context_path}/leafresource/hls/beyondChart/assets/js/skins.min.js"></script>
        <script src="${/request/@context_path}/leafresource/hls/beyondChart/assets/js/bootstrap.min.js"></script>
        <script src="${/request/@context_path}/leafresource/hls/beyondChart/assets/js/slimscroll/jquery.slimscroll.min.js"></script>
        <!--Beyond Scripts-->
        <script src="${/request/@context_path}/leafresource/hls/beyondChart/assets/js/beyond.min.js"></script>

        <!--Page Related Scripts-->
        <script src="${/request/@context_path}/leafresource/hls/beyondChart/assets/js/charts/morris/raphael-2.0.2.min.js"></script>
        <script src="${/request/@context_path}/leafresource/hls/beyondChart/assets/js/charts/morris/morris.js"></script>
        <script src="${/request/@context_path}/leafresource/hls/beyondChart/assets/js/charts/morris/morris-init.js"></script>

        <style>
            html,body{
            background-color:#eee;
            width:870px;
            height:260px;
            margin: 0;
            padding: 0;
            color:#758697;
            }
            .widget_prj_count{
            width:870px;
            height:260px;
            background-color:#fff;
            position:relative;
            }
            .widget_prj_count .clearFloat{
            clear:both;
            height:0;
            line-height:0;
            font-size:0
            }
            .widget_prj_count i{
            display:inline-block;
            width:12px;
            height: 12px;
            margin-right:6px;
            border-radius: 100%;
            }
            .widget_prj_count .row1{
            width:870px;
            height:70px;
            }
            .widget_prj_count .row1-l{
            width:72px;
            height:70px;
            margin:0 40px 0 20px;
            float:left;
            text-align:center;
            font-size:18px;
            color:#2b425b;
            font-family:'Open Sans','Segoe UI';
            }
            .widget_prj_count .row1-r{
            width:680px;
            height:50px;
            margin-top:20px;
            float:left;
            }
            .widget_prj_count .progress-title{
            height:18px;
            line-height:18px;
            }
            .widget_prj_count .progress{
            background-color:#FA800A;
            }
            .widget_prj_count .progress:before{
            width:0;
            }
            .widget_prj_count .progress-bar{
            background-color:#FA800A;
            width:2em;
            min-width: 2em;
            background-color: rgb(46, 195, 232);
            font-size:10px;
            height:100%;
            color:#fff;
            text-align:center;
            background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);
            background-image:-o-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);
            background-image:linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);
            -webkit-background-size:40px 40px;
            background-size:40px 40px;
            transition:width .6s ease;
            animation:progress-bar-stripes 2s linear infinite;
            -o-animation:progress-bar-stripes 2s linear infinite;
            -webkit-animation:progress-bar-stripes 2s linear infinite;
            }
            .widget_prj_count .progress-bar-label{
            position:absolute;
            display: none;
            z-index:1000;
            padding:6px 10px;
            color:#fff;
            background: rgb(0,0,0);
            border-radius: 3px;
            }
            .widget_prj_count .progress-bar-label p{
            margin:0;
            }
            @-webkit-keyframes progress-bar-stripes {
            from  { background-position: 40px 0; }
            to    { background-position: 0 0; }
            }
            @keyframes progress-bar-stripes {
            from  { background-position: 40px 0; }
            to    { background-position: 0 0; }
            }
            .widget_prj_count .row2{
            width:870px;
            height:190px;
            }
            .widget_prj_count #row2Donut{
            width:270px;
            height:190px;
            margin-left:30px;
            float:left;
            }
            .widget_prj_count .row2-r{
            width:400px;
            max-height:190px;
            margin-left:30px;
            float:left;
            }
            .widget_prj_count #row2Table{
            width:400px;
            border-collapse: collapse;
            }
            .widget_prj_count #row2Table tr{
            height:25px;
            border-bottom:1px solid #ccc;
            }
            .widget_prj_count #row2Table td{
            border:none;
            }
            .widget_prj_count #row2Table tr:hover{
            background-color:#e8e8e8;
            }
        </style>
        <script><![CDATA[
        jQuery(document).on('mouseover mouseout mousemove', '.progress-bar', function (event) {
            if(window.$pop){
                $pop=window.$pop;
            }else{
                window.$pop=jQuery("<div>", {
                    "class": "progress-bar-label"
                });
                $pop=window.$pop;
                $pop.html(jQuery("<p>本月新增项目</p><p>"+jQuery(".progress-bar")[0].innerText+"</p>"));
            }
            if (event.type === 'mouseover') {
                $pop.appendTo(".widget_prj_count");
                $pop.show().css({
                    left: (event.pageX + 10) + 'px',
                    top: (event.pageY + 10) + 'px'
                });
            }
            if (event.type === 'mouseout') {
                $pop.hide();
            }
            if (event.type === 'mousemove') {
                if ($pop.is(":visible")) {
                    $pop.css({
                        left: (event.pageX + 10) + 'px',
                        top: (event.pageY + 10) + 'px'
                    })
                }
            }
            event.preventDefault();
        });

        function progressBarLoader(ds){
            var per=ds.data[0].data['prj_month_per'];
            jQuery(".progress-bar").text(per);
            jQuery(".progress-bar").css("width",per);
        }

        function statusCountLoader(ds){
            var records=ds.data;
            var donutData=[];
            var colors=[];
            $row2Table=jQuery("#row2Table");
            var statusInfo = [
                {
                    statusValue: "新建",
                    status: "NEW",
                    color:"#2EC3E8",
                    valueParam:"projectCount",
                    newAddParam:"currentMonthAppend"
                },
                { statusValue: "审批中",
                    status: "APPROVING",
                    color:"#FFCD55",
                    valueParam:"projectCount",
                    newAddParam:"currentMonthAppend"
                },
                {
                    statusValue: "取消",
                    status: "CANCEL",
                    color:"#14A9CC",
                    valueParam:"projectCount",
                    newAddParam:"currentMonthAppend"
                },
                {
                    statusValue: "审批退回",
                    status: "APPROVED_RETURN",
                    color:"#E75B8D",
                    valueParam:"projectCount",
                    newAddParam:"currentMonthAppend"
                },
                {
                    statusValue: "审批拒绝",
                    status: "REJECTED",
                    color:"#FA6A4D",
                    valueParam:"projectCount",
                    newAddParam:"currentMonthAppend"
                },
                {
                    statusValue: "审批通过",
                    status: "APPROVED",
                    color:"#A0D469",
                    valueParam:"projectCount",
                    newAddParam:"currentMonthAppend"
                }
            ];
            if(records!==null && records.length>0){
                records.forEach(function(i){
                    statusInfo.forEach(function(j){
                        if(i.data['prj_status']==j.status){
                            j.value=i.data['prj_status_count'];
                            j.per=i.data['prj_status_per'];
                        }
                    });
                });
            }
            var html="<tbody><tr style='color:#000;'><td><span></span></td><td><span>项目状态</span></td><td><span>占比</span></td><td><span>数量</span></td></tr>";
            statusInfo.forEach(function(i){
                if(i.value==undefined){
                    i.value=0;
                }
                if(i.per==undefined){
                    i.per='0.00%';
                }
                donutData.push({
                    label:i.statusValue,
                    value:i.value
                });
                colors.push(i.color);

                html+="<tr><td><i style='background-color:"+i.color+";'></i></td>";
                html+="<td>"+i.statusValue+"</td>";
                html+="<td>"+i.per+"</td>";
                html+="<td>"+i.value+"</td></tr>";
            });
            $row2Table.html("</tbody>"+html);
            Morris.Donut({
              element: 'row2Donut',
              data:donutData,
              colors:colors
            });
        }
            ]]></script>
        <a:dataSets>
            <a:dataSet id="prj_status_count_ds" autoQuery="true" model="prj.PRJ1101.prj_status_count">
                <a:fields>
                    <a:field name="prj_status"/>
                    <a:field name="prj_status_count"/>
                    <a:field name="prj_status_per"/>
                </a:fields>
                <a:events>
                    <a:event name="load" handler="statusCountLoader"/>
                </a:events>
            </a:dataSet>
            <a:dataSet id="prj_count_ds" autoQuery="true" model="prj.PRJ1101.prj_count">
                <a:fields>
                    <a:field name="prj_count"/>
                    <a:field name="prj_month_count"/>
                    <a:field name="prj_month_per"/>
                </a:fields>
                <a:events>
                    <a:event name="load" handler="progressBarLoader"/>
                </a:events>
            </a:dataSet>
        </a:dataSets>
        <div class="widget_prj_count">
            <div class="row1">
                <div class="row1-l">
                    <a:label className="prj_count_num" bindTarget="prj_count_ds" name="prj_count" style="width:70px;margin:10px 0;"/>
                    <div>项目总数</div>
                </div>
                <div class="row1-r">
                    <div class="progress-title">
                        <i style="background-color:#2EC3E8;"> </i><span style="font-size:13px">本月新增项目</span>
                    </div>
                    <div class="progress">
                        <div data-description="本月新增项目" class="progress-bar">0%</div>
                    </div>
                </div>
                <div class="clearFloat"> </div>
            </div>
            <div class="row2">
                <div class="row2-l" id="row2Donut"></div>
                <div class="row2-r">
                    <table id="row2Table" cellspacing="0"></table>
                </div>
                <div class="clearFloat"></div>
            </div>
        </div>
        <a:screenBody style="display:none"> </a:screenBody>
    </a:view>
</a:screen>