Brak opisu

sourceChannel.js 11KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512
  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. format: 'yyyy-MM-dd',
  12. theme: '#114a97',
  13. done: function(value, date) {
  14. var areaOneVal=$(".areaOne").val();
  15. partOne(value,areaOneVal)
  16. }
  17. });
  18. laydate.render({
  19. elem: '#time2',
  20. range: '~',
  21. format: 'yyyy-MM-dd',
  22. theme: '#114a97',
  23. done: function(value, date) {
  24. var areaOneVal=$(".areaOne").val();
  25. partTwo(value && value.split(' ~ ')[0], value && value.split(' ~ ')[1],areaOneVal)
  26. }
  27. });
  28. laydate.render({
  29. elem: '#time3',
  30. range: '~',
  31. theme: '#114a97',
  32. done: function(value, date) {
  33. var areaOneVal=$(".areaOne").val();
  34. partThree(value && value.split(' ~ ')[0], value && value.split(' ~ ')[1],areaOneVal)
  35. }
  36. });
  37. Ajax();
  38. $(".areaOne").change(function() {
  39. var areaOneVal=$(this).val();
  40. var areaOneText=$(".areaOne").find("option:selected").text();
  41. helper.cookies.set("areaOneVal", areaOneVal, 7);
  42. helper.cookies.set("areaOneText", areaOneText, 7);
  43. partOne($('#time1').val(),areaOneVal);
  44. partTwo($('#time2').val() && $('#time2').val().split(' ~ ')[0], $('#time2').val() && $('#time2').val().split(' ~ ')[1],areaOneVal);
  45. partThree($('#time3').val() && $('#time3').val().split(' ~ ')[0], $('#time3').val() && $('#time3').val().split(' ~ ')[1],areaOneVal);
  46. // Ajax()
  47. });
  48. })
  49. // 跳轉
  50. $(".index").click(function(){
  51. window.open('detail.html','_self')
  52. })
  53. $(".second").click(function(){
  54. window.open('second.html','_self')
  55. })
  56. $(".third").click(function(){
  57. window.open('third.html','_self')
  58. })
  59. $(".fourth").click(function(){
  60. window.open('fourth.html','_self')
  61. })
  62. $("#department").click(function(){
  63. window.open('receiptDepartment.html','_self')
  64. })
  65. $("#call").click(function(){
  66. window.open('TelephoneDetails.html','_self')
  67. })
  68. $("#complaint").click(function(){
  69. window.open('complaintsReport.html','_self')
  70. })
  71. $(".nav_middle").click(function(){
  72. window.open('index.html','_self')
  73. })
  74. //区县筛选
  75. //deprtment();
  76. function deprtment() {
  77. $.getJSON( huayi.config.callcenter_url +"CountyBranch/GetBranchListS",{token: $.cookie("token"),}, function(result) {
  78. if(result.state.toLowerCase() == "success") {
  79. goodslist = result.data;
  80. // 第五屏
  81. $(".areaOne").empty();
  82. $(goodslist).each(function(i, n) {
  83. $('<option value="' + n.F_Code
  84. + '">' + n.F_Name
  85. + '</option>').appendTo($(".areaOne"));
  86. });
  87. if (areaOneVal) {
  88. $(".areaOne").val(areaOneVal);
  89. }
  90. }
  91. });
  92. }
  93. //part 1 //受理群众区域统计 对接完毕
  94. var part_1 = echarts.init(document.getElementById('part_1'));
  95. part_1.setOption({
  96. color: ['#69e1a9', '#6a91e0', '#ceba5f', '#f06e84', '#569d4e', '#7d55ba', '#ce5aba', '#7931dd', '#7f9d3e','#ff5500','#0a45e7'],
  97. tooltip: {
  98. trigger: 'axis',
  99. axisPointer: {
  100. type: 'cross',
  101. label: {
  102. show: true,
  103. backgroundColor: '#333'
  104. }
  105. }
  106. },
  107. toolbox: {
  108. x:100,
  109. y:20,
  110. show : true,
  111. feature : {
  112. mark : {show: true},
  113. magicType : {show: true, type: ['line', 'bar']},
  114. },
  115. iconStyle:{
  116. normal:{
  117. color:'#ffaa00',//设置颜色
  118. }
  119. }
  120. },
  121. grid: {
  122. left: '2%',
  123. right: '5%',
  124. bottom: '6%',
  125. containLabel: true
  126. },
  127. legend: {
  128. top: 'top',
  129. left: '180px',
  130. data: [],
  131. textStyle: {
  132. color: '#00e9ff'
  133. },
  134. selected: {
  135. '市区': true,
  136. '文峰区': false,
  137. '北关区': false,
  138. '殷都区': false,
  139. '龙安区': false,
  140. '安阳县': false,
  141. '汤阴县': false,
  142. '内黄县': false,
  143. '滑县': false,
  144. '林州市': false,
  145. '高新区': false
  146. }
  147. },
  148. xAxis: {
  149. name: '时',
  150. data: [],
  151. axisLine: {
  152. lineStyle: {
  153. color: '#3061a2'
  154. }
  155. },
  156. axisTick: {
  157. alignWithLabel: true,
  158. show: false
  159. },
  160. axisLabel: { //横轴字体颜色
  161. show: true,
  162. textStyle: {
  163. color: '#eff0f4'
  164. }
  165. }
  166. },
  167. yAxis: {
  168. name: '(数量)',
  169. splitLine: {
  170. show: false
  171. },
  172. axisLine: {
  173. lineStyle: {
  174. color: '#3061a2'
  175. }
  176. },
  177. axisLabel: { //横轴字体颜色
  178. show: true,
  179. textStyle: {
  180. color: '#eff0f4'
  181. }
  182. }
  183. },
  184. series: []
  185. });
  186. part_1.on('legendselectchanged', function(params) {
  187. console.log(params.selected)
  188. var option = this.getOption();
  189. var select_key = Object.keys(params.selected);
  190. var select_value = Object.values(params.selected);
  191. console.log(select_value,select_key)
  192. var n = 0;
  193. // select_value.map(res => {
  194. // if(!res){
  195. // n++;
  196. // }
  197. // });
  198. // console.log('n',n)
  199. // if (n == select_value.length ) {
  200. // option.legend[0].selected[params.name] = true;
  201. // }
  202. // $sel.map(res => {
  203. // console.log(res)
  204. // });
  205. this.setOption(option)
  206. });
  207. function partOne(dates,areaOneVal) {
  208. $.ajax({
  209. type: "get",
  210. url: huayi.config.callcenter_url + "info/GetAreaCount24ByDate",
  211. async: true,
  212. dataType: "json",
  213. data: {
  214. token: $.cookie("token"),
  215. date: dates,
  216. branchcode:areaOneVal
  217. },
  218. success: function(data) {
  219. if(data.state.toLowerCase() == "success") {
  220. var con = data.data;
  221. console.log(con)
  222. var part1Axis = con.hours;
  223. var sers = []
  224. $(con.cols).each(function(i, n) {
  225. var obj = {};
  226. obj.name = n;
  227. obj.type = "bar";
  228. obj.smooth = true;
  229. obj.showAllSymbol = true;
  230. obj.symbol = "emptyCircle";
  231. obj.symbolSize = 10;
  232. obj.data = con.counts[i];
  233. sers.push(obj);
  234. console.log(sers)
  235. })
  236. part_1.setOption({
  237. xAxis: {
  238. data: part1Axis
  239. },
  240. legend: {
  241. data: con.cols
  242. },
  243. series: sers
  244. });
  245. }
  246. }
  247. });
  248. }
  249. //part2 //渠道来源
  250. var source = echarts.init(document.getElementById('source'));
  251. source.setOption({
  252. tooltip: {
  253. trigger: 'axis',
  254. axisPointer: {
  255. type: false,
  256. label: {
  257. show: true,
  258. backgroundColor: '#030917'
  259. }
  260. },
  261. },
  262. // legend: {
  263. // top: 'top',
  264. // left: '180px',
  265. // data: [],
  266. // textStyle: {
  267. // color: '#00e9ff'
  268. // }
  269. // },
  270. xAxis: {
  271. // name: '时',
  272. data: [],
  273. axisLine: {
  274. lineStyle: {
  275. color: '#3061a2'
  276. }
  277. },
  278. axisTick: {
  279. alignWithLabel: true,
  280. show: false
  281. },
  282. axisLabel: { //横轴字体颜色
  283. show: true,
  284. textStyle: {
  285. color: '#eff0f4'
  286. }
  287. }
  288. },
  289. yAxis: {
  290. name: '数量',
  291. splitLine: {
  292. show: false
  293. },
  294. axisLine: {
  295. lineStyle: {
  296. color: '#3061a2'
  297. }
  298. },
  299. axisLabel: { //横轴字体颜色
  300. show: true,
  301. textStyle: {
  302. color: '#eff0f4'
  303. }
  304. }
  305. },
  306. series: [{
  307. name: '数量',
  308. type: 'bar',
  309. barWidth: 18,
  310. itemStyle: {
  311. normal: {
  312. color: function(params) {
  313. // build a color map as your need.
  314. var colorList = ['#368cab', '#54b793', '#4b6ab0', '#2531a9'];
  315. return colorList[params.dataIndex]
  316. }
  317. }
  318. },
  319. label: {
  320. normal: {
  321. show: true,
  322. position: 'top', //顶部数据显示位置
  323. textStyle: {
  324. color: '#fff' //顶部数据颜色
  325. },
  326. formatter: '{c}' // 这里是数据展示的时候显示的数据
  327. }
  328. },
  329. data: []
  330. }]
  331. });
  332. function partTwo(start, end,areaOneVal) {
  333. $.ajax({
  334. type: "get",
  335. url: huayi.config.callcenter_url + "info/GetSourcePercentByDate",
  336. dataType: 'json',
  337. async: true,
  338. data: {
  339. token: $.cookie("token"),
  340. start: start,
  341. end: end,
  342. branchcode:areaOneVal
  343. },
  344. success: function(data) {
  345. if(data.state.toLowerCase() == "success") {
  346. // layer.close(index);
  347. var con = data.data;
  348. var qd_legend = [];
  349. var ser_data = [];
  350. $(con).each(function(i, n) {
  351. ser_data.push(n.Count)
  352. qd_legend.push(n.Source);
  353. })
  354. source.setOption({
  355. // legend: {
  356. // data: qd_legend
  357. // },
  358. xAxis: {
  359. data: qd_legend
  360. },
  361. series: {
  362. data: ser_data
  363. }
  364. })
  365. }
  366. }
  367. });
  368. }
  369. // part3 受理区域统计
  370. var part3 = echarts.init(document.getElementById('part3'));
  371. part3.setOption({
  372. color: ['#6ce7ac', '#6a91e0', '#ce2c10', '#cb5f79', '#ae765a', '#569d4e', '#7d55ba', '#ce5aba', '#355cdd', '#44c1c6', '#ceba5e', '#c64444','#ffff00'],
  373. title: {
  374. text: '各区县占比',
  375. x: 'center',
  376. y: '45%',
  377. textStyle: {
  378. fontWeight: 'normal',
  379. fontSize: 16,
  380. color: '#fff'
  381. }
  382. },
  383. tooltip: {
  384. trigger: 'item',
  385. formatter: "{a} <br/>{b} : {c} ({d}%)",
  386. axisPointer: {
  387. crossStyle: {
  388. color: '#fff'
  389. }
  390. }
  391. },
  392. legend: {
  393. // orient: 'vertical',
  394. bottom: 'bottom',
  395. data: ['安阳县','北关区','林州市','龙安区','内黄县','市区','汤阴县','安阳县','文峰区','殷都区','滑县','高新区'],
  396. textStyle: {
  397. color: '#fff'
  398. }
  399. },
  400. series: [{
  401. name: '数据',
  402. type: 'pie',
  403. radius: ['30%', '60%'],
  404. center: ['50%', '50%'],
  405. data: [],
  406. itemStyle: {
  407. emphasis: {
  408. shadowBlur: 10,
  409. shadowOffsetX: 0,
  410. shadowColor: 'rgba(0, 0, 0, 0.5)'
  411. },
  412. normal: {
  413. label: {
  414. show: true,
  415. // formatter: '{b} : {c} ({d}%)'
  416. formatter: '{d}%'
  417. },
  418. labelLine: {
  419. show: true
  420. }
  421. }
  422. },
  423. label: {
  424. normal: {
  425. textStyle: {
  426. color: '#fff'
  427. }
  428. }
  429. }
  430. }]
  431. });
  432. function partThree(start, end,areaOneVal) {
  433. // var index = layer.load(1, {
  434. // shade: [0.5, '#030303'] //0.1透明度的白色背景
  435. // });
  436. $.ajax({
  437. type: "get",
  438. url: huayi.config.callcenter_url + "info/GetAreaCountByDate",
  439. async: true,
  440. dataType: 'json',
  441. data: {
  442. token: $.cookie("token"),
  443. start: start,
  444. end: end,
  445. branchcode:areaOneVal
  446. },
  447. success: function(data) {
  448. if(data.state.toLowerCase() == 'success') {
  449. // layer.close(index);
  450. $('.complaint_typeL').html('');
  451. $('.complaint_typeR').html('');
  452. var con = data.data;
  453. var part_1_legend = [];
  454. var part_1_ser = [];
  455. $(con).each(function(i, n) {
  456. part_1_legend.push(n.AreaName)
  457. var part_1_obj = {};
  458. part_1_obj.value = n.Count;
  459. part_1_obj.name = n.AreaName;
  460. part_1_ser.push(part_1_obj)
  461. if(n.AreaName.indexOf('城乡一体') != -1) {
  462. n.AreaName = "城乡示范"
  463. }
  464. var str = '<li>' +
  465. '<span class="type_name">' + n.AreaName + '</span> <span class="type_count">' + n.Count + '</span>' +
  466. '</li>'
  467. if(i <= 5) {
  468. $(str).appendTo('.complaint_typeL');
  469. } else if(i <= 11&&i >5){
  470. $(str).appendTo('.complaint_typeR');
  471. }
  472. })
  473. part3.setOption({
  474. // legend: {
  475. // selected: {
  476. // '当即办理': false
  477. // }
  478. // },
  479. series: [{
  480. data: part_1_ser
  481. }]
  482. })
  483. }
  484. }
  485. });
  486. }
  487. function Ajax() {
  488. var areaOneVal = helper.cookies.get("areaOneVal");
  489. var areaOneText = helper.cookies.get("areaOneText");
  490. partOne($('#time1').val(),areaOneVal)
  491. partTwo($('#time2').val() && $('#time2').val().split(' ~ ')[0], $('#time2').val() && $('#time2').val().split(' ~ ')[1],areaOneVal);
  492. partThree($('#time3').val() && $('#time3').val().split(' ~ ')[0], $('#time3').val() && $('#time3').val().split(' ~ ')[1],areaOneVal)
  493. }