From 9dd958f0ee99cdd36356cc4f253ec3216bdce1c6 Mon Sep 17 00:00:00 2001 From: luobisheng <727299681@qq.com> Date: 星期五, 25 十一月 2022 17:50:53 +0800 Subject: [PATCH] 上传处置结果 --- src/views/operate/message/myIndex/update/index.vue | 67 +++++++++++++++++---------------- 1 files changed, 35 insertions(+), 32 deletions(-) diff --git a/src/views/operate/message/myIndex/update/index.vue b/src/views/operate/message/myIndex/update/index.vue index bfea845..92f232e 100644 --- a/src/views/operate/message/myIndex/update/index.vue +++ b/src/views/operate/message/myIndex/update/index.vue @@ -14,7 +14,7 @@ <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="03">閭欢</el-radio> </el-radio-group> <span class="message-tip">(鐭俊鍙敤鏁�: 1000鏉�)</span> </el-form-item> @@ -75,7 +75,7 @@ </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"> @@ -133,20 +133,26 @@ 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: "", + messageType: null, head: "", targetTo: "", - targetFrom: null, body: "", - channelCode: "01", + channelCode: null, }, createRoleRules: { messageType: [ @@ -163,8 +169,7 @@ body: [ { required: true, - trigger: ["blue", "change"], - message: "璇疯緭鍏ユ秷鎭唴瀹�", + validator: validateEditor }, ], }, @@ -187,8 +192,18 @@ 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: { @@ -261,10 +276,10 @@ // 鏂板缓/淇濆瓨娑堟伅(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, @@ -272,9 +287,11 @@ channelCode: `${channelCode}`, sendTime: new Date(), targetTo: this.checkedList.join(","), - targetFrom: `${targetFrom}`, status: mystatus, }; + if (this.role.channelCode === '03') { + delete params.messageType; + } if (this.type === "create") { sendMessage(params) .then(() => { @@ -306,15 +323,9 @@ }); }, - // 鑾峰緱娑堟伅浣� - getMyBody(obj) { - this.role.body = obj; - }, - // 閲嶇疆琛ㄥ崟 handleReset() { this.$refs.edit.editor.txt.clear(); - this.setDepartList(); this.$refs.user.resetFields(); }, @@ -332,6 +343,7 @@ // 娑堟伅棰勮 handleView() { + this.role.body = this.$refs.edit.editor.txt.html(); this.$refs.user.validate((valid) => { if (valid) { const { body, head, channelCode } = this.role; @@ -342,27 +354,18 @@ channelCode: channelCode === "01" ? "绔欏唴淇�" - : channelCode === "02" + : channelCode === "03" ? "閭欢" : "鐭俊", - 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> -- Gitblit v1.8.0