|
@@ -11,59 +11,40 @@
|
|
destroyOnClose
|
|
destroyOnClose
|
|
>
|
|
>
|
|
<!-- <button @click="mxcadmode = !mxcadmode">Switch Previewer</button> -->
|
|
<!-- <button @click="mxcadmode = !mxcadmode">Switch Previewer</button> -->
|
|
- <CADViewer v-if="mxcadmode" class="w-100%" :height="650" />
|
|
|
|
- <Iframe v-else class="w-100% h-100%" :frame-src="iframerc" />
|
|
|
|
- <!-- <iframe id="ext_cad_viewer" :src="iframerc"></iframe> -->
|
|
|
|
|
|
+ <CADViewer v-if="mxcadmode" :id="fileid" :filename="filename" class="w-100%" :height="800" />
|
|
|
|
+ <iframe v-else :src="iframesrc" class="w-100%" :height="800" ref="frameRef"></iframe>
|
|
</BasicModal>
|
|
</BasicModal>
|
|
</template>
|
|
</template>
|
|
<script lang="ts" setup>
|
|
<script lang="ts" setup>
|
|
import { ref } from 'vue';
|
|
import { ref } from 'vue';
|
|
import { BasicModal, useModalInner } from '/@/components/Modal';
|
|
import { BasicModal, useModalInner } from '/@/components/Modal';
|
|
import { onMounted } from 'vue';
|
|
import { onMounted } from 'vue';
|
|
- import { CADViewer, useCADViewer } from '/@/components/CADViewer';
|
|
|
|
|
|
+ import CADViewer from '/@/views/vent/performance/fileDetail/commen/CADViewer.vue';
|
|
import { useGlobSetting } from '/@/hooks/setting';
|
|
import { useGlobSetting } from '/@/hooks/setting';
|
|
- import Iframe from '/@/views/sys/iframe/index.vue';
|
|
|
|
- const globSetting = useGlobSetting();
|
|
|
|
- const baseApiUrl = globSetting.domainUrl;
|
|
|
|
-
|
|
|
|
- let props = defineProps({
|
|
|
|
- fileType: {
|
|
|
|
- type: String,
|
|
|
|
- default: '',
|
|
|
|
- },
|
|
|
|
- editID: {
|
|
|
|
- type: String,
|
|
|
|
- default: '',
|
|
|
|
- },
|
|
|
|
- });
|
|
|
|
|
|
+ import { AUTO_LOGIN_URL_QUERY } from '/@/router/constant';
|
|
|
|
|
|
const { sysOrgCode } = useGlobSetting();
|
|
const { sysOrgCode } = useGlobSetting();
|
|
- // 不是布尔台的使用 mxcad 模式,是布尔台的使用 kkviewer 模式
|
|
|
|
|
|
+ // 不是布尔台的使用 mxcad 模式,是布尔台的使用 iframe 模式以避免“法律风险”
|
|
const mxcadmode = ref(sysOrgCode !== 'sdmtjtbetmk');
|
|
const mxcadmode = ref(sysOrgCode !== 'sdmtjtbetmk');
|
|
|
|
|
|
// CAD预览器的 DEMO 01 相关代码
|
|
// CAD预览器的 DEMO 01 相关代码
|
|
- const iframerc = ref('');
|
|
|
|
|
|
+ const iframesrc = ref('');
|
|
|
|
|
|
- // CAD 预览器的 DEMO 02 相关代码
|
|
|
|
- const { processFile, postMessage } = useCADViewer();
|
|
|
|
|
|
+ // CAD预览器 DEMO 02
|
|
|
|
+ const fileid = ref('');
|
|
|
|
+ const filename = ref('');
|
|
|
|
|
|
//表单赋值
|
|
//表单赋值
|
|
- const [registerModal, { setModalProps }] = useModalInner(async ({ record, getBlob }) => {
|
|
|
|
|
|
+ const [registerModal, { setModalProps }] = useModalInner(async ({ record }) => {
|
|
//重置表单
|
|
//重置表单
|
|
setModalProps({ confirmLoading: false });
|
|
setModalProps({ confirmLoading: false });
|
|
|
|
|
|
if (mxcadmode.value) {
|
|
if (mxcadmode.value) {
|
|
- getBlob().then((res: Blob) => {
|
|
|
|
- // CAD 预览器的 DEMO 02
|
|
|
|
- processFile(new File([res], record.fileName)).then((path) => {
|
|
|
|
- postMessage('MKY_Open_Mxweb', path);
|
|
|
|
- });
|
|
|
|
- });
|
|
|
|
|
|
+ fileid.value = record.id;
|
|
|
|
+ filename.value = record.fileName;
|
|
} else {
|
|
} else {
|
|
- // CAD 预览器的 DEMO 01 @link https://kkfileview.keking.cn/zh-cn/docs/usage.html
|
|
|
|
- const baseUrl = import.meta.env.PROD ? baseApiUrl : import.meta.env.VITE_GLOB_DOMAIN_URL;
|
|
|
|
- const url = `${baseUrl}/ventanaly-sharefile/fileServer/downloadById?id=${record.id}&fullfilename=preview${record.fileSuffix}`;
|
|
|
|
- iframerc.value = 'http://182.92.126.35:8012/onlinePreview?url=' + encodeURIComponent(window.btoa(url));
|
|
|
|
|
|
+ const origin = import.meta.env.PROD ? 'http://182.92.126.35:8092' : window.location.origin;
|
|
|
|
+ iframesrc.value = `${origin}/fileManager/cad-viewer?${AUTO_LOGIN_URL_QUERY.key}=${AUTO_LOGIN_URL_QUERY.val}&id=${record.id}&filename=${record.fileName}`;
|
|
}
|
|
}
|
|
});
|
|
});
|
|
|
|
|