/** * 我的呼叫任务管理(自动外呼) * * */ var ishistory = '0'; //是否是历史任务 $(document).ready(function() { var ndate = helper.DateFormat.getNowDate(); var fmdate = helper.DateFormat.getFirstDayInCurrentMonth(); laydate.render({ elem: '#sc_times', range: '~', value: fmdate + ' ~ ' + ndate, btns: ['confirm'], theme: '#249fea', }); initTable(); $('#tab_head_left li').click(function() { ishistory = $(this).index(); $(this).addClass('tab_head_active').siblings().removeClass('tab_head_active'); $('#tab_contents .tabs_details').eq(ishistory).addClass('showtabs').siblings().removeClass('showtabs'); initTable(); }); $('#sc_btns').click(function() { initTable(); }); }); function initTable() { //话务标志,意思是否具备接听和呼叫电话的功能(false:非话务;true 话务标志) var seatFlag = window.localStorage.getItem('seatFlag'); if(seatFlag === "true") { $.ajax({ url: huayi.config.callcenter_url + 'callcenterapi/api/autocallouttask/getmytask', type: 'get', data: { isstart: $('#sc_taskState').val(), // 否 int 任务状态 (不传值时查询所有状态) stime: $('#sc_times').val() && $('#sc_times').val().split(' ~ ')[0], // 否 string 开始时间 etime: $('#sc_times').val() && $('#sc_times').val().split(' ~ ')[1], // 否 string 结束时间 agentid: window.localStorage.getItem('userCode'), //否 string 坐席工号(不传值查询全部坐席) infokind: ishistory, //否 int 查询类型(为0或不传时获取全部,为1时获取当前任务,为2时获取历史任务) taskname: $('#sc_keyWords').val(), // 否 string 计划名称,可模糊查询 }, dataType: "json", async: true, success: function (res) { if(res.state.toLowerCase() === 'success'){ //异步获取数据 var resultData1 = res.rows; $('#tableLists').bootstrapTable('load', resultData1); if(res.total >= 100) { res.total = '99+'; } if(res.dqnum >= 100) { res.dqnum = '99+'; } if(res.lsnum >= 100) { res.lsnum = '99+'; } $('.audit_all').text(res.total); //全部 $('.audit_refuse').text(res.dqnum); //当前任务 $('.audit_wait').text(res.lsnum); //历史任务 $('.tool_down').authorizeOperateButton(); }else{ layer.confirm(res.message, { icon: 7, btn: ['确定'] //按钮 }); } } }); $('#tableLists').bootstrapTable('destroy').bootstrapTable({ striped: true }); }else{ $('#tableLists').html('

当前账号不是坐席账号,无法查看我的任务!

'); } } //操作按钮格式化操作 function formatterOperate(val, row) { //导出已接通;导出未接通; var str = ''; str = '
' + '' + '' + '
'; return str; } //格式化参与状态 function formatterjoinflag(val) { //参与标志(1为参与,0为不参与) if(val == '1') { return '已参与'; } else if(val == '0') { return '未参与'; } else { return '' + val + ''; } } //格式化状态 function formatterState(val, row) { //0未启动,1已启动,2暂停,3处理完成,4撤销,5完成 var stateClass = 'timeout_default'; var stateTxt = '-'; switch(val) { case 0: stateClass = 'timeout_wait'; stateTxt = '未启动'; break; case 1: stateClass = 'timeout_success'; stateTxt = '已启动'; break; case 2: stateClass = 'timeout_refuse'; stateTxt = '暂停'; break; case 3: stateClass = 'timeout_doned'; stateTxt = '处理完成'; break; case 4: stateClass = 'timeout_revoke'; stateTxt = '撤销'; break; case 5: stateClass = 'timeout_end'; stateTxt = '完成'; break; default: break; } return '' + stateTxt + ''; } //导出已接通或者未接通 0=导出未接通号码 1=导出已接通号码 function btn_export(tid, type) { window.open(huayi.config.callcenter_url + "callcenterapi/api/autocallouttask/exportexcel?taskid=" + tid + "&calloutok=" + type); } //结束时间 超期变红 function endTime(val, row) { if(val) { var d = val.replace(/-/g, "/"); var curDate = new Date().getFullYear() + "-" + (new Date().getMonth() + 1) + "-" + new Date().getDate(); curDate = curDate.replace(/-/g, "/"); var str = ''; if(Date.parse(d) >= Date.parse(curDate)) { str = '
' + val + '
'; } else { str = '
' + val + '
'; } return str } }