Ei kuvausta

callTaskManage.js 6.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  1. /**
  2. * 呼叫任务管理(自动外呼)
  3. *
  4. * */
  5. var ishistory = '0'; //是否是历史任务
  6. $(document).ready(function() {
  7. var ndate = helper.DateFormat.getNowDate();
  8. var fmdate = helper.DateFormat.getFirstDayInCurrentMonth();
  9. laydate.render({
  10. elem: '#sc_times',
  11. range: '~',
  12. value: fmdate + ' ~ ' + ndate,
  13. btns: ['confirm'],
  14. theme: '#249fea',
  15. });
  16. helper.getDropList.getSeatlistDrop($('#sc_seat')).then(function() {
  17. $('#sc_seat').on('change', initTable);
  18. });
  19. initTable();
  20. $('#tab_head_left li').click(function() {
  21. ishistory = $(this).index();
  22. $(this).addClass('tab_head_active').siblings().removeClass('tab_head_active');
  23. $('#tab_contents .tabs_details').eq(ishistory).addClass('showtabs').siblings().removeClass('showtabs');
  24. initTable();
  25. });
  26. $('#sc_btns').click(function() {
  27. initTable();
  28. });
  29. });
  30. function initTable() {
  31. $.ajax({
  32. url: huayi.config.callcenter_url + 'callcenterapi/api/autocallouttask/getmytask',
  33. type: 'get',
  34. data: {
  35. isstart: $('#sc_taskState').val(), // 否 int 任务状态 (不传值时查询所有状态)
  36. stime: $('#sc_times').val() && $('#sc_times').val().split(' ~ ')[0], // 否 string 开始时间
  37. etime: $('#sc_times').val() && $('#sc_times').val().split(' ~ ')[1], // 否 string 结束时间
  38. agentid: $('#sc_seat').val(), //否 string 坐席工号(不传值查询全部坐席)
  39. infokind: ishistory, //否 int 查询类型(为0或不传时获取全部,为1时获取当前任务,为2时获取历史任务)
  40. taskname: $('#sc_keyWords').val(), // 否 string 计划名称,可模糊查询
  41. },
  42. dataType: "json",
  43. async: true,
  44. success: function(res) {
  45. if(res.state.toLowerCase() === 'success') {
  46. //异步获取数据
  47. var resultData1 = res.rows;
  48. $('#tableLists').bootstrapTable('load', resultData1);
  49. if(res.total >= 100) {
  50. res.total = '99+';
  51. }
  52. if(res.dqnum >= 100) {
  53. res.dqnum = '99+';
  54. }
  55. if(res.lsnum >= 100) {
  56. res.lsnum = '99+';
  57. }
  58. $('.audit_all').text(res.total); //全部
  59. $('.audit_refuse').text(res.dqnum); //当前任务
  60. $('.audit_wait').text(res.lsnum); //历史任务
  61. $('.tool_down').authorizeOperateButton();
  62. } else {
  63. layer.confirm(res.message, {
  64. icon: 7,
  65. btn: ['确定'] //按钮
  66. });
  67. }
  68. }
  69. });
  70. $('#tableLists').bootstrapTable('destroy').bootstrapTable({
  71. striped: true
  72. });
  73. }
  74. //操作按钮格式化操作
  75. function formatterOperate(val, row) {
  76. //取消参与资格;监控;导出已接通;导出未接通;
  77. var str = '';
  78. str = '<div class="task_tools" onclick = helper.methods.taskTools(this)>' +
  79. '<a title="操作"><i class="fa fa-cogs" aria-hidden="true"></i></a>' +
  80. '<ul class="tool_down">' +
  81. '<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>' +
  82. '<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>' +
  83. '<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>' +
  84. '<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>' +
  85. '</ul>' +
  86. '</div>';
  87. return str;
  88. }
  89. //格式化状态
  90. function formatterState(val, row) {
  91. //0未启动,1已启动,2暂停,3处理完成,4撤销,5完成
  92. var stateClass = 'timeout_default';
  93. var stateTxt = '-';
  94. switch(val) {
  95. case 0:
  96. stateClass = 'timeout_wait';
  97. stateTxt = '未启动';
  98. break;
  99. case 1:
  100. stateClass = 'timeout_success';
  101. stateTxt = '已启动';
  102. break;
  103. case 2:
  104. stateClass = 'timeout_refuse';
  105. stateTxt = '暂停';
  106. break;
  107. case 3:
  108. stateClass = 'timeout_doned';
  109. stateTxt = '处理完成';
  110. break;
  111. case 4:
  112. stateClass = 'timeout_revoke';
  113. stateTxt = '撤销';
  114. break;
  115. case 5:
  116. stateClass = 'timeout_end';
  117. stateTxt = '完成';
  118. break;
  119. default:
  120. break;
  121. }
  122. return '<span class="' + stateClass + '">' + stateTxt + '</span>';
  123. }
  124. //导出已接通或者未接通 0=导出未接通号码 1=导出已接通号码
  125. function btn_export(tid, type) {
  126. window.open(huayi.config.callcenter_url + "callcenterapi/api/autocallouttask/exportexcel?taskid=" + tid + "&calloutok=" + type);
  127. }
  128. //取消参与资格
  129. function btn_cancle(tid) {
  130. var loadIndex;
  131. if(!$.trim($('#sc_seat').val())) {
  132. layer.confirm('请选择您要取消参与资格的坐席!', {
  133. icon: 7,
  134. btn: ['确定'] //按钮
  135. });
  136. return;
  137. }
  138. layer.confirm('您确定要取消坐席:' + $('#sc_seat').find('option:checked').text() + '的参与资格吗?', {
  139. icon: 7,
  140. btn: ['是', '否'] //按钮
  141. }, function() {
  142. $.ajax({
  143. type: "post",
  144. url: huayi.config.callcenter_url + "callcenterapi/api/autocall/joinprecall",
  145. dataType: 'json',
  146. async: true,
  147. beforeSend: function() { //触发ajax请求开始时执行
  148. loadIndex = layer.load();
  149. },
  150. data: {
  151. taskid: tid, // 是 string 任务id
  152. agentid: $('#sc_seat').val(), // 是 string 坐席工号
  153. joinflag: 0, // 是 int 参与标志(1为参与,0为不参与)
  154. },
  155. success: function(data) {
  156. layer.close(loadIndex);
  157. if(data.state.toLowerCase() === "success") {
  158. layer.msg("坐席:" + $('#sc_seat').find('option:checked').text() + "的参与资格取消成功!");
  159. $('#tableLists').bootstrapTable('refresh');
  160. //更新右上角信息
  161. if(top.$('#task_real_info').is(":visible")) {
  162. if($('#sc_seat').val() === window.localStorage.getItem("userCode")) {
  163. top.getTaskRealInfo();
  164. }
  165. }
  166. }
  167. },
  168. error: function(textStatus) {
  169. layer.close(loadIndex);
  170. layer.confirm('网络繁忙,请稍后再试...', {
  171. icon: 7,
  172. closeBtn: 0,
  173. btn: ['确定'] //按钮
  174. });
  175. },
  176. complete: function(XMLHttpRequest, textStatus) {
  177. layer.close(loadIndex);
  178. if(textStatus == 'timeout') {
  179. var xmlhttp = window.XMLHttpRequest ? new window.XMLHttpRequest() : new ActiveXObject("Microsoft.XMLHttp");
  180. xmlhttp.abort();
  181. layer.confirm('网络超时,请稍后再试...', {
  182. icon: 7,
  183. closeBtn: 0,
  184. btn: ['确定'] //按钮
  185. });    
  186. }
  187. },
  188. });
  189. });
  190. }
  191. //结束时间 超期变红
  192. function endTime(val, row) {
  193. if(val) {
  194. var d = val.replace(/-/g, "/");
  195. var curDate = new Date().getFullYear() + "-" + (new Date().getMonth() + 1) + "-" + new Date().getDate();
  196. curDate = curDate.replace(/-/g, "/");
  197. var str = '';
  198. if(Date.parse(d) >= Date.parse(curDate)) {
  199. str = '<div>' + val + '</div>';
  200. } else {
  201. str = '<div style="color:red;">' + val + '</div>';
  202. }
  203. return str
  204. }
  205. }