|
@@ -12,7 +12,7 @@
|
|
|
:upload-url="uploadUrl"
|
|
|
:upload-data="updateData"
|
|
|
:format="['txt']"
|
|
|
- @upload-success="checkUploadStatus"
|
|
|
+ @upload-success="uploadSuccessHandle"
|
|
|
@valid-error="onValidError"
|
|
|
>
|
|
|
<a-button class="type-box" @click="seleted('COMPARE')">
|
|
@@ -27,7 +27,7 @@
|
|
|
:upload-url="uploadUrl"
|
|
|
:upload-data="updateData"
|
|
|
:format="['txt']"
|
|
|
- @upload-success="startLoopSync"
|
|
|
+ @upload-success="uploadSuccessHandle"
|
|
|
@valid-error="onValidError"
|
|
|
>
|
|
|
<a-button class="type-box" @click="seleted('OVERRIDE')">
|
|
@@ -45,6 +45,9 @@
|
|
|
</a-button>
|
|
|
</div>
|
|
|
</a-modal>
|
|
|
+
|
|
|
+ <!-- TaskProgressDialog -->
|
|
|
+ <TaskProgressDialog ref="taskProgressDialogRef" :task="curExportTask" />
|
|
|
</template>
|
|
|
|
|
|
<script setup lang="ts">
|
|
@@ -57,14 +60,13 @@ import {
|
|
|
import { computed, ref } from "vue";
|
|
|
import useModal from "@/hooks/useModal";
|
|
|
import { ImportType } from "@/ap/types/absentCheck";
|
|
|
-import { absentImportStatus } from "@/ap/absentCheck";
|
|
|
import { absentTemplateDownload } from "@/ap/absentCheck";
|
|
|
import useLoading from "@/hooks/useLoading";
|
|
|
-import useLoop from "@/hooks/useLoop";
|
|
|
+import { message } from "@qmth/ui";
|
|
|
+import { useUserStore } from "@/store";
|
|
|
|
|
|
import ImportBtn from "@/components/ImportBtn/index.vue";
|
|
|
-import { useUserStore } from "@/store";
|
|
|
-import { message } from "@qmth/ui";
|
|
|
+import TaskProgressDialog from "../ResultExport/TaskProgressDialog.vue";
|
|
|
|
|
|
defineOptions({
|
|
|
name: "ImportTypeDialog",
|
|
@@ -90,25 +92,6 @@ function seleted(type: ImportType) {
|
|
|
uploadMode.value = type;
|
|
|
}
|
|
|
|
|
|
-const { start: startLoopSync, stop: stopLoopSync } = useLoop(
|
|
|
- checkUploadStatus,
|
|
|
- 1000
|
|
|
-);
|
|
|
-
|
|
|
-async function checkUploadStatus() {
|
|
|
- const res = await absentImportStatus(userStore.curExam.id).catch(() => {});
|
|
|
- if (res) {
|
|
|
- if (!res.synching) {
|
|
|
- stopLoopSync();
|
|
|
- message.success("导入成功!");
|
|
|
- close();
|
|
|
- }
|
|
|
- } else {
|
|
|
- stopLoopSync();
|
|
|
- message.error("导入错误!");
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
function onValidError(data: { message: string }) {
|
|
|
message.error(message);
|
|
|
}
|
|
@@ -126,6 +109,17 @@ async function onDownloadTemp() {
|
|
|
if (!res) return;
|
|
|
message.success("下载成功!");
|
|
|
}
|
|
|
+
|
|
|
+// task progress
|
|
|
+const curExportTask = ref({ id: "", name: "" });
|
|
|
+const taskProgressDialogRef = ref();
|
|
|
+function uploadSuccessHandle(res: { taskId: string }) {
|
|
|
+ curExportTask.value = {
|
|
|
+ id: res.taskId,
|
|
|
+ name: "缺考名单导入",
|
|
|
+ };
|
|
|
+ taskProgressDialogRef.value?.open();
|
|
|
+}
|
|
|
</script>
|
|
|
|
|
|
<style lang="less" scoped>
|