road_manage_statistics.js 44 KB

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