Browse Source

[Feat 0000]修复CAD模态框id与点击文件不匹配的问题

houzekong 4 tháng trước cách đây
mục cha
commit
aa11a6d40a

+ 27 - 21
src/views/vent/performance/comment/CADModal.vue

@@ -12,7 +12,7 @@
   >
     <!-- <button @click="mxcadmode = !mxcadmode">Switch Previewer</button> -->
     <div v-if="mxcadmode">
-      <CADViewer v-if="fileid" :id="fileid" :filename="filename" class="w-100%" :height="800" />
+      <CADViewer v-if="fileid" :id="fileid" class="w-100%" :height="800" />
     </div>
     <iframe v-else :src="iframesrc" class="w-100%" :height="800" ref="frameRef"></iframe>
   </BasicModal>
@@ -35,11 +35,17 @@
   import { onMounted } from 'vue';
   import CADViewer from '/@/views/vent/performance/fileDetail/commen/CADViewer.vue';
   // import { useGlobSetting } from '/@/hooks/setting';
-  import { useAutoLogin } from '/@/hooks/vent/useAutoLogin';
-  import { MOCK_LOGIN_UESRNAME } from '/@/store/constant';
+  // import { useAutoLogin } from '/@/hooks/vent/useAutoLogin';
+  // import { MOCK_LOGIN_UESRNAME } from '/@/store/constant';
 
+  defineProps({
+    fileid: {
+      type: String,
+      default: '',
+    },
+  });
   // const { sysOrgCode } = useGlobSetting();
-  const { getUrl } = useAutoLogin();
+  // const { getUrl } = useAutoLogin();
   // 不是布尔台的使用 mxcad 模式,是布尔台的使用 iframe 模式以避免“法律风险”
   // 暂时只允许本地预览模式,是因为认证需要机器码,目前仅在神东公司端有这个认证服务,前端也只有这一个码存好了
   const mxcadmode = ref(true);
@@ -49,29 +55,29 @@
   const iframesrc = ref('');
 
   // CAD预览器 DEMO 02
-  const fileid = ref('');
-  const filename = ref('');
+  // const fileid = ref('');
+  // const filename = ref('');
 
   //表单赋值
   const [registerModal, { setModalProps }] = useModalInner(async ({ record }) => {
     //重置表单
     setModalProps({ confirmLoading: false });
 
-    if (mxcadmode.value) {
-      fileid.value = record.id;
-      filename.value = record.fileName;
-    } else {
-      // 当以 iframe 模式运行时,origin 在生产模式下需要指向本项目公司端所部署的地址
-      const origin = import.meta.env.PROD ? 'http://10.248.235.101:8092' : window.location.origin;
-      // const origin = import.meta.env.DEV ? 'http://182.92.126.35:8092' : window.location.origin;
-      iframesrc.value = getUrl(`${origin}/fileManager/cad-viewer`, {
-        // [SKIP_SSO_URL_QUERY.key]: SKIP_SSO_URL_QUERY.val,
-        id: record.id,
-        filename: record.fileName,
-        workNo: MOCK_LOGIN_UESRNAME,
-      });
-      // iframesrc.value = `${origin}/fileManager/cad-viewer?${SKIP_SSO_URL_QUERY.key}=${SKIP_SSO_URL_QUERY.val}&${MOCK_LOGIN_URL_QUERY.key}=${MOCK_LOGIN_URL_QUERY.val}&id=${record.id}&filename=${record.fileName}`;
-    }
+    // if (mxcadmode.value) {
+    //   fileid.value = record.id;
+    //   filename.value = record.fileName;
+    // } else {
+    //   // 当以 iframe 模式运行时,origin 在生产模式下需要指向本项目公司端所部署的地址
+    //   const origin = import.meta.env.PROD ? 'http://10.248.235.101:8092' : window.location.origin;
+    //   // const origin = import.meta.env.DEV ? 'http://182.92.126.35:8092' : window.location.origin;
+    //   iframesrc.value = getUrl(`${origin}/fileManager/cad-viewer`, {
+    //     // [SKIP_SSO_URL_QUERY.key]: SKIP_SSO_URL_QUERY.val,
+    //     id: record.id,
+    //     filename: record.fileName,
+    //     workNo: MOCK_LOGIN_UESRNAME,
+    //   });
+    //   // iframesrc.value = `${origin}/fileManager/cad-viewer?${SKIP_SSO_URL_QUERY.key}=${SKIP_SSO_URL_QUERY.val}&${MOCK_LOGIN_URL_QUERY.key}=${MOCK_LOGIN_URL_QUERY.val}&id=${record.id}&filename=${record.fileName}`;
+    // }
   });
 
   onMounted(() => {});

+ 1 - 1
src/views/vent/performance/comment/NormalTable.vue

@@ -21,7 +21,7 @@
       </template>
     </BasicTable>
     <DeviceModal :editID="editID" :fileType="fileType" @register="registerDeviceModal" />
-    <CADModal @register="registerCADModal" />
+    <CADModal :fileid="editID" @register="registerCADModal" />
     <!-- 审批-提交弹窗 -->
     <a-modal v-model:visible="visibleTj" centered :width="600" title="提交文件" @ok="handleTjOk" @cancel="handleTjCancel">
       <a-form :model="formStateTj" labelAlign="right" :label-col="{ span: 8 }" :wrapper-col="{ span: 16 }">