| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281 |
- /**
- * 自动外呼监控
- * */
- $(function() {
- var t_id = helper.request.queryString("t_id");
- //获取任务监控信息
- getTaskDetails(t_id);
- //获取参与任务的坐席
- getTaskSeats(t_id);
- //返回上一级
- $('.reback').click(function() {
- top.$("iframe:visible")[0].src = "outcryManage/callTaskManage.html";
- })
- //修改并发数
- $('#HY_edit').on('click', btn_edit);
- refreshMonitorDatas(huayi.config.monitorPlatformTime); //刷新 监控数据
- });
- /**
- * 获取任务监控信息
- * tid 任务id
- * */
- function getTaskDetails(tid) {
- $.getJSON(huayi.config.callcenter_url + "callcenterapi/api/autocallouttask/getmonitor", {
- id: tid, //是 string 任务id
- }, function(res) {
- if(res.state.toLowerCase() === "success") {
- $('#createtime').text(helper.DateFormat.timestampToTime(Date.parse(res.createtime))); //创建时间
- //$('#').text(res.);//坐席队列
- $('#totalnum').text(res.totalnum); //总号码数
- $('#call_total_times').text(res.hjzsc); //呼叫总时长(秒)
- $('#starttime').text(res.starttime); //任务开始日期
- $('#call_online').text(res.zxrs + '人'); //在线坐席
- $('#callnum').text(res.yhnum); //已呼个数
- $('#call_doned').text(res.ywc); //已完成
- $('#endtime').text(res.endtime); //任务结束日期
- $('#call_caliing').text(res.thrs + '人'); //通话人数
- $('#call_applys').text(res.zyds); //总应答数
- $('#call_apply_rate').text(res.ydl); //应答率
- $('#worktimes1').text(res.workstarttimes1 + ' ~ ' + res.workendtimes1); //工作时段一
- $('#call_frees').text(res.kxrs); //空闲人数
- $('#call_tranfer_seat').text(res.zzzxs); //总转坐席数
- $('#call_tranfer_seat_rate').text(res.zzxl); //转坐席率
- $('#worktimes2').text(res.workstarttimes2 + ' ~ ' + res.workendtimes2); //工作时段二
- $('#bfnum').text(res.bfnum); // 并发数
- $('#bfnum_input').val(res.bfnum); //并发数
- if(res.bftype) {
- $('#bftype').find('input[name="bftype_radio"][value="' + res.bftype + '"]').prop('checked', true); // 否 int 并发类型
- $('#hideBftype').val(res.bftype);
- }
- $('#call_now_calling').text(res.dqhhs); //当前会话数
- $('#call_now_recording').text(res.fys); //当前听录音数
- }
- });
- }
- /**
- * 获取参与任务的坐席
- * tid 任务id
- * */
- function getTaskSeats(tid) {
- $.ajax({
- type: "get",
- url: huayi.config.callcenter_url + "callcenterapi/api/autocallouttask/getfplist",
- async: true,
- dataType: 'json',
- data: {
- joinflag: 1, //传值1获取在参与的
- taskid: tid, // 是 string 任务id
- },
- success: function(data) {
- if(data.state.toLowerCase() === "success") {
- data = data.data;
- if(data && data.length > 0) {
- $('#seat_lists_body').html('');
- $.each(data, function(i, v) {
- $('#seat_lists_body').append('<div class="col-md-3 clearfix">' +
- '<div class="seat_item">' +
- '<ul class="seat_content clearfix">' +
- '<li><span>参与坐席:</span><span>' + v.usercode + '</span></li>' +
- '<li><span>分配者:</span><span>' + v.createusercode + '</span></li>' +
- '<li style="width:100%"><span>分配时间:</span><span>' + v.createtime + '</span></li>' +
- '</ul>' +
- '<div class="seat_btns">' +
- '<input type="button" onclick="cancleJoin(\'' + v.usercode + '\')" class="btn btn-primary btn-xs" value="取消参与" />' +
- '</div>' +
- '</div>' +
- '</div>');
- });
- } else {
- $('#seat_lists_body').html('<p class="text-center col-md-12">暂无坐席参与。。。</p>');
- }
- }
- }
- });
- }
- /**
- * 修改并发数
- *
- * */
- function btn_edit() {
- var t_id = helper.request.queryString("t_id");
- var loadIndex;
- if($.trim($('#bfnum_input').val()) === $('#bfnum').text()) {
- if($('#bftype').find('input[name="bftype_radio"]:checked').val() === $('#hideBftype').val()) {
- layer.confirm('您输入的并发数/进号速率与原来的值一样,请重新输入!', {
- icon: 7,
- btn: ['确定'] //按钮
- });
- return;
- }
- }
- if(!regexs.num.test($.trim($('#bfnum_input').val()))) {
- layer.confirm('并发数/进号速率(只能输入数字)!', {
- icon: 2,
- btn: ['确定'] //按钮
- });
- return;
- }
- $.ajax({
- type: "post",
- url: huayi.config.callcenter_url + "callcenterapi/api/autocall/setbfnum",
- dataType: 'json',
- async: true,
- beforeSend: function() { //触发ajax请求开始时执行
- loadIndex = layer.load();
- },
- data: {
- taskid: t_id, // 是 string 任务id
- bfnum: $('#bfnum_input').val(), //是 int 并发数
- },
- success: function(data) {
- layer.close(loadIndex);
- if(data.state.toLowerCase() === "success") {
- layer.msg("修改成功!");
- //获取任务监控信息
- getTaskDetails(t_id);
- }
- },
- error: function(textStatus) {
- layer.close(loadIndex);
- layer.confirm('网络繁忙,请稍后再试...', {
- icon: 7,
- closeBtn: 0,
- btn: ['确定'] //按钮
- });
- },
- complete: function(XMLHttpRequest, textStatus) {
- layer.close(loadIndex);
- if(textStatus == 'timeout') {
- var xmlhttp = window.XMLHttpRequest ? new window.XMLHttpRequest() : new ActiveXObject("Microsoft.XMLHttp");
- xmlhttp.abort();
- layer.confirm('网络超时,请稍后再试...', {
- icon: 7,
- closeBtn: 0,
- btn: ['确定'] //按钮
- });
- }
- },
- });
- }
- /**
- * 取消参与
- * agentid 坐席usercode
- * joinflag 参与标志(1为参与,0为不参与)
- */
- function cancleJoin(agentid) {
- var loadIndex;
- var t_id = helper.request.queryString("t_id");
- layer.confirm('您确定要取消当前坐席的参与资格吗?', {
- icon: 7,
- btn: ['是', '否'] //按钮
- }, function() {
- $.ajax({
- type: "post",
- url: huayi.config.callcenter_url + "callcenterapi/api/autocall/joinprecall",
- dataType: 'json',
- async: true,
- beforeSend: function() { //触发ajax请求开始时执行
- loadIndex = layer.load();
- },
- data: {
- taskid: t_id, // 是 string 任务id
- agentid: agentid, // 是 string 坐席工号
- joinflag: 0, // 是 int 参与标志(1为参与,0为不参与)
- },
- success: function(data) {
- layer.close(loadIndex);
- if(data.state.toLowerCase() === "success") {
- layer.msg("坐席:" + agentid + "的参与资格取消成功!");
- //获取参与任务的坐席
- getTaskSeats(t_id);
- //获取任务监控信息
- getTaskDetails(t_id);
- //更新右上角信息
- if(top.$('#task_real_info').is(":visible")) {
- if(agentid === window.localStorage.getItem("userCode")) {
- top.getTaskRealInfo();
- }
- }
- }
- },
- error: function(textStatus) {
- layer.close(loadIndex);
- layer.confirm('网络繁忙,请稍后再试...', {
- icon: 7,
- closeBtn: 0,
- btn: ['确定'] //按钮
- });
- },
- complete: function(XMLHttpRequest, textStatus) {
- layer.close(loadIndex);
- if(textStatus == 'timeout') {
- var xmlhttp = window.XMLHttpRequest ? new window.XMLHttpRequest() : new ActiveXObject("Microsoft.XMLHttp");
- xmlhttp.abort();
- layer.confirm('网络超时,请稍后再试...', {
- icon: 7,
- closeBtn: 0,
- btn: ['确定'] //按钮
- });
- }
- },
- });
- });
- }
- /**
- * 刷新 工单数据
- * repairPlatformTime 刷新时间的间隔;
- *
- * */
- function refreshMonitorDatas(repairPlatformTime) {
- var t_id = helper.request.queryString("t_id");
- var objTime = {
- init: 0,
- time: function() {
- if(top.$("iframe:visible").contents().find('.layui-layer').length === 0) {
- objTime.init += 1000;
- //console.log(objTime.init);
- //当页面没有click、keydown、mousemove、mousewheel 并且没有layer 弹窗时;每间隔 huayi.config.repairPlatformTime 刷新数据;
- if(objTime.init == repairPlatformTime) {
- //获取任务监控信息
- getTaskDetails(t_id);
- //获取参与任务的坐席
- getTaskSeats(t_id);
- objTime.init = 0;
- }
- }
- },
- eventFun: function() {
- clearInterval(testUser);
- objTime.init = 0;
- testUser = setInterval(objTime.time, 1000);
- }
- }
- var testUser = setInterval(objTime.time, 1000);
- var body = document.querySelector('html');
- body.addEventListener("click", objTime.eventFun);
- body.addEventListener("keydown", objTime.eventFun);
- body.addEventListener("mousemove", objTime.eventFun);
- body.addEventListener("mousewheel", objTime.eventFun);
- }
|