| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243 |
- /**
- * 给计划分配坐席
- * */
- var loadIndex;
- $(function() {
- getTaskLits(); //获取全部任务
- });
- //获取全部任务
- function getTaskLits() {
- var wURL = '';
- var isLogin = helper.request.queryString("isLogin");//是否是签入
- if(isLogin === "true"){
- wURL = 'callcenterapi/api/autocallouttask/getqrjoinlist';
- }else{
- wURL = 'callcenterapi/api/autocallouttask/getjoinlist';
- }
- $.ajax({
- type: "get",
- url: huayi.config.callcenter_url + wURL,
- dataType: 'json',
- async: true,
- beforeSend: function() { //触发ajax请求开始时执行
- loadIndex = layer.load();
- },
- data: {
-
- },
- success: function(data) {
- layer.close(loadIndex);
- if(data.state.toLowerCase() === "success") {
- data = data.data;
- $('#task_lists').html('');
- if(data && data.length > 0) {
- $.each(data, function(i, v) {
- $('#task_lists').append('<div class="col-sm-12 clearfix">'+
- '<div class="seat_item" id="seat_item_'+ v.id +'">'+
- '<ul class="seat_content clearfix">'+
- '<li><span>任务名称:</span><span>'+ v.taskname +'</span></li>'+
- '<li><span>创建人:</span><span>'+ v.createusercode +'</span></li>'+
- '<li><span>任务量:</span><span style="color: red">'+ v.totalnum +'条</span></li>'+
- '<li><span>剩余:</span><span style="color: red">'+ v.surplusnum +'条</span></li>'+
- '<li><span>接通:</span><span style="color: red">'+ v.successnum +'条</span></li>'+
- // '<li><span>成交:</span><span style="color: #f0f">20条</span></li>'+
- '<li><span>'+ formatterbfType(v.bftype) +':</span><span>'+ v.bfnum +'</span></li>'+
- '<li style="width: 100%;"><span>呼叫方式:</span><span>'+ formattercallType(v.calltype) +'</span></li>'+
- '<li style="width: 100%;"><span>起止日期:</span><span>'+ v.starttime +' 到 '+ v.endtime +'</span></li>'+
- '<li style="width: 100%;"><span>说明备注:</span><span>'+ (v.taskremark == null ? '' : v.taskremark) +'</span></li>'+
- '</ul>'+
- '<button id="btn_join_'+ v.id +'" type="button" class="btn btn-primary join_btn">立即参与</button>'+
- '</div>'+
- '</div>');
- //0未参与任务,1参与任务
- if(v.joinflag === 1){
- $('#seat_item_'+ v.id).addClass('seat_item_active');
- $('#btn_join_'+ v.id).text('取消参与');
- }
- });
- $('.join_btn').on('click', joinChange);
- }else{
- $('#task_lists').append('<p class="text-center text-warning">暂无任务信息!</p>');
- }
- }
- },
- 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: ['确定'] //按钮
- });
- }
- },
- });
- }
- //是否参与
- function joinChange() {
- var tid = $(this).attr('id') && $(this).attr('id').split('btn_join_')[1];
- switch($(this).text()) {
- case "立即参与":
- var self = this;
- var seatItemEl = $('#task_lists').find('.seat_item_active');
- if(seatItemEl.length > 0){
- //其他先取消参与 再让当前参与
- var curTid = seatItemEl.find('.join_btn').attr('id').split('btn_join_')[1];
- seatItemEl.removeClass('seat_item_active');
- seatItemEl.find('.join_btn').text('立即参与');
- joinNow(curTid, 0).then(function(){
- $(self).parent().addClass('seat_item_active');
- $(self).text('取消参与');
- joinNow(tid, 1);
- });
- }else{
- $(self).parent().addClass('seat_item_active');
- $(self).text('取消参与');
- joinNow(tid, 1);
- }
- break;
- case "取消参与":
- $(this).text('立即参与');
- $('#task_lists').find('.seat_item').removeClass('seat_item_active');
- joinNow(tid, 0);
- break;
- }
- }
- /**
- * 格式化呼叫方式
- * option type值
- */
- function formattercallType(option) {
- //0 不播放语音直接转坐席 1 播放语音后转坐席 2 播放语音后按1键转坐席
- var str = ""
- switch(option + '') {
- case '0':
- str = "不播放语音直接转坐席";
- break;
- case '1':
- str = "播放语音后转坐席";
- break;
- case '2':
- str = "播放语音后按1键转坐席";
- break;
- default:
- str = "不播放语音直接转坐席";
- break;
- }
- return str;
- }
- /**
- * 格式化并发类型
- * option type值
- */
- function formatterbfType(option) {
- //0 并发数 1 进号码速率
- var str = ""
- switch(option + '') {
- case '0':
- str = "并发数";
- break;
- case '1':
- str = "进号码速率";
- break;
- }
- return str;
- }
- /**
- * 立即参与
- * taskid 任务id
- * joinflag 参与标志(1为参与,0为不参与)
- */
- function joinNow(taskid, joinflag) {
- var dtd = $.Deferred(); //在函数内部,新建一个Deferred对象
- $.ajax({
- type: "post",
- url: huayi.config.callcenter_url + "callcenterapi/api/autocall/joinprecall",
- dataType: 'json',
- async: true,
- data: {
- taskid: taskid,// 是 string 任务id
- agentid: window.localStorage.getItem('userCode'),// 是 string 坐席工号
- joinflag: joinflag,// 是 int 参与标志(1为参与,0为不参与)
- },
- success: function(data) {
- layer.close(loadIndex);
- if(data.state.toLowerCase() === "success") {
- if(joinflag === 1){
- var index = parent.layer.getFrameIndex(window.name);
- parent.layer.close(index);
- parent.layer.msg("参与成功!");
- parent.getTaskRealInfo();//更新右上角任务信息
- updateSeatRealIngo(taskid);//更新自动外呼监控/外呼分配/我的呼叫任务
- }else{
- parent.layer.msg("取消成功!");
- parent.getTaskRealInfo();//更新右上角任务信息
- updateSeatRealIngo(taskid);//更新自动外呼监控/外呼分配/我的呼叫任务
- }
- }
- dtd.resolve(); // 改变Deferred对象的执行状态
- },
- 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: ['确定'] //按钮
- });
- }
- },
- });
- return dtd.promise(); // 返回promise对象
- }
- /**
- * 更新自动外呼监控/外呼分配/我的呼叫任务
- * taskid任务id
- */
- function updateSeatRealIngo(taskid){
- var curW = top.$("iframe:visible")[0].contentWindow;
- var curC = top.$("iframe:visible").contents();
- if(curC.find('#autoCallMonitor').length > 0){
- // curW.location.reload(true);//刷新页面
- curW.getTaskSeats(taskid);//更新参与任务的坐席
- curW.getTaskDetails(taskid);//更新任务监控信息
- }
- if(curC.find('#outBoundAllo').length > 0){
-
- curW.setPersonInfos(taskid);//更新外呼分配 参与坐席
- }
- if(curC.find('#myCallTaskManage').length > 0){
- curW.initTable();//更新我的呼叫任务
- }
- }
|