toll_station_statistics.js 45 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211
  1. var year = new Date().getFullYear();
  2. var month = new Date().getMonth();
  3. var x_m_array = new Array();
  4. var x_m_array_temp = new Array();
  5. var date = new Date().getDate();
  6. var select_road = $(".div-roadManage select").val();
  7. var select_station = $("#second").val();
  8. var array_year_score = new Array();
  9. var array_points = new Array();
  10. var array_check_type = new Array();
  11. var array_points_name = new Array();
  12. var array_points_pre = new Array();
  13. var arrar_points_month = new Array();
  14. var array_score_order = new Array();
  15. var array_score_data = new Array();
  16. var array_score_data_temp = new Array();
  17. var array_five_name = new Array();
  18. var array_five_score = new Array();
  19. var array_five_score_temp = new Array();
  20. var array_five_name_back = new Array();
  21. var array_five_score_back = new Array();
  22. var array_five_score_back_temp = new Array();
  23. var year_assess;
  24. var points_assess;
  25. var check_type;
  26. var people_points;
  27. var score_rank;
  28. var rank_assess;
  29. var rank_assess_back;
  30. var min_year;
  31. var min_five;
  32. var min_five_back;
  33. var min_score;
  34. var flag = false;
  35. var change_echart = 2;
  36. $(function() {
  37. setVisit();
  38. // 公用方法,根据当前年月动态将13个月push数组
  39. month_method();
  40. // 公用方法,月份下拉框
  41. // select_option();
  42. $.jeDate("#month_date", {
  43. isinitVal: true,
  44. format: 'YYYY/MM' // 分隔符可以任意定义,该例子表示只显示年月
  45. });
  46. var road_manager;
  47. if (roleContains("STATION")) {
  48. road_manager = getCurrentUser().road_manager_id;
  49. }
  50. if (roleContains("ROAD_MANAGER")) {
  51. road_manager = getCurrentUser().organid;
  52. }
  53. // setRoadManagerSelect("#first", road_manager);
  54. setSecond();
  55. var temp_time = $.zui.store.get('page_data_param_temp_time');
  56. var road_p = $.zui.store.get('page_data_param_road_p');
  57. var station_p = $.zui.store.get('page_data_param_station_p');
  58. if (temp_time) {
  59. $("#month_date").val(temp_time);
  60. setRoadManagerSelect_1(".div-roadManage select", road_p);
  61. setSecond_1(station_p);
  62. $.zui.store.set('page_data_param_temp_time', null);
  63. $.zui.store.set('page_data_param_road_p', null);
  64. $.zui.store.set('page_data_param_station_p', null);
  65. }
  66. var p = $.zui.store.get('store_param_' + current_url);
  67. $.zui.store.set('store_param_' + current_url, null)
  68. if (p) {
  69. $("#month_date").val(p.time)
  70. setRoadManagerSelect(".div-roadManage select", p.road_p);
  71. setSecond_2(p.station_p);
  72. }
  73. // 回显当前年月份
  74. // $(".div-month select").val(initDate);
  75. refresh(true);
  76. $(".div-button button").click(function() {
  77. refresh(flag);
  78. flag = false;
  79. });
  80. // 加载图配置
  81. // echart();
  82. // 如果道管中心下拉框改变,点击时加载图一
  83. $(".div-station select").change(function() {
  84. flag = true;
  85. });
  86. function refresh(flag) {
  87. var select_month = $("#month_date").val();
  88. var select_station = $(".div-station select").val();
  89. // 加载图配置
  90. echart(flag);
  91. echart_change();
  92. echart_change2();
  93. init_tollStation_year_assess("statistics/score/year/info", select_station, select_month.split('/')[0], select_month.split('/')[1]);
  94. // flag = false;
  95. top5_change(select_month, select_station);
  96. // 查询图二
  97. init_company_points_assess("statistics/lost/score/rate", select_month + '', select_station);
  98. // 查询图四
  99. init_people_score_rank("statistics/stuff/score/info", select_month + '', select_station);
  100. // 查询图五
  101. // console.log(select_month+","+select_station);
  102. init_server_check_type("statistics/lost/itemscore/rate", select_month + "", select_station);
  103. // 查询图六
  104. init_each_people_points("statistics/lost/twice/itemscore/rate", select_month + "", select_station);
  105. }
  106. /**
  107. * 初始化图一
  108. */
  109. function init_tollStation_year_assess(url, select_station, y, m) {
  110. x_m_array = new Array();
  111. for (var i = 1; i <= 12; i++) {
  112. var month = parseInt(m) + i;
  113. var starty = parseInt(y) - 1
  114. if (month > 12) {
  115. month = month - 12;
  116. starty = y;
  117. }
  118. x_m_array.push(starty + "/" + (month >= 10 ? month : ("0" + month)));
  119. }
  120. if(m != 12){
  121. var start_date = (parseInt(y) - 1) + "-" + (parseInt(m)+1) + "-1" + " 00:00:00";
  122. var end_date = y + "-" + (parseInt(m)+1) + "-1" + " 00:00:00";
  123. }else{
  124. var start_date = (parseInt(y)) + "-" + '1' + "-1" + " 00:00:00";
  125. var end_date = (parseInt(y)+1) + "-" + '1' + "-1" + " 00:00:00";
  126. }
  127. var param = {
  128. "start_date": start_date,
  129. "end_date": end_date,
  130. "dept_id": select_station,
  131. "queryType": 2
  132. }
  133. initRqueset(url, param, 1);
  134. }
  135. /**
  136. * 初始化图二
  137. */
  138. function init_company_points_assess(url, mon, select_station) {
  139. var param = {
  140. mth: mon,
  141. "dept_id": select_station,
  142. "queryType": 2
  143. }
  144. initRqueset(url, param, 2);
  145. }
  146. /**
  147. * 初始化图三 前5名
  148. */
  149. function init_progress_rank_assess(url, mon, select_station) {
  150. var prev_mth;
  151. // 判断当前年月是否为一月
  152. if (parseInt((mon + '').substr(5)) == 1) {
  153. prev_mth = ((parseInt((mon + '').substr(0, 4))) - 1) + "/12";
  154. } else {
  155. if ((parseInt((mon + '').substr(5)) + '').length == 1) {
  156. prev_mth = (mon + '').substr(0, 4) + '/0' + (parseInt((mon + '').substr(5)) - 1);
  157. } else {
  158. prev_mth = (mon + '').substr(0, 4) + '/' + (parseInt((mon + '').substr(5)) - 1);
  159. }
  160. }
  161. var param = {
  162. "mth": mon,
  163. "dept_id": select_station,
  164. "prev_mth": prev_mth,
  165. "order_type": 0
  166. };
  167. initRqueset(url, param, 3);
  168. }
  169. /**
  170. * 初始化图四
  171. */
  172. function init_people_score_rank(url, mon, select_station) {
  173. var param = {
  174. "mth": mon,
  175. "dept_id": select_station,
  176. "queryType": 2,
  177. "order_type": 1
  178. }
  179. initRqueset(url, param, 4);
  180. }
  181. /**
  182. * 初始化图五
  183. */
  184. function init_server_check_type(url, mon, select_station) {
  185. var param = {
  186. "mth": mon,
  187. "dept_id": select_station,
  188. "queryType": 2
  189. };
  190. initRqueset(url, param, 5);
  191. }
  192. /**
  193. * 初始化图六
  194. */
  195. function init_each_people_points(url, mon, select_station) {
  196. var prev_mth;
  197. // 判断当前年月是否为一月
  198. if (parseInt((mon + '').substr(5)) == 1) {
  199. prev_mth = ((parseInt((mon + '').substr(0, 4))) - 1) + "/12";
  200. } else {
  201. var m = (parseInt((mon + '').substr(5)) - 1);
  202. if ((parseInt((mon + '').substr(5)) + '').length == 1) {
  203. prev_mth = (mon + '').substr(0, 4) + '/' + (m > 9 ? m : "0" + m);
  204. } else {
  205. prev_mth = (mon + '').substr(0, 4) + '/' + (m > 9 ? m : "0" + m);
  206. }
  207. }
  208. var param = {
  209. "mth": mon,
  210. "prev_mth": prev_mth,
  211. "dept_id": select_station,
  212. "queryType": 2
  213. };
  214. initRqueset(url, param, 6);
  215. }
  216. /**
  217. * 图切换后5名
  218. */
  219. function init_backward_rank_assess(url, mon, select_station) {
  220. var prev_mth;
  221. // 判断当前年月是否为一月
  222. if (parseInt((mon + '').substr(5)) == 1) {
  223. prev_mth = ((parseInt((mon + '').substr(0, 4))) - 1) + "/12";
  224. } else {
  225. if ((parseInt((mon + '').substr(5)) + '').length == 1) {
  226. prev_mth = (mon + '').substr(0, 4) + '/0' + (parseInt((mon + '').substr(5)) - 1);
  227. } else {
  228. prev_mth = (mon + '').substr(0, 4) + '/' + (parseInt((mon + '').substr(5)) - 1);
  229. }
  230. }
  231. var param = {
  232. "mth": mon,
  233. "dept_id": select_station,
  234. "prev_mth": prev_mth,
  235. "order_type": 1
  236. };
  237. initRqueset(url, param, 7);
  238. }
  239. /**
  240. * 请求
  241. * @param {*} url
  242. * @param {*} param
  243. * @param {*} type
  244. */
  245. function initRqueset(url, param, type) {
  246. post_common_service(url, param, function(data) {
  247. data_array(data, type);
  248. if (type == 1) {
  249. // 画图
  250. year_assess.setOption(tollStation_year_assess());
  251. } else if (type == 2) {
  252. // 画图
  253. points_assess.setOption(tollStation_points_assess());
  254. } else if (type == 3) {
  255. // 画图
  256. rank_assess.setOption(progress_rank_assess());
  257. } else if (type == 4) {
  258. // 画图
  259. score_rank.setOption(people_score_rank());
  260. } else if (type == 5) {
  261. // 画图
  262. check_type.setOption(server_check_type());
  263. } else if (type == 6) {
  264. // 画图
  265. people_points.setOption(each_people_points());
  266. } else if (type == 7) {
  267. // 画图
  268. rank_assess_back.setOption(backward_rank_assess());
  269. }
  270. }, function(error) {
  271. return "";
  272. });
  273. }
  274. /**
  275. * 数组数据
  276. * @param {*} data
  277. * @param {*} type
  278. */
  279. function data_array(data, type) {
  280. if (type == 1) {
  281. console.log(data);
  282. array_year_score.length = 0;
  283. if (data != '' &&  data.length != 0) {
  284. x_m_array_temp = new Array();
  285. x_m_array_temp=x_m_array;
  286. for (var i = 0; i < x_m_array.length; i++) {
  287. var index = -1;
  288. var score = 0;
  289. for (var j = 0; j < data.length; j++) {
  290. if (x_m_array[i] == data[j].mth) {
  291. index = j;
  292. score = data[index].all_check_score;
  293. break;
  294. }
  295. }
  296. array_year_score.push(
  297. (100 - score));
  298. // if (index < 0) {} else {
  299. // x_m_array_temp.push(x_m_array[i]);
  300. // array_year_score.push(
  301. // (100 - data[index].all_check_score));
  302. // }
  303. }
  304. } else {
  305. array_year_score.length = 0;
  306. x_m_array = new Array();
  307. x_m_array_temp = new Array();
  308. }
  309. if (eval("Math.min(" + array_year_score.toString() + ")") == 0)
  310. min_year = 0;
  311. else
  312. min_year = eval("Math.min(" + array_year_score.toString() + ")").toFixed(0) - 10;
  313. console.log(array_year_score);
  314. } else if (type == 2) {
  315. array_points.length = 0;
  316. if (data != '') {
  317. array_points.push({ "value": (data.people_num - (data.score_fifteen + data.score_fifty + data.score_over_fifty)), "name": '满分' });
  318. array_points.push({ "value": data.score_fifteen, "name": '0-5分' });
  319. array_points.push({ "value": data.score_fifty, "name": '5-10分' });
  320. array_points.push({ "value": data.score_over_fifty, "name": '10分以上' });
  321. } else {
  322. array_points.length = 0;
  323. }
  324. } else if (type == 3) {
  325. array_five_name.length = 0;
  326. array_five_score.length = 0;
  327. if (data != '' &&  data.length != 0) {
  328. for (var i = 0; i < data.length; i++) {
  329. array_five_score.push(data[i].ranking_change);
  330. }
  331. } else {
  332. array_five_name.length = 0;
  333. array_five_score.length = 0;
  334. }
  335. if (eval("Math.min(" + array_five_score.toString() + ")") == 0)
  336. min_five = 0;
  337. else
  338. min_five = eval("Math.min(" + array_five_score.toString() + ")").toFixed(0) - 1;
  339. // 给考核进步top5排名次
  340. var rank = new Array();
  341. rank[0] = 1;
  342. for (var i = 1; i < array_five_score.length; i++) {
  343. if (array_five_score[i - 1] == array_five_score[i]) {
  344. rank[i] = rank[i - 1];
  345. } else {
  346. rank[i] = i + 1;
  347. }
  348. }
  349. array_five_score_temp = new Array();
  350. for (var i = 0; i < array_five_score.length; i++) {
  351. array_five_name.push(data[i].user.truename + "\n" + (rank[i]));
  352. array_five_score_temp.push({ value: array_five_score[i], name: data[i].user.id + "_" + data[i].user.organid })
  353. }
  354. } else if (type == 4) {
  355. array_score_order.length = 0;
  356. array_score_data.length = 0;
  357. var m = 1;
  358. if (data != '' && data.length != 0) {
  359. for (var i = 0; i < data.length; i++) {
  360. array_score_data.push((100 - data[i].all_check_score));
  361. }
  362. } else {
  363. array_score_order.length = 0;
  364. array_score_data.length = 0;
  365. }
  366. if (eval("Math.min(" + array_score_data.toString() + ")") == 0)
  367. min_score = 0;
  368. else
  369. min_score = eval("Math.min(" + array_score_data.toString() + ")").toFixed(0) - 10;
  370. // 给得分人员排名次
  371. var rank = new Array();
  372. rank[0] = 1;
  373. for (var i = 1; i < array_score_data.length; i++) {
  374. if (array_score_data[i - 1] == array_score_data[i]) {
  375. rank[i] = rank[i - 1];
  376. } else {
  377. rank[i] = i + 1;
  378. }
  379. }
  380. array_score_data_temp = new Array();
  381. for (var i = 0; i < array_score_data.length; i++) {
  382. array_score_order.push(data[i].user.truename + "(" + (rank[i]) + ")");
  383. array_score_data_temp.push({ value: array_score_data[i], name: data[i].user.id + "_" + data[i].user.organid })
  384. }
  385. } else if (type == 5) {
  386. array_check_type.length = 0;
  387. if (data.length != 0) {
  388. for (var i = 0; i < data.length; i++) {
  389. array_check_type.push({ "value": data[i].all_check_score, "name": data[i].name });
  390. }
  391. } else {
  392. array_check_type.length = 0;
  393. }
  394. } else if (type == 6) {
  395. array_points_name.length = 0;
  396. array_points_pre.length = 0;
  397. arrar_points_month.length = 0;
  398. if (data != '' && data.Pmth.length != 0 || data.Tmth.length != 0) {
  399. data_each_people_points(data);
  400. } else {
  401. array_points_name.length = 0;
  402. array_points_pre.length = 0;
  403. arrar_points_month.length = 0;
  404. }
  405. } else if (type == 7) {
  406. array_five_name_back.length = 0;
  407. array_five_score_back.length = 0;
  408. if (data != '') {
  409. for (var i = 0; i < data.length; i++) {
  410. if (data[i].ranking_change < 0) {
  411. array_five_score_back.push((data[i].ranking_change + '').substr(1));
  412. } else {
  413. array_five_score_back.push((data[i].ranking_change + ''));
  414. }
  415. }
  416. } else {
  417. array_five_name_back.length = 0;
  418. array_five_score_back.length = 0;
  419. }
  420. if (eval("Math.min(" + array_five_score_back.toString() + ")") == 0) {
  421. min_five_back = 0;
  422. } else {
  423. min_five_back = eval("Math.min(" + array_five_score_back.toString() + ")").toFixed(0) - 1;
  424. }
  425. // 退步top5排名次
  426. var rank = new Array();
  427. rank[0] = 1;
  428. for (var i = 1; i < array_five_score_back.length; i++) {
  429. if (array_five_score_back[i - 1] == array_five_score_back[i]) {
  430. rank[i] = rank[i - 1];
  431. } else {
  432. rank[i] = i + 1;
  433. }
  434. }
  435. array_five_score_back_temp = new Array();
  436. for (var i = 0; i < array_five_score_back.length; i++) {
  437. array_five_name_back.push(data[i].user.truename + "\n" + (rank[i]));
  438. array_five_score_back_temp.push({ value: array_five_score_back[i], name: data[i].user.id + "_" + data[i].user.organid })
  439. }
  440. }
  441. }
  442. function data_each_people_points(data) {
  443. var flag = true;
  444. array_all_name=new Array()
  445. for(var index in data.item[0].itemList){
  446. var obj = data.item[0].itemList[index];
  447. //console.log(obj.name);
  448. array_all_name.push(obj.name);
  449. }
  450. // array_all_name = ["安全管理", "系统和设备管理", "票、款、卡管理", "内部解缴", "外部解缴", "环境卫生", "服务形象", "服务规范", "操作流程", "便民服务", "通行质量", "内部管理"];
  451. var Tmth = data.Tmth;
  452. var Pmth = data.Pmth;
  453. var Ntemp = new Array();
  454. var Ptemp = new Array();
  455. var Ttemp = new Array();
  456. for (var i = 0; i < array_all_name.length; i++) {
  457. flag = true;
  458. if (Tmth.length > 0) {
  459. for (var j = 0; j < Tmth.length; j++) {
  460. if (array_all_name[i] == Tmth[j].name && Tmth[j].all_check_score != null) {
  461. // Ttemp[i] = filter_handler(Tmth[j].all_check_score,Tmth[j].checked_num,Tmth[j].people_num,0);
  462. Ttemp[i] = Tmth[j].all_check_score;
  463. break;
  464. } else {
  465. Ttemp[i] = 0;
  466. }
  467. }
  468. } else {
  469. Ttemp[i] = 0;
  470. }
  471. if (Pmth.length > 0) {
  472. for (var m = 0; m < Pmth.length; m++) {
  473. if (array_all_name[i] == Pmth[m].name && Pmth[m].all_check_score != null) {
  474. // Ptemp[i] = filter_handler(Pmth[m].all_check_score,Pmth[m].checked_num,Pmth[m].people_num,0);
  475. Ptemp[i] = Pmth[m].all_check_score;
  476. break;
  477. } else {
  478. Ptemp[i] = 0;
  479. }
  480. }
  481. } else {
  482. Ptemp[i] = 0;
  483. }
  484. if (Ttemp[i] == 0 && Ptemp[i] == 0) {
  485. name[i] = "";
  486. flag = null;
  487. }
  488. if (flag) {
  489. array_points_pre.push(Ptemp[i]);
  490. arrar_points_month.push(Ttemp[i]);
  491. }
  492. }
  493. }
  494. /**
  495. * 根据道管中心获取收费站列表(下拉框)
  496. */
  497. $(".div-roadManage select").change(function() {
  498. setSecond();
  499. flag = true;
  500. });
  501. function setSecond_1(name) {
  502. var select_road = $(".div-roadManage select").val();
  503. var feeList = $.zui.store.get("cache_fee_station_list");
  504. if (select_road) feeList = cache_road_manager_fee_list_map.get(select_road);
  505. refreshFee(feeList, name, true);
  506. }
  507. function setSecond_2(name) {
  508. var select_road = $(".div-roadManage select").val();
  509. var feeList = $.zui.store.get("cache_fee_station_list");
  510. if (select_road) feeList = cache_road_manager_fee_list_map.get(select_road);
  511. refreshFee(feeList, name, false);
  512. }
  513. function setSecond() {
  514. // var select_road = $(".div-roadManage select").val();
  515. var feeList = $.zui.store.get("cache_fee_station_list");
  516. if (select_road) feeList = cache_road_manager_fee_list_map.get(select_road);
  517. var dept;
  518. if (roleContains("STATION")) {
  519. dept = getCurrentUser().organid;
  520. }
  521. refreshFee(feeList, dept, false);
  522. // var param = {
  523. // "parentid":select_road
  524. // }
  525. // post_common_service("dept/getDeptInfosByDeptId",param,function(data){
  526. // },function(error){
  527. // return "" ;
  528. // });
  529. }
  530. function refreshFee(data, selectId, isname) {
  531. var sec = document.getElementById('second');
  532. var tempStr = ''
  533. if (data.length != 0) {
  534. for (var i = 0; i < data.length; i++) {
  535. // if(select_road==30){
  536. // tempStr += "<option value="+data[i].id+">"+data[i].organname+"</option>";
  537. // }else if(select_road==31){
  538. // tempStr += "<option value="+data[i].id+">"+data[i].organname+"</option>";
  539. // }else{
  540. if (isname ? data[i].name == selectId : data[i].deptid == selectId)
  541. tempStr += "<option value=" + data[i].deptid + " selected>" + data[i].name + "</option>";
  542. else
  543. tempStr += "<option value=" + data[i].deptid + ">" + data[i].name + "</option>";
  544. // }
  545. sec.innerHTML = tempStr;
  546. }
  547. } else {
  548. sec.innerHTML = '';
  549. }
  550. // // 页面初始化
  551. // var select_month = $("#month_date").val();
  552. // var select_station = $("#second").val();
  553. // echart();
  554. // // 进退步top5
  555. // top5_change(select_month,select_station);
  556. // init_tollStation_year_assess("statistics/score/year/info",select_station);
  557. // init_company_points_assess("statistics/lost/score/rate",select_month+'',select_station);
  558. // init_people_score_rank("statistics/stuff/score/info",select_month+'',select_station);
  559. // init_server_check_type("statistics/lost/itemscore/rate",select_month+"",select_station);
  560. // init_each_people_points("statistics/lost/twice/itemscore/rate",select_month+"",select_station);
  561. // flag = false;
  562. }
  563. /**
  564. * 进步前5名后退步前五名切换
  565. */
  566. $(".view_change").click(function() {
  567. var select_month = $("#month_date").val();
  568. var select_station = $("#second").val();
  569. // 进退步top5
  570. top5_change(select_month, select_station);
  571. });
  572. /**
  573. * 进退步top5
  574. * @param {*} select_month
  575. * @param {*} select_station
  576. */
  577. function top5_change(select_month, select_station) {
  578. if (change_echart == 1) {
  579. $("#progress span").text("考核退步Top5排行榜");
  580. $("#progress-rank-assess").css("display", "none");
  581. $("#backward-rank-assess").css("display", "block");
  582. echart_change();
  583. init_backward_rank_assess("statistics/fs/up/five", select_month + '', select_station);
  584. change_echart = 2
  585. } else if (change_echart == 2) {
  586. $("#progress span").text("考核进步Top5排行榜");
  587. $("#progress-rank-assess").css("display", "block");
  588. $("#backward-rank-assess").css("display", "none");
  589. echart_change2();
  590. init_progress_rank_assess("statistics/fs/up/five", select_month + '', select_station);
  591. change_echart = 1
  592. }
  593. }
  594. /**
  595. * 除数为0处理
  596. * @param {*} num
  597. * @param {*} num1
  598. * @param {*} num2
  599. * @param {*} num4
  600. */
  601. function filter_handler(num, num1, num2, num3) {
  602. if (num1 == 0 || num2 == 0) {
  603. return num3;
  604. } else {
  605. return ((num / num1) / num2).toFixed(2);
  606. }
  607. }
  608. function filter(num, num1, num2) {
  609. if (num1 == 0) {
  610. return num2;
  611. } else {
  612. return (num / num1).toFixed(2);
  613. }
  614. }
  615. /**
  616. * 其它图配置
  617. */
  618. function echart(flag) {
  619. echart_config(1, flag);
  620. }
  621. /**
  622. * 进步top5图配置
  623. */
  624. function echart_change2() {
  625. echart_config(2, false);
  626. }
  627. /**
  628. * 退步top5图配置
  629. */
  630. function echart_change() {
  631. echart_config(3, false);
  632. }
  633. /**
  634. * 图配置
  635. */
  636. function echart_config(type, flag) {
  637. require.config({
  638. paths: {
  639. echarts: '/js/lib/echarts/build/dist'
  640. }
  641. });
  642. require(
  643. [
  644. 'echarts',
  645. 'echarts/theme/macarons',
  646. 'echarts/chart/line',
  647. 'echarts/chart/bar',
  648. 'echarts/chart/pie'
  649. ],
  650. function(ec, theme) {
  651. if (type == 2) {
  652. rank_assess = ec.init(document.getElementById('progress-rank-assess'));
  653. rank_assess.on(ecConfig.EVENT.CLICK, station_c)
  654. } else if (type == 3) {
  655. rank_assess_back = ec.init(document.getElementById('backward-rank-assess'));
  656. rank_assess_back.on(ecConfig.EVENT.CLICK, station_c)
  657. } else {
  658. if (flag) {
  659. year_assess = ec.init(document.getElementById('tollStation-year-assess'), theme);
  660. }
  661. points_assess = ec.init(document.getElementById('tollStation-points-assess'), theme);
  662. score_rank = ec.init(document.getElementById('people-score-rank'));
  663. check_type = ec.init(document.getElementById('server-check-type'), theme);
  664. people_points = ec.init(document.getElementById('each-people-points'));
  665. rank_assess_back = ec.init(document.getElementById('backward-rank-assess'));
  666. score_rank.on(ecConfig.EVENT.CLICK, station_c)
  667. rank_assess_back.on(ecConfig.EVENT.CLICK, station_c)
  668. }
  669. }
  670. );
  671. }
  672. /**
  673. * 图一
  674. */
  675. function tollStation_year_assess() {
  676. option = {
  677. color: ['#00ced1'],
  678. tooltip: {
  679. trigger: 'axis'
  680. },
  681. noDataLoadingOption: {
  682. text: '暂无数据',
  683. effect: 'bubble',
  684. effectOption: {
  685. effect: {
  686. n: 0 //气泡个数为0
  687. }
  688. },
  689. textStyle: {
  690. fontSize: 20,
  691. fontFamily: 'cursive',
  692. fontWeight: 'bold'
  693. }
  694. },
  695. legend: {
  696. data: ['收费站得分']
  697. },
  698. toolbox: {
  699. show: true,
  700. },
  701. calculable: true,
  702. xAxis: [{
  703. type: 'category',
  704. boundaryGap: false,
  705. data: x_m_array_temp
  706. }],
  707. yAxis: [{
  708. type: 'value',
  709. min: min_year,
  710. max: 100,
  711. axisLabel: {
  712. formatter: '{value}'
  713. }
  714. }],
  715. series: [{
  716. name: '收费站得分',
  717. type: 'line',
  718. data: array_year_score,
  719. markPoint: {
  720. data: [
  721. { type: 'max', name: '最大值' },
  722. { type: 'min', name: '最小值' }
  723. ]
  724. },
  725. markLine: {
  726. data: [
  727. { type: 'average', name: '平均值' }
  728. ]
  729. }
  730. },
  731. ]
  732. };
  733. return option;
  734. }
  735. /**
  736. * 图二
  737. */
  738. function tollStation_points_assess() {
  739. option = {
  740. tooltip: {
  741. trigger: 'item',
  742. formatter: "收费站考核扣分占比 <br/>{b} : {c}人 ({d}%)"
  743. },
  744. noDataLoadingOption: {
  745. text: '暂无数据',
  746. effect: 'bubble',
  747. effectOption: {
  748. effect: {
  749. n: 0 //气泡个数为0
  750. }
  751. },
  752. textStyle: {
  753. fontSize: 20,
  754. fontFamily: 'cursive',
  755. fontWeight: 'bold'
  756. }
  757. },
  758. toolbox: {
  759. show: true,
  760. feature: {
  761. magicType: {
  762. type: ['pie', 'funnel'],
  763. option: {
  764. funnel: {
  765. x: '25%',
  766. width: '50%',
  767. funnelAlign: 'left',
  768. max: 1548
  769. }
  770. }
  771. },
  772. }
  773. },
  774. calculable: true,
  775. series: [{
  776. name: '访问来源',
  777. type: 'pie',
  778. radius: '55%',
  779. center: ['50%', '50%'],
  780. data: array_points,
  781. itemStyle: {
  782. normal: {
  783. label: {
  784. show: true,
  785. formatter: '{b} :\n{c}人 ({d}%)'
  786. },
  787. labelLine: { show: true }
  788. }
  789. }
  790. }]
  791. };
  792. return option;
  793. }
  794. /**
  795. * 图三 前5名
  796. */
  797. function progress_rank_assess() {
  798. option = {
  799. color: ['#00ced1'], // 条形图颜色
  800. tooltip: {
  801. trigger: 'axis'
  802. },
  803. noDataLoadingOption: {
  804. text: '暂无数据',
  805. effect: 'bubble',
  806. effectOption: {
  807. effect: {
  808. n: 0 //气泡个数为0
  809. }
  810. },
  811. textStyle: {
  812. fontSize: 20,
  813. fontFamily: 'cursive',
  814. fontWeight: 'bold'
  815. }
  816. },
  817. grid: {
  818. width: "80%"
  819. },
  820. legend: {
  821. data: ['进步名次']
  822. },
  823. calculable: true,
  824. xAxis: [{
  825. type: 'category',
  826. data: array_five_name
  827. }],
  828. yAxis: [{
  829. type: 'value',
  830. min: min_five
  831. }],
  832. series: [{
  833. name: '进步名次',
  834. type: 'bar',
  835. data: array_five_score_temp,
  836. itemStyle: {
  837. normal: {
  838. label: {
  839. show: true,
  840. position: 'insideTop'
  841. }
  842. }
  843. },
  844. }]
  845. };
  846. return option;
  847. }
  848. /**
  849. * 图三 后5名
  850. */
  851. function backward_rank_assess() {
  852. option = {
  853. color: ['#FF7F27'], // 条形图颜色
  854. tooltip: {
  855. trigger: 'axis'
  856. },
  857. noDataLoadingOption: {
  858. text: '暂无数据',
  859. effect: 'bubble',
  860. effectOption: {
  861. effect: {
  862. n: 0 //气泡个数为0
  863. }
  864. },
  865. textStyle: {
  866. fontSize: 20,
  867. fontFamily: 'cursive',
  868. fontWeight: 'bold'
  869. }
  870. },
  871. grid: {
  872. width: "80%"
  873. },
  874. legend: {
  875. data: ['退步名次']
  876. },
  877. calculable: true,
  878. xAxis: [{
  879. type: 'category',
  880. data: array_five_name_back
  881. }],
  882. yAxis: [{
  883. type: 'value',
  884. min: min_five_back
  885. }],
  886. series: [{
  887. name: '退步名次',
  888. type: 'bar',
  889. data: array_five_score_back_temp,
  890. itemStyle: {
  891. normal: {
  892. label: {
  893. show: true,
  894. position: 'insideTop'
  895. }
  896. }
  897. },
  898. }]
  899. };
  900. return option;
  901. }
  902. /**
  903. * 图四
  904. */
  905. function people_score_rank() {
  906. option = {
  907. color: ['#00ced1'], // 条形图颜色
  908. tooltip: {
  909. trigger: 'axis'
  910. },
  911. noDataLoadingOption: {
  912. text: '暂无数据',
  913. effect: 'bubble',
  914. effectOption: {
  915. effect: {
  916. n: 0 //气泡个数为0
  917. }
  918. },
  919. textStyle: {
  920. fontSize: 20,
  921. fontFamily: 'cursive',
  922. fontWeight: 'bold'
  923. }
  924. },
  925. grid: {
  926. width: "88%"
  927. },
  928. legend: {
  929. data: ['人员考核得分']
  930. },
  931. calculable: true,
  932. xAxis: [{
  933. axisLabel: {
  934. interval: 0,
  935. rotate: 45,
  936. textStyle: {
  937. fontSize: 10
  938. }
  939. },
  940. type: 'category',
  941. data: array_score_order
  942. }],
  943. yAxis: [{
  944. type: 'value',
  945. min: min_score,
  946. max: 100
  947. }],
  948. series: [{
  949. name: '人员考核得分',
  950. type: 'bar',
  951. data: array_score_data_temp,
  952. itemStyle: {
  953. normal: {
  954. label: {
  955. show: true,
  956. position: 'insideTop'
  957. }
  958. }
  959. },
  960. markLine: {
  961. data: [
  962. { type: 'average', name: '平均值' }
  963. ]
  964. }
  965. }]
  966. };
  967. return option;
  968. }
  969. /**
  970. * 图五
  971. */
  972. function server_check_type() {
  973. option = {
  974. tooltip: {
  975. trigger: 'item',
  976. formatter: "温馨服务检查占比 <br/>{b} : {c}分 ({d}%)"
  977. },
  978. noDataLoadingOption: {
  979. text: '暂无数据',
  980. effect: 'bubble',
  981. effectOption: {
  982. effect: {
  983. n: 0 //气泡个数为0
  984. }
  985. },
  986. textStyle: {
  987. fontSize: 20,
  988. fontFamily: 'cursive',
  989. fontWeight: 'bold'
  990. }
  991. },
  992. toolbox: {
  993. show: true,
  994. feature: {
  995. magicType: {
  996. type: ['pie', 'funnel'],
  997. option: {
  998. funnel: {
  999. x: '25%',
  1000. width: '50%',
  1001. funnelAlign: 'left',
  1002. max: 1548
  1003. }
  1004. }
  1005. },
  1006. }
  1007. },
  1008. calculable: true,
  1009. series: [{
  1010. name: '访问来源',
  1011. type: 'pie',
  1012. radius: '55%',
  1013. center: ['50%', '50%'],
  1014. data: array_check_type,
  1015. itemStyle: {
  1016. normal: {
  1017. label: {
  1018. show: true,
  1019. formatter: '{b} :\n{c}分 ({d}%)'
  1020. },
  1021. labelLine: { show: true }
  1022. }
  1023. }
  1024. }]
  1025. };
  1026. return option;
  1027. }
  1028. /**
  1029. * 图六
  1030. */
  1031. function each_people_points() {
  1032. option = {
  1033. tooltip: {
  1034. trigger: 'axis'
  1035. },
  1036. noDataLoadingOption: {
  1037. text: '暂无数据',
  1038. effect: 'bubble',
  1039. effectOption: {
  1040. effect: {
  1041. n: 0 //气泡个数为0
  1042. }
  1043. },
  1044. textStyle: {
  1045. fontSize: 20,
  1046. fontFamily: 'cursive',
  1047. fontWeight: 'bold'
  1048. }
  1049. },
  1050. grid: {
  1051. width: "80%"
  1052. },
  1053. legend: {
  1054. data: ['上月', '本月']
  1055. },
  1056. calculable: true,
  1057. xAxis: [{
  1058. type: 'category',
  1059. data: array_all_name,
  1060. axisLabel: {
  1061. interval:0
  1062. }
  1063. }],
  1064. yAxis: [{
  1065. type: 'value'
  1066. }],
  1067. series: [{
  1068. name: '上月',
  1069. type: 'bar',
  1070. data: array_points_pre,
  1071. itemStyle: {
  1072. normal: {
  1073. color: '#7bc0f2',
  1074. label: {
  1075. show: true,
  1076. textStyle: {
  1077. color: 'black'
  1078. }
  1079. }
  1080. }
  1081. },
  1082. },
  1083. {
  1084. name: '本月',
  1085. type: 'bar',
  1086. data: arrar_points_month,
  1087. itemStyle: {
  1088. normal: {
  1089. color: '#ea644a',
  1090. label: {
  1091. show: true,
  1092. textStyle: {
  1093. color: 'black'
  1094. }
  1095. }
  1096. }
  1097. },
  1098. }
  1099. ]
  1100. };
  1101. return option;
  1102. }
  1103. });
  1104. function setVisit() {
  1105. if (roleContains("STATION")) {
  1106. $("#first").attr("disabled", "disabled");
  1107. $("#second").attr("disabled", "disabled");
  1108. }
  1109. if (roleContains("ROAD_MANAGER")) {
  1110. $("#first").attr("disabled", "disabled");
  1111. }
  1112. }
  1113. var ecConfig = require('echarts/config');
  1114. function station_c(param) {
  1115. if (typeof param.seriesIndex == 'undefined') {
  1116. return;
  1117. }
  1118. if (param.type == 'click') {
  1119. var pdata = {
  1120. time: $("#month_date").val(),
  1121. road_p: $(".div-roadManage select").val(),
  1122. station_p: $("#second").val()
  1123. }
  1124. $.zui.store.set('page_data_param_temp_time', $("#month_date").val());
  1125. //获取站名+用户名
  1126. var namelist = param.data.name.split("_")
  1127. var userid = namelist[0];
  1128. var deptid = namelist[1];
  1129. $.zui.store.set('store_param_' + current_url, pdata);
  1130. isnew = false;
  1131. changePage("/view/statistics/personal_data_statistics.html?userid=" + userid + "&deptid=" + deptid + "&jump=1");
  1132. }
  1133. }