|
@@ -26,12 +26,17 @@
|
|
|
<script setup lang="ts">
|
|
|
import { computed, onMounted, onUnmounted, ref } from "vue";
|
|
|
import saveAs from "@/util/file-serve";
|
|
|
-import { checkHasDownload, getDownloadProcess, downloadScene, axios } from "@/request";
|
|
|
+import {
|
|
|
+ checkCaseHasDownload as checkHasDownload,
|
|
|
+ getCaseHasDownloadProcess as getDownloadProcess,
|
|
|
+ downloadCaseScene as downloadScene,
|
|
|
+ axios,
|
|
|
+} from "@/request";
|
|
|
import { ElLoading, ElMessage } from "element-plus";
|
|
|
import { QuoteScene, SceneType } from "@/store/scene";
|
|
|
import { QuiskExpose } from "@/helper/mount";
|
|
|
|
|
|
-const props = defineProps<{ scene: QuoteScene }>();
|
|
|
+const props = defineProps<{ caseId: number; title: string }>();
|
|
|
enum State {
|
|
|
uncreate,
|
|
|
package,
|
|
@@ -51,19 +56,18 @@ const getState = (type: number) => {
|
|
|
|
|
|
const state = ref<State>(State.uncreate);
|
|
|
const count = ref<number>(0);
|
|
|
-const filename = ref<string>(props.scene.title + ".zip");
|
|
|
+const filename = ref<string>(props.title + ".zip");
|
|
|
const downloadURL = ref<string>();
|
|
|
const percent = ref(0);
|
|
|
|
|
|
const stateTitle = {
|
|
|
- [State.uncreate]: "下载场景离线数据包,可在本地运行查看。",
|
|
|
- [State.package]: "正在打包场景离线数据",
|
|
|
+ [State.uncreate]: "下载案件离线数据包,可在本地运行查看。",
|
|
|
+ [State.package]: "正在打包案件离线数据",
|
|
|
[State.readDown]: filename.value,
|
|
|
};
|
|
|
|
|
|
const params = {
|
|
|
- num: props.scene.num,
|
|
|
- isObj: Number(![SceneType.SWSS, SceneType.SWYDSS].includes(props.scene.type)),
|
|
|
+ caseId: props.caseId,
|
|
|
};
|
|
|
// 初始化
|
|
|
const initial = async () => {
|
|
@@ -110,7 +114,8 @@ const requestUpdateURL = async (callback: () => void) => {
|
|
|
const res = await axios.get(getDownloadProcess, { params });
|
|
|
|
|
|
percent.value = parseInt(res.data.percent);
|
|
|
- downloadURL.value = res.data.url;
|
|
|
+
|
|
|
+ downloadURL.value = percent.value === 100 ? res.data.url : null;
|
|
|
if (downloadURL.value) {
|
|
|
state.value = State.readDown;
|
|
|
callback();
|
|
@@ -135,4 +140,3 @@ defineExpose<QuiskExpose>({
|
|
|
},
|
|
|
});
|
|
|
</script>
|
|
|
-
|