ReportCollege.vue 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. <template>
  2. <div class="report-college">
  3. <report-box title="学院成绩分析">
  4. <div
  5. v-if="(chart, cindex) in collegeCharts"
  6. :key="cindex"
  7. class="page-chart"
  8. >
  9. <v-chart :option="chart"></v-chart>
  10. </div>
  11. <table
  12. v-for="(tgroup, tindex) in collegeTables"
  13. :key="tindex"
  14. class="table table-border"
  15. >
  16. <tr>
  17. <th>学院</th>
  18. <th>平均分</th>
  19. <th>最高分</th>
  20. <th>最低分</th>
  21. <th>及格数</th>
  22. <th>及格率(%)</th>
  23. <th>优秀数</th>
  24. <th>优秀率(%)</th>
  25. </tr>
  26. <tr v-for="(item, ind) in tgroup" :key="ind">
  27. <td>{{ item.name }}</td>
  28. <td>{{ item.avgScore }}</td>
  29. <td>{{ item.maxScore }}</td>
  30. <td>{{ item.minScore }}</td>
  31. <td>{{ item.passCount }}</td>
  32. <td>{{ item.passRate }}</td>
  33. <td>{{ item.excellentCount }}</td>
  34. <td>{{ item.excellentRate }}</td>
  35. </tr>
  36. </table>
  37. </report-box>
  38. </div>
  39. </template>
  40. <script>
  41. import { mapState } from "vuex";
  42. import ReportBox from "./ReportBox.vue";
  43. import { sectionArr } from "./utils";
  44. import { getBarsOptions } from "./chart";
  45. export default {
  46. name: "report-college",
  47. components: { ReportBox },
  48. data() {
  49. return {
  50. collegeCharts: [],
  51. collegeTables: [],
  52. };
  53. },
  54. computed: {
  55. ...mapState("report", ["college"]),
  56. },
  57. methods: {
  58. initData() {
  59. const college = this.college.map((item) => {
  60. return {
  61. ...item,
  62. name: item.college,
  63. };
  64. });
  65. this.collegeCharts = sectionArr(college, 10).map((data) =>
  66. getBarsOptions(data)
  67. );
  68. this.collegeTables = sectionArr(college, 30);
  69. },
  70. },
  71. };
  72. </script>