browse.vue 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. <template>
  2. <ele-modal
  3. :visible.sync="showEditFlag"
  4. :close-on-click-modal="false"
  5. custom-class="ele-dialog-form"
  6. append-to-body
  7. :fullscreen="true"
  8. >
  9. <iframe
  10. :src="fileUrl"
  11. width="100%"
  12. v-if="showEditFlag"
  13. style="height: calc(100vh - 100px)"
  14. frameborder="0"
  15. allowfullscreen="true"
  16. ></iframe
  17. ></ele-modal>
  18. </template>
  19. <script>
  20. import { getFileType } from './util.js';
  21. export default {
  22. data() {
  23. return {
  24. fileUrl: '',
  25. showEditFlag: false
  26. };
  27. },
  28. methods: {
  29. open(row) {
  30. this.showEditFlag = true;
  31. this.setFileUrl(row);
  32. },
  33. setFileUrl(row) {
  34. let file = row.storagePath[0];
  35. let fileNames = file.storePath.split('/');
  36. let url =
  37. window.location.origin +
  38. '/api/main/file/getFile?objectName=' +
  39. file.storePath +
  40. '&fullfilename=' +
  41. fileNames[fileNames.length - 1];
  42. this.fileUrl = '/kkfile/onlinePreview?url=' + btoa(url);
  43. // const fileExt = file.name.substr(file.name.lastIndexOf('.') + 1);
  44. // this.fileType = getFileType().includes(fileExt) ? 2 : 1;
  45. // if (this.fileType == 2) {
  46. // this.fileUrl =
  47. // '/fm/' +
  48. // (['dxf', 'dwg'].includes(fileExt) ? '2DViewer' : '3DViewer') +
  49. // '/view.html?url=' +
  50. // sessionStorage.filePath +
  51. // '/' +
  52. // row.outputNdsFiles;
  53. // } else {
  54. // this.fileUrl = '/kkfile/onlinePreview?url=' + btoa(url);
  55. // // 'http://192.168.1.107:18082/kkfile/onlinePreview?url=' + btoa(url);
  56. // }
  57. }
  58. }
  59. };
  60. </script>
  61. <style scoped lang="scss"></style>