browseOpen.vue 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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. export default {
  21. data() {
  22. return {
  23. fileUrl: '',
  24. showEditFlag: false
  25. };
  26. },
  27. methods: {
  28. open(row) {
  29. this.showEditFlag = true;
  30. this.setFileUrl(row);
  31. },
  32. setFileUrl(row) {
  33. console.log(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. this.visible = true;
  44. }
  45. }
  46. };
  47. </script>
  48. <style scoped lang="scss"></style>