|
@@ -24,6 +24,7 @@
|
|
|
v-model:value="searchCourseCode"
|
|
|
placeholder="请选择科目"
|
|
|
:options="courses"
|
|
|
+ :field-names="fieldNames"
|
|
|
filter-option
|
|
|
style="width: 200px"
|
|
|
></a-select>
|
|
@@ -39,6 +40,7 @@
|
|
|
v-model:value="exportCourseCode"
|
|
|
placeholder="请选择科目"
|
|
|
:options="courses"
|
|
|
+ :field-names="fieldNames"
|
|
|
filter-option
|
|
|
style="width: 200px"
|
|
|
></a-select>
|
|
@@ -62,6 +64,7 @@
|
|
|
v-model:value="resetCourseCode"
|
|
|
placeholder="请选择科目"
|
|
|
:options="courses"
|
|
|
+ :field-names="fieldNames"
|
|
|
filter-option
|
|
|
style="width: 200px"
|
|
|
></a-select>
|
|
@@ -75,7 +78,7 @@
|
|
|
<a-collapse-panel>
|
|
|
<template #header><PushpinFilled />复核标记 </template>
|
|
|
|
|
|
- <a-radio-group v-model:value="historyResult" @change="onHistoryMark">
|
|
|
+ <a-radio-group v-model:value="historyResult" @change="onMark">
|
|
|
<a-radio :value="1">正常</a-radio>
|
|
|
<a-radio :value="0">异常</a-radio>
|
|
|
</a-radio-group>
|
|
@@ -111,6 +114,9 @@
|
|
|
/>
|
|
|
</div>
|
|
|
</div>
|
|
|
+
|
|
|
+ <!-- ExportTypeDialog -->
|
|
|
+ <ExportTypeDialog ref="exportTypeDialogRef" @confirm="onExportConfirm" />
|
|
|
</template>
|
|
|
|
|
|
<script setup lang="ts">
|
|
@@ -124,12 +130,9 @@ import {
|
|
|
} from "@ant-design/icons-vue";
|
|
|
import { showConfirm } from "@/utils/uiUtils";
|
|
|
|
|
|
-import {
|
|
|
- reviewWarningTaskExport,
|
|
|
- reviewTaskHistory,
|
|
|
- reviewTaskSave,
|
|
|
-} from "@/ap/review";
|
|
|
+import { reviewWarningTaskExport, reviewTaskHistory } from "@/ap/review";
|
|
|
import { ReviewTaskListItem } from "@/ap/types/review";
|
|
|
+import { SubjectItem } from "@/ap/types/base";
|
|
|
|
|
|
import { downloadByApi } from "@/utils/download";
|
|
|
import useTable from "@/hooks/useTable";
|
|
@@ -137,6 +140,7 @@ import useLoading from "@/hooks/useLoading";
|
|
|
import { useUserStore, useReviewStore } from "@/store";
|
|
|
|
|
|
import SimplePagination from "@/components/SimplePagination/index.vue";
|
|
|
+import ExportTypeDialog from "./ExportTypeDialog.vue";
|
|
|
|
|
|
defineOptions({
|
|
|
name: "ReviewAction",
|
|
@@ -146,6 +150,8 @@ const emit = defineEmits(["search", "reset", "mark"]);
|
|
|
const userStore = useUserStore();
|
|
|
const reviewStore = useReviewStore();
|
|
|
|
|
|
+const fieldNames = { label: "subjectName", value: "subjectCode" };
|
|
|
+
|
|
|
// tab
|
|
|
const reviewKey = ref("1");
|
|
|
|
|
@@ -159,19 +165,10 @@ async function switchTab(key: "review" | "history") {
|
|
|
}
|
|
|
|
|
|
// course data
|
|
|
-interface optionListItem {
|
|
|
- value: string;
|
|
|
- label: string;
|
|
|
-}
|
|
|
-const courses = ref<optionListItem[]>([]);
|
|
|
+const courses = ref<SubjectItem[]>([]);
|
|
|
async function getCourses() {
|
|
|
const res = await subjectList({ examId: userStore.curExam.id });
|
|
|
- courses.value = (res || []).map((item) => {
|
|
|
- return {
|
|
|
- value: item.subjectCode,
|
|
|
- label: item.subjectName,
|
|
|
- };
|
|
|
- });
|
|
|
+ courses.value = res || [];
|
|
|
}
|
|
|
|
|
|
const searchCourseCode = ref("");
|
|
@@ -201,29 +198,31 @@ function onSearch() {
|
|
|
}
|
|
|
|
|
|
function onReset() {
|
|
|
- emit("reset", resetCourseCode.value);
|
|
|
+ let subjectData: SubjectItem | null = null;
|
|
|
+ if (resetCourseCode.value) {
|
|
|
+ subjectData = courses.value.find(
|
|
|
+ (item) => item.subjectCode === resetCourseCode.value
|
|
|
+ );
|
|
|
+ subjectData = subjectData || null;
|
|
|
+ }
|
|
|
+ emit("reset", subjectData);
|
|
|
}
|
|
|
|
|
|
function onMark() {
|
|
|
- emit("mark", result.value);
|
|
|
-}
|
|
|
-
|
|
|
-async function onHistoryMark() {
|
|
|
- if (!reviewStore.curTask) return;
|
|
|
-
|
|
|
- const res = await reviewTaskSave({
|
|
|
- id: reviewStore.curTask.id,
|
|
|
- result: historyResult.value,
|
|
|
- });
|
|
|
- reviewStore.setInfo({
|
|
|
- curTask: Object.assign({}, reviewStore.curTask, {
|
|
|
- markStatus: historyResult.value,
|
|
|
- }),
|
|
|
- });
|
|
|
+ emit(
|
|
|
+ "mark",
|
|
|
+ reviewStore.tabKey === "review" ? result.value : historyResult.value
|
|
|
+ );
|
|
|
}
|
|
|
|
|
|
+// 导出
|
|
|
const { loading: downloading, setLoading } = useLoading();
|
|
|
-async function onExport() {
|
|
|
+const exportTypeDialogRef = ref();
|
|
|
+function onExport() {
|
|
|
+ if (downloading.value) return;
|
|
|
+ exportTypeDialogRef.value?.open();
|
|
|
+}
|
|
|
+async function onExportConfirm(type: "student" | "room") {
|
|
|
if (downloading.value) return;
|
|
|
|
|
|
setLoading(true);
|
|
@@ -231,6 +230,7 @@ async function onExport() {
|
|
|
reviewWarningTaskExport({
|
|
|
examId: userStore.curExam.id,
|
|
|
subjectCode: exportCourseCode.value,
|
|
|
+ type,
|
|
|
})
|
|
|
).catch((e: Error) => {
|
|
|
message.error(e.message || "下载失败,请重新尝试!");
|