| | |
| | | <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" > |
| | |
| | | <el-input v-model.trim="state.noticeForm.noticeTitle" v-if="!isReview" ></el-input> |
| | | <span v-else>{{state.noticeForm.noticeTitle}}</span> |
| | | </el-form-item> |
| | | <el-form-item label="公告内容:" v-if="showEditor" prop="noticeContent"> |
| | | <we-editor ref="myEditor" :propData="state.noticeForm.noticeContent" @childFn="getEditorData" /> |
| | | <el-form-item label="公告内容:" v-if="showEditor" required> |
| | | <!-- <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 class="ql-editor"> |
| | | <div v-html="state.noticeForm.noticeContent" @click="showFile($event)"></div> |
| | | <div class="reviewTable" v-html="state.noticeForm.noticeContent" @click="showFile($event)"></div> |
| | | </div> |
| | | </div> |
| | | </el-form-item> |
| | |
| | | <template #footer v-if="!isReview"> |
| | | <span class="dialog-footer"> |
| | | <el-button @click="handleClose" size="default">取 消</el-button> |
| | | <el-button type="primary" @click="onSubmit" size="default">确认发布</el-button> |
| | | <el-button type="primary" @click="onSubmit" size="default" v-preReClick>确认发布</el-button> |
| | | </span> |
| | | </template> |
| | | </el-dialog> |
| | | </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"]); |
| | |
| | | }, |
| | | formRules:{ |
| | | noticeTitle: [{ required: true, message: '请填写公告标题', trigger: 'blur' }], |
| | | noticeContent: [{ required: true, message: '请输入公告内容', trigger: 'blur' }], |
| | | // noticeContent: [{ required: true, message: '请输入公告内容', trigger: 'blur' }], |
| | | }, |
| | | |
| | | }) |
| | | |
| | | 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 () => { |
| | | myEditor.value.submit(); |
| | | state.noticeForm.noticeContent = tinyMCE.activeEditor.getContent(); |
| | | console.log("点击提交") |
| | | console.log('data',state.noticeForm.noticeContent) |
| | | // // myEditor.value.submit(); |
| | | const valid = await noticeRef.value.validate(); |
| | | if(valid){ |
| | | |
| | | if(state.noticeForm.noticeContent == "") { |
| | | ElMessage({ |
| | | type: 'warning', |
| | | message: '请输入公告内容' |
| | | }); |
| | | return; |
| | | } |
| | | if(title.value === '新增'){ |
| | | const param = { |
| | | content: state.noticeForm.noticeContent, |
| | |
| | | } |
| | | |
| | | const handleClose = () => { |
| | | if(title ==="新增"|| title ==='编辑'){ |
| | | if(title.value ==="新增"|| title.value ==='编辑'){ |
| | | myEditor.value.clear(); |
| | | showEditor.value=false |
| | | |
| | | } |
| | | |
| | | // reset() |
| | | noticeRef.value.clearValidate(); |
| | | dialogVisible.value = false; |
| | | } |
| | |
| | | align-items: flex-start; |
| | | } |
| | | } |
| | | .reviewTable { |
| | | :deep(table){ |
| | | border: 1px solid #ccc; |
| | | text-align: center; |
| | | } |
| | | :deep(table td){ |
| | | border: 1px solid #ccc; |
| | | text-align: center; |
| | | padding: 0 5px; |
| | | } |
| | | :deep(table th){ |
| | | border: 1px solid #ccc; |
| | | } |
| | | } |
| | | |
| | | |
| | | </style> |