| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930 |
- /**
- * 首页js
- * */
- var $storages = window.localStorage;
- var taskRealInfoTimer = null;
- var isTaskTimerOn = false; //定时器是否开启
- let callType = ''
- //录音的路径
- var recordpath = '';
- $(document).ready(function() {
- if(/mobile/i.test(navigator.userAgent) || /android/i.test(navigator.userAgent)) {
- $(".title-box").hide();
- }
- // 判断大屏按钮
- console.log($storages.getItem('roleCode'))
- if($storages.getItem('roleCode') == "CJGL") {
- $('#bgview').show()
- } else {
- $('#bgview').hide()
- }
- if(window.localStorage.getItem('token') == null) {
- window.location.href = "./login.html";
- }
- //获取当前用户的信息
- getUserInfo();
- //加载左侧导航菜单
- loadMenu();
- //话务相关
- $("#top-search li").click(function(event) {
- event.stopPropagation();
- if($(this).find("i").hasClass("active")) {
- if(!window.localStorage.getItem('extno')) {
- layer.confirm('分机号不存在,请重新登录...', {
- icon: 7,
- closeBtn: 0,
- btn: ['确定'], //按钮
- yes: function() {
- window.location.href = "login.html";
- }
- });
- return;
- }
- //坐席工号
- if(window.localStorage.getItem('userCode')) {
- var fun = $(this).attr("datafun");
- console.log(fun)
- switch(fun) {
- case "Login": //签入
- scoketDatas = {
- "Type": fun,
- "AgentID": window.localStorage.getItem('userCode'),
- "AgentExten": window.localStorage.getItem("extno"),
- "AgentGroup": window.localStorage.getItem('group'), //坐席组id
- "AgentType": "0",
- "DisposeTime": "0", //话后处理时长设置,0代表一致话后处理,除非发送置闲 (按照历史习惯,字符串形式)
- };
- // getChartT()
- getExtno()
- Send();
- break;
- case "MakeCall": //外呼
- //
- callType = 'MakeCall'
- $(".hidCallID").val("");
- $("#hidwhtype").val(fun);
- whtp("MakeCall");
- break;
- case "Meeting": //多方通话
- callType = 'Meeting'
- $("#hidwhtype").val(fun);
- whtp("Meeting");
- break;
- case "Transfer": //转移
- callType = 'Transfer'
- $("#hidwhtype").val(fun);
- whtp("Transfer");
- break;
- case "Consult": //协商呼叫
- $("#hidwhtype").val(fun);
- whtp();
- break;
- case "Logout": //协商呼叫
- scoketDatas = {
- "Type": fun,
- "AgentID": window.localStorage.getItem('userCode'),
- "AgentExten": window.localStorage.getItem("extno"),
- };
- Send();
- // getChartF()
- break;
- default:
- scoketDatas = {
- "Type": fun,
- "AgentID": window.localStorage.getItem('userCode'),
- "AgentExten": window.localStorage.getItem("extno"),
- };
- Send();
- break;
- }
- }
- }
- });
- //关闭外呼弹屏
- $(".closes").click(function() {
- $(".WH").removeClass("fadeInDown").addClass("fadeOutUp");
- $(".WH").addClass("hidens");
- });
- //外呼呼出
- $(".CallOut").click(function(event) {
- // 813811115503
- // debugger
- console.log("号码", $("#hidwhtype").val())
- event.stopPropagation();
- if($("#Result").val()) {
- $.ajax({
- type: "get",
- url: huayi.config.call_url + "CallOutOpt/GetCallOutprefix",
- async: true,
- dataType: 'json',
- data: {
- phone: $("#Result").val()
- },
- success: function(result) {
- //result = $.parseJSON(result);
- if(result.state.toLowerCase() == "success") {
- switch($("#hidwhtype").val()) {
- case "MakeCall":
- scoketDatas = {
- "Type": $("#hidwhtype").val(),
- "AgentID": window.localStorage.getItem('userCode'),
- "AgentExten": window.localStorage.getItem("extno"),
- "Header": result.data.fix, //号码前缀 用于截断前缀得到真实号码
- "DestinationNumber": result.data.phone, //
- };
- break;
- case "Meeting":
- scoketDatas = {
- "Type": $("#hidwhtype").val(),
- "AgentID": window.localStorage.getItem('userCode'),
- "AgentExten": window.localStorage.getItem("extno"),
- "DestinationNumber": result.data.phone, //会议目标号码
- };
- break;
- case "Transfer":
- scoketDatas = {
- "Type": $("#hidwhtype").val(),
- "AgentID": window.localStorage.getItem('userCode'),
- "AgentExten": window.localStorage.getItem("extno"),
- "DestinationNumber": result.data.phone, //转移目标号码
- };
- break;
- case "Consult": //协商呼叫
- scoketDatas = {
- "Type": $("#hidwhtype").val(),
- "AgentID": window.localStorage.getItem('userCode'),
- "AgentExten": window.localStorage.getItem("extno"),
- "Callee": result.data.phone, //对方号码
- "Caller": window.localStorage.getItem("extno") //自己的号码(分机号)
- };
- break;
- default:
- break;
- }
- Send();
- $(".closes").trigger('click'); //关闭弹屏
- }
- }
- });
- } else {
- layer.confirm('请输入外呼号码', {
- icon: 7,
- closeBtn: 0,
- btn: ['确定'] //按钮
- })
- }
- })
- //外呼弹屏数字键盘点击样式
- $(".Num_ul .dNum").mousedown(function() {
- $(this).addClass("actives");
- $(".img").removeClass("hidens");
- }).mouseup(function() {
- $(this).removeClass("actives");
- });
- //外呼弹屏数字键盘号码输入
- $(".Num_ul li .dNum").click(function() {
- var rt = $("#Result").val() + "";
- if(rt.length < 17) {
- rt = rt + $(this).find("a").text();
- $("#Result").val(rt);
- } else {
- layer.msg('号码长度不能超过16位!');
- }
- });
- //外呼弹屏数字键盘号码截取(删除)
- $(".img").click(function() {
- var Result = $("#Result").val() + "";
- Result = Result.substr(0, Result.length - 1);
- $("#Result").val(Result);
- if(Result.length == 0) {
- $(".img").addClass("hidens");
- }
- });
- //外呼电话列表
- $(".bg_title li").click(function() {
- $(this).addClass("lactive").siblings().removeClass("lactive");
- console.log(callType)
- loadWH(callType);
- });
- //搜索
- $(".sc_btns").click(function() {
- loadWH(callType);
- });
- });
- //获取1002的坐席工号
- function getExtno() {
- if(window.localStorage.getItem("extno") === '1002') {
- $.ajax({
- type: "get",
- url: huayi.config.call_url + "CallOutOpt/Update",
- dataType: 'json',
- async: true,
- data: {
- F_CalledNo: window.localStorage.getItem("extno"),
- F_userCode: window.localStorage.getItem("userCode")
- },
- success: function(res) {}
- })
- }
- }
- //改变客服在线状态
- function getChartT() {
- $.ajax({
- type: "get",
- url: huayi.config.callcenter_url + 'testusertypeapi/api/TestUserType/upfpzxinfos',
- async: true,
- dataType: 'json',
- data: {
- usercode: window.localStorage.getItem("userCode"),
- loginstate: '1',
- token: $.cookie("token")
- },
- success: function(data) {
- if(data.state.toLowerCase() == 'success') {}
- }
- });
- }
- //改变客服在线状态
- function getChartF() {
- $.ajax({
- type: "get",
- url: huayi.config.callcenter_url + 'testusertypeapi/api/TestUserType/upfpzxinfos',
- async: true,
- dataType: 'json',
- data: {
- usercode: window.localStorage.getItem("userCode"),
- loginstate: '0',
- token: $.cookie("token")
- },
- success: function(data) {
- if(data.state.toLowerCase() == 'success') {}
- }
- });
- }
- //验证拨号长度
- function regTelNums() {
- var rt = $("#Result").val() + "";
- if(rt.length === 0) {
- $(".img").addClass("hidens");
- } else {
- $(".img").removeClass("hidens");
- if(rt.length < 17) {
- $("#Result").val(rt);
- } else {
- $("#Result").val(rt.substring(0, 16));
- layer.msg('号码长度不能超过16位!');
- }
- }
- }
- //菜单数字
- workcount()
- //setInterval(function() {
- // workcount();
- //}, huayi.config.menuworktime);
- function workcount() {
- $.post(huayi.config.callcenter_url + "equipmentapi/api/worepairbase/Getinfotx", {
- "token": $.cookie("token")
- }, function(result) {
- result = JSON.parse(result);
- if(result.state.toLowerCase() == "success") {
- if(result.data.total) {
- $(".bxgd").text(result.data.total)
- }
- }
- })
- }
- //外呼弹屏
- function whtp(type) {
- $("#Result").val("");
- if($(".WH").hasClass("fadeOutUp")) {
- $(".WH").removeClass("fadeOutUp").addClass("fadeInDown");
- }
- $(".WH").removeClass("hidens");
- $('.first').removeClass('first');
- $('.WH').addClass('first');
- //键盘事件外呼
- document.onkeydown = function(e) {
- var theEvent = window.event || e;
- var code = theEvent.keyCode || theEvent.which;
- if(code == 13) {
- $(".CallOut").click();
- }
- }
- loadWH(type);
- }
- //加载外呼电话列表
- function loadWH(type) {
- var loadWHindex = $('.bg_title').find('.lactive').attr('itemid');
- $(".phonediv").eq(loadWHindex).addClass('show_phonediv').siblings().removeClass('show_phonediv');
- var table = $(".phonediv").eq(loadWHindex).find(".phonelist");
- switch(loadWHindex) {
- case '0':
- //先销毁表格
- table.bootstrapTable('destroy');
- //初始化表格,动态从服务器加载数据
- table.bootstrapTable({
- method: "get", //使用get请求到服务器获取数据
- url: huayi.config.callcenter_url + "callcenterapi/api/CallRecords/getlistbypage", //获取数据的Servlet地址
- contentType: 'application/x-www-form-urlencoded',
- striped: true, //表格显示条纹
- pagination: true, //启动分页
- pageSize: 10, //每页显示的记录数
- pageNumber: 1, //当前第几页
- pageList: [10, 20, 50, 100], //记录数可选列表
- search: false, //是,//否启用查询
- showColumns: false, //显示下拉框勾选要显示的列
- showRefresh: false, //显示刷新按钮
- sidePagination: "server", //表示服务端请求
- //设置为undefined可以获取pageNumber,pageSize,searchText,sortName,sortOrder
- //设置为limit可以获取limit, offset, search, sort, order
- queryParamsType: "undefined",
- queryParams: function queryParams(params) { //设置查询参数
- var param = {
- pageindex: params.pageNumber, //否 string 当前页
- pagesize: params.pageSize, //否 string 每页记录数
- keyword: $('#sc_tel').val(), // 否 string 模糊查询(呼叫号码)
- // stime: $("#old_scTime").val() && $("#old_scTime").val().split(' ~ ')[0], //否 string 工单起止时间
- // etime: $("#old_scTime").val() && $("#old_scTime").val().split(' ~ ')[1], //否 string 工单起止时间
- };
- return param;
- },
- onLoadSuccess: function(res) { //加载成功时执行
- //layer.msg("加载成功");
- if(res.state.toLowerCase() === "success") {
- var newData = {};
- res.data.rows.forEach(function(v, n) {
- v.type = type;
- })
- newData.state = res.state;
- newData.message = res.message;
- newData.rows = res.data.rows;
- newData.total = res.data.total;
- recordpath = res.data.recordpath;
- console.log(newData)
- table.bootstrapTable('load', newData);
- }
- },
- onLoadError: function() { //加载失败时执行
- //layer.msg("加载数据失败", { time: 1500, icon: 2 });
- }
- });
- break;
- case '1':
- break;
- case '2':
- table.bootstrapTable('destroy');
- //初始化表格,动态从服务器加载数据
- table.bootstrapTable({
- method: "get", //使用get请求到服务器获取数据
- url: huayi.config.callcenter_url + "testusertypeapi/api/TestUserType/GetYytxluinfo", //获取数据的Servlet地址
- contentType: 'application/x-www-form-urlencoded',
- striped: true, //表格显示条纹
- pagination: true, //启动分页
- pageSize: 10, //每页显示的记录数
- pageNumber: 1, //当前第几页
- pageList: [10, 20, 50, 100], //记录数可选列表
- search: false, //是,//否启用查询
- showColumns: false, //显示下拉框勾选要显示的列
- showRefresh: false, //显示刷新按钮
- sidePagination: "server", //表示服务端请求
- //设置为undefined可以获取pageNumber,pageSize,searchText,sortName,sortOrder
- //设置为limit可以获取limit, offset, search, sort, order
- queryParamsType: "undefined",
- queryParams: function queryParams(params) { //设置查询参数
- var param = {
- PageIndex: params.pageNumber,
- PageSize: params.pageSize,
- deptname: $("#department").val(),
- doctorname: $("#docName").val()
- };
- return param;
- },
- // responseHandler: function(res) {
- // return {
- // "rows": res.data.rows, //数据
- // "total": res.data.total
- // };
- // },
- onLoadSuccess: function(res) { //加载成功时执行
- if(res.state.toLowerCase() === "success") {
- var newData = {};
- res.data.rows.forEach(function(v, n) {
- v.type = type;
- })
- newData.state = res.state;
- newData.message = res.message;
- newData.rows = res.data.rows;
- newData.total = res.data.total;
- recordpath = res.data.recordpath;
- console.log(newData)
- table.bootstrapTable('load', newData);
- }
- },
- onLoadError: function() { //加载失败时执行
- //layer.msg("加载数据失败", { time: 1500, icon: 2 });
- }
- });
- break;
- }
- }
- function callout(val, row) {
- if(val == '') {
- var str = '<div>' + val + '</div>';
- return str;
- } else {
- var str = '<div>' + val +
- '<img src="img/extensionnumber_icons.png" style="width:20px;height:20px;padding-left:5px;padding-bottom:5px" onclick= "callPhone(\'' + val + '\',\'' + row.type + '\')"></div>'
- return str
- }
- }
- function callPhone(val, type) {
- console.log('号码', val)
- // debugger
- if(val) {
- if(type == 'MakeCall') {
- layer.confirm('您确定要拨打此号码?', {
- icon: 7,
- btn: ['确定', '取消'],
- yes: function(index, layero) {
- callData(type)
- },
- });
- } else if(type == 'Meeting') {
- layer.confirm('您确定要多方通话?', {
- icon: 7,
- btn: ['确定', '取消'],
- yes: function(index, layero) {
- callData(type)
- },
- });
- } else if(type == 'Transfer') {
- layer.confirm('您确定要转移?', {
- icon: 7,
- btn: ['是', '否'] //按钮
- }, function() {
- /*发送请求*/
- callData(type)
- });
- }
- function callData(type) {
- $.ajax({
- type: "get",
- url: huayi.config.call_url + "CallOutOpt/GetCallOutprefix",
- async: true,
- dataType: 'json',
- data: {
- phone: val
- },
- success: function(result) {
- //result = $.parseJSON(result);
- if(result.state.toLowerCase() == "success") {
- layer.close(layer.index)
- top.scoketDatas = {
- "Type": type,
- "AgentID": window.localStorage.getItem('userCode'),
- "AgentExten": window.localStorage.getItem("extno"),
- "Header": result.data.fix, //号码前缀 用于截断前缀得到真实号码
- "DestinationNumber": result.data.phone, //
- };
- top.Send();
- }
- }
- });
- }
- } else {
- layer.confirm('请选择手机号', {
- icon: 7,
- btn: ['确定'] //按钮
- });
- return;
- }
- }
- //格式化手机号码
- function formatterCallTel(val) {
- if(val) {
- return '<a href="javascript:;" class="xg" onclick="btn_call(\'' + val + '\')">' + val + '</a>';
- }
- }
- //给外呼键盘赋值
- function btn_call(cphone) {
- if(cphone.indexOf('-') != -1) {
- cphone = cphone.replace('-', '');
- }
- $('#Result').val(cphone);
- $('#Result').trigger('keyup');
- }
- //格式化 呼叫类型
- function formatterCalltype(val, row) {
- //(0:呼入,1:呼出)
- var str = '-';
- if(val === 0) {
- str = '呼入';
- } else {
- str = '呼出';
- }
- return str;
- }
- //格式化 呼叫状态
- function formatterCallstate(val, row) {
- //(0:未接通,1:已接通)
- var str = '-';
- var stateClass = 'timeout_default';
- if(val === 0) {
- str = '未接通';
- stateClass = 'timeout_termination';
- } else {
- str = '已接通';
- stateClass = 'timeout_success';
- }
- return '<span class="' + stateClass + '">' + str + '</span>';
- }
- //格式化处理方式
- function formatterDealtype(val, row) {
- //(0:IVR处理 1:骚扰电话 2:自助服务 3:转值班电话 4:留言 5:呼损 6:人工处理)
- var str = '-';
- switch(val) {
- case 0:
- str = "IVR处理"
- break;
- case 1:
- str = "骚扰电话"
- break;
- case 2:
- str = "自助服务"
- break;
- case 3:
- str = "转值班电话"
- break;
- case 4:
- str = "留言"
- break;
- case 5:
- str = "呼损"
- break;
- case 6:
- str = "人工处理"
- break;
- default:
- str = "-"
- break;
- }
- return str;
- }
- //格式化外呼类型
- function formatterCallopttype(val, row) {
- //( 0:拨号外呼 1:回访外呼)
- var str = '-';
- switch(val) {
- case 0:
- str = "拨号外呼"
- break;
- case 1:
- str = "回访外呼"
- break;
- default:
- str = "-"
- break;
- }
- return str;
- }
- //音频
- function formatterAudio(val) {
- var audioUrl = recordpath + val;
- if(val && val.length > 0) {
- return '<div class="imgs" style="cursor: pointer;">' +
- '<img src="img/vice.png" alt="录音" onclick="seeAudio(\'' + audioUrl + '\')" />' +
- '</div>';
- } else {
- return '-';
- }
- }
- //查看录音详情
- function seeAudio(audioUrl) {
- layer.open({
- type: 2,
- content: "templateHtml/audioPlayer.html?audioUrl=" + audioUrl, //iframe的url,no代表不显示滚动条
- title: '录音详情',
- area: ['50%', '280px'], //宽高
- });
- }
- //格式化地址
- function formatterAddress(val, row) {
- var locations = '';
- var address = '';
- if(val) {
- locations = val + row.cityname;
- }
- if(row.address) {
- address = row.address;
- }
- return locations + address;
- }
- //格式化创建人
- function formatterCreateuser(val, row) {
- return val + '-' + row.createusername;
- }
- //左侧菜单
- function loadMenu() {
- var menuData = top.clients.authorizeMenu.Result;
- var _html = "";
- $.each(menuData, function(i) {
- var row = menuData[i];
- if(-(row.parent_id) == 0) {
- _html += '<li>';
- var childNodes = row.childnodes; //二级
- if(childNodes.length > 0) {
- _html += '<a class="Click" data-id="Menu_' + row.id + '" data-target="' + row.target + '" href="' + row.opt_url +
- '"><i class="fa iconfont">' + row.img_url + '</i><span class="nav-label">' + row.module_name +
- '</span><span class="fa arrows iconfont"></span></a>';
- _html += '<ul class="nav nav-second-level">';
- $.each(childNodes, function(i) {
- var subrow = childNodes[i];
- var childNodsThird = subrow.childnodes; //三级
- if(childNodsThird.length > 0) {
- _html += '<li>';
- _html += '<a href="' + subrow.opt_url + '">';
- _html += '<span class="nav-label">' + subrow.module_name + '</span>';
- _html += '<span class="fa arrows iconfont"></span>';
- _html += '</a>';
- _html += '<ul class="nav nav-third-level">';
- $.each(childNodsThird, function(i) {
- var subrowThird = childNodsThird[i];
- _html += '<li>';
- _html += '<a class="J_menuItem" data-id="Menu_' + subrowThird.id + '" data-target="' + subrowThird.target +
- '" href="' + subrowThird.opt_url + '" >' + subrowThird.module_name + '</a>';
- _html += '</li>';
- });
- _html += '</ul>';
- } else {
- _html += '<li>';
- _html += '<a class="J_menuItem" data-id="Menu_' + subrow.id + '" data-target="' + subrow.target + '" href="' +
- subrow.opt_url + '" >' + subrow.module_name + '</a>';
- if(subrow.module_name == '报修工单') {
- _html += '<span class="label label-warning pull-right lblcount bxgd"></span>';
- }
- _html += '</li>';
- }
- });
- _html += '</ul>';
- } else {
- _html += '<a class="Click"data-id="Menu_' + row.id + '" href="' + row.opt_url + '"><i class="fa iconfont">' + row
- .img_url + '</i><span class="nav-label">' + row.module_name + '</span></a>';
- }
- _html += '</li>';
- }
- });
- $(_html).appendTo("#side-menu");
- //绑定点击事件 添加点击的样式
- $('#side-menu').find('.J_menuItem').on('click', function() {
- $(this).parent().addClass('sub_active').siblings().removeClass('sub_active');
- });
- }
- //跳转
- function jumps() {
- $("iframe:visible")[0].src = "widgets.html"
- $(".J_menuTab").eq(0).addClass("active").text('首页');
- $(".J_menuTab").eq(0).attr("data-id", 'widgets.html');
- $(".J_mainContent .J_iframe0").attr("data-id", "widgets.html");
- }
- // 大屏跳转
- function enterbg() {
- window.open('http://192.168.5.46/WebChart/index.html')
- }
- //设置
- function settings() {
- layer.open({
- type: 2,
- content: "./templateHtml/personalCenter.html", //iframe的url,no代表不显示滚动条
- title: '设置',
- resize: false,
- area: ['50%', '60%'], //宽高
- });
- }
- //退出
- function logout() {
- window.localStorage.removeItem('token');
- window.localStorage.removeItem('headImg');
- window.localStorage.removeItem('userName');
- window.localStorage.removeItem('userCode');
- window.localStorage.removeItem('roleName');
- window.localStorage.removeItem('seatFlag');
- window.localStorage.removeItem('extno');
- window.localStorage.removeItem('group');
- window.localStorage.removeItem('deptId');
- window.localStorage.removeItem('teamId');
- window.localStorage.removeItem('mobile');
- location.href = "./login.html";
- }
- //获取当前用户信息
- function getUserInfo() {
- //用户名
- $(".username").text(window.localStorage.getItem('userName'));
- $(".chat_username").text(window.localStorage.getItem('userCode'))
- //用户角色
- $(".rolename").text(window.localStorage.getItem('roleName'));
- //用户头像
- if(window.localStorage.getItem('headImg')) {
- $('#head_img').attr('src', window.localStorage.getItem('headImg'));
- } else {
- $('#head_img').attr('src', './img/zxPhone.png');
- }
- //话务标志,意思是否具备接听和呼叫电话的功能(false:非话务;true 话务标志)
- var seatFlag = window.localStorage.getItem('seatFlag');
- if(seatFlag === "true") {
- //话务控制条
- $('#navbarTopLinks').css('display', 'block');
- //分机号
- if(window.localStorage.getItem("extno")) {
- $(".Gnum").text('(' + window.localStorage.getItem("extno") + ')');
- }
- Connect();
- //话机、坐席状态
- $(".zts .phoneType").show();
- }
- }
- //签入成功后并且分配有任务的时候 弹出 相关计划任务
- //function btn_joinTask() {
- // var dtd = $.Deferred(); //在函数内部,新建一个Deferred对象
- // $.ajax({
- // type: "get",
- // url: huayi.config.call_url + "autocallouttask/getqrjoinlist",
- // dataType: 'json',
- // async: true,
- // data: {
- // //agentid 否 string 坐席工号(不传值默认登录坐席工号)
- // //joinflag 否 int 参与标志(不传值获取分配给坐席的全部任务,传值0获取未参与任务,传值1获取参与任务)
- // },
- // success: function(data) {
- // if(data.state.toLowerCase() === "success") {
- // data = data.data;
- // if(data && data.length > 0) {
- // //弹出任务信息(签入时传参数)
- // switchingTask(true);
- // }
- // dtd.resolve(); // 改变Deferred对象的执行状态
- // }
- // },
- // error: function(textStatus) {
- // layer.confirm('网络繁忙,请稍后再试...', {
- // icon: 7,
- // closeBtn: 0,
- // btn: ['确定'] //按钮
- // });
- // },
- // complete: function(XMLHttpRequest, textStatus) {
- // 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对象
- //}
- //签入成功后 显示右上角 当前参与任务信息
- function getTaskRealInfo() {
- $.ajax({
- type: "get",
- url: huayi.config.call_url + "callcenterapi/api/autocallouttask/getjoinlist",
- dataType: 'json',
- async: true,
- data: {
- // agentid: window.localStorage.getItem('userCode'),// 否 string 坐席工号(不传值默认登录坐席工号)
- joinflag: 1, //否 int 参与标志(不传值获取分配给坐席的全部任务,传值0获取未参与任务,传值1获取参与任务)
- },
- success: function(data) {
- if(data.state.toLowerCase() === "success") {
- // console.log('...............右上角信息...................');
- // console.log(data);
- data = data.data;
- if(data && data.length > 0) {
- $('#task_real_info').find('.task_num').text(data[0].totalnum); //任务量
- $('#task_real_info').find('.task_surNum').text(data[0].surplusnum); //剩余量
- $('#task_real_info').find('.task_name').text(data[0].taskname); //计划名称
- } else {
- $('#task_real_info').find('.task_num').text('0');
- $('#task_real_info').find('.task_surNum').text('0');
- $('#task_real_info').find('.task_name').text('当前没有参与任务');
- }
- }
- },
- error: function(textStatus) {
- layer.confirm('网络繁忙,请稍后再试...', {
- icon: 7,
- closeBtn: 0,
- btn: ['确定'] //按钮
- });
- },
- complete: function(XMLHttpRequest, textStatus) {
- if(textStatus == 'timeout') {
- var xmlhttp = window.XMLHttpRequest ? new window.XMLHttpRequest() : new ActiveXObject("Microsoft.XMLHttp");
- xmlhttp.abort();
- layer.confirm('网络超时,请稍后再试...', {
- icon: 7,
- closeBtn: 0,
- btn: ['确定'] //按钮
- });
- }
- },
- });
- }
- /**
- * 刷新数据 右上角 当前参与任务信息
- * platformTime 刷新时间的间隔;
- *
- * */
- var refreshTaskRealInfo = function(platformTime) {
- var objTime = {
- init: 0,
- time: function() {
- if($(document).find('.layui-layer').length === 0 && top.$("iframe:visible").contents().find('.layui-layer').length ===
- 0) {
- objTime.init += 1000;
- //console.log(objTime.init);
- //当页面layer 弹窗时;每间隔 huayi.config.taskRealInfoTime 刷新数据;
- if(objTime.init == platformTime) {
- getTaskRealInfo();
- objTime.init = 0;
- }
- }
- },
- eventFun: function() {
- clearInterval(taskRealInfoTimer);
- objTime.init = 0;
- if(isTaskTimerOn) {
- taskRealInfoTimer = setInterval(objTime.time, 1000);
- }
- },
- }
- taskRealInfoTimer = setInterval(objTime.time, 1000);
- var body = document.querySelector('html');
- var bodyIframe = top.$("iframe:visible").contents()[0].querySelector('html');
- body.addEventListener("click", objTime.eventFun);
- body.addEventListener("keydown", objTime.eventFun);
- body.addEventListener("mousemove", objTime.eventFun);
- body.addEventListener("mousewheel", objTime.eventFun);
- bodyIframe.addEventListener("click", objTime.eventFun);
- bodyIframe.addEventListener("keydown", objTime.eventFun);
- bodyIframe.addEventListener("mousemove", objTime.eventFun);
- bodyIframe.addEventListener("mousewheel", objTime.eventFun);
- }
- //切换任务
- //isLogin true(签入时传参数)
- function switchingTask(isLogin) {
- layer.open({
- // maxmin: true, //开启最大化最小化按钮
- type: 2,
- id: 'layer_switch_info',
- content: "templateHtml/joinTask.html?isLogin=" + isLogin, //iframe的url,no代表不显示滚动条
- title: '任务信息',
- area: ['50%', '86%'], //宽高
- end: function() {
- getTaskRealInfo(); //更新右上角任务信息
- },
- });
- }
|