BaseDialog.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. <template>
  2. <el-dialog
  3. :visible.sync="visible"
  4. :width="width"
  5. :show-close="false"
  6. :close-on-click-modal="false"
  7. :append-to-body="appendToBody"
  8. @closed="close"
  9. :fullscreen="fullscreen"
  10. >
  11. <div slot="title" class="hearders">
  12. <div class="leftTitle">{{ title }}</div>
  13. <div class="rightBoxs">
  14. <i class="el-icon-full-screen full_style" @click="fullscreen = !fullscreen"></i>
  15. <img
  16. src="@/assets/images/Close@2x.png"
  17. alt=""
  18. @click="visible = false"
  19. />
  20. </div>
  21. </div>
  22. <slot></slot>
  23. <div slot="footer" class="dialog-footer" v-if="isShowFooter">
  24. <slot name="slotBtn"></slot>
  25. <el-button :loading="disabledBtn" @click="visible = false">{{
  26. cancelName
  27. }}</el-button>
  28. <el-button
  29. v-if="confirmStatus"
  30. :loading="disabledBtn"
  31. type="primary"
  32. @click="confirmBtn"
  33. >{{ confirmName }}</el-button
  34. >
  35. <slot name="slotBtnRight"></slot>
  36. </div>
  37. </el-dialog>
  38. </template>
  39. <script>
  40. export default {
  41. name: "BaseDialog",
  42. props: {
  43. title: {
  44. type: String,
  45. default: "",
  46. },
  47. isShow: {
  48. type: Boolean,
  49. default: false,
  50. },
  51. width: {
  52. type: String,
  53. default: "600px",
  54. },
  55. cancelName: {
  56. type: String,
  57. default: "取 消",
  58. },
  59. confirmName: {
  60. type: String,
  61. default: "确 定",
  62. },
  63. isShowFooter: {
  64. type: Boolean,
  65. default: true,
  66. },
  67. appendToBody: {
  68. type: Boolean,
  69. default: false,
  70. },
  71. disabledBtn: {
  72. type: Boolean,
  73. default: false,
  74. },
  75. confirmStatus: {
  76. type: Boolean,
  77. default: true,
  78. },
  79. },
  80. data() {
  81. return {
  82. fullscreen:false,
  83. };
  84. },
  85. methods: {
  86. confirmBtn() {
  87. this.$emit("submit");
  88. },
  89. close() {
  90. this.$emit("close");
  91. },
  92. },
  93. computed: {
  94. visible: {
  95. get() {
  96. return this.isShow;
  97. },
  98. set(val) {
  99. this.$emit("update:isShow", false);
  100. },
  101. },
  102. },
  103. watch: {
  104. visible(val) {
  105. if (val === false) {
  106. this.fullscreen = false
  107. } else {
  108. this.$emit("open");
  109. }
  110. },
  111. },
  112. };
  113. </script>
  114. <style scoped lang="scss">
  115. /deep/.el-dialog {
  116. border-radius: 8px;
  117. .el-dialog__header {
  118. padding: 0;
  119. .hearders {
  120. height: 40px;
  121. display: flex;
  122. align-items: center;
  123. justify-content: space-between;
  124. padding: 0px 18px 0px 20px;
  125. border-bottom: 1px solid #e2e2e2;
  126. .leftTitle {
  127. font-size: 14px;
  128. font-weight: bold;
  129. color: #2f4378;
  130. }
  131. .rightBoxs {
  132. display: flex;
  133. align-items: center;
  134. img {
  135. width: 14px;
  136. height: 14px;
  137. margin-left: 13px;
  138. cursor: pointer;
  139. }
  140. }
  141. }
  142. }
  143. .el-dialog__footer {
  144. padding: 0;
  145. .dialog-footer {
  146. padding: 0px 40px;
  147. height: 70px;
  148. border-top: 1px solid #e2e2e2;
  149. display: flex;
  150. align-items: center;
  151. justify-content: flex-end;
  152. }
  153. }
  154. }
  155. /deep/.el-button {
  156. border-radius: 8px;
  157. }
  158. .full_style {
  159. cursor: pointer;
  160. color:#6e6e6e;
  161. }
  162. </style>