dialog.vue 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. <template>
  2. <!-- :title="title"-->
  3. <el-dialog
  4. :visible.sync="dialogVisible"
  5. :close-on-click-modal="false"
  6. :close-on-press-escape="false"
  7. :top="dialogTop||'3vh'"
  8. :width="dialogWidth||'90%'"
  9. class="js-custom-dialog"
  10. append-to-body
  11. :fullscreen="components.fullscreen||false"
  12. @open="getFormData"
  13. @close="closeDialog"
  14. >
  15. <div
  16. v-if="components.customBody"
  17. :style="{'height':bodyHeight||'100px','width':bodyWidth||'100px'}"
  18. v-html="$utils.formatText(components.customBody)"
  19. />
  20. <iframe
  21. v-else
  22. :src="components.url"
  23. :height="components.bodyHeight||'100%'"
  24. :width="components.bodyWidth||'100%'"
  25. frameborder="0"
  26. scrolling="no"
  27. />
  28. </el-dialog>
  29. </template>
  30. <script>
  31. export default {
  32. props: {
  33. visible: {
  34. type: Boolean,
  35. default: false
  36. },
  37. data: Object,
  38. id: String,
  39. toolbars: {
  40. type: Array,
  41. default: () => [
  42. { key: 'save' },
  43. { key: 'cancel' }
  44. ]
  45. },
  46. components: Object,
  47. dialogHeight: String,
  48. dialogWidth: String,
  49. dialogTop: String,
  50. bodyHeight: String,
  51. bodyWidth: String
  52. },
  53. data() {
  54. return {
  55. dialogVisible: this.visible,
  56. templateType: '',
  57. template: ''
  58. }
  59. },
  60. watch: {
  61. visible: {
  62. handler: function(val, oldVal) {
  63. this.dialogVisible = this.visible
  64. },
  65. immediate: true
  66. }
  67. },
  68. methods: {
  69. getFormData() {
  70. // console.log(this.components)
  71. },
  72. closeDialog() {
  73. this.$emit('close', false)
  74. },
  75. handleSave() {},
  76. handleActionEvent({ key }) {
  77. switch (key) {
  78. case 'save':
  79. this.handleSave()
  80. break
  81. case 'cancel':
  82. this.closeDialog()
  83. break
  84. default:
  85. break
  86. }
  87. }
  88. }
  89. }
  90. </script>