|
|
|
@ -60,7 +60,7 @@ const generateMailContent = (mailData) => `
|
|
|
|
|
${mailData.content}
|
|
|
|
|
</p>`
|
|
|
|
|
|
|
|
|
|
const EmailEditorPopup = ({ open, setOpen, fromEmail, fromUser, conversationid, quoteid, initial = {}, mailData: _mailData, action = 'reply', ...props }) => {
|
|
|
|
|
const EmailEditorPopup = ({ open, setOpen, fromEmail, fromUser, toEmail, conversationid, quoteid, initial = {}, mailData: _mailData, action = 'reply', ...props }) => {
|
|
|
|
|
const [mobile] = useStyleStore((state) => [state.mobile]);
|
|
|
|
|
const [userId, username, emailList] = useAuthStore((state) => [state.loginUser.userId, state.loginUser.username, state.loginUser.emailList]);
|
|
|
|
|
const emailListOption = emailList?.map(ele => ({ ...ele, label: ele.email, key: ele.email, value: ele.email })) || [];
|
|
|
|
@ -74,6 +74,7 @@ const EmailEditorPopup = ({ open, setOpen, fromEmail, fromUser, conversationid,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const [newFromEmail, setNewFromEmail] = useState(fromEmail);
|
|
|
|
|
const [newToEmail, setNewToEmail] = useState(toEmail);
|
|
|
|
|
const [emailOPI, setEmailOPI] = useState(fromUser);
|
|
|
|
|
const [emailMat, setEmailMat] = useState('');
|
|
|
|
|
useEffect(() => {
|
|
|
|
@ -89,12 +90,13 @@ const EmailEditorPopup = ({ open, setOpen, fromEmail, fromUser, conversationid,
|
|
|
|
|
|
|
|
|
|
setNewFromEmail(fromEmail);
|
|
|
|
|
setEmailOPI(emailUser);
|
|
|
|
|
setNewToEmail(toEmail);
|
|
|
|
|
|
|
|
|
|
const _findMat = emailListAddrMapped?.[fromEmail]?.mat_sn
|
|
|
|
|
setEmailMat(emailUserMat || _findMat)
|
|
|
|
|
|
|
|
|
|
return () => {}
|
|
|
|
|
}, [fromEmail, fromUser, mailData])
|
|
|
|
|
}, [fromEmail, fromUser, toEmail, mailData])
|
|
|
|
|
|
|
|
|
|
const handleSwitchEmail = (labelValue) => {
|
|
|
|
|
const { value } = labelValue
|
|
|
|
@ -151,7 +153,7 @@ const EmailEditorPopup = ({ open, setOpen, fromEmail, fromUser, conversationid,
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
// console.log('quoteid', quoteid, isEmpty(quoteid), isEmpty(mailData.info));
|
|
|
|
|
|
|
|
|
|
if (isEmpty(quoteid)) {
|
|
|
|
|
if (isEmpty(quoteid) && action !== 'new') {
|
|
|
|
|
return () => {};
|
|
|
|
|
}
|
|
|
|
|
const { info, } = mailData
|
|
|
|
@ -188,10 +190,14 @@ const EmailEditorPopup = ({ open, setOpen, fromEmail, fromUser, conversationid,
|
|
|
|
|
// console.log('thisBody', thisBody);
|
|
|
|
|
|
|
|
|
|
setInitialContent(thisBody)
|
|
|
|
|
} else if (action === 'new') {
|
|
|
|
|
const newEmail = { to: newToEmail, }
|
|
|
|
|
form.setFieldsValue(newEmail);
|
|
|
|
|
setInitialForm(newEmail);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return () => {};
|
|
|
|
|
}, [open, mailData.info]);
|
|
|
|
|
}, [open, action, mailData.info]);
|
|
|
|
|
|
|
|
|
|
const [openPlainTextConfirm, setOpenPlainTextConfirm] = useState(false);
|
|
|
|
|
const handlePlainTextOpenChange = ({ target }) => {
|
|
|
|
|