浏览代码

完成部门月度网站考评

hyx 3 年之前
父节点
当前提交
736a41c15f
共有 1 个文件被更改,包括 76 次插入94 次删除
  1. 76 94
      nngkxxdp/src/main/resources/static/wzkp/wzkp.html

+ 76 - 94
nngkxxdp/src/main/resources/static/wzkp/wzkp.html

@@ -47,7 +47,7 @@
                                         <ul>
                                             <li>
                                                 <div class="img_wrap">
-                                                    <p class="wrap_text">公安</p>
+                                                    <p class="wrap_text"></p>
                                                     <img src="img/pm_g.png" alt="" class="img_g">
                                                 </div>
                                                 <div id="bestRanking1" class="descript_box">
@@ -58,7 +58,7 @@
                                             </li>
                                             <li>
                                                 <div class="img_wrap">
-                                                    <p class="wrap_text">文旅</p>
+                                                    <p class="wrap_text"></p>
                                                     <img src="img/pm_y.png" alt="" class="img_g">
                                                 </div>
                                                 <div id="bestRanking2" class="descript_box">
@@ -69,7 +69,7 @@
                                             </li>
                                             <li>
                                                 <div class="img_wrap">
-                                                    <p class="wrap_text">社保</p>
+                                                    <p class="wrap_text"></p>
                                                     <img src="img/pm_j.png" alt="" class="img_g">
                                                 </div>
                                                 <div id="bestRanking3" class="descript_box">
@@ -91,7 +91,7 @@
                                         <ul>
                                             <li>
                                                 <div class="img_wrap">
-                                                    <p class="wrap_text_cover">公安</p>
+                                                    <p class="wrap_text_cover"></p>
                                                 </div>
                                                 <div id="lowestRanking1" class="descript_box">
                                                     <h1></h1>
@@ -101,7 +101,7 @@
                                             </li>
                                             <li>
                                                 <div class="img_wrap">
-                                                    <p class="wrap_text_cover">文旅</p>
+                                                    <p class="wrap_text_cover"></p>
                                                 </div>
                                                 <div id="lowestRanking2" class="descript_box">
                                                     <h1></h1>
@@ -111,7 +111,7 @@
                                             </li>
                                             <li>
                                                 <div class="img_wrap">
-                                                    <p class="wrap_text_cover">社保</p>
+                                                    <p class="wrap_text_cover"></p>
                                                 </div>
                                                 <div id="lowestRanking3" class="descript_box">
                                                     <h1></h1>
@@ -132,7 +132,7 @@
                                         <ul>
                                             <li>
                                                 <div class="img_wrap">
-                                                    <p class="wrap_text">公安</p>
+                                                    <p class="wrap_text"></p>
                                                     <img src="img/jb_zd.png" alt="" class="img_jb">
                                                 </div>
                                                 <div id="greatestProgress1" class="descript_box">
@@ -145,7 +145,7 @@
                                             </li>
                                             <li>
                                                 <div class="img_wrap">
-                                                    <p class="wrap_text">文旅</p>
+                                                    <p class="wrap_text"></p>
                                                     <img src="img/jb_zd.png" alt="" class="img_jb">
                                                 </div>
                                                 <div id="greatestProgress2" class="descript_box">
@@ -158,7 +158,7 @@
                                             </li>
                                             <li>
                                                 <div class="img_wrap">
-                                                    <p class="wrap_text">社保</p>
+                                                    <p class="wrap_text"></p>
                                                     <img src="img/jb_zd.png" alt="" class="img_jb">
                                                 </div>
                                                 <div id="greatestProgress3" class="descript_box">
@@ -182,7 +182,7 @@
                                         <ul>
                                             <li>
                                                 <div class="img_wrap">
-                                                    <p class="wrap_text_cover">公安</p>
+                                                    <p class="wrap_text_cover"></p>
                                                 </div>
                                                 <div id="regressiveMaximum1" class="descript_box">
                                                     <h1>区公安分局</h1>
@@ -194,7 +194,7 @@
                                             </li>
                                             <li>
                                                 <div class="img_wrap">
-                                                    <p class="wrap_text_cover">文旅</p>
+                                                    <p class="wrap_text_cover"></p>
                                                 </div>
                                                 <div id="regressiveMaximum2" class="descript_box">
                                                     <h1>区文化旅游委</h1>
@@ -206,7 +206,7 @@
                                             </li>
                                             <li>
                                                 <div class="img_wrap">
-                                                    <p class="wrap_text_cover">社保</p>
+                                                    <p class="wrap_text_cover"></p>
                                                 </div>
                                                 <div id="regressiveMaximum3" class="descript_box">
                                                     <h1>区人力社保局</h1>
@@ -223,52 +223,8 @@
                             <div class="rank_detail">
                                 <div class="rank_title"><span></span>&nbsp;&nbsp;<p>排名详情</p></div>
                                 <div class="table_wrap">
-                                    <table class="layui-table table_css" lay-even lay-skin="line">
-                                        <colgroup>
-                                            <col width="300">
-                                            <col width="200">
-                                            <col width="120">
-                                            <col width="150">
-                                            <col>
-                                        </colgroup>
-                                        <thead>
-                                        <tr>
-                                            <th>部门</th>
-                                            <th>总分(基础分/加分)</th>
-                                            <th>排名</th>
-                                            <th>环比上月排名</th>
-                                            <th>基础分加分</th>
-                                        </tr>
-                                        </thead>
-                                        <tbody id="rankingTbody">
-                                        <tr>
-                                            <td></td>
-                                            <td></td>
-                                            <td>1</td>
-                                            <td>
-
-                                            </td>
-                                            <td></td>
-                                        </tr>
-                                        <tr>
-                                            <td></td>
-                                            <td></td>
-                                            <td>2</td>
-                                            <td>
-
-                                            </td>
-                                            <td></td>
-                                        </tr>
-                                        <tr>
-                                            <td></td>
-                                            <td></td>
-                                            <td>3</td>
-                                            <td>
-
-                                            </td>
-                                            <td></td>
-                                        </tr>
-                                        </tbody>
+                                    <table id="rankingDetails" class="layui-table table_css" lay-even lay-skin="line">
+
                                     </table>
                                 </div>
                             </div>
@@ -287,8 +243,8 @@
                                         </div>
                                     </div>
                                     <div class="rank_text">
-                                        <h1>当前排名第&nbsp;&nbsp;<p> 3 </p>&nbsp;&nbsp;名</h1>
-                                        <h1>当前得分&nbsp;&nbsp;<p>83.00</p>&nbsp;&nbsp;分</h1>
+                                        <h1>当前排名第&nbsp;&nbsp;<p></p>&nbsp;&nbsp;名</h1>
+                                        <h1>当前得分&nbsp;&nbsp;<p></p>&nbsp;&nbsp;分</h1>
                                     </div>
                                     <div id="main" style="width: 100%;height: 500px;"></div>
                                 </form>
@@ -377,24 +333,29 @@
 <script type="text/javascript" src="../page/js/echarts.min.js" charset="utf-8"></script>
 <script src="../zdjc/js/constans.js"></script>
 <script>
+    var newDataList = [];
     $(function () {
-        let month = getMonth();
+        let yearMonth = getYearMonth();
         let type = 0;
-        let childrenType = (new Date).getMonth() + 1;
+        let childrenType = (new Date).getMonth() == 0 ? 12 : (new Date).getMonth();
         let deptId = $("[name='department']").val();
         let hasDept = 1;
-        let newMon = (new Date).getFullYear() + "-" + month;
+        let newMon = yearMonth;
         loadData(type, childrenType, deptId, hasDept, newMon);
     });
 
     //获取当前月份
-    function getMonth() {
+    function getYearMonth() {
         let date = new Date();
-        let month = date.getMonth() + 1;
-        if (month < 10) {
-            month = "0" + month;
+        let year = date.getFullYear();
+        let month = date.getMonth();
+        if (month == 0) {
+            return (year - 1) + "-12";
+        } else if (month < 10) {
+            return year + "-0" + month;
+        } else {
+            return year + "-" + month;
         }
-        return month;
     }
 
     function loadData(type, childrenType, deptId, hasDept, newMon) {
@@ -431,7 +392,6 @@
                 listSort(dataList);
                 listSort(lastDataList);
 
-                let newDataList = [];
                 let dlLength = dataList.length;
                 for (let i = 0; i < dlLength; i++) {
                     newDataList.push(dataList[dlLength - 1 - i]);
@@ -496,7 +456,7 @@
         laydate.render({
             elem: '#monInput',
             type: 'month',
-            value: new Date(),
+            value: getYearMonth(),
             done: function (value, date, endDate) {
                 dateDone(value);
             }
@@ -546,16 +506,19 @@
 
     //生成本月排名最优3位
     function bestRanking(obj) {
+        $("#bestRanking1").parent().children("div").eq(0).children("p").text(obj[0].department.substring(2, 4));
         $("#bestRanking1").children("h1").text(obj[0].department);
         $("#bestRanking1").children("p").children("span").text(obj[0].basicScore + obj[0].addScore);
         $("#bestRanking1").children("div").children("p").eq(0).text(obj[0].basicScore);
         $("#bestRanking1").children("div").children("p").eq(1).text(obj[0].addScore);
 
+        $("#bestRanking2").parent().children("div").eq(0).children("p").text(obj[1].department.substring(2, 4));
         $("#bestRanking2").children("h1").text(obj[1].department);
         $("#bestRanking2").children("p").children("span").text(obj[1].basicScore + obj[1].addScore);
         $("#bestRanking2").children("div").children("p").eq(0).text(obj[1].basicScore);
         $("#bestRanking2").children("div").children("p").eq(1).text(obj[1].addScore);
 
+        $("#bestRanking3").parent().children("div").eq(0).children("p").text(obj[2].department.substring(2, 4));
         $("#bestRanking3").children("h1").text(obj[2].department);
         $("#bestRanking3").children("p").children("span").text(obj[2].basicScore + obj[2].addScore);
         $("#bestRanking3").children("div").children("p").eq(0).text(obj[2].basicScore);
@@ -564,16 +527,19 @@
 
     //生成本月排名最末3位
     function lowestRanking(obj) {
+        $("#lowestRanking1").parent().children("div").eq(0).children("p").text(obj[0].department.substring(2, 4));
         $("#lowestRanking1").children("h1").text(obj[0].department);
         $("#lowestRanking1").children("p").children("span").text(obj[0].basicScore + obj[0].addScore);
         $("#lowestRanking1").children("div").children("p").eq(0).text(obj[0].basicScore);
         $("#lowestRanking1").children("div").children("p").eq(1).text(obj[0].addScore);
 
+        $("#lowestRanking2").parent().children("div").eq(0).children("p").text(obj[1].department.substring(2, 4));
         $("#lowestRanking2").children("h1").text(obj[1].department);
         $("#lowestRanking2").children("p").children("span").text(obj[1].basicScore + obj[1].addScore);
         $("#lowestRanking2").children("div").children("p").eq(0).text(obj[1].basicScore);
         $("#lowestRanking2").children("div").children("p").eq(1).text(obj[1].addScore);
 
+        $("#lowestRanking3").parent().children("div").eq(0).children("p").text(obj[2].department.substring(2, 4));
         $("#lowestRanking3").children("h1").text(obj[2].department);
         $("#lowestRanking3").children("p").children("span").text(obj[2].basicScore + obj[2].addScore);
         $("#lowestRanking3").children("div").children("p").eq(0).text(obj[2].basicScore);
@@ -582,16 +548,19 @@
 
     //排名进步最大3位
     function greatestProgress(obj) {
+        $("#greatestProgress1").parent().children("div").eq(0).children("p").text(obj[0].department.substring(2, 4));
         $("#greatestProgress1").children("h1").text(obj[0].department);
         $("#greatestProgress1").children("p").children("span").text(obj[0].basicScore + obj[0].addScore);
         $("#greatestProgress1").children("div").children("p").eq(0).text(obj[0].basicScore);
         $("#greatestProgress1").children("div").children("p").eq(1).text(obj[0].addScore);
 
+        $("#greatestProgress2").parent().children("div").eq(0).children("p").text(obj[1].department.substring(2, 4));
         $("#greatestProgress2").children("h1").text(obj[1].department);
         $("#greatestProgress2").children("p").children("span").text(obj[1].basicScore + obj[1].addScore);
         $("#greatestProgress2").children("div").children("p").eq(0).text(obj[1].basicScore);
         $("#greatestProgress2").children("div").children("p").eq(1).text(obj[1].addScore);
 
+        $("#greatestProgress3").parent().children("div").eq(0).children("p").text(obj[2].department.substring(2, 4));
         $("#greatestProgress3").children("h1").text(obj[2].department);
         $("#greatestProgress3").children("p").children("span").text(obj[2].basicScore + obj[2].addScore);
         $("#greatestProgress3").children("div").children("p").eq(0).text(obj[2].basicScore);
@@ -600,16 +569,19 @@
 
     //排名退步最大3位
     function regressiveMaximum(obj) {
+        $("#regressiveMaximum1").parent().children("div").eq(0).children("p").text(obj[0].department.substring(2, 4));
         $("#regressiveMaximum1").children("h1").text(obj[0].department);
         $("#regressiveMaximum1").children("p").children("span").text(obj[0].basicScore + obj[0].addScore);
         $("#regressiveMaximum1").children("div").children("p").eq(0).text(obj[0].basicScore);
         $("#regressiveMaximum1").children("div").children("p").eq(1).text(obj[0].addScore);
 
+        $("#regressiveMaximum2").parent().children("div").eq(0).children("p").text(obj[1].department.substring(2, 4));
         $("#regressiveMaximum2").children("h1").text(obj[1].department);
         $("#regressiveMaximum2").children("p").children("span").text(obj[1].basicScore + obj[1].addScore);
         $("#regressiveMaximum2").children("div").children("p").eq(0).text(obj[1].basicScore);
         $("#regressiveMaximum2").children("div").children("p").eq(1).text(obj[1].addScore);
 
+        $("#regressiveMaximum3").parent().children("div").eq(0).children("p").text(obj[2].department.substring(2, 4));
         $("#regressiveMaximum3").children("h1").text(obj[2].department);
         $("#regressiveMaximum3").children("p").children("span").text(obj[2].basicScore + obj[2].addScore);
         $("#regressiveMaximum3").children("div").children("p").eq(0).text(obj[2].basicScore);
@@ -618,33 +590,30 @@
 
     //生成排名表格
     function rankingDetails(dataList) {
-        $("#rankingTbody").children("tr").eq(0).children("td").eq(0).html(dataList[dataList.length - 1].department);
-        $("#rankingTbody").children("tr").eq(0).children("td").eq(1).html(dataList[dataList.length - 1].totalScore);
-        if (dataList[dataList.length - 1].rankingLast >= 0) {
-            $("#rankingTbody").children("tr").eq(0).children("td").eq(3).html('<img src="img/up.png" alt="" class="img_tr">' + dataList[dataList.length - 1].rankingLast);
-        } else {
-            $("#rankingTbody").children("tr").eq(0).children("td").eq(3).html('<img src="img/down.png" alt="" class="img_tr">' + dataList[dataList.length - 1].rankingLast);
+        let dataList1 = [];
+        for (let i = 0; i < dataList.length; i++) {
+            dataList1.push(dataList[dataList.length - 1 - i]);
         }
-        $("#rankingTbody").children("tr").eq(0).children("td").eq(4).html(dataList[dataList.length - 2].addScore);
+        layui.table.render({
+            elem: '#rankingDetails'
+            , height: 450
+            , page: true //开启分页
+            , cols: [[ //表头
+                {field: 'department', title: '部门', width: 300}
+                , {field: 'totalScore', title: '总分(基础分/加分)', width: 200}
+                , {type: 'numbers', title: '排名', width: 120}
+                , {field: 'sign', title: '环比上月排名', width: 150, templet: rankingMonth}
+                , {field: 'addScore', title: '基础分加分'}
+            ]]
+            , data: dataList1
+        });
+    }
 
-        $("#rankingTbody").children("tr").eq(1).children("td").eq(0).html(dataList[dataList.length - 2].department);
-        $("#rankingTbody").children("tr").eq(1).children("td").eq(1).html(dataList[dataList.length - 2].totalScore);
-        if (dataList[dataList.length - 2].rankingLast >= 0) {
-            $("#rankingTbody").children("tr").eq(1).children("td").eq(3).html('<img src="img/up.png" alt="" class="img_tr">' + dataList[dataList.length - 2].rankingLast);
-        } else {
-            $("#rankingTbody").children("tr").eq(1).children("td").eq(3).html('<img src="img/down.png" alt="" class="img_tr">' + dataList[dataList.length - 2].rankingLast);
+    function rankingMonth(d) {
+        if (d.rankingLast >= 0) {
+            return '<img src="img/up.png" alt="" class="img_tr">' + d.rankingLast;
         }
-        $("#rankingTbody").children("tr").eq(1).children("td").eq(4).html(dataList[dataList.length - 2].addScore);
-
-        $("#rankingTbody").children("tr").eq(2).children("td").eq(0).html(dataList[dataList.length - 3].department);
-        $("#rankingTbody").children("tr").eq(2).children("td").eq(1).html(dataList[dataList.length - 3].totalScore);
-        if (dataList[dataList.length - 3].rankingLast >= 0) {
-            $("#rankingTbody").children("tr").eq(2).children("td").eq(3).html('<img src="img/up.png" alt="" class="img_tr">' + dataList[dataList.length - 3].rankingLast);
-        } else {
-            $("#rankingTbody").children("tr").eq(2).children("td").eq(3).html('<img src="img/down.png" alt="" class="img_tr">' + dataList[dataList.length - 3].rankingLast);
-        }
-        $("#rankingTbody").children("tr").eq(2).children("td").eq(4).html(dataList[dataList.length - 3].addScore);
-
+        return '<img src="img/down.png" alt="" class="img_tr">' + d.rankingLast;
     }
 
     //生成相应的部门
@@ -668,6 +637,9 @@
         var option;
 
         option = {
+            tooltip: {
+                trigger: 'axis'
+            },
             xAxis: {
                 type: 'category',
                 boundaryGap: false,
@@ -734,6 +706,16 @@
                 lineChart(data.data['detail-data'], data.data['detail-x']);
             }
         })
+        rankingScore(obj)
+    }
+
+    function rankingScore(pid) {
+        for (let i = 0; i < newDataList.length; i++) {
+            if (newDataList[i].deptid == pid) {
+                $(".rank_text").children("h1").eq(0).children("p").text(newDataList.length - i);
+                $(".rank_text").children("h1").eq(1).children("p").text(newDataList[i].basicScore + newDataList[i].addScore);
+            }
+        }
     }
 </script>
 </body>