road_manage_statistics.js 39 KB

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