|
@@ -3,59 +3,166 @@
|
|
|
<div class="check-menu">
|
|
|
<div class="check-menu-body">
|
|
|
<ul>
|
|
|
- <li v-for="item in dataList" :key="item.id">{{ item.examNumber }}</li>
|
|
|
+ <li
|
|
|
+ v-for="item in studentList"
|
|
|
+ :key="item.id"
|
|
|
+ @click="onSelectStudent(item)"
|
|
|
+ >
|
|
|
+ {{ item.examNumber }}
|
|
|
+ </li>
|
|
|
</ul>
|
|
|
</div>
|
|
|
<div class="check-menu-page">
|
|
|
<SimplePagination
|
|
|
- :total="pagination.total"
|
|
|
- :page-size="pagination.pageSize"
|
|
|
- @change="toPage"
|
|
|
+ :total="total"
|
|
|
+ :page-size="pageSize"
|
|
|
+ @change="onChangeListPage"
|
|
|
/>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="check-body">
|
|
|
- <ScanImage v-if="curRecogData.length" :recog-data="curRecogData" />
|
|
|
+ <ScanImage
|
|
|
+ v-if="dataCheckStore.curPage && isOriginImage && recogList.length"
|
|
|
+ :key="dataCheckStore.curPage.kid"
|
|
|
+ :img-src="dataCheckStore.curPage.sheetUri"
|
|
|
+ :recog-data="recogList"
|
|
|
+ @prev="onPrevPage"
|
|
|
+ @next="onNextPage"
|
|
|
+ @recog-block-modified="onRecogEditConfirm"
|
|
|
+ />
|
|
|
+ <!-- TODO: slice image show -->
|
|
|
+ <div v-if="dataCheckStore.curPage && !isOriginImage"></div>
|
|
|
</div>
|
|
|
|
|
|
- <CheckAction />
|
|
|
+ <CheckAction @search="onSearch" />
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
-import { ref, reactive, onMounted } from "vue";
|
|
|
+import { ref, reactive, onMounted, computed } from "vue";
|
|
|
import { message } from "ant-design-vue";
|
|
|
import { CaretLeftOutlined, CaretRightOutlined } from "@ant-design/icons-vue";
|
|
|
|
|
|
-import useTable from "@/hooks/useTable";
|
|
|
-
|
|
|
import { DataCheckListFilter, DataCheckListItem } from "@/ap/types/dataCheck";
|
|
|
import { dataCheckList } from "@/ap/dataCheck";
|
|
|
-import { useUserStore } from "@/store";
|
|
|
|
|
|
import SimplePagination from "@/components/SimplePagination/index.vue";
|
|
|
import ScanImage from "@/components/ScanImage/index.vue";
|
|
|
import CheckAction from "./CheckAction.vue";
|
|
|
-
|
|
|
-import recogSampleData from "@/utils/recog/data.json";
|
|
|
-import { parseDetailSize } from "@/utils/recog/recog";
|
|
|
+import { ImageType } from "@/constants/enumerate";
|
|
|
+import { StudentPage } from "./types";
|
|
|
+import { useDataCheckStore } from "@/store";
|
|
|
+
|
|
|
+import {
|
|
|
+ parseRecogData,
|
|
|
+ parseDetailSize,
|
|
|
+ RecognizeArea,
|
|
|
+ RecogBlock,
|
|
|
+} from "@/utils/recog/recog";
|
|
|
+import { objAssign } from "@/utils/tool";
|
|
|
|
|
|
defineOptions({
|
|
|
name: "DataCheck",
|
|
|
});
|
|
|
|
|
|
-const userStore = useUserStore();
|
|
|
+const dataCheckStore = useDataCheckStore();
|
|
|
+
|
|
|
+let searchModel = {} as DataCheckListFilter;
|
|
|
+const pageNumber = ref(1);
|
|
|
+const pageSize = ref(10);
|
|
|
+const total = ref(0);
|
|
|
+const studentList = ref<DataCheckListItem[]>([]);
|
|
|
+const dataList = ref<StudentPage[]>([]);
|
|
|
+const loading = ref(false);
|
|
|
+
|
|
|
+async function getList() {
|
|
|
+ loading.value = true;
|
|
|
+ const datas = {
|
|
|
+ ...searchModel,
|
|
|
+ pageNumber: pageNumber.value,
|
|
|
+ pageSize: pageSize.value,
|
|
|
+ };
|
|
|
+ const res = await dataCheckList(datas).catch(() => null);
|
|
|
+ loading.value = false;
|
|
|
+ if (!res) return;
|
|
|
+
|
|
|
+ total.value = res.totalCount;
|
|
|
+ studentList.value = res.result;
|
|
|
+
|
|
|
+ parseStudentPageList(res.result);
|
|
|
+}
|
|
|
|
|
|
-const searchModel = reactive({
|
|
|
- examId: userStore.curExam.id,
|
|
|
-});
|
|
|
+function parseStudentPageList(students: DataCheckListItem[]) {
|
|
|
+ dataList.value = [];
|
|
|
+
|
|
|
+ students.forEach((student, studentIndex) => {
|
|
|
+ student.papers.forEach((paper, paperIndex) => {
|
|
|
+ if (!paper.pages) return;
|
|
|
+ paper.pages.forEach((page, pageIndex) => {
|
|
|
+ dataList.value.push({
|
|
|
+ ...page,
|
|
|
+ pageIndex,
|
|
|
+ paperIndex,
|
|
|
+ studentIndex,
|
|
|
+ studentId: student.id,
|
|
|
+ examId: searchModel.examId,
|
|
|
+ kid: `${student.id}-${studentIndex}-${paperIndex}-${pageIndex}`,
|
|
|
+ });
|
|
|
+ });
|
|
|
+ });
|
|
|
+ });
|
|
|
+}
|
|
|
|
|
|
-const { dataList, loading, pagination, getList, toPage, setPageSize } =
|
|
|
- useTable<DataCheckListItem>(dataCheckList, searchModel, false);
|
|
|
+function onSelectStudent(record: DataCheckListItem) {
|
|
|
+ const pageIndex = dataList.value.findIndex(
|
|
|
+ (item) => item.studentId === record.id
|
|
|
+ );
|
|
|
+ if (pageIndex === -1) return;
|
|
|
|
|
|
-setPageSize(30);
|
|
|
+ selectPage(pageIndex);
|
|
|
+}
|
|
|
+
|
|
|
+// imageType
|
|
|
+const isOriginImage = computed(() => {
|
|
|
+ return dataCheckStore.imageType === "ORIGIN";
|
|
|
+});
|
|
|
+
|
|
|
+// table
|
|
|
+async function onChangeListPage(index: number) {
|
|
|
+ pageNumber.value = index;
|
|
|
+ await getList();
|
|
|
+ selectPage(0);
|
|
|
+}
|
|
|
+async function onSearch(datas: DataCheckListFilter) {
|
|
|
+ searchModel = { ...datas };
|
|
|
+ pageNumber.value = 1;
|
|
|
+ await getList();
|
|
|
+ selectPage(0);
|
|
|
+}
|
|
|
|
|
|
// page
|
|
|
+const curStudentInfo = ref({
|
|
|
+ examNumber: "",
|
|
|
+ name: "",
|
|
|
+ examSite: "",
|
|
|
+ seatNumber: "",
|
|
|
+ paperType: "",
|
|
|
+});
|
|
|
+const curPageQuestions = ref<string[]>([]);
|
|
|
+
|
|
|
+function selectPage(index: number) {
|
|
|
+ dataCheckStore.setInfo({
|
|
|
+ curPage: dataList.value[index],
|
|
|
+ curPageIndex: index,
|
|
|
+ });
|
|
|
+
|
|
|
+ if (!dataCheckStore.curPage) return;
|
|
|
+
|
|
|
+ const curStudent = studentList.value[dataCheckStore.curPage.studentIndex];
|
|
|
+ dataCheckStore.setInfo({ curStudent });
|
|
|
+ updateRecogList();
|
|
|
+}
|
|
|
+
|
|
|
function onPrevPage() {
|
|
|
const { total, current } = pagination;
|
|
|
if (current <= 1) {
|
|
@@ -66,38 +173,50 @@ function onPrevPage() {
|
|
|
}
|
|
|
|
|
|
function onNextPage() {
|
|
|
- const { total, current } = pagination;
|
|
|
- if (current >= total) {
|
|
|
- message.error("没有下一页了");
|
|
|
- return;
|
|
|
+ if (curPageIndex.value >= curPaper.value?.pages?.length) {
|
|
|
}
|
|
|
- toPage(current);
|
|
|
-}
|
|
|
|
|
|
-const curRecogData = ref([]);
|
|
|
-// 试题
|
|
|
-let index = 0;
|
|
|
-recogSampleData.question.forEach((gGroup) => {
|
|
|
- gGroup.fill_result.forEach((qRecog) => {
|
|
|
- qRecog.index = ++index;
|
|
|
+ selectPage(++curPageIndex.value);
|
|
|
+}
|
|
|
|
|
|
- curRecogData.value.push(parseDetailSize(qRecog, "question", qRecog.index));
|
|
|
+// recog data
|
|
|
+const recogList = ref<RecognizeArea[]>([]);
|
|
|
+function updateRecogList() {
|
|
|
+ if (!dataCheckStore.curPage) return;
|
|
|
+
|
|
|
+ const regdata = parseRecogData(dataCheckStore.curPage.recogData);
|
|
|
+ if (!regdata) return;
|
|
|
+
|
|
|
+ recogList.value = [] as RecognizeArea[];
|
|
|
+ let index = 0;
|
|
|
+ regdata.question.forEach((gGroup) => {
|
|
|
+ gGroup.fill_result.forEach((qRecog) => {
|
|
|
+ const result = dataCheckStore.curPage.question[index - 1] || "";
|
|
|
+ qRecog.index = ++index;
|
|
|
+ // TODO: 解析其他数据
|
|
|
+
|
|
|
+ const fileResult = result ? result.split("") : [];
|
|
|
+ const recogItem = parseDetailSize(
|
|
|
+ qRecog,
|
|
|
+ "question",
|
|
|
+ qRecog.index,
|
|
|
+ fileResult
|
|
|
+ );
|
|
|
+ recogList.value.push(recogItem);
|
|
|
+ });
|
|
|
});
|
|
|
-});
|
|
|
+}
|
|
|
|
|
|
-// TODO: 测试数据
|
|
|
-dataList.value = "#"
|
|
|
- .repeat(30)
|
|
|
- .split("")
|
|
|
- .map((item, index) => {
|
|
|
- return {
|
|
|
- id: index + 1,
|
|
|
- examNumber: `3600802404012${index}`,
|
|
|
- name: `考生名${index}`,
|
|
|
- studentCode: `36008${index}`,
|
|
|
- subjectCode: "科目代码",
|
|
|
- subjectName: "科目名称",
|
|
|
- seatNumber: "11",
|
|
|
- };
|
|
|
- });
|
|
|
+async function onRecogEditConfirm(data: RecogBlock) {
|
|
|
+ if (data.type === "question") {
|
|
|
+ const index = data.index - 1;
|
|
|
+ dataCheckStore.curPage.question.splice(index, 1, data.result.join(""));
|
|
|
+ await dataCheckStore.updateField({
|
|
|
+ field: data.type,
|
|
|
+ value: dataCheckStore.curPage.question,
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ updateRecogList();
|
|
|
+}
|
|
|
</script>
|