| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357 |
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="utf-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <script src="../Script/Common/huayi.load.js"></script>
- <script src="../Script/Common/huayi.config.js"></script>
- <title>接通呼损统计</title>
- <link rel="stylesheet" href="../css/init.css" />
- <style>
- .husun {
- font-size: 12px;
- }
-
- .th-top {
- background: #f3f3f4;
- padding: 10px 20px;
- }
-
- .topCon {
- float: right;
- margin-right: 45px;
- }
-
- .th-content h2 {
- font-size: 18px;
- margin-bottom: 20px;
- }
-
- .th-content {
- width: 90%;
- margin: 0 auto;
- }
-
- .th-table table thead tr td {
- background: #1ab394;
- color: #fff;
- }
-
- .th-table {
- display: none;
- }
- </style>
- </head>
- <body class="gray-bg">
- <div class="husun">
- <div class="daoHang clearfix">
- <div class="dhLeft">
- <sapn><i class="syIcon"></i>位置:
- <a id="ReIndex" href="javaScript:;">首页</a>>
- <a href="javaScript:;">报表分析</a>>
- <a href="javaScript:;">话务运营分析</a>>
- <a href="" style="color: #000;">接通呼损统计</a>
- </sapn>
- </div>
- </div>
- <div class="th-top clearfix form-inline">
- <div class="topCon">
- 选择日期:
- <input type="text" class="form-control" id="startTime" />
- <button class="btns sear">搜索</button>
- <a class="btns export">导出</a>
- </div>
- </div>
- <ul class="nav nav-tabs th-tab">
- <li role="presentation" class="active">
- <a href="javascript:;">图形</a>
- </li>
- <li role="presentation">
- <a href="javascript:;">表格</a>
- </li>
- </ul>
- <div class="th-content">
- <div class="th-tu">
- <h2 style="text-align: center;">服务热线-接通率和呼损率统计</h2>
- <div id="tabtu" style="width: 100%; height: 600px;"></div>
- </div>
- <div class="th-table">
- <h2 style="text-align: center;">服务热线-接通率和呼损率统计</h2>
- <table class="table table-bordered text-center table-hover thTable" style="width: 100%;">
- <thead>
- <tr>
- </tr>
- </thead>
- <tbody class="tbody">
- </tbody>
- </table>
- </div>
- </div>
- </div>
- <script src="../js/laydate/laydate.js"></script>
- <script src="../js/echarts.common.min.js"></script>
- <script>
- var token = $.cookie("token");
- var myChartp;
- var endtime = helper.DateFormat.getNowDate(); //结束时间
- var stime = helper.DateFormat.getPreMonth(endtime); //开始时间
- $(document).ready(function() {
- laydate.render({
- elem: '#startTime',
- range: '~',
- value: stime + ' ~ ' + endtime,
- theme: '#1ab394',
- calendar: 'true',
- });
- //tab切换
- $('.th-tab li').click(function() {
- $(this).addClass('active')
- .siblings().removeClass('active');
- var index = $(this).index();
- $('.th-content >div').eq(index).show()
- .siblings().hide();
- });
- //搜索事件
- $(".sear").click(function() {
- stime = $('#startTime').val() && $('#startTime').val().split(' ~ ')[0];
- endtime = $('#startTime').val() && $('#startTime').val().split(' ~ ')[1];
- getDataLists();
- });
- //导出功能
- $('.export').click(function() {
- dcexcel(this);
- });
- myChartp = echarts.init(document.getElementById('tabtu'));
- myChartp.clear();
- myChartp.showLoading();
- option = {
- tooltip: {
- trigger: 'axis',
- },
- legend: {
- data: ['接通次数', '呼损次数', '接通率', '呼损率'],
- bottom: 0
- },
- xAxis: [{
- type: 'category',
- data: [],
- axisPointer: {
- type: ''
- },
- axisLabel: {
- rotate: 30,
- interval: 0
- }
- }],
- yAxis: [{
- type: 'value',
- name: '通话次数(次)',
- nameLocation: 'end',
- nameGap: 40,
- // min: 0,
- // max:300,
- interval: 50,
- axisLabel: {
- formatter: '{value} '
- }
- },
- {
- type: 'value',
- name: '百分比(%)',
- nameLocation: 'end',
- nameGap: 35,
- min: 0,
- max: 100,
- interval: 10,
- axisLabel: {
- formatter: '{value} '
- }
- }
- ],
- series: [{
- type: 'bar',
- name: '接通次数',
- data: []
- },
- {
- type: 'bar',
- name: '呼损次数',
- data: []
- },
- {
- type: 'line',
- name: '接通率',
- data: [],
- yAxisIndex: 1,
- },
- {
- type: 'line',
- name: '呼损率',
- data: [],
- yAxisIndex: 1,
- }
- ],
- color: ['#1ab394', '#fbbe5b', '#88ebc4', '#fa957f']
- }
- // 使用刚指定的配置项和数据显示图表。
- myChartp.setOption(option);
- getDataLists(); //加载数据
- getColumnList(); //获取表格头部
- });
- //获取数据
- function getDataLists() {
- $.ajax({
- type: "get",
- url: huayi.config.callcenter_url + "SwitchedlossCall/GetDataList",
- async: true,
- dataType: 'json',
- data: {
- stime: stime,
- endtime: endtime,
- token: token,
- },
- success: function(data) {
- }
- })
- .then(function(data) {
- $('.thTable tbody').html('');
- myChartp.hideLoading();
- if(data.state.toLowerCase() == "success") {
- var tbodyCon = data.data;
- //排序
- tbodyCon.sort(compare("日期"));
-
- // 填入数据
- if(tbodyCon) {
- myChartp.setOption({
- xAxis: {
- data: (function() {
- var res = [];
- for(var i = 0; i < tbodyCon.length; i++) {
- res.push(tbodyCon[i].日期);
- }
- return res;
- })(),
- },
- series: (function() {
- var sres = [],
- sres1 = [],
- sres2 = [],
- sres3 = [];
- var sobj = [{
- data: sres,
- },
- {
- data: sres1,
- },
- {
- data: sres2,
- },
- {
- data: sres3,
- },
- ];
- for(var i = 0; i < tbodyCon.length; i++) {
- sres.push(tbodyCon[i].接通次数);
- sres1.push(tbodyCon[i].呼损次数);
- sres2.push(tbodyCon[i].接通率);
- sres3.push(tbodyCon[i].呼损率);
- }
- return sobj;
- })(),
- });
- //填充表格数据
- for(var j = 0; j < tbodyCon.length; j++) {
- $('<tr><td>' + tbodyCon[j].日期 + '</td><td>' + tbodyCon[j].接通次数 + '</td><td>' + tbodyCon[j].呼损次数 + '</td><td>' + tbodyCon[j].接通率 + '</td><td>' + tbodyCon[j].呼损率 + '</td></tr>').appendTo('.thTable tbody');
- }
- } else {
- $('#tabtu').html('<p class="text-center">暂无数据</p>');
- $('.thTable tbody').html('<td colspan="5">没有找到您想要的记录呢!我会努力的...</td>');
- }
- } else {
- $('#tabtu').html('<p class="text-center">暂无数据</p>');
- $('.thTable tbody').html('<td colspan="5">没有找到您想要的记录呢!我会努力的...</td>');
- }
- });
- }
- //获取表头数据
- function getColumnList() {
- $.ajax({
- type: "get",
- url: huayi.config.callcenter_url + "SwitchedlossCall/GetColumnList",
- async: true,
- dataType: 'json',
- data: {
- token: token
- },
- success: function(res) {
- }
- })
- .then(function(data) {
- $('.thTable thead tr').html('');
- if(data.state.toLowerCase() == "success") {
- var con = data.data;
- if(con) {
- for(var i = 0; i < con.length; i++) {
- $('<td>' + con[i] + '</td>').appendTo('.thTable thead tr');
- }
- } else {
- $('<td colspan="5">暂无表头数据</td>').appendTo('.thTable thead tr')
- }
- } else {
- $('<td colspan="5">暂无表头数据</td>').appendTo('.thTable thead tr')
- }
- });
- }
- //导出
- function dcexcel(obj) {
- var url = huayi.config.callcenter_url + "SwitchedlossCall/ExptList?token=" + token;
- url += "&stime=" + stime + "&endtime=" + endtime;
- obj.href = url;
- }
- //定义一个比较器
- function compare(propertyName) {
- return function(object1, object2) {
- var value1 = object1[propertyName];
- var value2 = object2[propertyName];
- if(value2 < value1) {
- return 1;
- } else if(value2 > value1) {
- return -1;
- } else {
- return 0;
- }
- }
- }
- </script>
- </body>
- </html>
|