From 41c4dcbea05e80aea77636a7b46f061c55369823 Mon Sep 17 00:00:00 2001
From: xwx <1594082401@qq.com>
Date: Fri, 1 Jul 2022 17:09:14 +0800
Subject: [PATCH] 【1401】通知统计功能 点击全部结果与实际数据不符

---
 hg-monitor-web-base/src/main/resources/static/src/controller/noticeCountIndex.js | 71 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---------
 hg-monitor-web-base/src/main/resources/static/src/views/noticeCount/index.html   | 19 ++++++++++++++-----
 2 files changed, 76 insertions(+), 14 deletions(-)

diff --git a/hg-monitor-web-base/src/main/resources/static/src/controller/noticeCountIndex.js b/hg-monitor-web-base/src/main/resources/static/src/controller/noticeCountIndex.js
index 4fccd00..b9c86e2 100644
--- a/hg-monitor-web-base/src/main/resources/static/src/controller/noticeCountIndex.js
+++ b/hg-monitor-web-base/src/main/resources/static/src/controller/noticeCountIndex.js
@@ -34,9 +34,25 @@ layui.define(['common', 'admin', 'echarts', 'common', 'table', 'sessions'], func
         });
         //导出
         $('#exportNoticeCountBtn').on("click", function () {
-            var url=common.domainName + '/api-web/bAlarm/noticeExport?access_token=' + accessToken + '&type=' + tablePeriod;
+            var url = common.domainName + '/api-web/bAlarm/noticeExport?access_token=' + accessToken + '&type=' + tablePeriod;
             window.open(url);
         });
+
+        var alarmSendTips ;
+        $(".detail_base_info").hover(function() {
+            openMsg();
+        }, function() {
+            layer.close(alarmSendTips);
+        });
+        function openMsg() {
+            alarmSendTips =  layer.tips("<span style='color:#585858;'>" +
+                "人员告警发送统计规则:<br>" +
+                "&nbsp;&nbsp;&nbsp;&nbsp;• 一条告警可能存在多个通知人<br>" +
+                "&nbsp;&nbsp;&nbsp;&nbsp;• 按照通知人统计告警发送数量<br>" +
+                "</span>",
+                '.detail_base_info',{tips:[2,'#F0F0F0'], time:0,area: ['auto', 'auto']});
+        }
+
         //初始化柱状图页面
         function initNoticeCount() {
             $.ajax({
@@ -48,11 +64,36 @@ layui.define(['common', 'admin', 'echarts', 'common', 'table', 'sessions'], func
                         histogramECharts(res.map.business, 'count_notice_send_business', '业务子系统告警发送统计');
                         //初始化人员告警发送告警统计
                         histogramECharts(res.map.user, 'count_notice_send_user', '人员告警发送统计');
+
+                        $("#businessMore").unbind('click').on('click', function () {
+                            queryData('业务子系统告警发送统计', res.map.business)
+                        })
+                        $("#userMore").unbind('click').on('click', function () {
+                            queryData('人员告警发送统计', res.map.user)
+                        })
                     }
                 }
             })
         }
 
+        //lsq 弹框打开更多 2022-06-21
+        function queryData(title, data) {
+            let html = `
+            <div class="pie-chart pie-chart-custom" id="more_notice" style="height: 60vh"></div>
+            `
+            layer.open({
+                type: 1
+                , title: title //不显示标题栏
+                , area: ["91%", "800px"]
+                , id: 'moreData' //设定一个id,防止重复弹出
+                , btn: ['取消']
+                , content: html
+                , success: function (layero, index) {
+                    histogramECharts(data, 'more_notice', title)
+                }
+            })
+        }
+
         //初始化表格
         function initTable() {
             businessTable = table.render({
@@ -65,7 +106,7 @@ layui.define(['common', 'admin', 'echarts', 'common', 'table', 'sessions'], func
                 , page: {
                     layout: ['count', 'prev', 'page', 'next', 'limit', 'skip']
                     , theme: '#1E9FFF'//自定义分页主题颜色
-                    ,limits:[5,10,15,20]
+                    , limits: [5, 10, 15, 20]
                 }
                 , limit: '5'
                 , even: true
@@ -97,7 +138,7 @@ layui.define(['common', 'admin', 'echarts', 'common', 'table', 'sessions'], func
                 , page: {
                     layout: ['count', 'prev', 'page', 'next', 'limit', 'skip']
                     , theme: '#1E9FFF'//自定义分页主题颜色
-                    ,limits:[5,10,15,20]
+                    , limits: [5, 10, 15, 20]
                 }
                 , limit: '5'
                 , even: true
@@ -149,7 +190,8 @@ layui.define(['common', 'admin', 'echarts', 'common', 'table', 'sessions'], func
             var row = data.row;
             //列
             var line = data.line;
-            var myChart = echarts.init(document.getElementById(id));
+            let el = document.getElementById(id);
+            var myChart = echarts.init(el);
             var option;
             option = {
                 tooltip: {
@@ -169,7 +211,7 @@ layui.define(['common', 'admin', 'echarts', 'common', 'table', 'sessions'], func
                 grid: {
                     left: '3%',
                     right: '4%',
-                    bottom: '3%',
+                    bottom: '12%',
                     top: '20',
                     containLabel: true
                 },
@@ -184,7 +226,7 @@ layui.define(['common', 'admin', 'echarts', 'common', 'table', 'sessions'], func
                             color: '#000000',
                             show: true,
                             interval: 0,
-                            rotate: 30,
+                            rotate: 10,
                             fontSize: '10',
                         },
                     }
@@ -197,7 +239,7 @@ layui.define(['common', 'admin', 'echarts', 'common', 'table', 'sessions'], func
                 series: [
                     {
                         type: 'bar',
-                        barWidth: '40%',
+                        barWidth: '20',
                         data: line,
                         itemStyle: {
                             normal: {
@@ -218,10 +260,21 @@ layui.define(['common', 'admin', 'echarts', 'common', 'table', 'sessions'], func
                             }
                         }
                     }
-                ]
+                ],
+                //x轴拖动
+                dataZoom: [
+                    {
+                        show: id == 'more_notice' ? true : false,
+                        type: "slider",
+                        realtime: true, //拖动滚动条时是否动态的更新图表数据
+                        height: 25, //滚动条高度
+                        start: 0, //滚动条开始位置(共100等份)
+                        end: 12 //结束位置(共100等份)//lsq x轴缩放距离调整 2022-05-25
+                    }
+                ],
             };
             myChart.setOption(option)
         }
 
     });
-});
\ No newline at end of file
+});
diff --git a/hg-monitor-web-base/src/main/resources/static/src/views/noticeCount/index.html b/hg-monitor-web-base/src/main/resources/static/src/views/noticeCount/index.html
index 4cb94d7..74493e2 100644
--- a/hg-monitor-web-base/src/main/resources/static/src/views/noticeCount/index.html
+++ b/hg-monitor-web-base/src/main/resources/static/src/views/noticeCount/index.html
@@ -18,12 +18,21 @@
                     <div class="layui-card-body noticeCount-ECharts" id="count_notice_send">
                         <div class="layui-noticeCount-ECharts">
                             <div>
-                                <h5 class="lay-row-title" style="color: #666;">业务子系统告警发送统计</h5>
-                                <div class="pie-chart pie-chart-custom" id="count_notice_send_business" style="height: 30vh"></div>
+                                <h5 class="lay-row-title">
+                                    业务子系统告警发送统计
+                                    <span id="businessMore">查看更多</span>
+
+                                </h5>
+                                <div class="pie-chart pie-chart-custom" id="count_notice_send_business"
+                                     style="height: 30vh"></div>
                             </div>
                             <div>
-                                <h5 class="lay-row-title" style="color: #666;">人员告警发送统计</h5>
-                                <div class="pie-chart pie-chart-custom" id="count_notice_send_user" style="height: 30vh"></div>
+                                <h5 class="lay-row-title">人员告警发送统计
+                                    <i class="iconfont detail_base_info" style="color:rgb(30,159,255);">&#xe61e;</i>
+                                    <span id="userMore">查看更多</span>
+                                </h5>
+                                <div class="pie-chart pie-chart-custom" id="count_notice_send_user"
+                                     style="height: 30vh"></div>
                             </div>
                         </div>
                     </div>
@@ -51,4 +60,4 @@
     layui.use('noticeCountIndex', function (fn) {
         fn();
     });
-</script>
\ No newline at end of file
+</script>
--
libgit2 0.24.0