logSetDialog.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. <template>
  2. <el-dialog
  3. :visible.sync="isLogSetShow"
  4. :close-on-click-modal="false"
  5. :modal-append-to-body='false'
  6. title="添加日志"
  7. @close="closeDia"
  8. width="820px"
  9. v-dialogDrag
  10. center
  11. >
  12. <div class="log-set-wrap">
  13. <el-form :model="formData" :rules="rules" inline label-width="80px" ref="logForm">
  14. <el-form-item label="版本号" prop="Version">
  15. <el-input v-model="formData.Version" placeholder="请输入版本号" style="width:100%"></el-input>
  16. </el-form-item>
  17. <el-form-item label="更新内容" prop="Content" class="update-text">
  18. <div class="rich-editor-wrap">
  19. <froala :id="`log-editor`"
  20. :ref="`logEditor`"
  21. :tag="'textarea'"
  22. :config="richEditorConfig" v-model="formData.Content">
  23. </froala>
  24. </div>
  25. </el-form-item>
  26. <el-form-item label="更新日期" prop="UpdateDate">
  27. <el-date-picker
  28. v-model="formData.UpdateDate"
  29. type="date"
  30. value-format="yyyy-MM-dd"
  31. placeholder="选择日期">
  32. </el-date-picker>
  33. </el-form-item>
  34. </el-form>
  35. <div class="btn-wrap" style="text-align: center;margin-bottom: 25px;">
  36. <el-button type="primary" plain style="width:200px;" @click="closeDia">取消</el-button>
  37. <el-button type="primary" style="margin-left:50px;width:200px;" @click="saveLog">保存</el-button>
  38. </div>
  39. </div>
  40. </el-dialog>
  41. </template>
  42. <script>
  43. export default {
  44. props:{
  45. isLogSetShow:{
  46. type:Boolean,
  47. default:false
  48. },
  49. logInfo:{
  50. type:Object,
  51. default:()=>{ return {}}
  52. }
  53. },
  54. watch:{
  55. isLogSetShow(newVal){
  56. if(newVal){
  57. this.logInfo.Version
  58. ?(this.formData = _.cloneDeep(this.logInfo))
  59. :(this.formData = {Content:'',UpdateDate:this.$moment(new Date()).format('yyyy-MM-DD')})
  60. }
  61. }
  62. },
  63. data() {
  64. return {
  65. value1:'',
  66. formData:{},
  67. rules:{
  68. Version:[{ required: true, message: '请输入版本号', trigger: 'blur' }],
  69. Content:[{ required: true, message: '请输入更新内容', trigger: 'blur' }],
  70. UpdateDate:[{ required: true, message: '请选择更新日期', trigger: 'blur' }]
  71. },
  72. richEditorConfig:{
  73. toolbarButtons:[
  74. 'textColor',
  75. 'bold',
  76. 'italic',
  77. 'underline',
  78. 'fontFamily',
  79. 'fontSize',
  80. 'align',
  81. 'outdent',
  82. 'indent',
  83. 'specialCharacters',
  84. 'insertHR',
  85. 'selectAll',
  86. 'clearFormatting',
  87. 'undo',
  88. 'redo',
  89. ],
  90. height:220,
  91. fontSizeDefaultSelection: "16",
  92. quickInsertEnabled: false,
  93. pasteAllowedStyleProps: ['font-family', 'font-size', 'color'],
  94. language: "zh_cn",
  95. placeholderText:'请输入更新内容',
  96. wordPasteKeepFormatting:false,
  97. pastePlain:true,
  98. wordPasteModal:false,
  99. pluginsEnabled:['colors'],//定义可用插件
  100. },//富文本编辑器配置项
  101. };
  102. },
  103. methods: {
  104. closeDia(){
  105. this.$emit('close')
  106. },
  107. saveLog(){
  108. this.formData.Content = this.formData.Content.replace(/<p data-f-id=\"pbf\".*?<\/p>/g, "");
  109. this.$refs.logForm.validate((valid)=>{
  110. if(valid){
  111. this.$emit('saveLog',this.formData)
  112. }
  113. })
  114. }
  115. },
  116. };
  117. </script>
  118. <style lang="scss">
  119. .log-set-wrap{
  120. .el-form{
  121. .el-form-item.update-text{
  122. display: flex;
  123. .el-form-item__content{
  124. flex:1;
  125. }
  126. }
  127. }
  128. }
  129. </style>
  130. <style scoped lang="scss">
  131. </style>