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.
 
 
 
 
 
 

342 lines
7.1 KiB

  1. $(window).load(function () {
  2. //导航栏
  3. $(".headModeList li").eq(0).removeClass("active");
  4. $(".headModeList li").eq(1).removeClass("active");
  5. $(".headModeList li").eq(2).addClass("active");
  6. $(".headModeTxt").find('span').html($(".headModeList li").eq(2).find('a').html());
  7. //学生到课率预警
  8. var toClassNum = 20;
  9. var toClassBl = $('.toClassBl')
  10. if (toClassNum < 60) {
  11. toClassBl.addClass('green').height(toClassNum + '%')
  12. } else if (toClassNum >= 60 && toClassNum < 80) {
  13. toClassBl.addClass('blue').height(toClassNum + '%')
  14. } else if (toClassNum >= 80) {
  15. toClassBl.addClass('red').height(toClassNum + '%')
  16. }
  17. //专业总览
  18. majorEchart()
  19. //课程总览
  20. classEchart()
  21. //教师年龄比例
  22. ageEchart()
  23. //教师学历比例
  24. eduEchart()
  25. // 学生成绩预警
  26. achWarnEchart()
  27. // 学生逃课预警
  28. skipEchart()
  29. var layer = null;
  30. layui.use('form', function() {
  31. layer = layui.layer;
  32. let form = layui.form;
  33. // form.render()
  34. //监听select选择 专业总览
  35. form.on('select', function(data) {
  36. console.log(data);
  37. });
  38. });
  39. });
  40. //教师学历比例
  41. function eduEchart() {
  42. var myChart6 = echarts.init(document.getElementById('education'));
  43. option = {
  44. tooltip: {
  45. formatter: function(n) { //"{a} <br/>{b} : {d}({c}%)"
  46. //console.log(n)
  47. return n.name + '<br/>' + n.value + '人' + '(' + n.percent + '%)'
  48. }
  49. },
  50. // calculable: true,
  51. series: [{
  52. name: '教师学历比例',
  53. type: 'funnel',
  54. width: '100%',
  55. height: '80%',
  56. x: '0%',
  57. y: '10%',
  58. sort: 'ascending',
  59. label: {
  60. // show: false,
  61. position: 'center'
  62. },
  63. labelLine: {
  64. show: false,
  65. },
  66. color: ['#F6685E', '#ECBD02', '#67A0F5', '#198BE3', '#F6685E', '#DEBC03', '#0BB56C', '#CB1FA1'],
  67. data: TeacherByHighestRecord
  68. }]
  69. };
  70. // 使用刚指定的配置项和数据显示图表。
  71. myChart6.setOption(option);
  72. window.addEventListener("resize", function() {
  73. myChart6.resize();
  74. });
  75. }
  76. // 教师年龄比例
  77. function ageEchart() {
  78. var myChart6 = echarts.init(document.getElementById('age'));
  79. option = {
  80. tooltip: {
  81. trigger: 'item',
  82. formatter: '{b} : {c}人 ({d}%)'
  83. },
  84. legend: {
  85. // orient: 'vertical',
  86. textStyle: { //图例文字的样式
  87. color: '#424242',
  88. fontSize: 8
  89. },
  90. left: 0,
  91. bottom: 0,
  92. itemWidth: 8,
  93. itemHeight: 8,
  94. data: ['20~30岁', '30~40岁', '40~50岁', '50~60岁', '60岁以上']
  95. },
  96. color: ['#00E7B9', '#7486F1', '#FCF13E', '#ECBD02', '#F6685E', '#DEBC03', '#0BB56C', '#CB1FA1'],
  97. series: [{
  98. name: '教师年龄比例',
  99. type: 'pie',
  100. radius: [30, 50],
  101. center: ['55%', '50%'],
  102. label: {
  103. show: true
  104. },
  105. roseType: 'radius',
  106. data: TeacherByAge
  107. }],
  108. };
  109. // 使用刚指定的配置项和数据显示图表。
  110. myChart6.setOption(option);
  111. window.addEventListener("resize", function() {
  112. myChart6.resize();
  113. });
  114. }
  115. //课程总览
  116. function classEchart() {
  117. // 基于准备好的dom,初始化echarts实例
  118. var myChart3 = echarts.init(document.getElementById('class'));
  119. option = {
  120. tooltip: {
  121. trigger: 'item',
  122. formatter: '{b} : {c}'
  123. },
  124. series: [{
  125. name: '课程分类',
  126. type: 'pie',
  127. radius: [42, 57],
  128. center: ['50%', '50%'],
  129. hoverAnimation: false,
  130. zlevel: 2,
  131. color: ['#59D078', '#8F66E1'],
  132. data: LessonBySort
  133. },
  134. {
  135. name: '课程类型',
  136. type: 'pie',
  137. radius: [70, 85],
  138. center: ['50%', '50%'],
  139. hoverAnimation: false,
  140. color: ['#ECBD02', '#00E7B9'],
  141. data: LessonByType
  142. }
  143. ]
  144. };
  145. // 使用刚指定的配置项和数据显示图表。
  146. myChart3.setOption(option);
  147. window.addEventListener("resize", function() {
  148. myChart3.resize();
  149. });
  150. }
  151. //专业总览
  152. function majorEchart() {
  153. var myChart5 = echarts.init(document.getElementById('major'));
  154. option = {
  155. tooltip: {
  156. trigger: 'item',
  157. formatter: '{b} : {c}'
  158. },
  159. series: [{
  160. name: '专业学生',
  161. type: 'pie',
  162. radius: [60, 75],
  163. center: ['50%', '50%'],
  164. label: {
  165. // show: true
  166. show: false
  167. },
  168. color: ['#6C5CEA', '#57C5F5', '#E7C900', '#FF9C95', '#59D078', '#C97FEF', '#ECBD02', '#DF59B8', '#F6685E',
  169. '#00E7B9', '#7A74F1', '#4A9ADE', '#33F0E5', '#ECBD02', '#DF59B8'
  170. ],
  171. // hoverAnimation: false,
  172. data: StuByMajor
  173. }, {
  174. name: '班级总数',
  175. type: 'pie',
  176. radius: [50, 65],
  177. center: ['17%', '50%'],
  178. label: {
  179. // show: true
  180. show: false
  181. },
  182. color: ['#59D078', '#57C5F5', '#E7C900'],
  183. // hoverAnimation: false,
  184. data: [{
  185. value: ClassInfoTotalNum,
  186. name: '班级总数',
  187. }]
  188. }, {
  189. name: '专业教室',
  190. type: 'pie',
  191. radius: [50, 65],
  192. center: ['83%', '50%'],
  193. label: {
  194. // show: true
  195. show: false
  196. },
  197. color: ['#3E49E2', '#677BF5', '#67A0F5', '#E7C900'],
  198. // hoverAnimation: false,
  199. data: [{
  200. value: ClassRoomTotalNum,
  201. name: '教室总数',
  202. }]
  203. }, ]
  204. };
  205. // 使用刚指定的配置项和数据显示图表。
  206. myChart5.setOption(option);
  207. window.addEventListener("resize", function() {
  208. myChart5.resize();
  209. });
  210. setTimeout(function(){
  211. myChart5.resize();
  212. });
  213. }
  214. // 学生逃课预警
  215. function skipEchart() {
  216. // 基于准备好的dom,初始化echarts实例
  217. var myChart8 = echarts.init(document.getElementById('skipClass'));
  218. option = {
  219. tooltip: {
  220. formatter: '{a} : {c}%'
  221. },
  222. series: [{
  223. name: '学生逃课预警',
  224. type: 'gauge',
  225. radius: "70%",
  226. center: ["50%", "50%"],
  227. axisLine: {
  228. show: true,
  229. lineStyle: {
  230. color: [ //表盘颜色
  231. [0.6, "#0AB56B"], //0-50%处的颜色
  232. [0.8, "#64CDFE"], //51%-70%处的颜色
  233. [1, "#E44E4E"], //70%-90%处的颜色
  234. ],
  235. width: 15 //表盘宽度
  236. }
  237. },
  238. splitLine: {
  239. show: false,
  240. },
  241. axisLabel: {
  242. show: true,
  243. formatter: function(v) {
  244. // console.log(v)
  245. switch (v + '') {
  246. case '30':
  247. return '低';
  248. case '70':
  249. return '中';
  250. case '90':
  251. return '高';
  252. }
  253. },
  254. distance: -50 //文字离表盘的距离
  255. },
  256. axisTick: {
  257. show: false,
  258. },
  259. detail: {
  260. formatter: "{score|{value}%}",
  261. offsetCenter: [0, "80%"],
  262. height: 30,
  263. rich: {
  264. score: {
  265. fontSize: 16
  266. }
  267. }
  268. },
  269. data: [{
  270. value: 5,
  271. name: '',
  272. label: {
  273. textStyle: {
  274. fontSize: 12
  275. }
  276. }
  277. }]
  278. }]
  279. };
  280. // 使用刚指定的配置项和数据显示图表。
  281. myChart8.setOption(option);
  282. window.addEventListener("resize", function() {
  283. myChart8.resize();
  284. });
  285. }
  286. // 学生成绩预警
  287. function achWarnEchart() {
  288. var myChart5 = echarts.init(document.getElementById('achWarn'));
  289. option = {
  290. tooltip: {
  291. trigger: 'item',
  292. formatter: '{b} : {c}人({d}%)'
  293. },
  294. color: ['#EB5858', '#FB8383', '#FDACAC', '#FECACA', '#FFE2E2', '#DEBC03', '#0BB56C', '#CB1FA1'],
  295. series: [{
  296. name: '全校',
  297. type: 'pie',
  298. radius: [50, 60],
  299. center: ['50%', '50%'],
  300. label: {
  301. // show: false
  302. },
  303. hoverAnimation: false,
  304. data: StuScoreByMajor
  305. }]
  306. };
  307. // 使用刚指定的配置项和数据显示图表。
  308. myChart5.setOption(option);
  309. window.addEventListener("resize", function() {
  310. myChart5.resize();
  311. });
  312. }