| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224 |
- /**
- * 呼叫任务管理(自动外呼)
- *
- * */
- 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',
- });
- helper.getDropList.getSeatlistDrop($('#sc_seat')).then(function() {
- $('#sc_seat').on('change', initTable);
- });
- 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() {
- $.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: $('#sc_seat').val(), //否 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
- });
- }
- //操作按钮格式化操作
- function formatterOperate(val, row) {
- //取消参与资格;监控;导出已接通;导出未接通;
- var str = '';
- str = '<div class="task_tools" onclick = helper.methods.taskTools(this)>' +
- '<a title="操作"><i class="fa fa-cogs" aria-hidden="true"></i></a>' +
- '<ul class="tool_down">' +
- '<li><a class="aBtn" authorize="yes" id="HY_cancle_' + row.id + '" onclick="btn_cancle(\'' + row.id + '\')"><i class="fa icon-lixian tub"></i>取消参与资格</a><li>' +
- '<li><a href="autoCallMonitor.html?t_id=' + row.id + '" authorize="yes" id="HY_monitoring_' + row.id + '"><i class="fa icon-shuju1 tub"></i>监控</a></li>' +
- '<li><a class="aBtn" authorize="yes" id="HY_export_' + row.id + '" onclick="btn_export(\'' + row.id + '\', 1)"><i class="fa icon-export tub"></i>导出已接通</a><li>' +
- '<li><a class="aBtn" authorize="yes" id="HY_export_' + row.id + '" onclick="btn_export(\'' + row.id + '\', 0)"><i class="fa icon-export tub"></i>导出未接通</a><li>' +
- '</ul>' +
- '</div>';
- return str;
- }
- //格式化状态
- 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 '<span class="' + stateClass + '">' + stateTxt + '</span>';
- }
- //导出已接通或者未接通 0=导出未接通号码 1=导出已接通号码
- function btn_export(tid, type) {
- window.open(huayi.config.callcenter_url + "callcenterapi/api/autocallouttask/exportexcel?taskid=" + tid + "&calloutok=" + type);
- }
- //取消参与资格
- function btn_cancle(tid) {
- var loadIndex;
- if(!$.trim($('#sc_seat').val())) {
- layer.confirm('请选择您要取消参与资格的坐席!', {
- icon: 7,
- btn: ['确定'] //按钮
- });
- return;
- }
- layer.confirm('您确定要取消坐席:' + $('#sc_seat').find('option:checked').text() + '的参与资格吗?', {
- 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: tid, // 是 string 任务id
- agentid: $('#sc_seat').val(), // 是 string 坐席工号
- joinflag: 0, // 是 int 参与标志(1为参与,0为不参与)
- },
- success: function(data) {
- layer.close(loadIndex);
- if(data.state.toLowerCase() === "success") {
- layer.msg("坐席:" + $('#sc_seat').find('option:checked').text() + "的参与资格取消成功!");
- $('#tableLists').bootstrapTable('refresh');
- //更新右上角信息
- if(top.$('#task_real_info').is(":visible")) {
- if($('#sc_seat').val() === 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: ['确定'] //按钮
- });
- }
- },
- });
- });
- }
- //结束时间 超期变红
- 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 = '<div>' + val + '</div>';
- } else {
- str = '<div style="color:red;">' + val + '</div>';
- }
- return str
- }
- }
|