Przeglądaj źródła

[Feat 0000] CAD viewer新接口对接

houzekong 11 miesięcy temu
rodzic
commit
49a16bcfbd

+ 4 - 0
src/components/CADViewer/README.md

@@ -73,6 +73,10 @@ operationMap.set('MKY_Open_Mxweb', {
 });
 ```
 
+### 关于钩子方法
+
+钩子方法本质上和操作配置的实现细节一致,就是在 mxcad_app 中发送消息,我们接受到消息后执行钩子函数。目前仅支持为事件注册单个钩子
+
 ### 其他
 
 上文中提到的 mxcad app 在[前期文档](https://mxcadx.gitee.io/mxcad_docs/zh/7.%E6%9C%80%E4%BD%B3%E5%AE%9E%E8%B7%B5/1.MxCAD%20APP%E5%BA%94%E7%94%A8%E9%9B%86%E6%88%90.html)中下载(不会读到这还没看这个文档吧?)。

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

@@ -22,13 +22,12 @@
   import { BasicModal, useModalInner } from '/@/components/Modal';
   import { onMounted } from 'vue';
   import CADViewer from '/@/views/vent/performance/fileDetail/commen/CADViewer.vue';
-  // import { useGlobSetting } from '/@/hooks/setting';
+  import { useGlobSetting } from '/@/hooks/setting';
   import { AUTO_LOGIN_URL_QUERY } from '/@/router/constant';
 
-  // const { sysOrgCode } = useGlobSetting();
+  const { sysOrgCode } = useGlobSetting();
   // 不是布尔台的使用 mxcad 模式,是布尔台的使用 iframe 模式以避免“法律风险”
-  const mxcadmode = ref(true);
-  // const mxcadmode = ref(sysOrgCode !== 'sdmtjtbetmk');
+  const mxcadmode = ref(sysOrgCode !== 'sdmtjtbetmk');
 
   // CAD预览器的 DEMO 01 相关代码
   const iframesrc = ref('');

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

@@ -3,7 +3,7 @@
   <CADViewer class="w-100% h-100%" :height="height" />
 </template>
 <script lang="ts" setup>
-  import { onMounted, onUnmounted, watch } from 'vue';
+  import { onMounted, onUnmounted } from 'vue';
   import { CADViewer, useCADViewer } from '/@/components/CADViewer';
   import { downLoad } from '../fileDetail.api';
   import { useRoute } from 'vue-router';
@@ -24,7 +24,7 @@
     registHook('MKY_Open_File_Complete', () => {
       unregistHook('MKY_Open_File_Complete');
       const loading = message.loading('正在下载文件', 0);
-      downLoad({ id }).then((res: Blob) => {
+      downLoad({ id, ifMine: initByRoute }).then((res: Blob) => {
         processFile(new File([res], filename))
           .then((path) => {
             postMessage('MKY_Open_Mxweb', path);
@@ -44,9 +44,12 @@
   //   }
   // );
 
+  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, route.query.filename as string);
     } else {