|
@@ -28,7 +28,7 @@
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script setup lang="ts">
|
|
<script setup lang="ts">
|
|
-import { onMounted, watch } from "vue";
|
|
|
|
|
|
+import { onMounted, watch, h } from "vue";
|
|
import { store } from "@/store/store";
|
|
import { store } from "@/store/store";
|
|
import MarkHeader from "./MarkHeader.vue";
|
|
import MarkHeader from "./MarkHeader.vue";
|
|
import { useRoute } from "vue-router";
|
|
import { useRoute } from "vue-router";
|
|
@@ -53,6 +53,8 @@ import { getPaper } from "@/api/jsonMark";
|
|
import { getArbitrateHistory } from "@/api/arbitratePage";
|
|
import { getArbitrateHistory } from "@/api/arbitratePage";
|
|
import EventBus from "@/plugins/eventBus";
|
|
import EventBus from "@/plugins/eventBus";
|
|
import { addFileServerPrefixToTask } from "@/utils/utils";
|
|
import { addFileServerPrefixToTask } from "@/utils/utils";
|
|
|
|
+import { isNumber } from "lodash-es";
|
|
|
|
+import type { Question } from "@/types";
|
|
|
|
|
|
const route = useRoute();
|
|
const route = useRoute();
|
|
let isSingleStudent = !!route.query.historyId;
|
|
let isSingleStudent = !!route.query.historyId;
|
|
@@ -158,9 +160,41 @@ async function getOneOfStuTask() {
|
|
|
|
|
|
const saveTaskToServer = async (unselective: boolean) => {
|
|
const saveTaskToServer = async (unselective: boolean) => {
|
|
if (!store.currentTask) return;
|
|
if (!store.currentTask) return;
|
|
|
|
+ const markResult = store.currentTask.markResult;
|
|
|
|
+ if (!markResult) return;
|
|
console.log("save inspect task to server");
|
|
console.log("save inspect task to server");
|
|
const mkey = "save_task_key";
|
|
const mkey = "save_task_key";
|
|
void message.loading({ content: "保存评卷任务...", key: mkey });
|
|
void message.loading({ content: "保存评卷任务...", key: mkey });
|
|
|
|
+ type SubmitError = {
|
|
|
|
+ question: Question;
|
|
|
|
+ index: number;
|
|
|
|
+ error: string;
|
|
|
|
+ };
|
|
|
|
+ const errors: SubmitError[] = [];
|
|
|
|
+ markResult.scoreList.forEach((score, index) => {
|
|
|
|
+ if (!store.currentTask) return;
|
|
|
|
+ const question = store.currentTask.questionList[index];
|
|
|
|
+ let error;
|
|
|
|
+ if (!isNumber(score)) {
|
|
|
|
+ error = `${question.mainNumber}-${question.subNumber} 没有赋分不能提交。`;
|
|
|
|
+ } else if (isNumber(question.maxScore) && score > question.maxScore) {
|
|
|
|
+ error = `${question.mainNumber}-${question.subNumber} 赋分大于最高分不能提交。`;
|
|
|
|
+ } else if (isNumber(question.minScore) && score < question.minScore) {
|
|
|
|
+ error = `${question.mainNumber}-${question.subNumber} 赋分小于最低分不能提交。`;
|
|
|
|
+ }
|
|
|
|
+ if (error) {
|
|
|
|
+ errors.push({ question, index, error });
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ if (errors.length) {
|
|
|
|
+ console.log(errors);
|
|
|
|
+ const msg = errors.map((v) => h("div", `${v.error}`));
|
|
|
|
+ return message.warning({
|
|
|
|
+ content: h("span", ["校验失败", ...msg]),
|
|
|
|
+ duration: 10,
|
|
|
|
+ key: mkey,
|
|
|
|
+ });
|
|
|
|
+ }
|
|
let res;
|
|
let res;
|
|
if (unselective) {
|
|
if (unselective) {
|
|
res = await saveArbitrateTask(
|
|
res = await saveArbitrateTask(
|