total_company_statistics.js 41 KB

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