| | |
| | | <!-- 提醒方式 --> |
| | | <el-form-item class="optionItem" label="提醒方式:" prop="channelCode"> |
| | | <el-radio-group v-model="role.channelCode"> |
| | | <el-radio label="01">站内信</el-radio> |
| | | <el-radio label="02">邮件</el-radio> |
| | | <el-radio label="01" value="01">站内信</el-radio> |
| | | <el-radio label="02" value="02">邮件</el-radio> |
| | | </el-radio-group> |
| | | <span class="message-tip">(短信可用数: 1000条)</span> |
| | | </el-form-item> |
| | |
| | | </el-form-item> |
| | | <!-- 消息内容 --> |
| | | <el-form-item class="optionItem" label="消息内容:" prop="body"> |
| | | <MyEditor ref="edit" @getMyBody="getMyBody"></MyEditor> |
| | | <MyEditor ref="edit"></MyEditor> |
| | | </el-form-item> |
| | | <el-form-item> |
| | | <div class="optionBtn"> |
| | |
| | | import MyEditor from "@/components/edit"; |
| | | import MyColumnAdd from "@/views/operate/message/mycontrol/createUser"; |
| | | import MyColView from "../messageView"; |
| | | import { sendMessage, updateMessage } from "@/api/operate/messageManagement"; |
| | | import { sendMessage, updateMessage, getMessageById } from "@/api/operate/messageManagement"; |
| | | |
| | | export default { |
| | | components: { MyEditor, MyColumnAdd, MyColView }, |
| | | props: ["type", "myDataRow"], |
| | | data() { |
| | | const validateEditor = (rule, value, callback) => { |
| | | if (value) { |
| | | callback(); |
| | | } else { |
| | | callback(new Error('请输入')); |
| | | } |
| | | }; |
| | | return { |
| | | role: { |
| | | messageType: "", |
| | | head: "", |
| | | targetTo: "", |
| | | targetFrom: null, |
| | | body: "", |
| | | channelCode: "01", |
| | | }, |
| | |
| | | body: [ |
| | | { |
| | | required: true, |
| | | trigger: ["blue", "change"], |
| | | message: "请输入消息内容", |
| | | validator: validateEditor |
| | | }, |
| | | ], |
| | | }, |
| | |
| | | this.getColumnList(); |
| | | this.getDepartList(); |
| | | this.getLoginUserInfo(); |
| | | if (this.type === "update" && this.myDataRow) { |
| | | this.role = this.myDataRow; |
| | | if (this.type !== "create" && this.myDataRow) { |
| | | getMessageById(this.myDataRow.id) |
| | | .then(res => { |
| | | this.role = res; |
| | | this.role.targetTo = `${this.role.targetTo.split(',').length}人`; |
| | | }) |
| | | .catch(err => this.$message.error(`${err}`)) |
| | | } |
| | | }, |
| | | mounted() { |
| | | if (this.type !== 'create') { |
| | | this.$refs.edit.editor.txt.append(this.myDataRow.body); |
| | | } |
| | | }, |
| | | methods: { |
| | |
| | | |
| | | // 新建/保存消息(1:新建,0保存消息) |
| | | handleSubmit(mystatus) { |
| | | this.role.body = this.$refs.edit.editor.txt.html(); |
| | | this.$refs.user.validate((valid) => { |
| | | if (valid) { |
| | | const { body, head, messageType, targetFrom, channelCode } = |
| | | this.role; |
| | | const { body, head, messageType, channelCode } = this.role; |
| | | const params = { |
| | | body, |
| | | head, |
| | |
| | | channelCode: `${channelCode}`, |
| | | sendTime: new Date(), |
| | | targetTo: this.checkedList.join(","), |
| | | targetFrom: `${targetFrom}`, |
| | | status: mystatus, |
| | | }; |
| | | if (this.type === "create") { |
| | |
| | | }); |
| | | }, |
| | | |
| | | // 获得消息体 |
| | | getMyBody(obj) { |
| | | this.role.body = obj; |
| | | }, |
| | | |
| | | // 重置表单 |
| | | handleReset() { |
| | | this.$refs.edit.editor.txt.clear(); |
| | | this.setDepartList(); |
| | | this.$refs.user.resetFields(); |
| | | }, |
| | | |
| | |
| | | : channelCode === "02" |
| | | ? "邮件" |
| | | : "短信", |
| | | messageType: this.getColText(this.role.messageType), |
| | | messageType: this.role.messageType, |
| | | targetTo: this.tempNameArr, |
| | | targetFrom: this.sendUser, |
| | | targetFrom: this.sendUser |
| | | }; |
| | | } else { |
| | | this.$message({ type: "warning", message: "请检查必填项" }); |
| | | } |
| | | }); |
| | | }, |
| | | |
| | | // 获得栏目消息 |
| | | getColText(id) { |
| | | let str = ""; |
| | | this.colList.forEach((item) => { |
| | | item.id === id ? (str = item.columnName) : ""; |
| | | }); |
| | | return str; |
| | | }, |
| | | } |
| | | }, |
| | | }; |
| | | </script> |