智慧校园考试-班级报告
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

section_2.js 14KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302
  1. $(function () {
  2. function initaveragescoreEcharts (list,s_index) {
  3. var itemStyle = {
  4. normal: {
  5. label: {
  6. show: true, //开启显示数值
  7. position: "top" //数值在上方显示
  8. }
  9. }
  10. };
  11. var avgscore = [],xAxis_data=[],totalScore = 0;
  12. var curlegend = [ "平均分"];
  13. $.each(list.pjf, function (idx, item) {
  14. totalScore += item.classavgscore;
  15. avgscore.push(item.classavgscore);
  16. xAxis_data.push(item.classname)
  17. })
  18. var gradeAvgScore = Math.floor(totalScore / xAxis_data.length);
  19. var curseries = [
  20. {
  21. name: "平均分",
  22. type: "bar",
  23. barWidth: $.UnitUtil.mm2px(5),
  24. // 柱状图最小高度
  25. barMinHeight: $.UnitUtil.mm2px(2),
  26. barGap: 0,
  27. data: avgscore,
  28. itemStyle: itemStyle,
  29. markLine: {
  30. precision: 0,
  31. data: [{ type: "average", name: "平均值" }],
  32. itemStyle: {
  33. normal: {
  34. lineStyle: {
  35. color: "#ff001e",
  36. type: "dotted"
  37. },
  38. label: {
  39. show: true,
  40. color: "#ff001e",
  41. position: "insideEndTop",
  42. formatter: function () {
  43. return "年级平均分:" + gradeAvgScore;
  44. }
  45. }
  46. }
  47. },
  48. large: true
  49. },
  50. z: 10
  51. }
  52. ];
  53. var option = {
  54. animation: false,
  55. color: ["#5C99FF", "#FF5F56", "#5EC5C8", "#f1982b"],
  56. title: {
  57. text: "分",
  58. x: "left",
  59. y: "top",
  60. textStyle: {
  61. color: "#5F6E82",
  62. fontSize: $.UnitUtil.mm2px(3),
  63. fontWeight: 500
  64. }
  65. },
  66. legend: {
  67. itemWidth: $.UnitUtil.mm2px(2),
  68. itemHeight: $.UnitUtil.mm2px(2),
  69. top: "bottom",
  70. data: curlegend
  71. },
  72. grid: {
  73. top: $.UnitUtil.mm2px(10),
  74. left: 0,
  75. right: 0,
  76. bottom: $.UnitUtil.mm2px(8),
  77. containLabel: true
  78. },
  79. xAxis: [
  80. {
  81. type: "category",
  82. data: xAxis_data,
  83. axisLabel: {
  84. color: "#5F6E82" //更改坐标轴文字颜色
  85. },
  86. axisTick: {
  87. alignWithLabel: true
  88. },
  89. boundaryGap: true,
  90. triggerEvent: true,
  91. axisLine: {
  92. show: true, //是否显示轴线
  93. lineStyle: {
  94. color: "#DADADA" //刻度线的颜色
  95. }
  96. }
  97. }
  98. ],
  99. yAxis: [
  100. {
  101. type: "value",
  102. axisTick: {
  103. show: false //刻度
  104. },
  105. axisLine: {
  106. show: false, //是否显示轴线
  107. lineStyle: {
  108. color: "#DADADA" //刻度线的颜色
  109. }
  110. },
  111. splitLine: {
  112. //网格线
  113. lineStyle: {
  114. type: "dotted" //设置网格线类型 dotted:虚线 solid:实线
  115. },
  116. show: true //隐藏或显示
  117. },
  118. axisLabel: {
  119. color: "#5F6E82" //更改坐标轴文字颜色
  120. }
  121. }
  122. ],
  123. series: curseries
  124. };
  125. var myEcharts = echarts.init(
  126. document.querySelector(".section2.sectiontwo_"+s_index+" #averagescoreEcharts")
  127. );
  128. myEcharts.clear();
  129. myEcharts.setOption(option);
  130. }
  131. function achievementdistributiontable (list,s_index) {
  132. var table = "", goodTableHeadTr1Html = '<th class="dj">等级</th><th class="pm">排名(年级/名)</th><th class="dj">人数</th><th class="comm">详情</th>',
  133. trHtml = "";
  134. $.each(list.djtj, function (idx, item) {
  135. var stujson = JSON.parse(item.stujson),stuarr = "";
  136. $.each(stujson, function (index, items) {
  137. stuarr+=items.studentname+"("+items.schoolrank+"名)、"
  138. })
  139. stuarr = stuarr.substr(0, stuarr.length - 1);
  140. trHtml += '<tr><td>' + item.rankname + "类</td><td>" + item.rankrange + "</td><td>" +
  141. item.stunum+"</td><td>"+stuarr+"</td></tr>";
  142. })
  143. table = '<table border="1" class="my_table"><thead><tr class="goodTableHeadTr1">' +
  144. goodTableHeadTr1Html + '</tr></thead><tbody class="goodTableTbody">' +
  145. trHtml + '</tbody></table>'
  146. $(".section2.sectiontwo_"+s_index+" .achievementdistribution").html(table)
  147. }
  148. function progresstable (list,s_index) {
  149. var table = "", trHtml={1:"",2:""};
  150. var cjdjheight = $(".section2_1.sectiontwo_"+s_index+" .cjdjheight").height() - 454;
  151. var surplus = pageheight - cjdjheight; //本页剩余高度
  152. var height = 0,page = {1:"",2:""},ispage = false;
  153. $.each(list.dfjb, function (idx, item) {
  154. if (idx % 2 == 0) {
  155. height += 27.5;
  156. if (height > surplus && surplus - height < 27.5) {
  157. ispage = true;
  158. }
  159. if (ispage) {
  160. trHtml[2] += '<tr><td>' + (idx+1) + '</td><td>' + item.username + '</td><td>' + item.score + '分</td><td>第' +
  161. item.classrank + '名</td><td class="green">进步' + item.classrankpre + '名</td>';
  162. } else {
  163. trHtml[1] += '<tr><td>' + (idx+1) + '</td><td>' + item.username + '</td><td>' + item.score + '分</td><td>第' +
  164. item.classrank + '名</td><td class="green">进步' + item.classrankpre + '名</td>';
  165. }
  166. } else {
  167. if (ispage) {
  168. trHtml[2]+= '<td>' + (idx+1) + '</td><td>' + item.username + '</td><td>' + item.score + '分</td><td>第' +
  169. item.classrank + '名</td><td class="green">进步' + item.classrankpre + '名</td>';
  170. } else {
  171. trHtml[1] += '<td>' + (idx+1) + '</td><td>' + item.username + '</td><td>' + item.score + '分</td><td>第' +
  172. item.classrank + '名</td><td class="green">进步' + item.classrankpre + '名</td>';
  173. }
  174. }
  175. })
  176. for (var i = 1; i < 3; i++){
  177. page[i]='<table border="1" class="my_table"><tbody class="goodTableTbody">' +
  178. trHtml[i] + '</tbody></table>'
  179. }
  180. $(".section2_1.sectiontwo_"+s_index+" .progress").html(page[1])
  181. if (ispage) {
  182. //添加第二页
  183. $(".section2_1.sectiontwo_"+s_index).after(
  184. '<div class="page_root section2 sectiontwo_'+s_index+' section2_2"></div>'
  185. );
  186. $(".section2_2.sectiontwo_"+s_index).html(page[2]);
  187. }
  188. }
  189. function retrogression (list,s_index) {
  190. var trHtml = "", table = "";
  191. $.each(list.dftb, function (idx, item) {
  192. item.classrankpre = Math.abs(item.classrankpre)
  193. if (idx % 2 == 0) {
  194. trHtml += '<tr><td>' + (idx+1) + '</td><td>' + item.username + '</td><td>' + item.score + '分</td><td>第' +
  195. item.classrank + '名</td><td class="red">退步' + item.classrankpre + '名</td>';
  196. } else {
  197. trHtml += '<td>' + (idx+1) + '</td><td>' + item.username + '</td><td>' + item.score + '分</td><td>第' +
  198. item.classrank + '名</td><td class="red">退步' + item.classrankpre + '名</td>';
  199. }
  200. })
  201. var table ='<table border="1" class="my_table"><tbody class="goodTableTbody">' +
  202. trHtml + '</tbody></table>'
  203. $(".section2.sectiontwo_"+s_index+" .retrogression").html(table)
  204. }
  205. function critical (list,s_index) {
  206. var trHtml = "", table = "";
  207. $.each(list.ljs, function (idx, item) {
  208. if (idx % 2 == 0) {
  209. trHtml += '<tr><td>' + (idx+1) + '</td><td>' + item.username + '</td><td>' + item.score + '分</td><td>第' +
  210. item.classrank + '分</td><td class="red">' + item.classrankpre + '分</td>';
  211. } else {
  212. trHtml += '<td>' + (idx+1) + '</td><td>' + item.username + '</td><td>' + item.score + '分</td><td>第' +
  213. item.classrank + '分</td><td class="red">' + item.classrankpre + '分</td>';
  214. }
  215. })
  216. var table ='<table border="1" class="my_table"><tbody class="goodTableTbody">' +
  217. trHtml + '</tbody></table>'
  218. $(".section2.sectiontwo_"+s_index+" .critical").html(table)
  219. }
  220. function wave (list,s_index) {
  221. var trHtml = "", table = "";
  222. $.each(list.bds, function (idx, item) {
  223. var curdata = {
  224. class: "red",
  225. name :"退步"
  226. }
  227. if (item.classrankpre > 0) {
  228. curdata = {
  229. class: "green",
  230. name :"进步"
  231. }
  232. }
  233. item.classrankpre = Math.abs(item.classrankpre)
  234. if (idx % 2 == 0) {
  235. trHtml += '<tr><td>' + (idx+1) + '</td><td>' + item.username + '</td><td>' + item.score + '分</td><td>' +
  236. item.classrank + '分</td><td class="'+curdata.class+'">'+curdata.name + item.classrankpre + '名</td>';
  237. } else {
  238. trHtml += '<td>' + (idx+1) + '</td><td>' + item.username + '</td><td>' + item.score + '分</td><td>' +
  239. item.classrank + '分</td><td class="'+curdata.class+'">'+curdata.name + item.classrankpre + '名</td>';
  240. }
  241. })
  242. var table ='<table border="1" class="my_table"><tbody class="goodTableTbody">' +
  243. trHtml + '</tbody></table>'
  244. $(".section2.sectiontwo_"+s_index+" .wave").html(table)
  245. }
  246. function errquestion (list,s_index) {
  247. var table = "", goodTableHeadTr1Html = '<th>题号</th><th>题型</th><th>知识点</th><th>班级得分率</th><th>年级得分率</th><th>高频错误项</th>',
  248. trHtml = "";
  249. $.each(list.gpctList, function (idx, item) {
  250. item.answer = JSON.parse(item.answer);
  251. var pointnames = item.pointnames[0] || "";
  252. var erroroption = item.erroroption|| "--";
  253. trHtml += '<tr><td class="word_wrap">第' + item.qn + "题</td><td>" + item.eptname + "</td><td>" +
  254. pointnames+"</td><td>"+item.classsrate+'%</td><td>'+item.gradesrate+'%</td><td>'+erroroption+"</td></tr>";
  255. })
  256. table = '<table border="1" class="my_table"><thead><tr class="goodTableHeadTr1">' +
  257. goodTableHeadTr1Html + '</tr></thead><tbody class="goodTableTbody">' +
  258. trHtml + '</tbody></table>'
  259. $(".section2.sectiontwo_"+s_index+" .errquestion").html(table)
  260. }
  261. var parameter = $(".section_2_html_root").data("page-params");
  262. parameter = JSON.parse(parameter);
  263. var html = "";
  264. $.each(parameter, function (s_index, item) {
  265. html+=' <div class="page_root section2 sectiontwo_'+s_index+'">'+
  266. (s_index === 0 ?'<h1 class="section_title_1">第二章 单科概况</h1><div class="abstract_box"><div class="abstract_left"><img src="/img/img2.png" /></div><div class="abstract_right"><div class="abstract_content">从学校和数据的角度分析整体科目、整体班级及各科各班之间的水平和差异情况,系统从多个维度的数据进行对比分析,包括<strong> 满分、最高分、平均分、最低分、四率、参考人数、标准差。</strong ></div ></div ></div >':"")+
  267. '<h1 class="subjectinfo">'+item.subjectname+'概况</h1><div class="section_title_3 jj">本次报告是结合学生语文学科成绩,进行深层分析,很好地反映了全部学生阶段性的教学成果和存在的问题。学生整体表现大致如下:</div><h2 class="section_title_2">1.总览</h2><div class="section_list"><div class="section_item"><div class="item_num"><span class="classavgscore"></span>分</div><div class="item_title">平均分</div></div><div class="section_item"><div class="item_num"><span class="classavgscorerank"></span>名</div><div class="item_title">平均分排名</div></div><div class="section_item"><div class="item_num"><span class="yxrate"></span>%</div><div class="item_title">优秀率</div></div><div class="section_item"><div class="item_num"><span class="jgrate"></span>%</div><div class="item_title">及格率</div></div><div class="section_item" style="margin-right: 0"><div class="item_num"><span class="classmaxscore"></span>分</div><div class="item_title">最高分</div></div></div><div style="margin-bottom: 4mm; font-size: 4mm">全校平均分:<span class="schoolavgscore blue"></span>分<spanclass="line"></spanclass=>全校最高分:<span class="schoolmaxscore blue"></span>分</div><h2 class="section_title_2">2.学科平均分对比</h2><div id="averagescoreEcharts" style="margin: 0 4mm 4mm; height: 80mm"></div></div><div class="page_root section2 section2_1 sectiontwo_'+
  268. s_index + '"><div class="cjdjheight"><h2 class="section_title_2">3.成绩等级分布</h2><div class="achievementdistribution"></div><h2 class="section_title_2">4.需关注学生</h2><h3 class="section_title_3">4.1 大幅进步分布</h3></div><div class="progress multicolumn"></div></div><div class="page_root section2 sectiontwo_'+
  269. s_index + '"><h3 class="section_title_3">4.2 大幅退步分布</h3><div class="retrogression"></div></div><div class="page_root section2 sectiontwo_'+
  270. s_index + '"><h3 class="section_title_3">4.3 临界生分布</h3><div class="critical"></div></div><div class="page_root section2 sectiontwo_'+
  271. s_index + '"><h3 class="section_title_3">4.4 波动生分布</h3><div class="wave"></div></div><div class="page_root section2 sectiontwo_'+
  272. s_index + '"><h2 class="section_title_2">5.高频错题分析</h2><div class="errquestion"></div></div>'
  273. console.log(item);
  274. })
  275. $(".ChapterTwo").html(html)
  276. $.each(parameter, function (s_index, item) {
  277. $(".section2.sectiontwo_"+s_index+" .classavgscore").text(item.classavgscore);
  278. $(".section2.sectiontwo_"+s_index+" .classavgscorerank").text(item.classavgscorerank);
  279. $(".section2.sectiontwo_"+s_index+" .yxrate").text(item.yxrate);
  280. $(".section2.sectiontwo_"+s_index+" .jgrate").text(item.jgrate);
  281. $(".section2.sectiontwo_"+s_index+" .classmaxscore").text(item.classmaxscore);
  282. $(".section2.sectiontwo_"+s_index+" .schoolavgscore").text(item.schoolavgscore);
  283. $(".section2.sectiontwo_"+s_index+" .schoolmaxscore").text(item.schoolmaxscore);
  284. initaveragescoreEcharts(item,s_index);
  285. achievementdistributiontable(item,s_index);
  286. progresstable(item,s_index);
  287. retrogression(item,s_index);
  288. critical(item,s_index);
  289. wave(item,s_index);
  290. errquestion(item,s_index)
  291. })
  292. document.documentElement.scrollTop = 13500;
  293. });