|
@@ -30,10 +30,12 @@
|
|
|
</div>
|
|
|
</a-col>
|
|
|
<a-col :span="12">
|
|
|
- <div class="modal-box modal-origin"></div>
|
|
|
+ <div class="modal-box modal-origin">
|
|
|
+ <img :src="curArbitrateTaskDetail.sliceImg" alt="区域原图" />
|
|
|
+ </div>
|
|
|
</a-col>
|
|
|
<a-col :span="6">
|
|
|
- <div class="modal-box" @click="changePrevTaskDetail">
|
|
|
+ <div class="modal-box is-btn" @click="changePrevTaskDetail">
|
|
|
<p class="box-title">左键</p>
|
|
|
<p class="box-cont">上一个</p>
|
|
|
</div>
|
|
@@ -58,7 +60,7 @@
|
|
|
v-for="option in curArbitrateTaskDetail.options"
|
|
|
:key="option"
|
|
|
:type="
|
|
|
- curArbitrateTaskDetail.value.result.includes(option)
|
|
|
+ curArbitrateTaskDetail.result.includes(option)
|
|
|
? 'primary'
|
|
|
: 'default'
|
|
|
"
|
|
@@ -68,7 +70,7 @@
|
|
|
</div>
|
|
|
</a-col>
|
|
|
<a-col :span="6">
|
|
|
- <div class="modal-box">
|
|
|
+ <div class="modal-box is-btn" @click="onConfirm">
|
|
|
<p class="box-title">Enter键</p>
|
|
|
<p class="box-cont">下一个</p>
|
|
|
</div>
|
|
@@ -111,6 +113,7 @@ import {
|
|
|
RecognizeArbitrateSavePage,
|
|
|
} from "@/ap/types/recognizeCheck";
|
|
|
import { parseRecogData, parseDetailSize } from "@/utils/recog/recog";
|
|
|
+import { getSliceFileUrl } from "@/utils/tool";
|
|
|
|
|
|
defineOptions({
|
|
|
name: "RecognizeArbitrate",
|
|
@@ -152,21 +155,33 @@ const curTaskDetailName = computed(() => {
|
|
|
});
|
|
|
|
|
|
// 获取任务
|
|
|
-let curTask: RecognizeArbitrateItem | null = null;
|
|
|
-async function getTask() {
|
|
|
+// 当前的最新任务
|
|
|
+const recentTask = ref<RecognizeArbitrateItem | null>(null);
|
|
|
+const recentArbitrateTaskDetails = ref([] as RecognizeArbitrateTaskDetail[]);
|
|
|
+const recentPrevTaskId = ref(0);
|
|
|
+const curTask = ref<RecognizeArbitrateItem | null>(null);
|
|
|
+async function getNewTask() {
|
|
|
+ recentPrevTaskId.value = 0;
|
|
|
+
|
|
|
const res = await recognizeArbitrateTask(groupId).catch(() => false);
|
|
|
- curTask = res || null;
|
|
|
- if (!curTask) {
|
|
|
+ curTask.value = res || null;
|
|
|
+ if (!curTask.value) {
|
|
|
+ curArbitrateTaskDetailIndex.value = 0;
|
|
|
+ curArbitrateTaskDetail.value = null;
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- curArbitrateTaskDetails.value = parseDetails(curTask);
|
|
|
+ curArbitrateTaskDetails.value = parseDetails(curTask.value);
|
|
|
+ curArbitrateTaskDetailIndex.value = 0;
|
|
|
+ setCurTaskDetail();
|
|
|
+
|
|
|
+ recentTask.value = curTask.value;
|
|
|
+ recentArbitrateTaskDetails.value = curArbitrateTaskDetails.value;
|
|
|
}
|
|
|
|
|
|
async function initData() {
|
|
|
- await getTask();
|
|
|
- curArbitrateTaskDetailIndex.value = 0;
|
|
|
- setCurTaskDetail();
|
|
|
+ await getNewTask();
|
|
|
+ updateProgress();
|
|
|
}
|
|
|
|
|
|
// 解析仲裁任务详情
|
|
@@ -178,46 +193,46 @@ function parseDetails(
|
|
|
const recogData = parseRecogData(page.recogData);
|
|
|
if (!recogData) return;
|
|
|
|
|
|
- // 缺考
|
|
|
- if (page.absent) {
|
|
|
- details.push({
|
|
|
- ...parseDetailSize(recogData.absent.fill_result[0], "absent", 0, []),
|
|
|
- result1: page.absent ? page.absent[0] : "",
|
|
|
- result2: page.absent ? page.absent[1] : "",
|
|
|
- pageIndex: page.index,
|
|
|
- groupId: groupId,
|
|
|
- uri: page.uri,
|
|
|
- });
|
|
|
- }
|
|
|
-
|
|
|
- // 违纪
|
|
|
- if (page.breach) {
|
|
|
- details.push({
|
|
|
- ...parseDetailSize(recogData.breach.fill_result[0], "breach", 0, []),
|
|
|
- result1: page.breach ? page.breach[0] : "",
|
|
|
- result2: page.breach ? page.breach[1] : "",
|
|
|
- pageIndex: page.index,
|
|
|
- groupId: groupId,
|
|
|
- uri: page.uri,
|
|
|
- });
|
|
|
- }
|
|
|
-
|
|
|
- // 试卷类型
|
|
|
- if (page.paperType) {
|
|
|
- details.push({
|
|
|
- ...parseDetailSize(
|
|
|
- recogData.paperType.fill_result[0],
|
|
|
- "paperType",
|
|
|
- 0,
|
|
|
- []
|
|
|
- ),
|
|
|
- result1: page.paperType ? page.paperType[0] : "",
|
|
|
- result2: page.paperType ? page.paperType[1] : "",
|
|
|
- pageIndex: page.index,
|
|
|
- groupId: groupId,
|
|
|
- uri: page.uri,
|
|
|
- });
|
|
|
- }
|
|
|
+ // // 缺考
|
|
|
+ // if (page.absent) {
|
|
|
+ // details.push({
|
|
|
+ // ...parseDetailSize(recogData.absent.fill_result[0], "absent", 0, []),
|
|
|
+ // result1: page.absent ? page.absent[0] : "",
|
|
|
+ // result2: page.absent ? page.absent[1] : "",
|
|
|
+ // pageIndex: page.index,
|
|
|
+ // groupId: groupId,
|
|
|
+ // uri: page.uri,
|
|
|
+ // });
|
|
|
+ // }
|
|
|
+
|
|
|
+ // // 违纪
|
|
|
+ // if (page.breach) {
|
|
|
+ // details.push({
|
|
|
+ // ...parseDetailSize(recogData.breach.fill_result[0], "breach", 0, []),
|
|
|
+ // result1: page.breach ? page.breach[0] : "",
|
|
|
+ // result2: page.breach ? page.breach[1] : "",
|
|
|
+ // pageIndex: page.index,
|
|
|
+ // groupId: groupId,
|
|
|
+ // uri: page.uri,
|
|
|
+ // });
|
|
|
+ // }
|
|
|
+
|
|
|
+ // // 试卷类型
|
|
|
+ // if (page.paperType) {
|
|
|
+ // details.push({
|
|
|
+ // ...parseDetailSize(
|
|
|
+ // recogData.paperType.fill_result[0],
|
|
|
+ // "paperType",
|
|
|
+ // 0,
|
|
|
+ // []
|
|
|
+ // ),
|
|
|
+ // result1: page.paperType ? page.paperType[0] : "",
|
|
|
+ // result2: page.paperType ? page.paperType[1] : "",
|
|
|
+ // pageIndex: page.index,
|
|
|
+ // groupId: groupId,
|
|
|
+ // uri: page.uri,
|
|
|
+ // });
|
|
|
+ // }
|
|
|
|
|
|
// 试题
|
|
|
let index = 0;
|
|
@@ -227,8 +242,10 @@ function parseDetails(
|
|
|
const questionResult = page.question[qRecog.index];
|
|
|
const arbitrate = questionResult && questionResult.length >= 2;
|
|
|
if (!arbitrate) return;
|
|
|
+ const sizeData = parseDetailSize(qRecog, "question", qRecog.index, []);
|
|
|
+ if (questionResult[2]) sizeData.result = questionResult[2].split("");
|
|
|
details.push({
|
|
|
- ...parseDetailSize(qRecog, "question", qRecog.index, []),
|
|
|
+ ...sizeData,
|
|
|
result1: questionResult ? questionResult[0] : "",
|
|
|
result2: questionResult ? questionResult[1] : "",
|
|
|
pageIndex: page.index,
|
|
@@ -243,9 +260,14 @@ function parseDetails(
|
|
|
}
|
|
|
|
|
|
// 任务执行流程 ----------------- start>
|
|
|
-function setCurTaskDetail() {
|
|
|
- curArbitrateTaskDetail.value =
|
|
|
- curArbitrateTaskDetails.value[curArbitrateTaskDetailIndex.value];
|
|
|
+async function setCurTaskDetail() {
|
|
|
+ const val = curArbitrateTaskDetails.value[curArbitrateTaskDetailIndex.value];
|
|
|
+ curArbitrateTaskDetail.value = val;
|
|
|
+
|
|
|
+ curArbitrateTaskDetail.value.sliceImg = await getSliceFileUrl(
|
|
|
+ val.uri,
|
|
|
+ val.fillArea
|
|
|
+ );
|
|
|
}
|
|
|
const detailChanging = ref(false);
|
|
|
async function changeNextTaskDetail() {
|
|
@@ -253,8 +275,9 @@ async function changeNextTaskDetail() {
|
|
|
detailChanging.value = true;
|
|
|
|
|
|
if (nextDetailIsAnotherTask.value) {
|
|
|
- await submitCurTask().catch(() => {});
|
|
|
- await getNextTask().catch(() => {});
|
|
|
+ await submitCurTask();
|
|
|
+ await updateProgress();
|
|
|
+ await getNextTask();
|
|
|
await nextTick(() => {
|
|
|
detailChanging.value = false;
|
|
|
});
|
|
@@ -292,49 +315,56 @@ async function getPrevTask() {
|
|
|
let result = true;
|
|
|
const res = await recognizeArbitrateHistory({
|
|
|
groupId,
|
|
|
- id: curTask?.id,
|
|
|
+ id: curTask.value?.id,
|
|
|
}).catch(() => {
|
|
|
result = false;
|
|
|
});
|
|
|
|
|
|
- if (!result) {
|
|
|
- message.error("获取上一个任务失败!");
|
|
|
+ if (!res) {
|
|
|
+ message.error("未获取到上一个任务!");
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- if (!res) {
|
|
|
- message.error("没有上一个任务了!");
|
|
|
- return;
|
|
|
+ if (!recentPrevTaskId.value) {
|
|
|
+ recentPrevTaskId.value = res.id;
|
|
|
}
|
|
|
|
|
|
- curTask = res;
|
|
|
- curArbitrateTaskDetails.value = parseDetails(curTask);
|
|
|
+ curTask.value = res;
|
|
|
+ curArbitrateTaskDetails.value = parseDetails(curTask.value);
|
|
|
curArbitrateTaskDetailIndex.value = curArbitrateTaskDetails.value.length - 1;
|
|
|
setCurTaskDetail();
|
|
|
}
|
|
|
|
|
|
async function getNextTask() {
|
|
|
- let result = true;
|
|
|
- const res = await recognizeArbitrateHistory({
|
|
|
- groupId,
|
|
|
- id: curTask?.id,
|
|
|
- next: true,
|
|
|
- }).catch(() => {
|
|
|
- result = false;
|
|
|
- });
|
|
|
+ // 执行待仲裁任务时,取新的任务
|
|
|
+ if (recentTask.value.id === curTask.value.id) {
|
|
|
+ await getNewTask();
|
|
|
+ return;
|
|
|
+ }
|
|
|
|
|
|
- if (!result) {
|
|
|
- message.error("获取下一个任务失败!");
|
|
|
+ // 执行历史记录最后一个任务时,取缓存的待仲裁任务
|
|
|
+ if (recentPrevTaskId.value === curTask.value.id) {
|
|
|
+ recentPrevTaskId.value = 0;
|
|
|
+ curTask.value = recentTask.value;
|
|
|
+ curArbitrateTaskDetails.value = recentArbitrateTaskDetails.value;
|
|
|
+ curArbitrateTaskDetailIndex.value = 0;
|
|
|
+ setCurTaskDetail();
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
+ const res = await recognizeArbitrateHistory({
|
|
|
+ groupId,
|
|
|
+ id: curTask.value.id as number,
|
|
|
+ next: true,
|
|
|
+ }).catch(() => null);
|
|
|
+
|
|
|
if (!res) {
|
|
|
- message.error("没有下一个任务了!");
|
|
|
+ message.error("未获取到下一个任务!");
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- curTask = res;
|
|
|
- curArbitrateTaskDetails.value = parseDetails(curTask);
|
|
|
+ curTask.value = res;
|
|
|
+ curArbitrateTaskDetails.value = parseDetails(curTask.value);
|
|
|
|
|
|
curArbitrateTaskDetailIndex.value = 0;
|
|
|
setCurTaskDetail();
|
|
@@ -357,7 +387,7 @@ function selectOption(option: string) {
|
|
|
}
|
|
|
|
|
|
let result = curArbitrateTaskDetail.value.result.filter(
|
|
|
- (item) => item === "#"
|
|
|
+ (item) => item !== "#"
|
|
|
);
|
|
|
if (result.includes(option)) {
|
|
|
result = result.filter((item) => item !== option);
|
|
@@ -414,7 +444,7 @@ function getTaskTypeResult(
|
|
|
}
|
|
|
|
|
|
async function submitCurTask() {
|
|
|
- if (!curTask) return;
|
|
|
+ if (!curTask.value) return;
|
|
|
const curArbitrateTaskDetailQuestionResults: Record<string, string> = {};
|
|
|
curArbitrateTaskDetails.value.forEach((item) => {
|
|
|
if (item.type !== "question") return;
|
|
@@ -423,7 +453,7 @@ async function submitCurTask() {
|
|
|
curArbitrateTaskDetailQuestionResults[k] = item.result.join("");
|
|
|
});
|
|
|
|
|
|
- const pages = curTask.pages.map((page) => {
|
|
|
+ const pages = curTask.value.pages.map((page) => {
|
|
|
const absentResult = getTaskTypeResult(
|
|
|
"absent",
|
|
|
page.index
|
|
@@ -439,15 +469,13 @@ async function submitCurTask() {
|
|
|
) as RecognizeArbitrateSavePage["paperType"];
|
|
|
|
|
|
const questionResult: Record<number, string> = {};
|
|
|
- curTaskDetails.value.forEach((item) => {
|
|
|
- if (item.type !== "question") return;
|
|
|
-
|
|
|
- const k = `${item.pageIndex}-${item.index}`;
|
|
|
- const result = item.arbitrate
|
|
|
- ? curArbitrateTaskDetailQuestionResults[k]
|
|
|
- : item.result.join("");
|
|
|
- questionResult[item.index] = result;
|
|
|
- });
|
|
|
+ curArbitrateTaskDetails.value
|
|
|
+ .filter((item) => item.pageIndex === page.index)
|
|
|
+ .forEach((item) => {
|
|
|
+ if (item.type !== "question") return;
|
|
|
+
|
|
|
+ questionResult[item.index] = item.result.join("");
|
|
|
+ });
|
|
|
|
|
|
const npage: RecognizeArbitrateSavePage = {
|
|
|
index: page.index,
|
|
@@ -459,8 +487,11 @@ async function submitCurTask() {
|
|
|
};
|
|
|
return npage;
|
|
|
});
|
|
|
+ console.log(pages);
|
|
|
|
|
|
- await recognizeArbitrateSave({ id: curTask.id, pages }).catch(() => false);
|
|
|
+ await recognizeArbitrateSave({ id: curTask.value.id, pages }).catch(
|
|
|
+ () => false
|
|
|
+ );
|
|
|
}
|
|
|
|
|
|
async function releaseTask() {
|