| | |
| | | import MyEditor from "@/components/edit"; |
| | | import MyColumnAdd from "@/views/operate/message/mycontrol/createUser"; |
| | | import MyColView from "../messageView"; |
| | | import { sendMessage, updateMessage, getMessageById } from "@/api/operate/messageManagement"; |
| | | import { sendMessage, updateMessage, getMessageById,saveMessage } from "@/api/operate/messageManagement"; |
| | | |
| | | export default { |
| | | components: { MyEditor, MyColumnAdd, MyColView }, |
| | |
| | | |
| | | // 新建/保存消息(1:新建,0保存消息) |
| | | handleSubmit(mystatus) { |
| | | debugger; |
| | | this.role.body = this.$refs.edit.editor.txt.html(); |
| | | this.$refs.user.validate((valid) => { |
| | | if (valid) { |
| | | const { body, head, messageType, channelCode } = this.role; |
| | | if(mystatus==1){ |
| | | const { body, head, messageType, channelCode } = this.role; |
| | | const params = { |
| | | body, |
| | | head, |
| | |
| | | }) |
| | | ); |
| | | } |
| | | } |
| | | if(mystatus==0){ |
| | | const { body, head, messageType, channelCode } = this.role; |
| | | const params = { |
| | | body, |
| | | head, |
| | | messageType, |
| | | channelCode: `${channelCode}`, |
| | | sendTime: new Date(), |
| | | targetTo: this.checkedList.join(","), |
| | | status: mystatus, |
| | | }; |
| | | if (this.role.channelCode === '03') { |
| | | delete params.messageType; |
| | | } |
| | | if (this.type === "create") { |
| | | saveMessage(params) |
| | | .then(() => { |
| | | this.$emit("closeMyDialog"); |
| | | this.$message({ type: "success", message: "操作成功" }); |
| | | }) |
| | | .catch((err) => |
| | | this.$message({ |
| | | type: "error", |
| | | message: err.data || err.message, |
| | | }) |
| | | ); |
| | | } else { |
| | | updateMessage({ id: this.myDataRow.id, ...params }) |
| | | .then(() => { |
| | | this.$emit("closeMyDialog"); |
| | | this.$message({ type: "success", message: "操作成功" }); |
| | | }) |
| | | .catch((err) => |
| | | this.$message({ |
| | | type: "error", |
| | | message: err.data || err.message, |
| | | }) |
| | | ); |
| | | } |
| | | } |
| | | |
| | | } else { |
| | | this.$message.error({ type: "warning", message: "请检查必填项" }); |
| | | } |