Bez popisu

complaintsReport.js 9.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416
  1. var areaOneVal = helper.cookies.get("areaOneVal");
  2. var areaOneText = helper.cookies.get("areaOneText");
  3. if (areaOneVal) {
  4. var areaOneVal = helper.cookies.get("areaOneVal");
  5. } else{
  6. var areaOneVal="sqs12345"
  7. }
  8. $(function() {
  9. laydate.render({
  10. elem: '#time1',
  11. range: '~',
  12. format: 'yyyy-MM',
  13. type: 'month',
  14. theme: '#114a97',
  15. done: function(value, date) {
  16. var areaOneVal=$(".areaOne").val();
  17. partOne(value && value.split(' ~ ')[0], value && value.split(' ~ ')[1],areaOneVal)
  18. var start=value.split(' ~ ')[0];
  19. var end=value.split(' ~ ')[1];
  20. }
  21. });
  22. // 跳轉
  23. $(".index").click(function(){
  24. window.open('detail.html','_self')
  25. })
  26. $(".second").click(function(){
  27. window.open('second.html','_self')
  28. })
  29. $(".third").click(function(){
  30. window.open('third.html','_self')
  31. })
  32. $(".fourth").click(function(){
  33. window.open('fourth.html','_self')
  34. })
  35. $("#department").click(function(){
  36. window.open('receiptDepartment.html','_self')
  37. })
  38. $("#sourceChannel").click(function(){
  39. window.open('sourceChannel.html','_self')
  40. })
  41. $("#call").click(function(){
  42. window.open('TelephoneDetails.html','_self')
  43. })
  44. $(".nav_middle").click(function(){
  45. window.open('index.html','_self')
  46. })
  47. laydate.render({
  48. elem: '#time2',
  49. range: '~',
  50. format: 'yyyy-MM-dd',
  51. theme: '#114a97',
  52. done: function(value, date) {
  53. var areaOneVal=$(".areaOne").val();
  54. partTwo(value && value.split(' ~ ')[0], value && value.split(' ~ ')[1],areaOneVal)
  55. }
  56. });
  57. laydate.render({
  58. elem: '#time3',
  59. range: '~',
  60. theme: '#114a97',
  61. done: function(value, date) {
  62. var areaOneVal=$(".areaOne").val();
  63. partThree(value && value.split(' ~ ')[0], value && value.split(' ~ ')[1],areaOneVal)
  64. }
  65. });
  66. Ajax()
  67. $(".areaOne").change(function() {
  68. var areaOneVal=$(this).val();
  69. var areaOneText=$(".areaOne").find("option:selected").text();
  70. helper.cookies.set("areaOneVal", areaOneVal, 7);
  71. helper.cookies.set("areaOneText", areaOneText, 7);
  72. partOne($('#time1').val() && $('#time1').val().split(' ~ ')[0], $('#time1').val() && $('#time1').val().split(' ~ ')[1],areaOneVal);
  73. partTwo($('#time2').val() && $('#time2').val().split(' ~ ')[0], $('#time2').val() && $('#time2').val().split(' ~ ')[1],areaOneVal);
  74. partThree($('#time3').val() && $('#time3').val().split(' ~ ')[0], $('#time3').val() && $('#time3').val().split(' ~ ')[1],areaOneVal);
  75. // Ajax()
  76. });
  77. $(".keys").change(function() {
  78. var areaOneVal = helper.cookies.get("areaOneVal");
  79. partTwo($('#time2').val() && $('#time2').val().split(' ~ ')[0], $('#time2').val() && $('#time2').val().split(' ~ ')[1],areaOneVal);
  80. })
  81. keylist ();
  82. //部门下拉框
  83. function keylist () {
  84. $.getJSON( huayi.config.callcenter_url +"info/GetKeyList",{token: $.cookie("token"),} function(result) {
  85. if(result.state.toLowerCase() == "success") {
  86. goodslist = result.data;
  87. $(".keys").empty();
  88. $('<option value="">请选择关键词</option>').appendTo($(".keys"));
  89. $(goodslist).each(function(i, n) {
  90. $('<option value="' + n.F_ValueId
  91. + '">' + n.F_Value
  92. + '</option>').appendTo($(".keys"));
  93. })
  94. }
  95. });
  96. }
  97. })
  98. //区县筛选
  99. //deprtment ();
  100. function deprtment () {
  101. $.getJSON( huayi.config.callcenter_url +"CountyBranch/GetBranchListS",{token: $.cookie("token"),} function(result) {
  102. if(result.state.toLowerCase() == "success") {
  103. goodslist = result.data;
  104. // 第五屏
  105. $(".areaOne").empty();
  106. $(goodslist).each(function(i, n) {
  107. $('<option value="' + n.F_Code
  108. + '">' + n.F_Name
  109. + '</option>').appendTo($(".areaOne"));
  110. });
  111. if (areaOneVal) {
  112. $(".areaOne").val(areaOneVal);
  113. }
  114. }
  115. });
  116. }
  117. //part 1 //投诉类别月统计 对接完毕
  118. var part_1 = echarts.init(document.getElementById('part_1'));
  119. part_1.setOption({
  120. color: ['#69e1a9', '#6a91e0', '#ceba5f', '#f06e84', '#569d4e', '#7d55ba', '#ce5aba', '#345cdd', '#569d4e'],
  121. tooltip: {
  122. trigger: 'axis',
  123. axisPointer: {
  124. type: 'cross',
  125. label: {
  126. show: true,
  127. backgroundColor: '#333'
  128. }
  129. }
  130. },
  131. grid: {
  132. left: '2%',
  133. right: '5%',
  134. bottom: '6%',
  135. containLabel: true
  136. },
  137. legend: {
  138. top: 'top',
  139. left: '180px',
  140. data: [],
  141. textStyle: {
  142. color: '#00e9ff'
  143. }
  144. },
  145. xAxis: {
  146. name: '月份',
  147. data: [],
  148. axisLine: {
  149. lineStyle: {
  150. color: '#3061a2'
  151. }
  152. },
  153. axisTick: {
  154. alignWithLabel: true,
  155. show: false
  156. },
  157. axisLabel: { //横轴字体颜色
  158. show: true,
  159. textStyle: {
  160. color: '#eff0f4'
  161. }
  162. }
  163. },
  164. yAxis: {
  165. name: '(数量)',
  166. splitLine: {
  167. show: false
  168. },
  169. axisLine: {
  170. lineStyle: {
  171. color: '#3061a2'
  172. }
  173. },
  174. axisLabel: { //横轴字体颜色
  175. show: true,
  176. textStyle: {
  177. color: '#eff0f4'
  178. }
  179. }
  180. },
  181. series: []
  182. });
  183. function partOne(start, end,areaOneVal) {
  184. // var index = layer.load(1, {
  185. // shade: [0.5, '#030303'] //0.1透明度的白色背景
  186. // });
  187. $.ajax({
  188. type: "get",
  189. url: huayi.config.callcenter_url + "info/GetTypeCountMonthByDate",
  190. async: true,
  191. dataType: 'json',
  192. data: {
  193. token: $.cookie("token"),
  194. start: start,
  195. end: end,
  196. branchcode:areaOneVal
  197. },
  198. success: function(data) {
  199. if(data.state.toLowerCase() == 'success') {
  200. // layer.close(index);
  201. var con = data.data;
  202. var counts = con.counts;
  203. var sers = [];
  204. $(counts).each(function(i, n) {
  205. var obj = {};
  206. obj.name = con.cols[i];
  207. obj.type = "line";
  208. obj.smooth = true;
  209. obj.showAllSymbol = true;
  210. obj.symbol = "emptyCircle";
  211. obj.symbolSize = 10;
  212. obj.data = n;
  213. sers.push(obj)
  214. });
  215. part_1.setOption({
  216. xAxis: {
  217. data: con.months
  218. },
  219. legend: {
  220. data: con.cols
  221. },
  222. series: sers
  223. });
  224. }
  225. }
  226. });
  227. }
  228. //part2 //投诉关键字统计
  229. function partTwo(starts, ends, areaOneVal) {
  230. var keyid=$('.keys').val()
  231. $.ajax({
  232. type: "get",
  233. url: huayi.config.callcenter_url + "Info/GetKeyCountByDateNew",
  234. dataType: 'json',
  235. async: true,
  236. data: {
  237. token: $.cookie("token"),
  238. start: starts,
  239. end: ends,
  240. keyid: keyid,
  241. branchcode:areaOneVal
  242. },
  243. success: function(data) {
  244. if(data.state.toLowerCase() == 'success') {
  245. $('.thead tr').html('');
  246. $('#scroll_table tbody').html('');
  247. var con = data.data;
  248. var thead = con[0];
  249. $.each(thead, function(k, val) {
  250. $('<td>' + k + '</td>').appendTo('.thead tr');
  251. })
  252. $(con).each(function(j, n) {
  253. var str = '<tr>'
  254. $.each(thead, function(j, m) {
  255. $.each(n, function(k, val) {
  256. if(j == k) {
  257. if(val == '') {
  258. val = 0;
  259. }
  260. str += '<td>' + val + '</td>'
  261. }
  262. })
  263. })
  264. str += '</tr>';
  265. $('#scroll_table tbody').append(str);
  266. })
  267. }
  268. }
  269. });
  270. }
  271. // part3 投诉分类统计
  272. var part3 = echarts.init(document.getElementById('part3'));
  273. part3.setOption({
  274. color: ['#6ce7ac', '#6a91e0', '#ceba5f', '#cb5f79', '#ae765a', '#569d4e'],
  275. tooltip: {
  276. trigger: 'item',
  277. formatter: "{a} <br/>{b} : {c} ({d}%)",
  278. axisPointer: {
  279. crossStyle: {
  280. color: '#fff'
  281. }
  282. }
  283. },
  284. // legend: {
  285. // // orient: 'vertical',
  286. // bottom: 'bottom',
  287. // data: [],
  288. // textStyle: {
  289. // color: '#fff'
  290. // }
  291. // },
  292. series: [{
  293. name: '数据',
  294. type: 'pie',
  295. radius: ['30%', '60%'],
  296. center: ['40%', '50%'],
  297. data: [],
  298. itemStyle: {
  299. emphasis: {
  300. shadowBlur: 10,
  301. shadowOffsetX: 0,
  302. shadowColor: 'rgba(0, 0, 0, 0.5)'
  303. },
  304. normal: {
  305. label: {
  306. show: true,
  307. // formatter: '{b} : {c} ({d}%)'
  308. formatter: '{d}%'
  309. },
  310. labelLine: {
  311. show: true
  312. }
  313. }
  314. },
  315. label: {
  316. normal: {
  317. textStyle: {
  318. color: '#fff'
  319. }
  320. }
  321. }
  322. }]
  323. });
  324. function partThree(start, end,areaOneVal) {
  325. // var index = layer.load(1, {
  326. // shade: [0.5, '#030303'] //0.1透明度的白色背景
  327. // });
  328. $.ajax({
  329. type: "get",
  330. url: huayi.config.callcenter_url + "info/GetTypeCountByDate",
  331. async: true,
  332. dataType: 'json',
  333. data: {
  334. token: $.cookie("token"),
  335. start: start,
  336. end: end,
  337. branchcode:areaOneVal
  338. },
  339. success: function(data) {
  340. if(data.state.toLowerCase() == 'success') {
  341. // layer.close(index);
  342. $('.complaint_type').html('');
  343. var con = data.data;
  344. var part_1_legend = [];
  345. var part_1_ser = [];
  346. $(con).each(function(i, n) {
  347. part_1_legend.push(n.TypeName)
  348. var part_1_obj = {};
  349. part_1_obj.value = n.Count;
  350. part_1_obj.name = n.TypeName;
  351. part_1_ser.push(part_1_obj)
  352. $('<li>' +
  353. '<span class="type_name">' + n.TypeName + '</span> <span class="type_count">' + n.Count + '</span>' +
  354. '</li>').appendTo('.complaint_type')
  355. })
  356. part3.setOption({
  357. // legend: {
  358. // data: part_1_legend
  359. // },
  360. series: [{
  361. data: part_1_ser
  362. }]
  363. })
  364. }
  365. }
  366. });
  367. }
  368. //表格滚动
  369. var area = document.getElementById('scroll_table');
  370. var iliHeight = 34; //单行滚动的高度
  371. var speed = 20; //滚动的速度
  372. var time;
  373. var delay = 1000;
  374. area.scrollTop = 0;
  375. area.innerHTML += area.innerHTML; //克隆一份一样的内容
  376. function startScroll() {
  377. time = setInterval("scrollUp()", speed);
  378. area.scrollTop++;
  379. console.log(area.scrollTop);
  380. }
  381. function scrollUp() {
  382. if(area.scrollTop % iliHeight == 0) {
  383. clearInterval(time);
  384. setTimeout(startScroll, delay);
  385. } else {
  386. area.scrollTop++;
  387. if(area.scrollTop >= area.scrollHeight / 2) {
  388. area.scrollTop = 0;
  389. }
  390. }
  391. }
  392. setTimeout(startScroll, delay)
  393. function Ajax() {
  394. var areaOneVal = helper.cookies.get("areaOneVal");
  395. var areaOneText = helper.cookies.get("areaOneText");
  396. partOne($('#time1').val() && $('#time1').val().split(' ~ ')[0], $('#time1').val() && $('#time1').val().split(' ~ ')[1],areaOneVal)
  397. partTwo($('#time2').val() && $('#time2').val().split(' ~ ')[0], $('#time2').val() && $('#time2').val().split(' ~ ')[1],areaOneVal);
  398. partThree($('#time3').val() && $('#time3').val().split(' ~ ')[0], $('#time3').val() && $('#time3').val().split(' ~ ')[1],areaOneVal)
  399. }