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.
 
 
 
 
 
 

339 lines
7.0 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: 10
  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. }
  211. // 学生逃课预警
  212. function skipEchart() {
  213. // 基于准备好的dom,初始化echarts实例
  214. var myChart8 = echarts.init(document.getElementById('skipClass'));
  215. option = {
  216. tooltip: {
  217. formatter: '{a} : {c}%'
  218. },
  219. series: [{
  220. name: '学生逃课预警',
  221. type: 'gauge',
  222. radius: "70%",
  223. center: ["50%", "50%"],
  224. axisLine: {
  225. show: true,
  226. lineStyle: {
  227. color: [ //表盘颜色
  228. [0.6, "#0AB56B"], //0-50%处的颜色
  229. [0.8, "#64CDFE"], //51%-70%处的颜色
  230. [1, "#E44E4E"], //70%-90%处的颜色
  231. ],
  232. width: 15 //表盘宽度
  233. }
  234. },
  235. splitLine: {
  236. show: false,
  237. },
  238. axisLabel: {
  239. show: true,
  240. formatter: function(v) {
  241. // console.log(v)
  242. switch (v + '') {
  243. case '30':
  244. return '低';
  245. case '70':
  246. return '中';
  247. case '90':
  248. return '高';
  249. }
  250. },
  251. distance: -50 //文字离表盘的距离
  252. },
  253. axisTick: {
  254. show: false,
  255. },
  256. detail: {
  257. formatter: "{score|{value}%}",
  258. offsetCenter: [0, "80%"],
  259. height: 30,
  260. rich: {
  261. score: {
  262. fontSize: 16
  263. }
  264. }
  265. },
  266. data: [{
  267. value: 5,
  268. name: '',
  269. label: {
  270. textStyle: {
  271. fontSize: 12
  272. }
  273. }
  274. }]
  275. }]
  276. };
  277. // 使用刚指定的配置项和数据显示图表。
  278. myChart8.setOption(option);
  279. window.addEventListener("resize", function() {
  280. myChart8.resize();
  281. });
  282. }
  283. // 学生成绩预警
  284. function achWarnEchart() {
  285. var myChart5 = echarts.init(document.getElementById('achWarn'));
  286. option = {
  287. tooltip: {
  288. trigger: 'item',
  289. formatter: '{b} : {c}人({d}%)'
  290. },
  291. color: ['#EB5858', '#FB8383', '#FDACAC', '#FECACA', '#FFE2E2', '#DEBC03', '#0BB56C', '#CB1FA1'],
  292. series: [{
  293. name: '全校',
  294. type: 'pie',
  295. radius: [50, 60],
  296. center: ['50%', '50%'],
  297. label: {
  298. // show: false
  299. },
  300. hoverAnimation: false,
  301. data: StuScoreByMajor
  302. }]
  303. };
  304. // 使用刚指定的配置项和数据显示图表。
  305. myChart5.setOption(option);
  306. window.addEventListener("resize", function() {
  307. myChart5.resize();
  308. });
  309. }