| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172 |
- var token = $.cookie("token");
- var tabtu;
- $(document).ready(function() {
- //日期
- laydate.render({
- elem: '#startTime',
- range: '~',
- theme: '#00a1cb',
- });
- //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() {
- Ajax();
- });
- //导出
- $('.export').click(function() {
- dcexcel(this);
- })
- Ajax(); //表格数据
- tableHead(); //表头
- })
- //图形
- tabtu = echarts.init(document.getElementById('tabtu'));
- tabtu.setOption({
- tooltip: {
- trigger: 'axis',
- },
- legend: {
- data: ['接通次数', '呼损次数', '接通率', '呼损率'],
- bottom: 0
- },
- xAxis: [{
- type: 'category',
- data: [],
- axisPointer: {
- type: ''
- },
- axisLabel: {
- rotate: 30,
- interval: 0
- }
- }],
- yAxis: [{
- type: 'value',
- name: '通话次数(通)',
- nameLocation: 'middle',
- nameGap: 40,
- axisLabel: {
- formatter: '{value} '
- }
- },
- {
- type: 'value',
- name: '百分比(%)',
- nameLocation: 'middle',
- nameGap: 35,
- 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']
- });
- //表头数据
- function tableHead() {
- $.ajax({
- type: "get",
- url: huayi.config.callcenter_url + "SwitchedlossCall/GetColumnList",
- async: true,
- dataType: 'json',
- data: {
- token: token
- },
- success: function(res) {
- var con = res.data;
- $('#thead thead tr').html('');
- for(var i = 0; i < con.length; i++) {
- $('<th>' + con[i] + '</th>').appendTo('#thead thead tr')
- }
- }
- });
- }
- //表格数据
- function Ajax() {
- var jtshu = [],
- hsshu = [],
- jtlv = [],
- hslv = [],
- riqi = [];
- $.ajax({
- type: 'get',
- url: huayi.config.callcenter_url + 'SwitchedlossCall/GetDataList',
- async: false,
- dataType: 'json',
- data: {
- token: token,
- stime: $('#startTime').val() && $('#startTime').val().split('~')[0],
- endtime: $('#startTime').val() && $('#startTime').val().split('~')[1]
- },
- success: function(data) {
- var tbodyCon = data.data;
- $('.thTable tbody').html('');
- 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');
- riqi.push(tbodyCon[j].日期)
- jtshu.push(tbodyCon[j].接通次数);
- hsshu.push(tbodyCon[j].呼损次数);
- jtlv.push(tbodyCon[j].接通率);
- hslv.push(tbodyCon[j].呼损率);
- }
- }
- });
- tabtu.setOption({
- xAxis: {
- data: riqi
- },
- series: [{
- data: jtshu
- }, {
- data: hsshu
- }, {
- data: jtlv
- }, {
- data: hslv
- }]
- })
- }
- //导出
- function dcexcel(obj) {
- var url = huayi.config.callcenter_url + "SwitchedlossCall/ExptList?token=" + $.cookie("token");
- url += "&stime=" + $('#startTime').val() && $('#startTime').val().split('~')[0] + "&endtime=" + $('#startTime').val() && $('#startTime').val().split('~')[1];
- obj.href = url;
- }
|