index.vue 2.4 KB

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