|
|
|
|
|
<template>
|
|
|
|
|
|
<WellRecommend ref="recommend" :isView="true" />
|
|
|
|
|
|
|
|
|
|
|
|
<!-- <div>
|
|
|
|
|
|
<p>NodeID:{{ route.params.nodeId }}</p>
|
|
|
|
|
|
<p>ID:{{ route.params.id }}</p>
|
|
|
|
|
|
</div> -->
|
|
|
|
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
|
|
|
|
definePageMeta({
|
|
|
|
|
|
requiresAuth: true
|
|
|
|
|
|
});
|
|
|
|
|
|
import { ref, onMounted, onBeforeMount } from 'vue';
|
|
|
|
|
|
import { useRoute } from "vue-router";
|
|
|
|
|
|
import { fetchLoadFileById } from '~/services/projectService';
|
|
|
|
|
|
import { generateGUID } from "~/utils/common";
|
|
|
|
|
|
// 消息提示(自动隐藏)
|
|
|
|
|
|
const { $toastMessage } = useNuxtApp();
|
|
|
|
|
|
const useTabStore = useCurrentTabStore();
|
|
|
|
|
|
|
|
|
|
|
|
const route = useRoute();
|
|
|
|
|
|
|
|
|
|
|
|
const recommend = ref(null);
|
|
|
|
|
|
const nodeId = route.query.nodeId;
|
|
|
|
|
|
const id = route.query.id;
|
|
|
|
|
|
|
|
|
|
|
|
const loadFile = async () => {
|
|
|
|
|
|
try {
|
|
|
|
|
|
const response = await fetchLoadFileById(nodeId, id);
|
|
|
|
|
|
console.log("加载文件:", response);
|
|
|
|
|
|
if (response == null) {
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (checkEmpty(response.MapName)) {
|
|
|
|
|
|
$toastMessage.warning("未找到对应文件!");
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
const token = id || generateGUID();
|
|
|
|
|
|
localStorage.setItem("viewerToken", token);
|
|
|
|
|
|
emitter.emit("evtType", { type: 'viewFile', data: JSON.stringify({ fileUrl: response.MapName, viewerToken: token }) });
|
|
|
|
|
|
} catch (error) {
|
|
|
|
|
|
console.error("加载文件失败:", error);
|
|
|
|
|
|
$toastMessage.error(`加载文件失败:${error}`);
|
|
|
|
|
|
}
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
onBeforeMount(() => {
|
|
|
|
|
|
useTabStore.changeTab('/drawview');
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
onMounted(async () => {
|
|
|
|
|
|
nextTick();
|
|
|
|
|
|
useTabStore.changeShowRight(false);
|
|
|
|
|
|
await loadFile();
|
|
|
|
|
|
})
|
|
|
|
|
|
</script>
|
|
|
|
|
|
<style scoped></style>
|