index.vue 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. <template>
  2. <div class="flex direction-column full">
  3. <div class="p-t-base p-l-base fill-blank">
  4. <base-form :items="items" :model="model" :label-width="useVW(66)" size="small">
  5. <template #form-item-button>
  6. <el-button type="primary" @click="onSearch">查询</el-button>
  7. </template>
  8. </base-form>
  9. </div>
  10. <div class="flex-1 p-base">
  11. <div class="p-base fill-blank radius-base">
  12. <base-table size="small" :data="tableData" :columns="columns"></base-table>
  13. </div>
  14. </div>
  15. </div>
  16. </template>
  17. <script setup lang="ts" name="MarkingStatistics">
  18. /** 个人统计 */
  19. import { reactive, computed } from 'vue'
  20. import { ElButton } from 'element-plus'
  21. import BaseForm from '@/components/element/BaseForm.vue'
  22. import BaseTable from '@/components/element/BaseTable.vue'
  23. import useVW from '@/hooks/useVW'
  24. import useForm from '@/hooks/useForm'
  25. import useFetch from '@/hooks/useFetch'
  26. import useMainStore from '@/store/main'
  27. import type { EpFormItem, EpTableColumn } from 'global-type'
  28. import type { ExtractApiResponse } from '@/api/api'
  29. const mainStore = useMainStore()
  30. const model = reactive({
  31. time: [],
  32. })
  33. const { defineColumn, _ } = useForm()
  34. const OneRowSpan7 = defineColumn(_, 'row-1', { span: 7 })
  35. const items: EpFormItem[] = [
  36. OneRowSpan7({
  37. label: '时间',
  38. prop: 'time',
  39. slotType: 'dateTime',
  40. slot: {
  41. clearable: true,
  42. type: 'datetimerange',
  43. valueFormat: 'YYYYMMDDHHmmss',
  44. startPlaceholder: '开始时间',
  45. endPlaceholder: '结束时间',
  46. },
  47. }),
  48. OneRowSpan7({
  49. slotName: 'button',
  50. }),
  51. ]
  52. const { fetch: getPersonalStatistic, result } = useFetch('getPersonalStatistic')
  53. const columns: EpTableColumn<ExtractApiResponse<'getPersonalStatistic'>>[] = [
  54. { label: '评卷员', prop: 'markerName' },
  55. { label: '大题名称', prop: 'questionMainName' },
  56. { label: '正评量', prop: 'markingPaperCount' },
  57. { label: '速度', prop: 'markingRate' },
  58. { label: '平均分', prop: 'avg' },
  59. ]
  60. const tableData = computed<ExtractApiResponse<'getPersonalStatistic'>[]>(() => {
  61. return result?.value ? [result.value] : []
  62. })
  63. const onSearch = () => {
  64. getPersonalStatistic({ startTime: model.time[0], endTime: model.time[1], markerId: mainStore.myUserInfo?.id })
  65. }
  66. onSearch()
  67. </script>
  68. <style scoped lang="scss"></style>