ExplanatoryNoteDialog.vue 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. <template>
  2. <el-dialog
  3. :title="titleText === '气泡' ? titleText : '编辑' + titleText"
  4. :visible.sync="visible"
  5. width="680px"
  6. :modal="modal"
  7. :close-on-click-modal="false"
  8. @close="dialogClose()"
  9. >
  10. <RichText
  11. v-model="richData.dataStr"
  12. toolbar="fontselect fontsizeselect forecolor backcolor | underline | bold italic strikethrough alignleft aligncenter alignright image media link"
  13. :wordlimit-num="false"
  14. :height="240"
  15. :font-size="'14pt'"
  16. placeholder="输入内容"
  17. page-from="audit"
  18. />
  19. <template slot="footer">
  20. <el-button size="medium" @click="deleteNote">删除</el-button>
  21. <el-button type="primary" size="medium" @click="confirm">确定</el-button>
  22. </template>
  23. </el-dialog>
  24. </template>
  25. <script>
  26. import RichText from './RichText';
  27. export default {
  28. name: 'ExplanatoryNoteDialog',
  29. components: {
  30. RichText,
  31. },
  32. props: {
  33. open: {
  34. type: Boolean,
  35. default: false,
  36. required: true,
  37. },
  38. initData: {
  39. type: Object,
  40. default: () => ({}),
  41. },
  42. titleText: {
  43. type: String,
  44. default: '气泡',
  45. },
  46. modal: {
  47. type: Boolean,
  48. default: true,
  49. },
  50. },
  51. data() {
  52. return {
  53. visible: false,
  54. richData: this.initData,
  55. };
  56. },
  57. watch: {
  58. open(newVal) {
  59. this.visible = newVal;
  60. this.richData = this.initData;
  61. },
  62. visible(newVal) {
  63. if (!newVal) {
  64. this.$emit('update:open', false);
  65. this.richData = {};
  66. }
  67. },
  68. },
  69. methods: {
  70. // 关闭弹窗,调用富文本组件中的
  71. dialogClose() {
  72. this.visible = false;
  73. },
  74. deleteNote() {
  75. this.$confirm(`确定要删除此条${this.titleText}吗?`, '提示', {
  76. confirmButtonText: '确定',
  77. cancelButtonText: '取消',
  78. type: 'warning',
  79. })
  80. .then(() => {
  81. this.visible = false;
  82. this.$emit('cancel');
  83. })
  84. .catch(() => {});
  85. },
  86. confirm() {
  87. this.$emit('confirm', this.richData);
  88. },
  89. },
  90. };
  91. </script>
  92. <style lang="scss" scoped>
  93. .el-dialog {
  94. :deep &__body {
  95. display: flex;
  96. flex-direction: column;
  97. row-gap: 8px;
  98. padding: 8px 8px 0;
  99. .el-textarea__inner {
  100. height: 108px;
  101. }
  102. }
  103. :deep &__footer {
  104. display: flex;
  105. padding: 8px;
  106. .el-button {
  107. flex: 1;
  108. }
  109. }
  110. }
  111. </style>