|
@@ -19,7 +19,7 @@
|
|
|
</template>
|
|
|
<template v-else>
|
|
|
<a-button class="ant-gray m-r-4px">{{ info.paperType }}</a-button>
|
|
|
- <a-button @click="onEditPaperType">
|
|
|
+ <a-button v-if="paperTypeArea" @click="onEditPaperType">
|
|
|
<template #icon><SwapOutlined /></template>
|
|
|
</a-button>
|
|
|
</template>
|
|
@@ -71,7 +71,12 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
- <ModifyPaperType ref="modifyPaperTypeRef" />
|
|
|
+ <ModifyPaperType
|
|
|
+ ref="modifyPaperTypeRef"
|
|
|
+ :area-img="paperTypeImg"
|
|
|
+ :area-result="paperTypeResult"
|
|
|
+ @confirm="paperTypeModified"
|
|
|
+ />
|
|
|
</template>
|
|
|
|
|
|
<script setup lang="ts">
|
|
@@ -79,10 +84,14 @@ import { computed, ref, watch } from "vue";
|
|
|
import { message } from "ant-design-vue";
|
|
|
import { SwapOutlined } from "@ant-design/icons-vue";
|
|
|
import { QuestionInfo } from "./types";
|
|
|
+import { parseRecogData } from "@/utils/recog/recog";
|
|
|
+
|
|
|
import useDictOption from "@/hooks/dictOption";
|
|
|
import ModifyPaperType from "./ModifyPaperType.vue";
|
|
|
+import { useDataCheckStore } from "@/store";
|
|
|
|
|
|
import { vEleClickOutsideDirective } from "@/directives/eleClickOutside";
|
|
|
+import { getSliceFileUrl } from "@/utils/tool";
|
|
|
|
|
|
defineOptions({
|
|
|
name: "QuestionPanel",
|
|
@@ -103,6 +112,8 @@ const props = withDefaults(
|
|
|
);
|
|
|
const emit = defineEmits(["update:questions", "change", "examStatusChange"]);
|
|
|
|
|
|
+const dataCheckStore = useDataCheckStore();
|
|
|
+
|
|
|
const { optionList: examStatusOptions } = useDictOption("EXAM_SIMPLE_STATUS");
|
|
|
const examStatus = ref("");
|
|
|
const questionList = ref([]);
|
|
@@ -185,10 +196,64 @@ function onSaveQuesion() {
|
|
|
|
|
|
// edit paper
|
|
|
const modifyPaperTypeRef = ref();
|
|
|
-function onEditPaperType() {
|
|
|
+const paperTypeArea = ref<AreaSize | null>(null);
|
|
|
+const paperTypeImg = ref("");
|
|
|
+const paperTypeResult = ref("");
|
|
|
+async function onEditPaperType() {
|
|
|
+ if (paperTypeArea.value) {
|
|
|
+ paperTypeImg.value = await getSliceFileUrl(
|
|
|
+ dataCheckStore.curPage?.sheetUri,
|
|
|
+ paperTypeArea.value
|
|
|
+ );
|
|
|
+ } else {
|
|
|
+ paperTypeImg.value = "";
|
|
|
+ }
|
|
|
modifyPaperTypeRef.value?.open();
|
|
|
}
|
|
|
|
|
|
+async function paperTypeModified(paperType: string) {
|
|
|
+ if (!dataCheckStore.curPage) return;
|
|
|
+
|
|
|
+ await dataCheckStore.updateField({
|
|
|
+ field: "PAPER_TYPE",
|
|
|
+ value: JSON.stringify({
|
|
|
+ ...dataCheckStore.curPage.paperType,
|
|
|
+ result: paperType,
|
|
|
+ }),
|
|
|
+ });
|
|
|
+ dataCheckStore.curPage.paperType.result = paperType;
|
|
|
+}
|
|
|
+
|
|
|
+watch(
|
|
|
+ () => dataCheckStore.curPage?.recogData,
|
|
|
+ (val) => {
|
|
|
+ paperTypeArea.value = null;
|
|
|
+ if (!val) return;
|
|
|
+
|
|
|
+ const regdata = parseRecogData(dataCheckStore.curPage.recogData);
|
|
|
+ if (!regdata) return;
|
|
|
+
|
|
|
+ const rect = regdata.paperType.rect || null;
|
|
|
+ if (!rect) {
|
|
|
+ paperTypeArea.value = null;
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ const hasArea = rect.some((item) => item);
|
|
|
+ paperTypeArea.value = hasArea
|
|
|
+ ? {
|
|
|
+ x: rect[0],
|
|
|
+ y: rect[1],
|
|
|
+ w: rect[2],
|
|
|
+ h: rect[3],
|
|
|
+ }
|
|
|
+ : null;
|
|
|
+ },
|
|
|
+ {
|
|
|
+ immediate: true,
|
|
|
+ }
|
|
|
+);
|
|
|
+
|
|
|
watch(
|
|
|
() => props.questions,
|
|
|
(val) => {
|