暂无描述

index.js 30KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182
  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. token: $.cookie("token"),
  342. start: sd,
  343. end: ed,
  344. },
  345. success: function(data) {
  346. if(data.state.toLowerCase() == 'success') {
  347. var con = data.data;
  348. newData = con.sort(compare("SLCount"));
  349. console.log(1)
  350. $(newData).each(function(i, n) {
  351. if(n.AreaName=='安阳市'){
  352. n.AreaName="市区"
  353. }
  354. // if(n.AreaName.indexOf('安阳市') != -1) {
  355. // $(".AY_num").html(n.SLCount)
  356. // }
  357. // if(n.AreaName.indexOf('文峰区') != -1) {
  358. // $(".WFQ_num").html(n.SLCount)
  359. // }
  360. // if(n.AreaName.indexOf('北关区') != -1) {
  361. // $(".BGQ_num").html(n.SLCount)
  362. // }
  363. // if(n.AreaName.indexOf('殷都区') != -1) {
  364. // $(".YDQ_num").html(n.SLCount)
  365. // }
  366. // if(n.AreaName.indexOf('龙安区') != -1) {
  367. // $(".LAQ_num").html(n.SLCount)
  368. // }
  369. // if(n.AreaName.indexOf('安阳县') != -1) {
  370. // $(".AYX_num").html(n.SLCount)
  371. // }
  372. // if(n.AreaName.indexOf('汤阴县') != -1) {
  373. // $(".TYX_num").text(n.SLCount)
  374. // }
  375. // if(n.AreaName.indexOf('内黄县') != -1) {
  376. // $(".NHX_num").html(n.SLCount)
  377. // }
  378. // if(n.AreaName.indexOf('滑县') != -1) {
  379. // $(".HX_num").html(n.SLCount)
  380. // }
  381. // if(n.AreaName.indexOf('林州市') != -1) {
  382. // $(".LZS_num").html(n.SLCount)
  383. // }
  384. if(floag==true){
  385. $("#det_ult").html('')
  386. $(newData).each(function(i, n) {
  387. if(i<10){
  388. 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>';
  389. var a=$(str)
  390. a.appendTo($("#det_ult"))
  391. }
  392. })
  393. floag=false
  394. }
  395. if(n.AreaName.indexOf('总计') != -1) {
  396. $(".allSLCount").html(n.SLCount); //受理量
  397. $(".allJACount").html(n.JACount); //结案量
  398. //$(".allJARate").html(n.JARate); //结案量
  399. $(".allJARate").html("93%"); //结案量
  400. $(".allMYRate").html('94.09%'); //满意度
  401. }
  402. })
  403. }
  404. }
  405. });
  406. }
  407. function aa(){
  408. }
  409. //第二屏
  410. function twoScreen(start, end, areaTwoVal) {
  411. // if(!areaTwoVal) {
  412. // areaTwoVal = "sqs12345"
  413. // }
  414. $.ajax({
  415. type: "get",
  416. url: huayi.config.callcenter_url + "info/GetSourceByDateNew",
  417. async: true,
  418. dataType: 'json',
  419. data: {
  420. token: $.cookie("token"),
  421. start: start,
  422. end: end,
  423. branchcode: areaTwoVal
  424. },
  425. success: function(data) {
  426. if(data.state.toLowerCase() == 'success') {
  427. //layer.close(index);
  428. $('.orderSource ul li .rectangle').remove();
  429. var con = data.data;
  430. var obj=con[0];
  431. var con_list=[];
  432. con_list=con.shift();
  433. con.splice(3,0,obj);
  434. var Percent;
  435. $(con).each(function(i, n) {
  436. // if(n.Source.indexOf('信箱') != -1) {
  437. // n.Source = '市长信箱'
  438. // }
  439. // if(n.Source.indexOf('APP') != -1) {
  440. // n.Source = 'APP'
  441. // }
  442. // if(n.Source.indexOf('政务') != -1) {
  443. // n.Source = '政务网'
  444. // }
  445. var str = '<div class="source_kuang rectangle">' +
  446. '<div class="pbout">' +
  447. '<div class="percent_box">' +
  448. '<div class="percent_out"></div> ' +
  449. ' <div class="percent_in"></div>' +
  450. ' <div class="percent_word"><p>' + n.Rate.split('%')[0] + '%' +'</p><p style="margin-top: 30px;">占总量</p>' +
  451. '</div>' +
  452. '</div>' +
  453. '</div>' +
  454. '<p class="num_word nw">' +
  455. '<span>' + n.Source + '</span><span>' + n.Count + '</span>' +
  456. '</p>' +
  457. '</div>'
  458. $('.orderSource ul li').eq(i).prepend(str)
  459. })
  460. }
  461. }
  462. });
  463. }
  464. //第三屏
  465. function threeScreen(sd,areaTwoVal) {
  466. //alert(sd)
  467. $.ajax({
  468. type: "get",
  469. url: huayi.config.callcenter_url + "Info/GetTypeCountNew",
  470. async: true,
  471. dataType: 'json',
  472. data: {
  473. token: $.cookie("token"),
  474. date: sd,
  475. branchcode: areaTwoVal
  476. },
  477. success: function(data) {
  478. if(data.state.toLowerCase() == 'success') {
  479. $('.orderTtype_Con ul').html('');
  480. // layer.close(index);
  481. var newDatas =data.data ;
  482. var con =newDatas.sort(compare("TotalCount"))
  483. var img_name = '';
  484. $(con).each(function(i, n) {
  485. if(n.TypeName.indexOf('咨询') != -1) {
  486. img_name = 'order_ZX.png'
  487. }
  488. if(n.TypeName.indexOf('求助') != -1) {
  489. img_name = 'order_QZ.png'
  490. }
  491. if(n.TypeName.indexOf('投诉') != -1) {
  492. img_name = 'order_TS.png'
  493. }
  494. if(n.TypeName.indexOf('建议') != -1) {
  495. img_name = 'order_JY.png'
  496. }
  497. if(n.TypeName.indexOf('表扬') != -1) {
  498. img_name = 'order_BY.png'
  499. }
  500. if(n.TypeName.indexOf('其他') != -1) {
  501. img_name = 'order_QT.png'
  502. }
  503. $('<li>' +
  504. '<div class="typeWord">' + n.TypeName + '</div>' +
  505. '<img src="img/' + img_name + '" alt="" />' +
  506. '<p class="typeWord_line">数据展示</p>' +
  507. '<p class="order_count">' + n.DayCount + '</p>' +
  508. '<p class="typeWord_line">今日' + n.TypeName + '量</p>' +
  509. '<p class="order_count">' + n.MonthCount + '</p>' +
  510. '<p class="typeWord_line">本月' + n.TypeName + '量</p>' +
  511. '<p class="order_count">' + n.TotalCount + '</p>' +
  512. '<p class="typeWord_line">' + n.TypeName + '总量</p>' +
  513. '<div class="persent_box">' +
  514. '<div class="persent_kuang">' + n.Percent + '</div>' +
  515. '</div>' +
  516. '<p class="persent_word">总量占比</p>' +
  517. '</li>').appendTo('.orderTtype_Con ul');
  518. })
  519. }
  520. }
  521. });
  522. }
  523. //第五屏js
  524. function fiveScreen(sd,ed,areaTwoVal) {
  525. // if(!sd){
  526. // sd="2019-11-01"
  527. // }if(!ed){
  528. // ed="2019-11-30"
  529. // }
  530. keyWord(sd, ed,areaTwoVal);
  531. }
  532. $(".depart").change(function() {
  533. keyWordDetail($('#test6').val() && $('#test6').val().split(' ~ ')[0], $('#test6').val() && $('#test6').val().split(' ~ ')[1],$(".areaFive").val());
  534. })
  535. // 第二屏
  536. $(".areaTwo").change(function() {
  537. var areaTwoVal=$(this).val();
  538. twoScreen($('#time2').val() && $('#time2').val().split(' ~ ')[0], $('#time2').val() && $('#time2').val().split(' ~ ')[1],areaTwoVal);
  539. satisfaction($('#time2').val() && $('#time2').val().split(' ~ ')[0], $('#time2').val() && $('#time2').val().split(' ~ ')[1],areaTwoVal)
  540. });
  541. //第三屏
  542. $(".areaThree").change(function() {
  543. var areaTwoVal=$(this).val();
  544. threeScreen($('#time3').val(),areaTwoVal);
  545. });
  546. //第五屏
  547. $(".areaFive").change(function() {
  548. var areaTwoVal=$(this).val();
  549. fiveScreen($('#test6').val() && $('#test6').val().split(' ~ ')[0], $('#test6').val() && $('#test6').val().split(' ~ ')[1],areaTwoVal);
  550. deprtment ()
  551. });
  552. //部门下拉框
  553. function deprtment () {
  554. $.getJSON( huayi.config.callcenter_url +"info/GetDeptList",
  555. {
  556. token: $.cookie("token"),
  557. branchcode: $(".areaFive").val()
  558. },
  559. function(result) {
  560. if(result.state.toLowerCase() == "success") {
  561. goodslist = result.data;
  562. $(".depart").empty();
  563. $('<option value="">请选择部门</option>').appendTo($(".depart"));
  564. $(goodslist).each(function(i, n) {
  565. $('<option value="' + n.F_DeptId
  566. + '">' + n.F_DeptName
  567. + '</option>').appendTo($(".depart"));
  568. })
  569. }
  570. });
  571. }
  572. //区县筛选
  573. //areaSelect ();
  574. function areaSelect () {
  575. $.getJSON( huayi.config.callcenter_url +"CountyBranch/GetBranchListS", {token: $.cookie("token"),},function(result) {
  576. if(result.state.toLowerCase() == "success") {
  577. goodslist = result.data;
  578. // 第五屏
  579. $(".areaFive").empty();
  580. $(goodslist).each(function(i, n) {
  581. $('<option value="' + n.F_Code
  582. + '">' + n.F_Name
  583. + '</option>').appendTo($(".areaFive"));
  584. });
  585. //第3屏
  586. $(".areaThree").empty();
  587. $(goodslist).each(function(i, n) {
  588. $('<option value="' + n.F_Code
  589. + '">' + n.F_Name
  590. + '</option>').appendTo($(".areaThree"));
  591. });
  592. //第2屏
  593. $(".areaTwo").empty();
  594. $(goodslist).each(function(i, n) {
  595. $('<option value="' + n.F_Code
  596. + '">' + n.F_Name
  597. + '</option>').appendTo($(".areaTwo"));
  598. });
  599. }
  600. });
  601. }
  602. // 左侧关键词
  603. function keyWord(sd, ed,areaTwoVal) {
  604. $.ajax({
  605. type: "get",
  606. url: huayi.config.callcenter_url + "info/GetKeyCountRankByDate",
  607. async: true,
  608. dataType: 'json',
  609. data: {
  610. token: $.cookie("token"),
  611. start: sd,
  612. end: ed,
  613. branchcode: areaTwoVal
  614. },
  615. success: function(data) {
  616. if(data.state.toLowerCase() == 'success') {
  617. var con = data.data.reverse();
  618. if (con.length>0) {
  619. // $(".keyW_t").text(con[0].TypeName)
  620. $('.tagcloud').html('');
  621. $(con).each(function(k, j) {
  622. if(k < 19) {
  623. var strs = '<div index="'+j.Id+'" class="tagcloud_bj">' +
  624. '<p class="tag_title">' + j.TypeName + '</p>' +
  625. '<p class="imgs">' + j.Count + '</p>' +
  626. '</div>'
  627. $('.tagcloud').append(strs);
  628. }
  629. })
  630. $(".tagcloud div:first-child").removeClass("tagcloud_bj");
  631. $(".tagcloud div:first-child").addClass("tagcloud_bjShine");
  632. keyWordDetail(sd, ed,areaTwoVal);
  633. }else{
  634. $('.tagcloud').html('');
  635. }
  636. }
  637. }
  638. });
  639. }
  640. // 右侧部门
  641. function keyWordDetail(sd, ed,areaTwoVal) {
  642. $.ajax({
  643. type: "get",
  644. url: huayi.config.callcenter_url + "info/GetDeptKeyCountByDateNew",
  645. async: true,
  646. dataType: 'json',
  647. data: {
  648. token: $.cookie("token"),
  649. start: sd,
  650. end: ed,
  651. branchcode: areaTwoVal,
  652. deptid: $('.depart').val(),
  653. keyid: $(".tagcloud_bjShine").eq(0).attr("index")
  654. },
  655. success: function(data) {
  656. if(data.state.toLowerCase() == 'success') {
  657. $('.scroll_table tbody').html('');
  658. var con = data.data;
  659. $(con).each(function (j, n) {
  660. var rate = '';
  661. if (n.rate) { rate = n.rate;}
  662. var str = '<tr><td>' + n.deptname + '</td><td>' + n.acceptcount + '</td><td>' + rate + '</td></tr>'
  663. $('.scroll_table tbody').append(str);
  664. })
  665. $(".scroll_table").Scroll({
  666. line: 1,
  667. speed: 500,
  668. timer: 2000
  669. });
  670. }
  671. }
  672. });
  673. }
  674. $(".tagcloud").on("click","div",function(){
  675. $(".tagcloud div").addClass("tagcloud_bj");
  676. $(".tagcloud div").removeClass("tagcloud_bjShine");
  677. $(this).removeClass("tagcloud_bj");
  678. $(this).addClass("tagcloud_bjShine");
  679. keyWordDetail($('#test6').val() && $('#test6').val().split(' ~ ')[0], $('#test6').val() && $('#test6').val().split(' ~ ')[1],$(".areaFive").val());
  680. });
  681. function Ajax() {
  682. oneScreen($('#time1').val() && $('#time1').val().split(' ~ ')[0], $('#time1').val() && $('#time1').val().split(' ~ ')[1])
  683. twoScreen($('#time2').val() && $('#time2').val().split(' ~ ')[0], $('#time2').val() && $('#time2').val().split(' ~ ')[1])
  684. satisfaction($('#time2').val() && $('#time2').val().split(' ~ ')[0], $('#time2').val() && $('#time2').val().split(' ~ ')[1])
  685. threeScreen($('#time3').val(),$(".areaThree").val());
  686. fiveScreen($('#test6').val() && $('#test6').val().split(' ~ ')[0], $('#test6').val() && $('#test6').val().split(' ~ ')[1],$(".areaFive").val())
  687. //第五 屏 渠道来源
  688. var areaOneVal = helper.cookies.get("areaOneVal");
  689. var areaOneText = helper.cookies.get("areaOneText");
  690. partThree($('#time3').val() && $('#time3').val().split(' ~ ')[0], $('#time3').val() && $('#time3').val().split(' ~ ')[1],areaOneVal)
  691. // 接单 部门
  692. partTwo($('#phone_time').val() && $('#phone_time').val().split(' ~ ')[0], $('#phone_time').val() && $('#phone_time').val().split(' ~ ')[1],areaOneVal);
  693. // 话务数量
  694. parthuawu($('#time3').val(),areaOneVal);
  695. // 投诉举报
  696. partcomplain($('#time3').val() && $('#time3').val().split(' ~ ')[0], $('#time3').val() && $('#time3').val().split(' ~ ')[1],areaOneVal)
  697. }
  698. function loginTimeLimit(){
  699. $.ajax({
  700. type:"get",
  701. url: huayi.config.callcenter_url + "Login/GetAuAuthDate",
  702. async:false,
  703. data: {token: $.cookie("token"),},
  704. success:function(res){
  705. var res=$.parseJSON(res)
  706. if(res.state== "success") {
  707. } else {
  708. layer.confirm(res.message, {
  709. icon: 2,
  710. btn: ['确定'],
  711. yes: function(index, layero) {
  712. $("#wrap").hide()
  713. $(".timeLimit-wrapper").show()
  714. $(".nav_middle ul a").attr('href', '#')
  715. layer.close(index)
  716. },
  717. });
  718. }
  719. }
  720. });
  721. }
  722. // 渠道来源
  723. var part3 = echarts.init(document.getElementById('part3'));
  724. part3.setOption({
  725. color: ['#6ce7ac', '#6a91e0', '#ceba5f', '#cb5f79', '#ae765a', '#569d4e', '#7d55ba', '#ce5aba', '#355cdd', '#44c1c6', '#ceba5e', '#c64444'],
  726. title: {
  727. text: '各区县占比',
  728. x: 'center',
  729. y: '45%',
  730. textStyle: {
  731. fontWeight: 'normal',
  732. fontSize: 16,
  733. color: '#fff'
  734. }
  735. },
  736. tooltip: {
  737. trigger: 'item',
  738. formatter: "{a} <br/>{b} : {c} ({d}%)",
  739. axisPointer: {
  740. crossStyle: {
  741. color: '#fff'
  742. }
  743. }
  744. },
  745. legend: {
  746. // orient: 'vertical',
  747. bottom: 'bottom',
  748. data: ['安阳县','北关区','林州市','龙安区','内黄县','市区','汤阴县','安阳县','文峰区','殷都区','滑县'],
  749. textStyle: {
  750. color: '#fff'
  751. }
  752. },
  753. series: [{
  754. name: '数据',
  755. type: 'pie',
  756. radius: ['30%', '60%'],
  757. center: ['50%', '50%'],
  758. data: [],
  759. itemStyle: {
  760. emphasis: {
  761. shadowBlur: 10,
  762. shadowOffsetX: 0,
  763. shadowColor: 'rgba(0, 0, 0, 0.5)'
  764. },
  765. normal: {
  766. label: {
  767. show: true,
  768. // formatter: '{b} : {c} ({d}%)'
  769. formatter: '{d}%'
  770. },
  771. labelLine: {
  772. show: true
  773. }
  774. }
  775. },
  776. label: {
  777. normal: {
  778. textStyle: {
  779. color: '#fff'
  780. }
  781. }
  782. }
  783. }]
  784. });
  785. function partThree(start, end,areaOneVal) {
  786. // var index = layer.load(1, {
  787. // shade: [0.5, '#030303'] //0.1透明度的白色背景
  788. // });
  789. $.ajax({
  790. type: "get",
  791. url: huayi.config.callcenter_url + "info/GetAreaCountByDate",
  792. async: true,
  793. dataType: 'json',
  794. data: {
  795. token: $.cookie("token"),
  796. start: start,
  797. end: end,
  798. branchcode:areaOneVal
  799. },
  800. success: function(data) {
  801. if(data.state.toLowerCase() == 'success') {
  802. // layer.close(index);
  803. $('.complaint_typeL').html('');
  804. $('.complaint_typeR').html('');
  805. var con = data.data;
  806. var part_1_legend = [];
  807. var part_1_ser = [];
  808. $(con).each(function(i, n) {
  809. part_1_legend.push(n.AreaName)
  810. var part_1_obj = {};
  811. part_1_obj.value = n.Count;
  812. part_1_obj.name = n.AreaName;
  813. part_1_ser.push(part_1_obj)
  814. if(n.AreaName.indexOf('城乡一体') != -1) {
  815. n.AreaName = "城乡示范"
  816. }
  817. var str = '<li>' +
  818. '<span class="type_name">' + n.AreaName + '</span> <span class="type_count">' + n.Count + '</span>' +
  819. '</li>'
  820. if(i <= 5) {
  821. $(str).appendTo('.complaint_typeL');
  822. } else if(i <= 11&&i >5){
  823. $(str).appendTo('.complaint_typeR');
  824. }
  825. })
  826. part3.setOption({
  827. // legend: {
  828. // selected: {
  829. // '当即办理': false
  830. // }
  831. // },
  832. series: [{
  833. data: part_1_ser
  834. }]
  835. })
  836. }
  837. }
  838. });
  839. }
  840. // 接单部门
  841. //表格滚动
  842. var area = document.getElementById('scroll_table');
  843. var iliHeight = 34; //单行滚动的高度
  844. var speed = 20; //滚动的速度
  845. var time;
  846. var delay = 1000;
  847. area.scrollTop = 0;
  848. area.innerHTML += area.innerHTML; //克隆一份一样的内容
  849. function startScroll() {
  850. time = setInterval("scrollUp()", speed);
  851. area.scrollTop++;
  852. console.log(area.scrollTop);
  853. }
  854. function scrollUp() {
  855. if(area.scrollTop % iliHeight == 0) {
  856. clearInterval(time);
  857. setTimeout(startScroll, delay);
  858. } else {
  859. area.scrollTop++;
  860. if(area.scrollTop >= area.scrollHeight / 2) {
  861. area.scrollTop = 0;
  862. }
  863. }
  864. }
  865. setTimeout(startScroll, delay)
  866. function partTwo(starts, ends, areaOneVal) {
  867. $.ajax({
  868. type: "get",
  869. url: huayi.config.callcenter_url + "Info/GetDeptCountByDateNew",
  870. dataType: 'json',
  871. async: true,
  872. data: {
  873. token: $.cookie("token"),
  874. start: starts,
  875. end: ends,
  876. deptid: $('.depart').val(),
  877. branchcode:areaOneVal
  878. },
  879. success: function(data) {
  880. if(data.state.toLowerCase() == 'success') {
  881. $('.thead_six tr').html('');
  882. $('#scroll_table tbody').html('');
  883. var con = data.data;
  884. var thead_six = con[0];
  885. console.log(thead_six)
  886. $.each(thead_six, function(k, val) {
  887. $('<td style="width:55px">' + k + '</td>').appendTo('.thead_six tr');
  888. })
  889. $(con).each(function(j, n) {
  890. var str = '<tr>'
  891. $.each(thead_six, function(j, m) {
  892. $.each(n, function(k, val) {
  893. if(j == k) {
  894. if(val == '') {
  895. val = 0;
  896. }
  897. str += '<td style="width:53px">' + val + '</td>'
  898. }
  899. })
  900. })
  901. str += '</tr>';
  902. $('#scroll_table tbody').append(str);
  903. })
  904. }
  905. }
  906. });
  907. }
  908. // 话务数量
  909. //part3
  910. var todyPhoneCount = echarts.init(document.getElementById('todyPhoneCount'));
  911. todyPhoneCount.setOption({
  912. tooltip: {
  913. trigger: 'axis',
  914. axisPointer: {
  915. type: false,
  916. label: {
  917. show: true,
  918. backgroundColor: '#030917'
  919. }
  920. },
  921. },
  922. xAxis: {
  923. name: '类型',
  924. data: ["话务量(通)", "来电(通)", "接通量(通)", "平均通话时长(秒)","排队人数"],
  925. axisLine: {
  926. lineStyle: {
  927. color: '#3061a2'
  928. }
  929. },
  930. axisTick: {
  931. alignWithLabel: true,
  932. show: false
  933. },
  934. axisLabel: { //横轴字体颜色
  935. show: true,
  936. textStyle: {
  937. color: '#ffffff'
  938. }
  939. }
  940. },
  941. yAxis: {
  942. name: '数量',
  943. splitLine: {
  944. show: false
  945. },
  946. axisLine: {
  947. lineStyle: {
  948. color: '#3061a2'
  949. }
  950. },
  951. axisLabel: { //横轴字体颜色
  952. show: true,
  953. textStyle: {
  954. color: '#eff0f4'
  955. }
  956. }
  957. },
  958. series: [{
  959. name: '数量',
  960. type: 'bar',
  961. barWidth: 18,
  962. itemStyle: {
  963. normal: {
  964. color: function(params) {
  965. // build a color map as your need.
  966. var colorList = [
  967. '#368cab', '#54b793', '#4b6ab0', '#2531a9','#a93d19'
  968. ];
  969. return colorList[params.dataIndex]
  970. }
  971. }
  972. },
  973. label: {
  974. normal: {
  975. show: true,
  976. position: 'top', //顶部数据显示位置
  977. textStyle: {
  978. color: '#fff' //顶部数据颜色
  979. },
  980. formatter: '{c}' // 这里是数据展示的时候显示的数据
  981. }
  982. },
  983. data: []
  984. }]
  985. });
  986. function parthuawu(dates,areaOneVal) {
  987. $.ajax({
  988. type: "get",
  989. url: huayi.config.callcenter_url + "info/GetTelCountByDate",
  990. async: true,
  991. dataType: "json",
  992. data: {
  993. token: $.cookie("token"),
  994. date: dates,
  995. branchcode:areaOneVal
  996. },
  997. success: function(data) {
  998. if(data.state.toLowerCase() == "success") {
  999. var con = data.data;
  1000. con.person=person
  1001. todyPhoneCount.setOption({
  1002. series: [{
  1003. data: [con.hwcon, con.lhcon, con.jtcon, con.pjthtimes,con.person]
  1004. }]
  1005. })
  1006. }
  1007. }
  1008. });
  1009. }
  1010. // 投诉举报
  1011. var partcom = echarts.init(document.getElementById('partcom'));
  1012. partcom.setOption({
  1013. color: ['#6ce7ac', '#6a91e0', '#ceba5f', '#cb5f79', '#ae765a', '#569d4e'],
  1014. title: {
  1015. text: '各类型占比',
  1016. x: '28%',
  1017. y: '45%',
  1018. textStyle: {
  1019. fontWeight: 'normal',
  1020. fontSize: 16,
  1021. color: '#fff'
  1022. }
  1023. },
  1024. tooltip: {
  1025. trigger: 'item',
  1026. formatter: "{a} <br/>{b} : {c} ({d}%)",
  1027. axisPointer: {
  1028. crossStyle: {
  1029. color: '#fff'
  1030. }
  1031. }
  1032. },
  1033. legend: {
  1034. // orient: 'vertical',
  1035. bottom: 'bottom',
  1036. data: ['表扬','建议','投诉','举报','其他','求助','咨询'],
  1037. textStyle: {
  1038. color: '#fff'
  1039. }
  1040. },
  1041. series: [{
  1042. name: '数据',
  1043. type: 'pie',
  1044. radius: ['30%', '60%'],
  1045. center: ['40%', '50%'],
  1046. data: [],
  1047. itemStyle: {
  1048. emphasis: {
  1049. shadowBlur: 10,
  1050. shadowOffsetX: 0,
  1051. shadowColor: 'rgba(0, 0, 0, 0.5)'
  1052. },
  1053. normal: {
  1054. label: {
  1055. show: true,
  1056. // formatter: '{b} : {c} ({d}%)'
  1057. formatter: '{d}%'
  1058. },
  1059. labelLine: {
  1060. show: true
  1061. }
  1062. }
  1063. },
  1064. label: {
  1065. normal: {
  1066. textStyle: {
  1067. color: '#fff'
  1068. }
  1069. }
  1070. }
  1071. }]
  1072. });
  1073. function partcomplain(start, end,areaOneVal) {
  1074. // var index = layer.load(1, {
  1075. // shade: [0.5, '#030303'] //0.1透明度的白色背景
  1076. // });
  1077. $.ajax({
  1078. type: "get",
  1079. url: huayi.config.callcenter_url + "info/GetTypeCountByDate",
  1080. async: true,
  1081. dataType: 'json',
  1082. data: {
  1083. token: $.cookie("token"),
  1084. start: start,
  1085. end: end,
  1086. branchcode:areaOneVal
  1087. },
  1088. success: function(data) {
  1089. if(data.state.toLowerCase() == 'success') {
  1090. // layer.close(index);
  1091. $('.complaint_type').html('');
  1092. var con = data.data;
  1093. var part_1_legend = [];
  1094. var part_1_ser = [];
  1095. $(con).each(function(i, n) {
  1096. part_1_legend.push(n.TypeName)
  1097. var part_1_obj = {};
  1098. part_1_obj.value = n.Count;
  1099. part_1_obj.name = n.TypeName;
  1100. part_1_ser.push(part_1_obj)
  1101. $('<li>' +
  1102. '<span class="type_name">' + n.TypeName + '</span> <span class="type_count">' + n.Count + '</span>' +
  1103. '</li>').appendTo('.complaint_type')
  1104. })
  1105. partcom.setOption({
  1106. // legend: {
  1107. // data: part_1_legend
  1108. // },
  1109. series: [{
  1110. data: part_1_ser
  1111. }]
  1112. })
  1113. }
  1114. }
  1115. });
  1116. }