index.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. <template>
  2. <div class="flex p-base full submit-similar">
  3. <div class="flex-1 full-y p-extra-small fill-blank radius-base scroll-auto view-paper">
  4. <img :src="current?.url" alt="" />
  5. </div>
  6. <div class="flex direction-column full-h m-l-base p-base fill-blank radius-base history-view">
  7. <div class="flex-1 overflow-hidden">
  8. <base-table
  9. ref="tableRef"
  10. size="small"
  11. height="100%"
  12. :data="tableData"
  13. :columns="columns"
  14. class="history-table"
  15. highlight-current-row
  16. @current-change="onCurrentChange"
  17. ></base-table>
  18. </div>
  19. <div class="flex items-center m-t-base p-l-base">
  20. <span>雷同卷号:</span>
  21. <span>{{ query.secretNumber }}</span>
  22. </div>
  23. <div class="flex items-center p-l-base m-t-extra-small">
  24. <span class="checked-secret-number">{{ current?.secretNumber }}</span>
  25. </div>
  26. <div class="p-l-base m-t-base">
  27. <confirm-button class="confirm-buttons" size="small" @confirm="submit" @cancel="onCancel"></confirm-button>
  28. </div>
  29. </div>
  30. </div>
  31. </template>
  32. <script setup lang="tsx" name="SubmitSimilar">
  33. /** 提交雷同卷 */
  34. import { ref, computed, watch } from 'vue'
  35. import { useRouter, useRoute } from 'vue-router'
  36. import { ElRadio } from 'element-plus'
  37. import useFetch from '@/hooks/useFetch'
  38. import useTableCheck from '@/hooks/useTableCheck'
  39. import BaseTable from '@/components/element/BaseTable.vue'
  40. import ConfirmButton from '@/components/common/ConfirmButton.vue'
  41. import type { ExtractApiResponse } from '@/api/api'
  42. import type { EpTableColumn } from 'global-type'
  43. const props = defineProps<{
  44. taskId: number | string
  45. }>()
  46. const { query } = useRoute()
  47. const { back } = useRouter()
  48. const { fetch: getMarkHistory, result: markHistoryList } = useFetch('getMarkHistory')
  49. /** 过滤自己 */
  50. const filterSelfData = computed(() => {
  51. return (
  52. markHistoryList?.value?.filter((d) => `${d.taskId}` !== `${props.taskId}`).map((d, index) => ({ ...d, index })) ||
  53. []
  54. )
  55. })
  56. const { tableRef, tableData, current, onCurrentChange } = useTableCheck(filterSelfData)
  57. const columns = computed<EpTableColumn<ExtractArrayValue<ExtractApiResponse<'getMarkHistory'>>>[]>(() => [
  58. {
  59. label: '选中雷同',
  60. formatter(row) {
  61. return (
  62. <ElRadio modelValue={current.value?.secretNumber} label={row.secretNumber}>
  63. {' '}
  64. </ElRadio>
  65. )
  66. },
  67. align: 'center',
  68. },
  69. { label: '密号', prop: 'secretNumber', align: 'center' },
  70. { label: '分数', prop: 'markScore', align: 'center' },
  71. ])
  72. /** 提交 */
  73. const submit = async () => {
  74. try {
  75. await useFetch('submitSimilarPaper').fetch({ taskId: props.taskId, sameTaskId: 2 })
  76. back()
  77. } catch (error) {
  78. console.error(error)
  79. }
  80. }
  81. const onCancel = () => {
  82. back()
  83. }
  84. getMarkHistory()
  85. </script>
  86. <style scoped lang="scss">
  87. .submit-similar {
  88. }
  89. .history-view {
  90. width: 360px;
  91. font-size: $MediumFont;
  92. .checked-secret-number {
  93. margin-left: 74px;
  94. display: inline-block;
  95. padding: 6px 12px;
  96. border: $OnePixelLine;
  97. color: #e02020;
  98. border-radius: 4px;
  99. }
  100. .confirm-buttons {
  101. margin-left: 74px;
  102. ::v-deep(.el-button) {
  103. width: 80px;
  104. }
  105. }
  106. }
  107. </style>