Explorar el Código

[Feat 0000] CAD viewer默认文件替换,更新逻辑更改

houzekong hace 11 meses
padre
commit
77ee1a992f

BIN
public/mxcad/default.mxweb


La diferencia del archivo ha sido suprimido porque es demasiado grande
+ 0 - 0
public/mxcad/plugins/test.js


La diferencia del archivo ha sido suprimido porque es demasiado grande
+ 0 - 0
public/mxcad/plugins/test.js.map


BIN
public/mxcad/stamp.dwg


BIN
public/mxcad/stamp.mxweb


BIN
public/mxcad/test2.dwg


BIN
public/mxcad/test2.mxweb


BIN
public/mxcad/test3.mxweb


BIN
public/mxcad/tree.dwg


BIN
public/mxcad/tree.mxweb


+ 4 - 2
src/views/vent/performance/comment/CADModal.vue

@@ -11,12 +11,14 @@
     destroyOnClose
   >
     <!-- <button @click="mxcadmode = !mxcadmode">Switch Previewer</button> -->
-    <CADViewer v-if="mxcadmode" :id="fileid" :filename="filename" class="w-100%" :height="800" />
+    <div v-if="mxcadmode">
+      <CADViewer v-if="fileid" :id="fileid" :filename="filename" class="w-100%" :height="800" />
+    </div>
     <iframe v-else :src="iframesrc" class="w-100%" :height="800" ref="frameRef"></iframe>
   </BasicModal>
 </template>
 <script lang="ts" setup>
-  import { ref } from 'vue';
+  import { ref, triggerRef } from 'vue';
   import { BasicModal, useModalInner } from '/@/components/Modal';
   import { onMounted } from 'vue';
   import CADViewer from '/@/views/vent/performance/fileDetail/commen/CADViewer.vue';

+ 15 - 5
src/views/vent/performance/fileDetail/commen/CADViewer.vue

@@ -7,6 +7,7 @@
   import { CADViewer, useCADViewer } from '/@/components/CADViewer';
   import { downLoad } from '../fileDetail.api';
   import { useRoute } from 'vue-router';
+  import { message } from 'ant-design-vue';
 
   const props = defineProps<{
     // 文件共享中心中该文件的ID
@@ -19,14 +20,18 @@
   const { processFile, postMessage } = useCADViewer();
 
   function openFile(id: string, filename: string) {
+    const loading = message.loading('正在下载文件', 0);
     downLoad({ id }).then((res: Blob) => {
-      processFile(new File([res], filename)).then((path) => {
-        postMessage('MKY_Open_Mxweb', path);
-      });
+      processFile(new File([res], filename))
+        .then((path) => {
+          postMessage('MKY_Open_Mxweb', path);
+        })
+        .finally(() => {
+          loading();
+        });
     });
   }
 
-  // 通过 props 指定文件 ID 的形式使用该组件
   watch(
     () => props.id,
     (v) => {
@@ -35,11 +40,16 @@
     }
   );
 
-  // 通过 url query 指定文件 ID 的形式使用该组件
   onMounted(() => {
+    console.log('debug try open');
+    postMessage('MKY_Open_Mxweb', window.location.origin + '/mxcad/test31.mxweb');
     const route = useRoute();
     if (route.query.id && route.query.filename) {
+      // 通过 url query 指定文件 ID 的形式使用该组件
       openFile(route.query.id as string, route.query.filename as string);
+    } else {
+      // 通过 props 指定文件 ID 的形式使用该组件
+      openFile(props.id, props.filename);
     }
   });
 </script>

Algunos archivos no se mostraron porque demasiados archivos cambiaron en este cambio