/** * 坐席工作报表 * */ $(function() { $('.tool_bars').authorizeButton(); laydate.render({ elem: '#chooseTime', theme: '#249fea', range: '~', }); //部门下拉数据 getDeptLists(); getDataList(); //搜索事件 $("#sc_btns").click(function() { if($.trim($("#monthDays").val()) != ''){ if (!regexs.phoneNum.test($.trim($("#monthDays").val()))) { layer.confirm('月工作天数必须是正整数!', { icon: 2, btn: ['确定'] //按钮 }); return; } } $('.thTable tbody').html(''); getDataList(); }); $('#department').on('focus click', function() { $('#deptTreeView').removeClass('hidden').addClass('show'); }); $('#department').on('keyup', function() { if($(this).val() == '') { $('deptTreeView').treeview('uncheckAll', { silent: true }); $(this).attr('data-id', '-1'); } }); $('#department + .caret').on('click', function() { $('#deptTreeView').removeClass('hidden').addClass('show'); }); $('#deptTreeView').mouseleave(function() { $(this).removeClass('show').addClass('hidden'); }); }) //导出 function btn_export() { var url = huayi.config.callcenter_url + "ZuoXiWorkTotal/ExptList?token=" + $.cookie("token"); var st = $('#chooseTime').val() && $('#chooseTime').val().split(' ~ ')[0]; var et = $('#chooseTime').val() && $('#chooseTime').val().split(' ~ ')[1]; url += "&stime=" + st + "&endtime=" + et + "&dpt=" + $("#department").val() + "&dayss=" + $("#monthDays").val(); window.location.href = url; } //表头 function getColumnList() { $.ajax({ type: 'get', url: huayi.config.callcenter_url + "ZuoXiWorkTotal/GetColumnList", async: true, dataType: 'json', data: { token: token }, success: function(res) { var con = res.data; // console.log(con); for(var i = 0; i < con.length; i++) { $('' + con[i] + '').appendTo('.thTable thead tr') } } }) } //表内数据 function getDataList() { $.ajax({ type: "get", url: huayi.config.callcenter_url + "ZuoXiWorkTotal/GetDataList", async: true, dataType: 'json', data: { stime: $('#chooseTime').val() && $('#chooseTime').val().split(' ~ ')[0], endtime: $('#chooseTime').val() && $('#chooseTime').val().split(' ~ ')[1], dpt: $("#department").val(), dayss: $("#monthDays").val(), token: $.cookie("token") }, success: function(res) { var result = res.data; if(result){ for(var i = 0; i < result.length; i++) { $('' + result[i].部门 + '' + result[i].坐席 + '' + result[i].坐席工号 + '' + result[i].呼入电话数 + '' + result[i].坐席接通量 + '' + result[i].呼损量 + '' + result[i].接通率 + '' + result[i].呼损率 + '' + result[i].平均排队时间 + '' + result[i].接听通话次数 + '' + result[i].通话分钟数 + '' + result[i].通话秒数 + '' + result[i].平均接听通话秒数 + '' + result[i].平均振铃秒数 + '' + result[i].呼入占有率 + '' + result[i].用户评价 + '' + result[i].坐席登录次数 + '' + result[i].登录时长分钟数 + '' + result[i].工作时长分钟数 + '' + result[i].平均每天工作时长 + '' + result[i].平均操作分钟数 + '' + result[i].置忙次数 + '' + result[i].休息时长分钟数 + '' + result[i].平均每天休息时长 + '' + result[i].置忙平均休息分钟数 + '' + result[i].质检平均成绩 + '').appendTo('.thTable tbody') } } } }); } //获取部门 function getDeptLists() { $.getJSON(huayi.config.callcenter_url + 'Department/GetDeptList', { token: $.cookie("token") }, function (result) { if (result.state.toLowerCase() == "success") { var defaultDatas = result.data; var $sTree = $('#deptTreeView').treeview({ color: "#428bca", expandIcon: 'glyphicon glyphicon-chevron-right', collapseIcon: 'glyphicon glyphicon-chevron-down', nodeIcon: 'fa fa-folder-o', data: defaultDatas, onNodeSelected: function (event, node) { $sTree.treeview('clearSearch'); $('#department').val(node.text); $('#department').attr('data-id', node.id); $('#deptTreeView').removeClass('show').addClass('hidden'); }, onNodeUnselected: function (event, node) { $('#department').val(''); $('#department').attr('data-id', '-1'); } }); var findSNodes = function () { return $sTree.treeview('search', [$('#department').val(), { ignoreCase: false, exactMatch: false }]); }; $('#department').on('keyup', function (e) { var selectableNodes = findSNodes(); }); } }) }