index.vue 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. <template>
  2. <div class="flex direction-column full">
  3. <div class="p-l-base p-t-medium-base fill-blank">
  4. <base-form size="small" :items="items" :model="model" :disabled="loading">
  5. <template #form-item-operation>
  6. <el-button type="primary" @click="onSearch">查询</el-button>
  7. <el-button type="primary" custom-1 @click="onExport">导出</el-button>
  8. </template>
  9. </base-form>
  10. </div>
  11. <div class="flex-1 p-base">
  12. <div class="p-base radius-base fill-blank">
  13. <base-table :columns="columns" :data="data"></base-table>
  14. <el-pagination
  15. v-bind="pagination"
  16. v-model:current-page="currentPage"
  17. background
  18. right
  19. :hide-on-single-page="true"
  20. ></el-pagination>
  21. </div>
  22. </div>
  23. </div>
  24. </template>
  25. <script setup lang="ts" name="DataExport">
  26. /** CET成绩导出 */
  27. import { reactive, watch, computed } from 'vue'
  28. import { ElButton, ElPagination } from 'element-plus'
  29. import BaseForm from '@/components/element/BaseForm.vue'
  30. import BaseTable from '@/components/element/BaseTable.vue'
  31. import useForm from '@/hooks/useForm'
  32. import useTable from '@/hooks/useTable'
  33. import useOptions from '@/hooks/useOptions'
  34. import useFetch from '@/hooks/useFetch'
  35. import useVW from '@/hooks/useVW'
  36. import type { ExtractMultipleApiParams } from 'api-type'
  37. import type { EpFormItem, EpTableColumn } from 'global-type'
  38. const model = reactive<ExtractMultipleApiParams<'getCetScoreList'>>({
  39. subjectCode: '',
  40. })
  41. const { defineColumn, _ } = useForm()
  42. const { subjectList, dataModel, onOptionInit, changeModelValue } = useOptions(['subject'])
  43. watch(dataModel, () => {
  44. model.subjectCode = dataModel.subject || ''
  45. })
  46. const OneRowSpan5 = defineColumn(_, 'row-1', { span: 5 })
  47. const items = computed<EpFormItem[]>(() => {
  48. return [
  49. OneRowSpan5({
  50. label: '科目',
  51. prop: 'subjectCode',
  52. slotType: 'select',
  53. slot: { options: subjectList.value, onChange: changeModelValue('subject') },
  54. }),
  55. OneRowSpan5({ slotName: 'operation', labelWidth: useVW(20) }),
  56. ]
  57. })
  58. const requestModel = reactive<ExtractMultipleApiParams<'getCetScoreList'>>({ ...model })
  59. const { pagination, currentPage, loading, data } = useTable('getCetScoreList', requestModel, true, 'post', false)
  60. const columns: EpTableColumn[] = [
  61. { label: '准考证号', prop: 'examNumber' },
  62. { label: '科目代码', prop: 'subjectCode' },
  63. { label: '作文分', prop: 'compositionScore' },
  64. { label: '主观分', prop: 'subjectScore' },
  65. { label: '作文评卷员代码', prop: 'compositionMarker' },
  66. { label: '作文题评卷标志', prop: 'compositionTag' },
  67. { label: '翻译题得分', prop: 'translateScore' },
  68. { label: '翻译题评卷员代码', prop: 'translateMarker', minWidth: 100 },
  69. { label: '翻译题评卷标志', prop: 'translateTag' },
  70. { label: '作文雷同标记', prop: 'compositionSame' },
  71. { label: '翻译雷同标记', prop: 'translateSame' },
  72. ]
  73. function onSearch() {
  74. Object.assign(requestModel, model)
  75. }
  76. onOptionInit(onSearch)
  77. const { fetch } = useFetch('exportCetScoreList', 'get')
  78. function onExport() {
  79. fetch(model)
  80. }
  81. </script>
  82. <style scoped lang="scss"></style>