|
@@ -1,28 +1,22 @@
|
|
|
<template>
|
|
|
<!-- 更适用于文件共享中心的CAD viewer组件,支持两种使用方法,详见下文 -->
|
|
|
- <CADViewer class="w-100% h-100%" :height="height" />
|
|
|
+ <CADViewer class="w-100% h-100%" />
|
|
|
</template>
|
|
|
<script lang="ts" setup>
|
|
|
import { onMounted, onUnmounted } from 'vue';
|
|
|
import { CADViewer, useCADViewer } from '/@/components/CADViewer';
|
|
|
- import { useRoute } from 'vue-router';
|
|
|
-
|
|
|
- const props = defineProps<{
|
|
|
- // 文件共享中心中该文件的ID
|
|
|
- id: string;
|
|
|
- // 文件名
|
|
|
- filename?: string;
|
|
|
- height: number;
|
|
|
- }>();
|
|
|
+ import { queryGasGeoMap } from './cad.api';
|
|
|
|
|
|
const { processFile, postMessage, registHook, unregistHook } = useCADViewer();
|
|
|
|
|
|
- function openFile(id: string) {
|
|
|
+ function openFile() {
|
|
|
// 只触发一次,因为MKY_Open_Mxweb之后会自动触发MKY_Open_File_Complete钩子,导致循环
|
|
|
registHook('MKY_Open_File_Complete', () => {
|
|
|
unregistHook('MKY_Open_File_Complete');
|
|
|
- processFile(id).then((path) => {
|
|
|
- postMessage('MKY_Open_Mxweb', path);
|
|
|
+ queryGasGeoMap({}).then(({ id }) => {
|
|
|
+ processFile(id).then((path) => {
|
|
|
+ postMessage('MKY_Open_Mxweb', path);
|
|
|
+ });
|
|
|
});
|
|
|
});
|
|
|
}
|
|
@@ -38,15 +32,7 @@
|
|
|
// let initByRoute = false;
|
|
|
|
|
|
onMounted(() => {
|
|
|
- const route = useRoute();
|
|
|
- if (route.query.id && route.query.filename) {
|
|
|
- // initByRoute = true;
|
|
|
- // 通过 url query 指定文件 ID 的形式使用该组件
|
|
|
- openFile(route.query.id as string);
|
|
|
- } else {
|
|
|
- // 通过 props 指定文件 ID 的形式使用该组件
|
|
|
- openFile(props.id);
|
|
|
- }
|
|
|
+ openFile();
|
|
|
});
|
|
|
|
|
|
onUnmounted(() => {
|
|
@@ -55,10 +41,12 @@
|
|
|
</script>
|
|
|
|
|
|
<style scoped lang="less">
|
|
|
+ @import '/@/design/theme.less';
|
|
|
+
|
|
|
::v-deep .suffix {
|
|
|
height: 32px;
|
|
|
line-height: 32px;
|
|
|
margin-left: 5px;
|
|
|
- color: #fff;
|
|
|
+ color: var(--vent-font-color);
|
|
|
}
|
|
|
</style>
|