|
|
|
@ -69,7 +69,7 @@ const generateQuoteContent = (mailData, isRichText = true) => {
|
|
|
|
|
return isRichText ? html : parseHTMLText(html)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const generateMailContent = (mailData) => `<br><p>${mailData.content}</p><br>`
|
|
|
|
|
const generateMailContent = (mailData) => `<p>${mailData.content}</p><br>`
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 独立窗口编辑器
|
|
|
|
@ -105,7 +105,7 @@ const NewEmail = () => {
|
|
|
|
|
// const [emailOrderSN, setEmailOrderSN] = useState('')
|
|
|
|
|
// const [emailMat, setEmailMat] = useState('')
|
|
|
|
|
|
|
|
|
|
const [contentPrefix, setContentPrefix] = useState('')
|
|
|
|
|
// const [contentPrefix, setContentPrefix] = useState('')
|
|
|
|
|
const [localDraft, setLocalDraft] = useState();
|
|
|
|
|
|
|
|
|
|
// const readMailboxLocalCache = async () => {
|
|
|
|
@ -168,7 +168,8 @@ const NewEmail = () => {
|
|
|
|
|
document.title = docTitle
|
|
|
|
|
|
|
|
|
|
const { order_no } = orderDetail
|
|
|
|
|
setContentPrefix(order_no ? `<p>Dear Mr./Ms. ${orderDetail.contact?.[0]?.name || ''}</p><p>Reference Number: ${order_no}</p>` : '')
|
|
|
|
|
// setContentPrefix(order_no ? `<p>Dear Mr./Ms. ${orderDetail.contact?.[0]?.name || ''}</p><p>Reference Number: ${order_no}</p>` : '')
|
|
|
|
|
const orderPrefix = order_no ? `<p>Dear Mr./Ms. ${orderDetail.contact?.[0]?.name || ''}</p><p>Reference Number: ${order_no}</p>` : ''
|
|
|
|
|
|
|
|
|
|
const { info } = mailData
|
|
|
|
|
const { ...templateFormValues } = templateContent;
|
|
|
|
@ -202,8 +203,8 @@ const NewEmail = () => {
|
|
|
|
|
|
|
|
|
|
// const _initialContent = isEmpty(mailData.info) ? signatureBody : signatureBody+preQuoteBody
|
|
|
|
|
|
|
|
|
|
if (!isEmpty(mailData.info) && !['edit', 'new'].includes(pageParam.action)) {
|
|
|
|
|
readyToInitialContent = contentPrefix + signatureBody
|
|
|
|
|
if (!isEmpty(mailData.info) && !['edit'].includes(pageParam.action)) {
|
|
|
|
|
readyToInitialContent = orderPrefix + signatureBody
|
|
|
|
|
}
|
|
|
|
|
switch (pageParam.action) {
|
|
|
|
|
case 'reply':
|
|
|
|
@ -239,7 +240,7 @@ const NewEmail = () => {
|
|
|
|
|
from: quotedMailSenderObj,
|
|
|
|
|
to: info?.MAI_To || '',
|
|
|
|
|
cc: info?.MAI_CS || '',
|
|
|
|
|
subject: `Fw: ${info.MAI_Subject || ''}`,
|
|
|
|
|
subject: `${info.MAI_Subject || ''}`,
|
|
|
|
|
id: pageParam.quoteid,
|
|
|
|
|
mai_sn: pageParam.quoteid,
|
|
|
|
|
..._form2
|
|
|
|
@ -255,7 +256,7 @@ const NewEmail = () => {
|
|
|
|
|
subject: `${info.MAI_Subject || templateFormValues.subject || ''}`,
|
|
|
|
|
..._form2,
|
|
|
|
|
}
|
|
|
|
|
readyToInitialContent = generateMailContent({ content: templateContent.bodycontent || '' })
|
|
|
|
|
readyToInitialContent = generateMailContent({ content: templateContent.bodycontent || readyToInitialContent || '' })
|
|
|
|
|
setFileList(mailData.attachments.map(ele => ({ uid: ele.ATI_SN, name: ele.ATI_Name, url: ele.ATI_ServerFile, fullPath: `${EMAIL_ATTA_HOST}${ele.ATI_ServerFile}` })))
|
|
|
|
|
break
|
|
|
|
|
|
|
|
|
@ -267,7 +268,7 @@ const NewEmail = () => {
|
|
|
|
|
setInitialContent(readyToInitialContent);
|
|
|
|
|
|
|
|
|
|
return () => {}
|
|
|
|
|
}, [orderDetail.order_no, quoteLoading, loadingTamplate])
|
|
|
|
|
}, [orderDetail.order_no, quoteLoading, loadingTamplate, signature])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// const readFromTemplate = () => {
|
|
|
|
|