|
|
|
@ -59,7 +59,7 @@ const generateMailContent = (mailData) => `<br><br><p>${mailData.content}</p>`
|
|
|
|
|
* @property {string} quoteid - 引用邮件ID
|
|
|
|
|
* @property {object} draft - 草稿
|
|
|
|
|
*/
|
|
|
|
|
const EmailEditorPopup = ({ open, setOpen, fromEmail, fromUser, fromOrder, oid, toEmail, conversationid, quoteid, initial = {}, mailData: _mailData, action = 'reply', draft = {}, ...props }) => {
|
|
|
|
|
const EmailEditorPopup = ({ open, setOpen, fromEmail, fromUser, fromOrder, oid, toEmail, conversationid, quoteid, initial = {}, mailData: _mailData, action = 'reply', draft = {}, customerDetail={}, ...props }) => {
|
|
|
|
|
const { notification, message } = App.useApp();
|
|
|
|
|
const [form] = Form.useForm();
|
|
|
|
|
|
|
|
|
@ -93,6 +93,8 @@ const EmailEditorPopup = ({ open, setOpen, fromEmail, fromUser, fromOrder, oid,
|
|
|
|
|
setNewToEmail('')
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const [contentPrefix, setContentPrefix] = useState('');
|
|
|
|
|
|
|
|
|
|
// 存储: 会话ID,
|
|
|
|
|
// 这个窗口没有模态, 即使不是focus, 还是需要保持会话ID
|
|
|
|
|
// 否则, 会话列表切换之后, 会话ID更新, 导致消息关联错误
|
|
|
|
@ -100,6 +102,8 @@ const EmailEditorPopup = ({ open, setOpen, fromEmail, fromUser, fromOrder, oid,
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
const propsObj = { open, setOpen, fromEmail, fromUser, fromOrder, oid, toEmail, conversationid, quoteid, mai: _mailData?.info?.MAI_MAT_SN, action, draft }
|
|
|
|
|
|
|
|
|
|
setContentPrefix(oid ? `<p>Dear Mr./Ms. ${customerDetail.name || ''}</p><p>Reference Number: ${oid}</p>` : '');
|
|
|
|
|
|
|
|
|
|
// 没有引用邮件
|
|
|
|
|
if (isEmpty(quoteid)) {
|
|
|
|
|
setStickToProps(propsObj)
|
|
|
|
@ -197,7 +201,7 @@ const EmailEditorPopup = ({ open, setOpen, fromEmail, fromUser, fromOrder, oid,
|
|
|
|
|
// const _initialContent = isEmpty(mailData.info) ? signatureBody : signatureBody+preQuoteBody
|
|
|
|
|
|
|
|
|
|
if (!isEmpty(mailData.info) && action !== 'edit') {
|
|
|
|
|
setInitialContent(signatureBody)
|
|
|
|
|
setInitialContent(contentPrefix + signatureBody)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const _formValues = {
|
|
|
|
@ -230,7 +234,7 @@ const EmailEditorPopup = ({ open, setOpen, fromEmail, fromUser, fromOrder, oid,
|
|
|
|
|
const newEmail = { to: newToEmail, subject: draft?.subject || '' }
|
|
|
|
|
form.setFieldsValue(newEmail)
|
|
|
|
|
setInitialForm(newEmail)
|
|
|
|
|
setInitialContent((draft?.content || '') + signatureBody)
|
|
|
|
|
setInitialContent((draft?.content || contentPrefix || '') + signatureBody)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return () => {}
|
|
|
|
|