PdfDialog.vue 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. <template>
  2. <el-dialog
  3. class="my-dialog yse-events"
  4. :align-center="true"
  5. with-header="false"
  6. destroy-on-close
  7. :model-value="showDialog"
  8. @close="closeDialog()"
  9. :modal="true"
  10. >
  11. <div class="dialog-box">
  12. <div class="title">
  13. <div class="btn" @click="handleExport">导出</div>
  14. <div class="myclose cursor-pointer" @click="closeDialog"></div>
  15. </div>
  16. <iframe class="my-body" :src="src" id="my-pdf"></iframe>
  17. </div>
  18. </el-dialog>
  19. </template>
  20. <script setup>
  21. import {onMounted, toRefs, ref,watch} from "vue";
  22. import {base_img_url2} from "../api/config"
  23. import vueshowpdf from 'vueshowpdf'
  24. import eventBus from "@/api/eventBus";
  25. const title = ref(null)
  26. const src=ref()
  27. const showDialog=ref(false);
  28. onMounted(async () => {
  29. })
  30. function closeDialog(){
  31. showDialog.value = false;
  32. }
  33. function gybgListener(e){
  34. showDialog.value = true;
  35. src.value = e.filename;
  36. title.value = e.title;
  37. }
  38. eventBus.off("homePage:gybg",gybgListener)
  39. eventBus.on("homePage:gybg",gybgListener)
  40. </script>
  41. <style lang="scss" scoped>
  42. $title-height:44px;
  43. $body-height:calc(100% - $title-height);
  44. .dialog-box{
  45. font-family: PingFangSC-Regular, PingFang SC;
  46. position: fixed;
  47. left: calc(50% - 700px);
  48. top:0px;
  49. width: 80%;
  50. height: calc(100% - 100px);
  51. background: rgba(1,17,22,0.8);
  52. box-shadow: 0px 0px 20px 0px #232323;
  53. border-radius: 4px;
  54. border: 2px solid #232323;
  55. z-index: 99999;
  56. .title{
  57. position: relative;
  58. width: 100%;
  59. height: $title-height;
  60. box-sizing: border-box;
  61. background: #232323;
  62. border-radius: 4px 4px 0px 0px;
  63. border-bottom: 2px solid #232323;
  64. .myclose{
  65. position: absolute;
  66. right: 0px;
  67. top: calc($title-height / 2 - 8px);
  68. margin-right: 20px;
  69. width: 16px;
  70. height: 16px;
  71. background-image: url("@/assets/img/close.png");
  72. background-size: 100% 100%;
  73. }
  74. }
  75. .my-body{
  76. width: 100%;
  77. height: 100%;
  78. box-sizing: border-box;
  79. }
  80. }
  81. </style>