Sin descripción

index.js 30KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162
  1. var newData=[] //数据倒序
  2. var floag=true
  3. WEB_SOCKET_SWF_LOCATION = "./js/websocket/WebSocketMain.swf";
  4. // 开启flash的websocket debug
  5. WEB_SOCKET_DEBUG = true;
  6. var ws, n = 0,
  7. timer;
  8. var lockReconnect = false; //避免重复连接
  9. var obj = {};
  10. var Statess;
  11. var cls = 0;
  12. var lasttime = new Date().getTime();
  13. var cons;
  14. var person='';
  15. // var areaOneVal = helper.cookies.get("areaOneVal");
  16. // var areaOneText = helper.cookies.get("areaOneText");
  17. // if (areaOneVal) {
  18. // var areaOneVal = helper.cookies.get("areaOneVal");
  19. // } else{
  20. // var areaOneVal="sqs12345"
  21. // }
  22. //创建scoket连接
  23. createWebSocket()
  24. function createWebSocket() {
  25. try {
  26. Connect();
  27. } catch (e) {
  28. reconnect();
  29. }
  30. }
  31. //连接
  32. function Connect() {
  33. ws = new WebSocket("ws://" + huayi.config.socket_ip + ":" + huayi.config.socket_port);
  34. ws.onopen = function () {
  35. console.log(new Date() + " " + "建立连接");
  36. //心跳检测重置
  37. heartCheck.reset().start();
  38. cls = 0;
  39. lasttime = new Date().getTime();
  40. join()
  41. SayBusy()
  42. };
  43. //接收到消息的回调方法
  44. ws.onmessage = function (evt) {
  45. //如果获取到消息,心跳检测重置
  46. //拿到任何消息都说明当前连接是正常的
  47. heartCheck.reset().start();
  48. var myDate = new Date();
  49. console.log(myDate + " receive " + evt.data);
  50. var data = JSON.parse(evt.data)[0];
  51. if (data) {
  52. var rlt = data.Result;
  53. var type = data.Type;
  54. if (rlt == true) {
  55. switch (type.toLowerCase()) {
  56. case "login":
  57. LoginBack();
  58. break; //签入
  59. }
  60. } else {
  61. if (rlt == false) {
  62. $(".hwzt").text('操作失败!');
  63. } else {
  64. $(".hwzt").text(rlt);
  65. if(type.toLowerCase()=='waitcount') {
  66. backstageQueue(data);
  67. }
  68. }
  69. }
  70. }
  71. };
  72. //连接关闭的回调方法
  73. ws.onclose = function (evt) {
  74. if (cls == 0) {
  75. cls = 1;
  76. $(".hwzt").text('连接关闭!');
  77. $("#top-search li i").removeClass("active");
  78. reconnect();
  79. }
  80. };
  81. //连接发生错误的回调方法
  82. ws.onerror = function (evt) {
  83. //产生异常
  84. $(".hwzt").text('连接出现异常!');
  85. console.log(ws);
  86. if (ws == null || ws.readyState != ws.OPEN) {
  87. console.log(new Date() + "开始重连");
  88. reconnect();
  89. }
  90. };
  91. }
  92. //重连
  93. function reconnect() {
  94. if (lockReconnect) return;
  95. lockReconnect = true;
  96. //没连接上会一直重连,设置延迟避免请求过多
  97. setTimeout(function () {
  98. console.log(new Date() + " " + "重连中……");
  99. createWebSocket("ws://" + huayi.config.socket_ip + ":" + huayi.config.socket_port);
  100. lockReconnect = false;
  101. SayBusy()
  102. }, 2000);
  103. }
  104. //发送
  105. function Send() {
  106. if (ws.readyState != ws.OPEN) {
  107. reconnect();
  108. }
  109. if (ws.readyState == ws.OPEN) {
  110. console.log(new Date() + " send " + JSON.stringify(obj));
  111. ws.send(JSON.stringify(obj));
  112. }
  113. }
  114. //心跳检测
  115. var heartCheck = {
  116. timeout: 25000, //25秒
  117. timeoutObj: null,
  118. serverTimeoutObj: null,
  119. reset: function () {
  120. clearTimeout(this.timeoutObj);
  121. clearTimeout(this.serverTimeoutObj);
  122. return this;
  123. },
  124. start: function () {
  125. var self = this;
  126. this.timeoutObj = setTimeout(function () {
  127. //这里发送一个心跳,后端收到后,返回一个心跳消息,
  128. //onmessage拿到返回的心跳就说明连接正常
  129. obj.Type = "Heart";
  130. Send();
  131. self.serverTimeoutObj = setTimeout(function () { //如果超过一定时间还没重置,说明后端主动断开了
  132. ws.close(); //如果onclose会执行reconnect,我们执行ws.close()就行了.如果直接执行reconnect 会触发onclose导致重连两次
  133. }, self.timeout)
  134. }, this.timeout)
  135. }
  136. }
  137. // 签入
  138. function SayBusy() {
  139. obj.Type = "SayBusy";
  140. Send();
  141. console.log('置忙')
  142. }
  143. //签入
  144. function LoginBack() {
  145. obj.Type = "SayBusy";
  146. Send();
  147. console.log('置忙')
  148. }
  149. // 点击签入
  150. function join(){
  151. obj.Type ='Login',
  152. obj.AgentID='9898',
  153. obj.AgentExten='1015',
  154. obj.AgentType='0',
  155. obj.AgentGroup='364'
  156. // console.log(scoketDatas)
  157. Send()
  158. }
  159. //监测
  160. function SubScribeBack() {
  161. var obj = $("iframe:visible")
  162. if (obj.attr("data-id") == "./TelCall/SeatMonitor.html") {
  163. window.frames[obj.attr("name")].Start();
  164. }
  165. if (obj.attr("data-id") == "./TelCall/zxKong.html") {
  166. window.frames[obj.attr("name")].Start();
  167. }
  168. }
  169. //取消监测
  170. function SubScribeCancelBack() {
  171. $('.yuan_one').addClass("lx")
  172. $('.yuan_two').addClass("lx")
  173. }
  174. //后台排队
  175. function backstageQueue(data) {
  176. person=data.WaitCount
  177. console.log(person)
  178. }
  179. $(function() {
  180. loginTimeLimit(); //登录
  181. var mySwiper = new Swiper('.swiper-container', {
  182. pagination: { /* 分页器*/
  183. el: '.swiper-pagination',
  184. clickable: true,
  185. },
  186. navigation: {
  187. nextEl: '.swiper-button-next',
  188. prevEl: '.swiper-button-prev',
  189. },
  190. on: {
  191. init: function() {
  192. swiperAnimateCache(this); //隐藏动画元素
  193. swiperAnimate(this); //初始化完成开始动画
  194. },
  195. transitionEnd: function() {
  196. swiperAnimate(this); //每个slide切换结束时也运行当前slide动画
  197. },
  198. }
  199. })
  200. // 跳轉
  201. $(".nav_middle").click(function(){
  202. window.open('index.html','_self')
  203. })
  204. $("#department").click(function(){
  205. window.open('receiptDepartment.html','_self')
  206. })
  207. $("#sourceChannel").click(function(){
  208. window.open('sourceChannel.html','_self')
  209. })
  210. $("#call").click(function(){
  211. window.open('TelephoneDetails.html','_self')
  212. })
  213. $("#complaint").click(function(){
  214. window.open('complaintsReport.html','_self')
  215. })
  216. // 選項卡
  217.  $(".smallimg").click(function ()
  218.   {
  219.     //获取点击的元素给其添加样式,讲其兄弟元素的样式移除
  220.     $(this).addClass("activeBox").siblings().removeClass("activeBox");
  221.     //获取选中元素的下标
  222.     var index = $(this).index();
  223.     $(".slideCon_bg").eq(index).addClass("slideCon_bg_block")
  224.     .siblings().removeClass("slideCon_bg_block");
  225.   });
  226. Ajax();
  227. deprtment();// 第五屏部门下拉
  228. laydate.render({
  229. elem: '#time1',
  230. range: '~',
  231. format: 'yyyy-MM-dd',
  232. theme: '#114a97',
  233. done: function(value, date) {
  234. oneScreen(value && value.split(' ~ ')[0], value && value.split(' ~ ')[1])
  235. }
  236. });
  237. laydate.render({
  238. elem: '#time2',
  239. range: '~',
  240. format: 'yyyy-MM-dd',
  241. theme: '#114a97',
  242. done: function(value, date) {
  243. twoScreen(value && value.split(' ~ ')[0], value && value.split(' ~ ')[1],$(".areaTwo").val())
  244. satisfaction(value && value.split(' ~ ')[0], value && value.split(' ~ ')[1],$(".areaTwo").val())
  245. }
  246. });
  247. laydate.render({
  248. elem: '#time3',
  249. format: 'yyyy-MM-dd',
  250. theme: '#114a97',
  251. done: function(value) {
  252. threeScreen(value,$(".areaThree").val())
  253. }
  254. });
  255. laydate.render({
  256. elem: '#test6',
  257. range: '~',
  258. format: 'yyyy-MM-dd',
  259. theme: '#114a97',
  260. done: function(value, date) {
  261. fiveScreen(value && value.split(' ~ ')[0], value && value.split(' ~ ')[1],$(".areaFive").val())
  262. }
  263. });
  264. })
  265. var cityObj = {
  266. ele1: "sqs_count",
  267. ele2: "syq_count",
  268. ele3: "lyq_count",
  269. ele4: "ycs_count",
  270. ele5: "mqx_count",
  271. ele6: "sx_count",
  272. ele7: "nlx_count",
  273. ele8: "zcx_count",
  274. ele9: "ycx_count",
  275. ele10: "xyx_count",
  276. ele11: "cxyt_count",
  277. ele12: "lhpz_count",
  278. ele13: "saz_count",
  279. ele14: "djbl_count"
  280. }
  281. var vars = {};
  282. getCountUp(cityObj)
  283. function getCountUp(obj1) {
  284. var options = {  
  285. useEasing: true,
  286.   useGrouping: true,
  287.   separator: ',',
  288.   decimal: '.',
  289. };
  290. $.each(obj1, function(k, v) {
  291. new CountUp(v, 0, 0, 0, 2, options).start()
  292. vars[v] = new CountUp(v, 0, 0, 0, 2, options)
  293. })
  294. }
  295. var myDate = new Date();
  296. function turn(aa) {
  297. if(aa < 10) {
  298. aa = "0" + aa;
  299. }
  300. return aa
  301. }
  302. // 第三屏 第四屏 发光外框 定时
  303. (function() {
  304. var i = 0;
  305. var length = $(".orderState_ul >li").length;
  306. var j = 0;
  307. var length_1 = $(".orderTtype_Con li").length;
  308. setInterval(function() {
  309. if(i == length) {
  310. i = 0;
  311. $(".orderState_ul >li").removeClass('active');
  312. }
  313. $(".orderState_ul >li").eq(i).addClass('active').siblings().removeClass('active');
  314. if(i == 5) {
  315. $(".orderState_ul >li").eq(4).removeClass('active');
  316. }
  317. i++;
  318. if(j == length_1) {
  319. j = 0;
  320. }
  321. $(".orderTtype_Con li").eq(j).addClass('active').siblings().removeClass('active');
  322. j++;
  323. }, 2000);
  324. })();
  325. //对数组进行排序
  326. function compare(property) {
  327. return (firstobj, secondobj) => {
  328. const firstValue = firstobj[property];
  329. const secondValue = secondobj[property];
  330. return secondValue - firstValue; //降序
  331. };
  332. }
  333. //第一屏幕 开始
  334. function oneScreen(sd,ed) {
  335. $.ajax({
  336. type: "get",
  337. url: huayi.config.callcenter_url + "/info/GetAreaCountByDateNew",
  338. async: true,
  339. dataType: 'json',
  340. data: {
  341. start: sd,
  342. end: ed,
  343. },
  344. success: function(data) {
  345. if(data.state.toLowerCase() == 'success') {
  346. var con = data.data;
  347. newData = con.sort(compare("SLCount"));
  348. console.log(1)
  349. $(newData).each(function(i, n) {
  350. if(n.AreaName=='安阳市'){
  351. n.AreaName="市区"
  352. }
  353. // if(n.AreaName.indexOf('安阳市') != -1) {
  354. // $(".AY_num").html(n.SLCount)
  355. // }
  356. // if(n.AreaName.indexOf('文峰区') != -1) {
  357. // $(".WFQ_num").html(n.SLCount)
  358. // }
  359. // if(n.AreaName.indexOf('北关区') != -1) {
  360. // $(".BGQ_num").html(n.SLCount)
  361. // }
  362. // if(n.AreaName.indexOf('殷都区') != -1) {
  363. // $(".YDQ_num").html(n.SLCount)
  364. // }
  365. // if(n.AreaName.indexOf('龙安区') != -1) {
  366. // $(".LAQ_num").html(n.SLCount)
  367. // }
  368. // if(n.AreaName.indexOf('安阳县') != -1) {
  369. // $(".AYX_num").html(n.SLCount)
  370. // }
  371. // if(n.AreaName.indexOf('汤阴县') != -1) {
  372. // $(".TYX_num").text(n.SLCount)
  373. // }
  374. // if(n.AreaName.indexOf('内黄县') != -1) {
  375. // $(".NHX_num").html(n.SLCount)
  376. // }
  377. // if(n.AreaName.indexOf('滑县') != -1) {
  378. // $(".HX_num").html(n.SLCount)
  379. // }
  380. // if(n.AreaName.indexOf('林州市') != -1) {
  381. // $(".LZS_num").html(n.SLCount)
  382. // }
  383. if(floag==true){
  384. $("#det_ult").html('')
  385. $(newData).each(function(i, n) {
  386. if(i<10){
  387. var str=' <li class="orderli"><img src="img/num_icon.png" alt="" /><p class="num_word"><span>'+n.AreaName+'</span><span class="AY_num">'+n.SLCount+'</span></p></li>';
  388. var a=$(str)
  389. a.appendTo($("#det_ult"))
  390. }
  391. })
  392. floag=false
  393. }
  394. if(n.AreaName.indexOf('总计') != -1) {
  395. $(".allSLCount").html(n.SLCount); //受理量
  396. $(".allJACount").html(n.JACount); //结案量
  397. //$(".allJARate").html(n.JARate); //结案量
  398. $(".allJARate").html("93%"); //结案量
  399. $(".allMYRate").html('94.09%'); //满意度
  400. }
  401. })
  402. }
  403. }
  404. });
  405. }
  406. function aa(){
  407. }
  408. //第二屏
  409. function twoScreen(start, end, areaTwoVal) {
  410. // if(!areaTwoVal) {
  411. // areaTwoVal = "sqs12345"
  412. // }
  413. $.ajax({
  414. type: "get",
  415. url: huayi.config.callcenter_url + "info/GetSourceByDateNew",
  416. async: true,
  417. dataType: 'json',
  418. data: {
  419. start: start,
  420. end: end,
  421. branchcode: areaTwoVal
  422. },
  423. success: function(data) {
  424. if(data.state.toLowerCase() == 'success') {
  425. $('.orderSource ul li .rectangle').remove();
  426. var con = data.data;
  427. var num=0
  428. var sourceText = ['短信平台','连线政府','人民网','APP','省12345平台','市长电话','市长信箱','微信']
  429. $(con).each(function(i, n) {
  430. if(sourceText.indexOf(n.Source)===-1){
  431. return
  432. }
  433. var str = '<div class="source_kuang rectangle">' +
  434. '<div class="pbout">' +
  435. '<div class="percent_box">' +
  436. '<div class="percent_out"></div> ' +
  437. ' <div class="percent_in"></div>' +
  438. ' <div class="percent_word"><p>' + n.Rate.split('%')[0] + '%' +'</p><p style="margin-top: 30px;">占总量</p>' +
  439. '</div>' +
  440. '</div>' +
  441. '</div>' +
  442. '<p class="num_word nw">' +
  443. '<span>' + n.Source + '</span><span>' + n.Count + '</span>' +
  444. '</p>' +
  445. '</div>'
  446. $('.orderSource ul li').eq(num).prepend(str)
  447. num++
  448. })
  449. }
  450. }
  451. });
  452. }
  453. //第三屏
  454. function threeScreen(sd,areaTwoVal) {
  455. //alert(sd)
  456. $.ajax({
  457. type: "get",
  458. url: huayi.config.callcenter_url + "Info/GetTypeCountNew",
  459. async: true,
  460. dataType: 'json',
  461. data: {
  462. date: sd,
  463. branchcode: areaTwoVal
  464. },
  465. success: function(data) {
  466. if(data.state.toLowerCase() == 'success') {
  467. $('.orderTtype_Con ul').html('');
  468. // layer.close(index);
  469. var newDatas =data.data ;
  470. var con =newDatas.sort(compare("TotalCount"))
  471. var img_name = '';
  472. $(con).each(function(i, n) {
  473. if(n.TypeName.indexOf('咨询') != -1) {
  474. img_name = 'order_ZX.png'
  475. }
  476. if(n.TypeName.indexOf('求助') != -1) {
  477. img_name = 'order_QZ.png'
  478. }
  479. if(n.TypeName.indexOf('投诉') != -1) {
  480. img_name = 'order_TS.png'
  481. }
  482. if(n.TypeName.indexOf('建议') != -1) {
  483. img_name = 'order_JY.png'
  484. }
  485. if(n.TypeName.indexOf('表扬') != -1) {
  486. img_name = 'order_BY.png'
  487. }
  488. if(n.TypeName.indexOf('其他') != -1) {
  489. img_name = 'order_QT.png'
  490. }
  491. $('<li>' +
  492. '<div class="typeWord">' + n.TypeName + '</div>' +
  493. '<img src="img/' + img_name + '" alt="" />' +
  494. '<p class="typeWord_line">数据展示</p>' +
  495. '<p class="order_count">' + n.DayCount + '</p>' +
  496. '<p class="typeWord_line">今日' + n.TypeName + '量</p>' +
  497. '<p class="order_count">' + n.MonthCount + '</p>' +
  498. '<p class="typeWord_line">本月' + n.TypeName + '量</p>' +
  499. '<p class="order_count">' + n.TotalCount + '</p>' +
  500. '<p class="typeWord_line">' + n.TypeName + '总量</p>' +
  501. '<div class="persent_box">' +
  502. '<div class="persent_kuang">' + n.Percent + '</div>' +
  503. '</div>' +
  504. '<p class="persent_word">总量占比</p>' +
  505. '</li>').appendTo('.orderTtype_Con ul');
  506. })
  507. }
  508. }
  509. });
  510. }
  511. //第五屏js
  512. function fiveScreen(sd,ed,areaTwoVal) {
  513. // if(!sd){
  514. // sd="2019-11-01"
  515. // }if(!ed){
  516. // ed="2019-11-30"
  517. // }
  518. keyWord(sd, ed,areaTwoVal);
  519. }
  520. $(".depart").change(function() {
  521. keyWordDetail($('#test6').val() && $('#test6').val().split(' ~ ')[0], $('#test6').val() && $('#test6').val().split(' ~ ')[1],$(".areaFive").val());
  522. })
  523. // 第二屏
  524. $(".areaTwo").change(function() {
  525. var areaTwoVal=$(this).val();
  526. twoScreen($('#time2').val() && $('#time2').val().split(' ~ ')[0], $('#time2').val() && $('#time2').val().split(' ~ ')[1],areaTwoVal);
  527. satisfaction($('#time2').val() && $('#time2').val().split(' ~ ')[0], $('#time2').val() && $('#time2').val().split(' ~ ')[1],areaTwoVal)
  528. });
  529. //第三屏
  530. $(".areaThree").change(function() {
  531. var areaTwoVal=$(this).val();
  532. threeScreen($('#time3').val(),areaTwoVal);
  533. });
  534. //第五屏
  535. $(".areaFive").change(function() {
  536. var areaTwoVal=$(this).val();
  537. fiveScreen($('#test6').val() && $('#test6').val().split(' ~ ')[0], $('#test6').val() && $('#test6').val().split(' ~ ')[1],areaTwoVal);
  538. deprtment ()
  539. });
  540. //部门下拉框
  541. function deprtment () {
  542. $.getJSON( huayi.config.callcenter_url +"info/GetDeptList",
  543. {
  544. branchcode: $(".areaFive").val()
  545. },
  546. function(result) {
  547. if(result.state.toLowerCase() == "success") {
  548. goodslist = result.data;
  549. $(".depart").empty();
  550. $('<option value="">请选择部门</option>').appendTo($(".depart"));
  551. $(goodslist).each(function(i, n) {
  552. $('<option value="' + n.F_DeptId
  553. + '">' + n.F_DeptName
  554. + '</option>').appendTo($(".depart"));
  555. })
  556. }
  557. });
  558. }
  559. //区县筛选
  560. //areaSelect ();
  561. function areaSelect () {
  562. $.getJSON( huayi.config.callcenter_url +"CountyBranch/GetBranchListS", function(result) {
  563. if(result.state.toLowerCase() == "success") {
  564. goodslist = result.data;
  565. // 第五屏
  566. $(".areaFive").empty();
  567. $(goodslist).each(function(i, n) {
  568. $('<option value="' + n.F_Code
  569. + '">' + n.F_Name
  570. + '</option>').appendTo($(".areaFive"));
  571. });
  572. //第3屏
  573. $(".areaThree").empty();
  574. $(goodslist).each(function(i, n) {
  575. $('<option value="' + n.F_Code
  576. + '">' + n.F_Name
  577. + '</option>').appendTo($(".areaThree"));
  578. });
  579. //第2屏
  580. $(".areaTwo").empty();
  581. $(goodslist).each(function(i, n) {
  582. $('<option value="' + n.F_Code
  583. + '">' + n.F_Name
  584. + '</option>').appendTo($(".areaTwo"));
  585. });
  586. }
  587. });
  588. }
  589. // 左侧关键词
  590. function keyWord(sd, ed,areaTwoVal) {
  591. $.ajax({
  592. type: "get",
  593. url: huayi.config.callcenter_url + "info/GetKeyCountRankByDate",
  594. async: true,
  595. dataType: 'json',
  596. data: {
  597. start: sd,
  598. end: ed,
  599. branchcode: areaTwoVal
  600. },
  601. success: function(data) {
  602. if(data.state.toLowerCase() == 'success') {
  603. var con = data.data.reverse();
  604. if (con.length>0) {
  605. // $(".keyW_t").text(con[0].TypeName)
  606. $('.tagcloud').html('');
  607. $(con).each(function(k, j) {
  608. if(k < 19) {
  609. var strs = '<div index="'+j.Id+'" class="tagcloud_bj">' +
  610. '<p class="tag_title">' + j.TypeName + '</p>' +
  611. '<p class="imgs">' + j.Count + '</p>' +
  612. '</div>'
  613. $('.tagcloud').append(strs);
  614. }
  615. })
  616. $(".tagcloud div:first-child").removeClass("tagcloud_bj");
  617. $(".tagcloud div:first-child").addClass("tagcloud_bjShine");
  618. keyWordDetail(sd, ed,areaTwoVal);
  619. }else{
  620. $('.tagcloud').html('');
  621. }
  622. }
  623. }
  624. });
  625. }
  626. // 右侧部门
  627. function keyWordDetail(sd, ed,areaTwoVal) {
  628. $.ajax({
  629. type: "get",
  630. url: huayi.config.callcenter_url + "info/GetDeptKeyCountByDateNew",
  631. async: true,
  632. dataType: 'json',
  633. data: {
  634. start: sd,
  635. end: ed,
  636. branchcode: areaTwoVal,
  637. deptid: $('.depart').val(),
  638. keyid: $(".tagcloud_bjShine").eq(0).attr("index")
  639. },
  640. success: function(data) {
  641. if(data.state.toLowerCase() == 'success') {
  642. $('.scroll_table tbody').html('');
  643. var con = data.data;
  644. $(con).each(function (j, n) {
  645. var rate = '';
  646. if (n.rate) { rate = n.rate;}
  647. var str = '<tr><td>' + n.deptname + '</td><td>' + n.acceptcount + '</td><td>' + rate + '</td></tr>'
  648. $('.scroll_table tbody').append(str);
  649. })
  650. $(".scroll_table").Scroll({
  651. line: 1,
  652. speed: 500,
  653. timer: 2000
  654. });
  655. }
  656. }
  657. });
  658. }
  659. $(".tagcloud").on("click","div",function(){
  660. $(".tagcloud div").addClass("tagcloud_bj");
  661. $(".tagcloud div").removeClass("tagcloud_bjShine");
  662. $(this).removeClass("tagcloud_bj");
  663. $(this).addClass("tagcloud_bjShine");
  664. keyWordDetail($('#test6').val() && $('#test6').val().split(' ~ ')[0], $('#test6').val() && $('#test6').val().split(' ~ ')[1],$(".areaFive").val());
  665. });
  666. function Ajax() {
  667. oneScreen($('#time1').val() && $('#time1').val().split(' ~ ')[0], $('#time1').val() && $('#time1').val().split(' ~ ')[1])
  668. twoScreen($('#time2').val() && $('#time2').val().split(' ~ ')[0], $('#time2').val() && $('#time2').val().split(' ~ ')[1])
  669. satisfaction($('#time2').val() && $('#time2').val().split(' ~ ')[0], $('#time2').val() && $('#time2').val().split(' ~ ')[1])
  670. threeScreen($('#time3').val(),$(".areaThree").val());
  671. fiveScreen($('#test6').val() && $('#test6').val().split(' ~ ')[0], $('#test6').val() && $('#test6').val().split(' ~ ')[1],$(".areaFive").val())
  672. //第五 屏 渠道来源
  673. var areaOneVal = helper.cookies.get("areaOneVal");
  674. var areaOneText = helper.cookies.get("areaOneText");
  675. partThree($('#time3').val() && $('#time3').val().split(' ~ ')[0], $('#time3').val() && $('#time3').val().split(' ~ ')[1],areaOneVal)
  676. // 接单 部门
  677. partTwo($('#phone_time').val() && $('#phone_time').val().split(' ~ ')[0], $('#phone_time').val() && $('#phone_time').val().split(' ~ ')[1],areaOneVal);
  678. // 话务数量
  679. parthuawu($('#time3').val(),areaOneVal);
  680. // 投诉举报
  681. partcomplain($('#time3').val() && $('#time3').val().split(' ~ ')[0], $('#time3').val() && $('#time3').val().split(' ~ ')[1],areaOneVal)
  682. }
  683. function loginTimeLimit(){
  684. $.ajax({
  685. type:"get",
  686. url: huayi.config.callcenter_url + "Login/GetAuAuthDate",
  687. async:false,
  688. success:function(res){
  689. var res=$.parseJSON(res)
  690. if(res.state== "success") {
  691. } else {
  692. layer.confirm(res.message, {
  693. icon: 2,
  694. btn: ['确定'],
  695. yes: function(index, layero) {
  696. $("#wrap").hide()
  697. $(".timeLimit-wrapper").show()
  698. $(".nav_middle ul a").attr('href', '#')
  699. layer.close(index)
  700. },
  701. });
  702. }
  703. }
  704. });
  705. }
  706. // 渠道来源
  707. var part3 = echarts.init(document.getElementById('part3'));
  708. part3.setOption({
  709. color: ['#6ce7ac', '#6a91e0', '#ceba5f', '#cb5f79', '#ae765a', '#569d4e', '#7d55ba', '#ce5aba', '#355cdd', '#44c1c6', '#ceba5e', '#c64444'],
  710. title: {
  711. text: '各区县占比',
  712. x: 'center',
  713. y: '45%',
  714. textStyle: {
  715. fontWeight: 'normal',
  716. fontSize: 16,
  717. color: '#fff'
  718. }
  719. },
  720. tooltip: {
  721. trigger: 'item',
  722. formatter: "{a} <br/>{b} : {c} ({d}%)",
  723. axisPointer: {
  724. crossStyle: {
  725. color: '#fff'
  726. }
  727. }
  728. },
  729. legend: {
  730. // orient: 'vertical',
  731. bottom: 'bottom',
  732. data: ['安阳县','北关区','林州市','龙安区','内黄县','市区','汤阴县','安阳县','文峰区','殷都区','滑县'],
  733. textStyle: {
  734. color: '#fff'
  735. }
  736. },
  737. series: [{
  738. name: '数据',
  739. type: 'pie',
  740. radius: ['30%', '60%'],
  741. center: ['50%', '50%'],
  742. data: [],
  743. itemStyle: {
  744. emphasis: {
  745. shadowBlur: 10,
  746. shadowOffsetX: 0,
  747. shadowColor: 'rgba(0, 0, 0, 0.5)'
  748. },
  749. normal: {
  750. label: {
  751. show: true,
  752. // formatter: '{b} : {c} ({d}%)'
  753. formatter: '{d}%'
  754. },
  755. labelLine: {
  756. show: true
  757. }
  758. }
  759. },
  760. label: {
  761. normal: {
  762. textStyle: {
  763. color: '#fff'
  764. }
  765. }
  766. }
  767. }]
  768. });
  769. function partThree(start, end,areaOneVal) {
  770. // var index = layer.load(1, {
  771. // shade: [0.5, '#030303'] //0.1透明度的白色背景
  772. // });
  773. $.ajax({
  774. type: "get",
  775. url: huayi.config.callcenter_url + "info/GetAreaCountByDate",
  776. async: true,
  777. dataType: 'json',
  778. data: {
  779. start: start,
  780. end: end,
  781. branchcode:areaOneVal
  782. },
  783. success: function(data) {
  784. if(data.state.toLowerCase() == 'success') {
  785. // layer.close(index);
  786. $('.complaint_typeL').html('');
  787. $('.complaint_typeR').html('');
  788. var con = data.data;
  789. var part_1_legend = [];
  790. var part_1_ser = [];
  791. $(con).each(function(i, n) {
  792. part_1_legend.push(n.AreaName)
  793. var part_1_obj = {};
  794. part_1_obj.value = n.Count;
  795. part_1_obj.name = n.AreaName;
  796. part_1_ser.push(part_1_obj)
  797. if(n.AreaName.indexOf('城乡一体') != -1) {
  798. n.AreaName = "城乡示范"
  799. }
  800. var str = '<li>' +
  801. '<span class="type_name">' + n.AreaName + '</span> <span class="type_count">' + n.Count + '</span>' +
  802. '</li>'
  803. if(i <= 5) {
  804. $(str).appendTo('.complaint_typeL');
  805. } else if(i <= 11&&i >5){
  806. $(str).appendTo('.complaint_typeR');
  807. }
  808. })
  809. part3.setOption({
  810. // legend: {
  811. // selected: {
  812. // '当即办理': false
  813. // }
  814. // },
  815. series: [{
  816. data: part_1_ser
  817. }]
  818. })
  819. }
  820. }
  821. });
  822. }
  823. // 接单部门
  824. //表格滚动
  825. var area = document.getElementById('scroll_table');
  826. var iliHeight = 34; //单行滚动的高度
  827. var speed = 20; //滚动的速度
  828. var time;
  829. var delay = 1000;
  830. area.scrollTop = 0;
  831. area.innerHTML += area.innerHTML; //克隆一份一样的内容
  832. function startScroll() {
  833. time = setInterval("scrollUp()", speed);
  834. area.scrollTop++;
  835. console.log(area.scrollTop);
  836. }
  837. function scrollUp() {
  838. if(area.scrollTop % iliHeight == 0) {
  839. clearInterval(time);
  840. setTimeout(startScroll, delay);
  841. } else {
  842. area.scrollTop++;
  843. if(area.scrollTop >= area.scrollHeight / 2) {
  844. area.scrollTop = 0;
  845. }
  846. }
  847. }
  848. setTimeout(startScroll, delay)
  849. function partTwo(starts, ends, areaOneVal) {
  850. $.ajax({
  851. type: "get",
  852. url: huayi.config.callcenter_url + "Info/GetDeptCountByDateNew",
  853. dataType: 'json',
  854. async: true,
  855. data: {
  856. start: starts,
  857. end: ends,
  858. deptid: $('.depart').val(),
  859. branchcode:areaOneVal
  860. },
  861. success: function(data) {
  862. if(data.state.toLowerCase() == 'success') {
  863. $('.thead_six tr').html('');
  864. $('#scroll_table tbody').html('');
  865. var con = data.data;
  866. var thead_six = con[0];
  867. console.log(thead_six)
  868. $.each(thead_six, function(k, val) {
  869. $('<td style="width:55px">' + k + '</td>').appendTo('.thead_six tr');
  870. })
  871. $(con).each(function(j, n) {
  872. var str = '<tr>'
  873. $.each(thead_six, function(j, m) {
  874. $.each(n, function(k, val) {
  875. if(j == k) {
  876. if(val == '') {
  877. val = 0;
  878. }
  879. str += '<td style="width:53px">' + val + '</td>'
  880. }
  881. })
  882. })
  883. str += '</tr>';
  884. $('#scroll_table tbody').append(str);
  885. })
  886. }
  887. }
  888. });
  889. }
  890. // 话务数量
  891. //part3
  892. var todyPhoneCount = echarts.init(document.getElementById('todyPhoneCount'));
  893. todyPhoneCount.setOption({
  894. tooltip: {
  895. trigger: 'axis',
  896. axisPointer: {
  897. type: false,
  898. label: {
  899. show: true,
  900. backgroundColor: '#030917'
  901. }
  902. },
  903. },
  904. xAxis: {
  905. name: '类型',
  906. data: ["话务量(通)", "来电(通)", "接通量(通)", "平均通话时长(秒)","排队人数"],
  907. axisLine: {
  908. lineStyle: {
  909. color: '#3061a2'
  910. }
  911. },
  912. axisTick: {
  913. alignWithLabel: true,
  914. show: false
  915. },
  916. axisLabel: { //横轴字体颜色
  917. show: true,
  918. textStyle: {
  919. color: '#ffffff'
  920. }
  921. }
  922. },
  923. yAxis: {
  924. name: '数量',
  925. splitLine: {
  926. show: false
  927. },
  928. axisLine: {
  929. lineStyle: {
  930. color: '#3061a2'
  931. }
  932. },
  933. axisLabel: { //横轴字体颜色
  934. show: true,
  935. textStyle: {
  936. color: '#eff0f4'
  937. }
  938. }
  939. },
  940. series: [{
  941. name: '数量',
  942. type: 'bar',
  943. barWidth: 18,
  944. itemStyle: {
  945. normal: {
  946. color: function(params) {
  947. // build a color map as your need.
  948. var colorList = [
  949. '#368cab', '#54b793', '#4b6ab0', '#2531a9','#a93d19'
  950. ];
  951. return colorList[params.dataIndex]
  952. }
  953. }
  954. },
  955. label: {
  956. normal: {
  957. show: true,
  958. position: 'top', //顶部数据显示位置
  959. textStyle: {
  960. color: '#fff' //顶部数据颜色
  961. },
  962. formatter: '{c}' // 这里是数据展示的时候显示的数据
  963. }
  964. },
  965. data: []
  966. }]
  967. });
  968. function parthuawu(dates,areaOneVal) {
  969. $.ajax({
  970. type: "get",
  971. url: huayi.config.callcenter_url + "info/GetTelCountByDate",
  972. async: true,
  973. dataType: "json",
  974. data: {
  975. date: dates,
  976. branchcode:areaOneVal
  977. },
  978. success: function(data) {
  979. if(data.state.toLowerCase() == "success") {
  980. var con = data.data;
  981. con.person=person
  982. todyPhoneCount.setOption({
  983. series: [{
  984. data: [con.hwcon, con.lhcon, con.jtcon, con.pjthtimes,con.person]
  985. }]
  986. })
  987. }
  988. }
  989. });
  990. }
  991. // 投诉举报
  992. var partcom = echarts.init(document.getElementById('partcom'));
  993. partcom.setOption({
  994. color: ['#6ce7ac', '#6a91e0', '#ceba5f', '#cb5f79', '#ae765a', '#569d4e'],
  995. title: {
  996. text: '各类型占比',
  997. x: '28%',
  998. y: '45%',
  999. textStyle: {
  1000. fontWeight: 'normal',
  1001. fontSize: 16,
  1002. color: '#fff'
  1003. }
  1004. },
  1005. tooltip: {
  1006. trigger: 'item',
  1007. formatter: "{a} <br/>{b} : {c} ({d}%)",
  1008. axisPointer: {
  1009. crossStyle: {
  1010. color: '#fff'
  1011. }
  1012. }
  1013. },
  1014. legend: {
  1015. // orient: 'vertical',
  1016. bottom: 'bottom',
  1017. data: ['表扬','建议','投诉','举报','其他','求助','咨询'],
  1018. textStyle: {
  1019. color: '#fff'
  1020. }
  1021. },
  1022. series: [{
  1023. name: '数据',
  1024. type: 'pie',
  1025. radius: ['30%', '60%'],
  1026. center: ['40%', '50%'],
  1027. data: [],
  1028. itemStyle: {
  1029. emphasis: {
  1030. shadowBlur: 10,
  1031. shadowOffsetX: 0,
  1032. shadowColor: 'rgba(0, 0, 0, 0.5)'
  1033. },
  1034. normal: {
  1035. label: {
  1036. show: true,
  1037. // formatter: '{b} : {c} ({d}%)'
  1038. formatter: '{d}%'
  1039. },
  1040. labelLine: {
  1041. show: true
  1042. }
  1043. }
  1044. },
  1045. label: {
  1046. normal: {
  1047. textStyle: {
  1048. color: '#fff'
  1049. }
  1050. }
  1051. }
  1052. }]
  1053. });
  1054. function partcomplain(start, end,areaOneVal) {
  1055. // var index = layer.load(1, {
  1056. // shade: [0.5, '#030303'] //0.1透明度的白色背景
  1057. // });
  1058. $.ajax({
  1059. type: "get",
  1060. url: huayi.config.callcenter_url + "info/GetTypeCountByDate",
  1061. async: true,
  1062. dataType: 'json',
  1063. data: {
  1064. start: start,
  1065. end: end,
  1066. branchcode:areaOneVal
  1067. },
  1068. success: function(data) {
  1069. if(data.state.toLowerCase() == 'success') {
  1070. // layer.close(index);
  1071. $('.complaint_type').html('');
  1072. var con = data.data;
  1073. var part_1_legend = [];
  1074. var part_1_ser = [];
  1075. $(con).each(function(i, n) {
  1076. part_1_legend.push(n.TypeName)
  1077. var part_1_obj = {};
  1078. part_1_obj.value = n.Count;
  1079. part_1_obj.name = n.TypeName;
  1080. part_1_ser.push(part_1_obj)
  1081. $('<li>' +
  1082. '<span class="type_name">' + n.TypeName + '</span> <span class="type_count">' + n.Count + '</span>' +
  1083. '</li>').appendTo('.complaint_type')
  1084. })
  1085. partcom.setOption({
  1086. // legend: {
  1087. // data: part_1_legend
  1088. // },
  1089. series: [{
  1090. data: part_1_ser
  1091. }]
  1092. })
  1093. }
  1094. }
  1095. });
  1096. }