|
@@ -208,12 +208,28 @@
|
|
|
/>
|
|
|
</div>
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="发件人" prop="replyTo">
|
|
|
+ <!-- <el-form-item label="发件人" prop="replyTo">
|
|
|
<el-input
|
|
|
v-model="formData.data.replyTo"
|
|
|
placeholder="请输入"
|
|
|
style="width: 50%"
|
|
|
/>
|
|
|
+ </el-form-item> -->
|
|
|
+ <el-form-item label="发件人" prop="replyTo">
|
|
|
+ <el-select
|
|
|
+ v-model="formData.data.replyTo"
|
|
|
+ filterable
|
|
|
+ placeholder="请选择"
|
|
|
+ style="width: 50%"
|
|
|
+ @change="handleChangeReply"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="item in userMailList"
|
|
|
+ :key="item.mailUser"
|
|
|
+ :label="item.mailUser"
|
|
|
+ :value="item.mailUser"
|
|
|
+ />
|
|
|
+ </el-select>
|
|
|
</el-form-item>
|
|
|
<el-form-item>
|
|
|
<el-button type="primary" @click="handleSend()"> 发 送 </el-button>
|
|
@@ -231,9 +247,11 @@ import TinymceEditor from "@/components/Editor/TinymceEditor.vue";
|
|
|
|
|
|
import { validEmail } from "@/utils/validate.js";
|
|
|
import useMailStore from "@/store/modules/mail";
|
|
|
-import { nextTick } from "vue";
|
|
|
+import { computed, nextTick } from "vue";
|
|
|
const mailStore = useMailStore();
|
|
|
const { proxy } = getCurrentInstance();
|
|
|
+const userMailList = computed(() => mailStore.userMailList);
|
|
|
+let currentMail = ref({});
|
|
|
const loading = ref(false);
|
|
|
let uploadData = ref({});
|
|
|
const fileList = ref([]);
|
|
@@ -300,7 +318,8 @@ const formConfig = computed(() => {
|
|
|
});
|
|
|
const rules = ref({
|
|
|
subject: [{ required: true, message: "请输入主题", trigger: "blur" }],
|
|
|
- replyTo: [{ required: true, message: "请输入发件人", trigger: "blur" }],
|
|
|
+ // replyTo: [{ required: true, message: "请输入发件人", trigger: "blur" }],
|
|
|
+ replyTo: [{ required: true, message: "请输入发件人", trigger: "change" }],
|
|
|
});
|
|
|
const formData = reactive({
|
|
|
data: {
|
|
@@ -313,6 +332,11 @@ const bcc = ref([]);
|
|
|
const replyTo = ref([]);
|
|
|
const submit = ref(null);
|
|
|
const contentEditor = ref(null);
|
|
|
+
|
|
|
+const handleChangeReply = (val) => {
|
|
|
+ currentMail.value = userMailList.value.find((x) => x.mailUser === val);
|
|
|
+};
|
|
|
+
|
|
|
const handleReset = () => {
|
|
|
formData.data = {
|
|
|
to: "",
|
|
@@ -329,6 +353,7 @@ const handleReset = () => {
|
|
|
fileListCopy.value = [];
|
|
|
// contentEditor.value.changeHtml("");
|
|
|
};
|
|
|
+
|
|
|
const handleSend = () => {
|
|
|
submit.value.validate((valid) => {
|
|
|
if (valid) {
|
|
@@ -339,12 +364,12 @@ const handleSend = () => {
|
|
|
type: "info",
|
|
|
});
|
|
|
}
|
|
|
- if (!validEmail(formData.data.replyTo)) {
|
|
|
- return ElMessage({
|
|
|
- message: "发件人邮箱格式不正确",
|
|
|
- type: "info",
|
|
|
- });
|
|
|
- }
|
|
|
+ // if (!validEmail(formData.data.replyTo)) {
|
|
|
+ // return ElMessage({
|
|
|
+ // message: "发件人邮箱格式不正确",
|
|
|
+ // type: "info",
|
|
|
+ // });
|
|
|
+ // }
|
|
|
if (data.content) {
|
|
|
loading.value = true;
|
|
|
let replyTo = [
|
|
@@ -354,8 +379,8 @@ const handleSend = () => {
|
|
|
},
|
|
|
];
|
|
|
const submitData = {
|
|
|
- type: mailStore.selectMail.type,
|
|
|
- mailboxId: mailStore.selectMail.id,
|
|
|
+ type: currentMail.value.type,
|
|
|
+ mailboxId: currentMail.value.id,
|
|
|
subject: data.subject,
|
|
|
content: data.content,
|
|
|
to: to.value,
|
|
@@ -384,9 +409,11 @@ const handleSend = () => {
|
|
|
}
|
|
|
});
|
|
|
};
|
|
|
+
|
|
|
const updateContent = (val) => {
|
|
|
formData.data.content = val;
|
|
|
};
|
|
|
+
|
|
|
const handleBeforeUpload = async (file) => {
|
|
|
const res = await proxy.post("/fileInfo/getSing", { fileName: file.name });
|
|
|
uploadData.value = res.uploadBody;
|
|
@@ -398,6 +425,7 @@ const handleBeforeUpload = async (file) => {
|
|
|
uid: file.uid,
|
|
|
});
|
|
|
};
|
|
|
+
|
|
|
const handleClose = (index, val) => {
|
|
|
switch (val) {
|
|
|
case 10:
|
|
@@ -548,12 +576,15 @@ const handleReplyInit = (allData, pageType) => {
|
|
|
// contentEditor.value.getFocus();
|
|
|
// });
|
|
|
formData.data.replyTo = mailStore.selectMail.mailUser;
|
|
|
+ handleChangeReply(formData.data.replyTo);
|
|
|
}
|
|
|
};
|
|
|
// pageType 10为回复 20为转发 30为全部回复 40为再次编辑 0为写信 50为只回填收件人
|
|
|
const init = () => {
|
|
|
if (mailStore.currentMenu.pageType === "0") {
|
|
|
handleReset();
|
|
|
+ formData.data.replyTo = mailStore.selectMail.mailUser;
|
|
|
+ handleChangeReply(formData.data.replyTo);
|
|
|
} else if (mailStore.currentMenu.pageType === "10") {
|
|
|
handleReplyInit(mailStore.currentMenu, "10");
|
|
|
} else if (mailStore.currentMenu.pageType === "20") {
|
|
@@ -572,6 +603,8 @@ watch(
|
|
|
(val) => {
|
|
|
if (val === "0") {
|
|
|
handleReset();
|
|
|
+ formData.data.replyTo = mailStore.selectMail.mailUser;
|
|
|
+ handleChangeReply(formData.data.replyTo);
|
|
|
} else if (val === "10") {
|
|
|
handleReplyInit(mailStore.currentMenu, "10");
|
|
|
} else if (val === "20") {
|