ClassAnalysis.vue 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. <template>
  2. <div class="part-box is-filter">
  3. <el-form inline>
  4. <el-form-item label="科目">
  5. <select-subject v-model="searchModel.subject"></select-subject>
  6. </el-form-item>
  7. <el-form-item label="班级">
  8. <el-input
  9. v-model="searchModel.className"
  10. placeholder="请输入班级名称"
  11. clearable
  12. style="width: 200px"
  13. />
  14. </el-form-item>
  15. <el-form-item>
  16. <el-space wrap>
  17. <el-button type="primary" @click="toPage(1)">查询</el-button>
  18. <el-button @click="exportData">导出</el-button>
  19. </el-space>
  20. </el-form-item>
  21. </el-form>
  22. </div>
  23. <div class="part-box">
  24. <el-table class="page-table" :data="dataList" :loading="loading">
  25. <el-table-column type="index" label="序号" width="60" />
  26. <el-table-column property="className" label="班级" min-width="150" />
  27. <el-table-column
  28. property="totalStudents"
  29. label="报考人数"
  30. min-width="100"
  31. />
  32. <el-table-column
  33. property="validStudents"
  34. label="有效人数"
  35. min-width="100"
  36. />
  37. <el-table-column property="averageScore" label="平均分" min-width="100">
  38. <template #default="scope">
  39. {{ scope.row.averageScore?.toFixed(2) }}
  40. </template>
  41. </el-table-column>
  42. <el-table-column property="highestScore" label="最高分" min-width="100" />
  43. <el-table-column property="lowestScore" label="最低分" min-width="100" />
  44. <el-table-column
  45. property="passStudents"
  46. label="及格人数"
  47. min-width="100"
  48. />
  49. <el-table-column label="及格率" min-width="100">
  50. <template #default="scope">
  51. {{ (scope.row.passRate * 100).toFixed(2) }}%
  52. </template>
  53. </el-table-column>
  54. <el-table-column
  55. property="excellentStudents"
  56. label="优秀人数"
  57. min-width="100"
  58. />
  59. <el-table-column label="优秀率" min-width="100">
  60. <template #default="scope">
  61. {{ (scope.row.excellentRate * 100).toFixed(2) }}%
  62. </template>
  63. </el-table-column>
  64. </el-table>
  65. <el-pagination
  66. v-model:current-page="pagination.pageNumber"
  67. v-model:page-size="pagination.pageSize"
  68. :layout="pagination.layout"
  69. :total="pagination.total"
  70. @size-change="pageSizeChange"
  71. @current-change="toPage"
  72. />
  73. </div>
  74. </template>
  75. <script setup lang="ts">
  76. import { reactive } from 'vue';
  77. import { getClassAnalysisList } from '@/api/analysis';
  78. import { ClassAnalysisItem, ClassAnalysisFilter } from '@/api/types/analysis';
  79. import useTable from '@/hooks/table';
  80. defineOptions({
  81. name: 'ClassAnalysis',
  82. });
  83. const searchModel = reactive<ClassAnalysisFilter>({
  84. subject: null,
  85. className: '',
  86. });
  87. const { dataList, pagination, loading, toPage, pageSizeChange } =
  88. useTable<ClassAnalysisItem>(getClassAnalysisList, searchModel, false);
  89. function exportData() {
  90. // TODO: 实现导出功能
  91. console.log('导出班级分析数据');
  92. }
  93. </script>