| | |
| | | <el-dialog |
| | | v-model="dialogVisible" |
| | | :title="title" |
| | | width="50%" |
| | | width="800px" |
| | | :before-close="handleClose" |
| | | > |
| | | <el-form :model="state.noticeForm" size="default" ref="noticeRef" :rules="title === '新增' || title === '编辑' ? state.formRules : {}" label-width="110px" > |
| | |
| | | <span v-else>{{state.noticeForm.noticeTitle}}</span> |
| | | </el-form-item> |
| | | <el-form-item label="公告内容:" v-if="showEditor" required> |
| | | <we-editor ref="myEditor" :propData="state.noticeForm.noticeContent" @childFn="getEditorData" /> |
| | | <!-- <we-editor ref="myEditor" :propData="state.noticeForm.noticeContent" @childFn="getEditorData" />--> |
| | | <t-editor style="width: 800px" ref="myEditor" :value="state.noticeForm.noticeContent" ></t-editor> |
| | | </el-form-item> |
| | | <el-form-item label="公告内容:" v-else> |
| | | <div class="ql-container ql-snow" style="height: 500px;width: 100%;margin-top: 10px;" > |
| | |
| | | </div> |
| | | </template> |
| | | <script setup> |
| | | import {reactive, ref, toRefs} from 'vue' |
| | | import {nextTick, reactive, ref, toRefs, watch} from 'vue' |
| | | import WeEditor from "@/components/WeEditor/index.vue"; |
| | | import Editor from "@/components/Editor/index.vue"; |
| | | import TEditor from "@/components/Tinymce/Tinymce.vue" |
| | | import {ElMessage} from "element-plus"; |
| | | import {addNotice, editNotice, getNoticeDetail} from "@/api/backManage/notice"; |
| | | import axios from "axios"; |
| | | import {getToken} from "@/utils/auth"; |
| | | |
| | | |
| | | import {handleThemeStyle} from "@/utils/theme"; |
| | | import useSettingsStore from "@/store/modules/settings"; |
| | | |
| | | |
| | | const emit = defineEmits(["getList"]); |
| | |
| | | }) |
| | | |
| | | const openDialog = async (type, value) => { |
| | | // state.noticeForm.noticeContent = "" |
| | | isReview.value = false; |
| | | showEditor.value = false |
| | | title.value = type === 'add' ? '新增' : type ==='edit' ? '编辑' : '查看' ; |
| | |
| | | reset() |
| | | } |
| | | dialogVisible.value = true; |
| | | } |
| | | |
| | | } |
| | | const getEditorData = (val) =>{ |
| | | state.noticeForm.noticeContent = val; |
| | | } |
| | |
| | | } else { |
| | | this.$message.error('获取文件失败') |
| | | } |
| | | this.handleClose(); |
| | | // handleClose(); |
| | | }) |
| | | } |
| | | } |
| | | |
| | | const onSubmit = async () => { |
| | | state.noticeForm.noticeContent = tinyMCE.activeEditor.getContent(); |
| | | console.log("点击提交") |
| | | myEditor.value.submit(); |
| | | console.log('data',state.noticeForm.noticeContent) |
| | | // // myEditor.value.submit(); |
| | | const valid = await noticeRef.value.validate(); |
| | | if(valid){ |
| | | |
| | | if(state.noticeForm.noticeContent == "") { |
| | | ElMessage({ |
| | | type: 'warning', |
| | |
| | | } |
| | | |
| | | const handleClose = () => { |
| | | if(title ==="新增"|| title ==='编辑'){ |
| | | if(title.value ==="新增"|| title.value ==='编辑'){ |
| | | myEditor.value.clear(); |
| | | showEditor.value=false |
| | | |
| | | } |
| | | |
| | | // reset() |
| | | noticeRef.value.clearValidate(); |
| | | dialogVisible.value = false; |
| | | } |