ExplanatoryNoteDialog.vue 2.0 KB

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