ReportQuestion.vue 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. <template>
  2. <div class="report-question">
  3. <report-box :title="title">
  4. <div
  5. v-if="(chart, cindex) in questionCharts"
  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 questionTables"
  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. </tr>
  25. <tr v-for="(item, ind) in tgroup" :key="ind">
  26. <td>{{ item.title }}</td>
  27. <td>{{ item.mainNumber }}</td>
  28. <td>{{ item.subNumber }}</td>
  29. <td>{{ item.score }}</td>
  30. <td>{{ item.avgScore }}</td>
  31. <td>{{ item.socreRate }}</td>
  32. <td>{{ item.fullScoreRate }}</td>
  33. </tr>
  34. </table>
  35. </report-box>
  36. </div>
  37. </template>
  38. <script>
  39. import { mapState } from "vuex";
  40. import ReportBox from "./ReportBox.vue";
  41. import { sectionArr } from "./utils";
  42. import { getBarPointTopicOptions } from "./chart";
  43. export default {
  44. name: "report-question",
  45. components: { ReportBox },
  46. props: {
  47. type: String,
  48. },
  49. data() {
  50. return {
  51. questionCharts: [],
  52. questionTables: [],
  53. };
  54. },
  55. computed: {
  56. ...mapState("report", ["objective", "subjective"]),
  57. typeName() {
  58. return this.type === "subjective" ? "主观题" : "客观题";
  59. },
  60. title() {
  61. return `${this.typeName}成绩分析`;
  62. },
  63. },
  64. methods: {
  65. initData() {
  66. const question =
  67. this.type === "subjective" ? this.subjective : this.objective;
  68. this.questionCharts = sectionArr(question, 26).map((data) =>
  69. getBarPointTopicOptions(data)
  70. );
  71. this.questionTables = sectionArr(question, 32);
  72. },
  73. },
  74. };
  75. </script>