|
|
@@ -10,9 +10,10 @@
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
import { ElButton } from "element-plus"
|
|
|
+import type { Action } from "element-plus"
|
|
|
import { computed, ref, onMounted } from "vue"
|
|
|
import { initWorker, addCourseWareTask } from "@/worker/useCoursewaresWorker"
|
|
|
-import { ElMessage } from "element-plus"
|
|
|
+import { ElMessage, ElMessageBox } from "element-plus"
|
|
|
import FullscreenSpin from "@/components/FullscreenSpin.vue"
|
|
|
|
|
|
const inputRef = ref<HTMLInputElement>()
|
|
|
@@ -92,7 +93,7 @@ function importPPTXFile() {
|
|
|
filesIndex++
|
|
|
importPPTXFile()
|
|
|
} else {
|
|
|
- exportArrayToExcel(filesArr)
|
|
|
+ await exportArrayToExcel(filesArr)
|
|
|
ElMessage({
|
|
|
showClose: true,
|
|
|
message: `${filesIndex + 1}个文件,下载成功!`,
|
|
|
@@ -103,23 +104,53 @@ function importPPTXFile() {
|
|
|
}
|
|
|
} else if (e.status !== "doing") {
|
|
|
importing.value = false
|
|
|
- ElMessage({
|
|
|
- showClose: true,
|
|
|
- message: `第${filesIndex + 1}个,${file.name.trim()},下载失败!`,
|
|
|
- type: "error",
|
|
|
- duration: 0
|
|
|
+ ElMessageBox.confirm(`第${filesIndex + 1}个,${file.name.trim()},下载失败!`, "error", {
|
|
|
+ confirmButtonText: "继续重试下载",
|
|
|
+ cancelButtonText: "导出当前已经下载的文件",
|
|
|
+ closeOnClickModal: false,
|
|
|
+ closeOnPressEscape: false,
|
|
|
+ distinguishCancelAndClose: true
|
|
|
})
|
|
|
+ .then(() => {
|
|
|
+ importPPTXFile()
|
|
|
+ })
|
|
|
+ .catch(async (action: Action) => {
|
|
|
+ if (action === "cancel") {
|
|
|
+ await exportArrayToExcel(filesArr)
|
|
|
+ ElMessage({
|
|
|
+ showClose: true,
|
|
|
+ message: `${filesIndex}个文件,下载成功!`,
|
|
|
+ type: "success",
|
|
|
+ duration: 0
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
).catch(err => {
|
|
|
importing.value = false
|
|
|
- ElMessage({
|
|
|
- showClose: true,
|
|
|
- message: `第${filesIndex + 1}个,${file.name.trim()},下载失败!`,
|
|
|
- type: "error",
|
|
|
- duration: 0
|
|
|
+ ElMessageBox.confirm(`第${filesIndex + 1}个,${file.name.trim()},下载失败!`, "error", {
|
|
|
+ confirmButtonText: "继续重试下载",
|
|
|
+ cancelButtonText: "导出当前已经下载的文件",
|
|
|
+ closeOnClickModal: false,
|
|
|
+ closeOnPressEscape: false,
|
|
|
+ distinguishCancelAndClose: true
|
|
|
})
|
|
|
+ .then(() => {
|
|
|
+ importPPTXFile()
|
|
|
+ })
|
|
|
+ .catch(async (action: Action) => {
|
|
|
+ if (action === "cancel") {
|
|
|
+ await exportArrayToExcel(filesArr)
|
|
|
+ ElMessage({
|
|
|
+ showClose: true,
|
|
|
+ message: `${filesIndex}个文件,下载成功!`,
|
|
|
+ type: "success",
|
|
|
+ duration: 0
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
console.log(err)
|
|
|
})
|
|
|
}
|