index.vue 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. <template>
  2. <div class="data-check">
  3. <div class="check-menu">
  4. <div class="check-menu-body">
  5. <ul>
  6. <li v-for="item in dataList" :key="item.id">{{ item.examNumber }}</li>
  7. </ul>
  8. </div>
  9. <div class="check-menu-page">
  10. <SimplePagination
  11. :total="pagination.total"
  12. :page-size="pagination.pageSize"
  13. @change="toPage"
  14. />
  15. </div>
  16. </div>
  17. <div class="check-body">
  18. <ScanImage v-if="curRecogData.length" :recog-data="curRecogData" />
  19. </div>
  20. <CheckAction />
  21. </div>
  22. </template>
  23. <script setup lang="ts">
  24. import { ref, reactive, onMounted } from "vue";
  25. import { message } from "ant-design-vue";
  26. import { CaretLeftOutlined, CaretRightOutlined } from "@ant-design/icons-vue";
  27. import useTable from "@/hooks/useTable";
  28. import { DataCheckListFilter, DataCheckListItem } from "@/ap/types/dataCheck";
  29. import { dataCheckList } from "@/ap/dataCheck";
  30. import { useUserStore } from "@/store";
  31. import SimplePagination from "@/components/SimplePagination/index.vue";
  32. import ScanImage from "@/components/ScanImage/index.vue";
  33. import CheckAction from "./CheckAction.vue";
  34. import recogSampleData from "@/utils/recog/data.json";
  35. import { parseDetailSize } from "@/utils/recog/recog";
  36. defineOptions({
  37. name: "DataCheck",
  38. });
  39. const userStore = useUserStore();
  40. const searchModel = reactive({
  41. examId: userStore.curExam.id,
  42. });
  43. const { dataList, loading, pagination, getList, toPage, setPageSize } =
  44. useTable<DataCheckListItem>(dataCheckList, searchModel, false);
  45. setPageSize(30);
  46. // page
  47. function onPrevPage() {
  48. const { total, current } = pagination;
  49. if (current <= 1) {
  50. message.error("没有上一页了");
  51. return;
  52. }
  53. toPage(current);
  54. }
  55. function onNextPage() {
  56. const { total, current } = pagination;
  57. if (current >= total) {
  58. message.error("没有下一页了");
  59. return;
  60. }
  61. toPage(current);
  62. }
  63. const curRecogData = ref([]);
  64. // 试题
  65. let index = 0;
  66. recogSampleData.question.forEach((gGroup) => {
  67. gGroup.fill_result.forEach((qRecog) => {
  68. qRecog.index = ++index;
  69. curRecogData.value.push(parseDetailSize(qRecog, "question", qRecog.index));
  70. });
  71. });
  72. // TODO: 测试数据
  73. dataList.value = "#"
  74. .repeat(30)
  75. .split("")
  76. .map((item, index) => {
  77. return {
  78. id: index + 1,
  79. examNumber: `3600802404012${index}`,
  80. name: `考生名${index}`,
  81. studentCode: `36008${index}`,
  82. subjectCode: "科目代码",
  83. subjectName: "科目名称",
  84. seatNumber: "11",
  85. };
  86. });
  87. </script>