Ethan 6 éve
szülő
commit
b43121d0b7

+ 15 - 1
application/admin/controller/Report.php

@@ -35,7 +35,9 @@ class Report extends Base
             $join   = [
                 'alarm b' => 'a.servicelog_id = b.servicelog_id',
             ];
-            $field = ['alarm_count', 'evaluate_id'];
+            $field = ['alarm_count', 'evaluate_id', 'system'];
+            $system = [];
+            $systemCount = [];
             // 查询当天的工单.
             $serviceLog = model('serviceLog')->selectServiceLog($field, $join, $chatLogCountWhere);
             foreach ($serviceLog as $ke => $va) {
@@ -49,6 +51,11 @@ class Report extends Base
                 } elseif ($va['evaluate_id'] == 0) {
                     $evaluateNo++;
                 }
+                if (!isset($system[$va['system']])) {
+                    $system[$va['system']] = 1;
+                } else {
+                    $system[$va['system']]++;
+                }
             }
             // 会话总数.
             $xData[] = $value;
@@ -56,10 +63,17 @@ class Report extends Base
             // 当天工单总数.
             $serviceData[$k] = model('serviceLog')->countServiceLog($chatLogCountWhere);
         }
+        foreach ($system as $k => $v) {
+            $systemCount[] = [
+                'value' => $v,
+                'name' => $k,
+            ];
+        }
         $this->assign([
             'xData' => json_encode($xData),
             'chatData' => json_encode($chatData),
             'serviceData' => json_encode($serviceData),
+            'systemCount' => json_encode($systemCount),
             'evaluate' => json_encode([
                 'evaluateGood' => $evaluateGood,
                 'evaluateSecondary' => $evaluateSecondary,

+ 96 - 10
application/admin/view/report/index.html

@@ -17,21 +17,41 @@
     </div>
 
     <div class="row">
-        <div class="col-sm-8">
+        <div class="col-sm-12">
             <div class="ibox float-e-margins">
                 <div class="ibox-title">
                     <h5>今日数据分析</h5>
                 </div>
-                <div class="ibox-content no-padding">
+                <div class="ibox-content">
                     <div class="ibox-content" style="height: 350px" id="bar">
 
                     </div>
                 </div>
+            </div>
+        </div>
+    </div>
+</div>
+<div class="wrapper wrapper-content">
+    <div class="row">
+
+    </div>
+
+    <div class="row">
+        <div class="col-sm-12">
+            <div class="ibox float-e-margins">
+                <div style="display: flex;">
+                    <div class="ibox-title" style="width: 50%;">
+                        <h5>今日数据分析</h5>
+                    </div>
+                    <div class="ibox-title" style="width: 50%;">
+                        <h5>今日数据分析</h5>
+                    </div>
+                </div>
                 <div class="ibox-content no-padding" style="display: flex;">
                     <div class="ibox-content" style="width: 50%;height: 350px" id="pie_evaluate">
 
                     </div>
-                    <div class="ibox-content" style="width: 50%;height: 350px" id="pie_luate">
+                    <div class="ibox-content" style="width: 50%;height: 350px" id="pie_system">
 
                     </div>
                 </div>
@@ -48,10 +68,11 @@
     var chatData = {$chatData};
     var serviceData = {$serviceData};
     var evaluate = {$evaluate};
+    var systemCount = {$systemCount};
     // 基于准备好的dom,初始化echarts实例
     var myChart_bar = echarts.init(document.getElementById('bar'));
     var pie_evaluate = echarts.init(document.getElementById('pie_evaluate'));
-    var pie_evalu = echarts.init(document.getElementById('pie_luate'));
+    var pie_system = echarts.init(document.getElementById('pie_system'));
 
     // 指定图表的配置项和数据
     var option_bar = {
@@ -133,14 +154,14 @@
             {
                 name: '会话量',
                 type: 'bar',
-                barWidth: 12,// 柱形的宽度
+                barWidth: 24,// 柱形的宽度
                 barGap: 0,
                 data: serviceData
             },
             {
                 name: '消息量',
                 type: 'bar',
-                barWidth: 12,// 柱形的宽度
+                barWidth: 24,// 柱形的宽度
                 barGap: 0,
                 data: chatData
             }
@@ -173,9 +194,10 @@
             radius: '50%',
             center: ['50%', '50%'],
             color: ['rgb(131,249,103)', '#FBFE27', '#FE5050', '#1DB7E5'], //'#FBFE27','rgb(11,228,96)','#FE5050'
-            data: [{
-                value: evaluate['evaluateGood'],
-                name: '满意'
+            data: [
+                {
+                    value: evaluate['evaluateGood'],
+                    name: '满意'
                 }, {
                     value: evaluate['evaluateSecondary'],
                     name: '一般'
@@ -228,10 +250,74 @@
             }
         }]
     };
+    var option_PS = {
+        backgroundColor: '#fff',
+
+        tooltip: {
+            trigger: 'item',
+            formatter: "{b} : {c} ({d}%)"
+        },
+
+        visualMap: {
+            show: false,
+            min: 500,
+            max: 600,
+            inRange: {
+                //colorLightness: [0, 1]
+            }
+        },
+        series: [{
+            name: '满意度',
+            type: 'pie',
+            radius: '50%',
+            center: ['50%', '50%'],
+            color: ['rgb(131,249,103)', '#FBFE27', '#FE5050', '#1DB7E5'], //'#FBFE27','rgb(11,228,96)','#FE5050'
+            data: systemCount.sort(function(a, b) {
+                return a.value - b.value
+            }),
+            roseType: 'radius',
+
+            label: {
+                normal: {
+                    formatter: ['{c|{c}次}', '{b|{b}}'].join('\n'),
+                    rich: {
+                        c: {
+                            color: 'rgb(241,246,104)',
+                            fontSize: 20,
+                            fontWeight:'bold',
+                            lineHeight: 5
+                        },
+                        b: {
+                            color: 'rgb(98,137,169)',
+                            fontSize: 15,
+                            height: 40
+                        },
+                    },
+                }
+            },
+            labelLine: {
+                normal: {
+                    lineStyle: {
+                        color: 'rgb(98,137,169)',
+                    },
+                    smooth: 0.2,
+                    length: 10,
+                    length2: 20,
+
+                }
+            },
+            itemStyle: {
+                normal: {
+                    shadowColor: 'rgba(0, 0, 0, 0.8)',
+                    shadowBlur: 50,
+                }
+            }
+        }]
+    };
 
     // 使用刚指定的配置项和数据显示图表。
     pie_evaluate.setOption(option_PE);
-    pie_evalu.setOption(option_PE);
+    pie_system.setOption(option_PS);
 </script>
 </body>
 </html>