From 2d4edd6c642e430ce7571c6b92737a2c5c966905 Mon Sep 17 00:00:00 2001 From: Lei OT Date: Tue, 17 Jun 2025 16:54:34 +0800 Subject: [PATCH] =?UTF-8?q?=E2=8F=B3=20=E6=9F=A5=E6=89=BE=E8=AE=A2?= =?UTF-8?q?=E5=8D=95=E2=86=92=E9=82=AE=E7=AE=B1=E7=9B=AE=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/actions/EmailActions.js | 13 +- .../Online/Components/EmailBind.jsx | 2 +- src/views/orders/components/MailBox.jsx | 3 +- .../components/MailOrderSearchModal.jsx | 120 ++++++++++++++++++ 4 files changed, 128 insertions(+), 10 deletions(-) create mode 100644 src/views/orders/components/MailOrderSearchModal.jsx diff --git a/src/actions/EmailActions.js b/src/actions/EmailActions.js index 2635b85..8e7350e 100644 --- a/src/actions/EmailActions.js +++ b/src/actions/EmailActions.js @@ -165,15 +165,17 @@ const todoTypes = { } /** * 顾问的邮箱目录 - * @param {object} { opi_sn } + * @param {object} { opi_sn, year, by_start_date, by_success, important, if_want_book, if_thinking } */ -export const getEmailDirAction = async (params = { opi_sn: '' }) => { +export const getEmailDirAction = async (params = { opi_sn: '' }, retOrder=false) => { const defaultParams = { opi_sn: 0, year: dayjs().year(), by_start_date: -1, by_success: -1, important: -1, if_want_book: -1, if_thinking: -1 } const { errcode, result } = await fetchJSON(`${API_HOST_V3}/email_dir`, { ...defaultParams, ...params }) const mailboxSort = result //.sort(sortBy('MDR_Order')); let tree = buildTree(mailboxSort, { key: 'VKey', parent: 'VParent', name: 'VName', iconIndex: 'ImageIndex', rootKeys: [1], ignoreKeys: [-227001, -227002] }) tree = tree.filter((ele) => ele.key !== 1) - return errcode === 0 ? { [`${params.opi_sn}`]: tree } : { [`${params.opi_sn}`]: [] } + const retTree = errcode === 0 ? tree : []; + const orderList = groupBy(result, row => `${row.IsTrue}`)?.['0'] || []; + return retOrder !== false ? orderList : { [`${params.opi_sn}`]: retTree } }; export const getTodoOrdersAction = async (params) => { const opi_arr = params.opisn.split(',') @@ -347,17 +349,13 @@ const updateEmailKeyFun = { const channel = getEmailChangesChannel() channel.postMessage(notificationPayload) // - 当前tab - // console.log(`[EmailDetail] Emitted internal`, EMAIL_CHANNEL_NAME, notificationPayload); internalEventEmitter.emit(EMAIL_CHANNEL_NAME, notificationPayload); }, processed: async (params) => { const readRow0 = await readIndexDB(params.mai_sn_list[0], 'listrow', 'mailbox') - console.log('first000', readRow0); const listKey = readRow0?.data?.listKey || ''; if (listKey) { - console.log('first', listKey); const readCache = await readIndexDB(listKey, 'maillist', 'mailbox') - console.log('222', readCache); const updatedMailList = readCache.data.filter(mai_sn => !params.mai_sn_list.includes(mai_sn)); writeIndexDB([{ key: listKey, data: updatedMailList }], 'maillist', 'mailbox') // 通知邮件列表数据更新 @@ -366,7 +364,6 @@ const updateEmailKeyFun = { const channel = getEmailChangesChannel() channel.postMessage(notificationPayload) // - 当前tab - // console.log(`[EmailDetail] Emitted internal`, EMAIL_CHANNEL_NAME, notificationPayload); internalEventEmitter.emit(EMAIL_CHANNEL_NAME, notificationPayload); } } diff --git a/src/views/Conversations/Online/Components/EmailBind.jsx b/src/views/Conversations/Online/Components/EmailBind.jsx index 1a0923f..a2c782a 100644 --- a/src/views/Conversations/Online/Components/EmailBind.jsx +++ b/src/views/Conversations/Online/Components/EmailBind.jsx @@ -155,7 +155,7 @@ export const EmailBindFormModal = ({ mai_sn, conversationid, userId, coliID, onB onCancel={() => { setOpen(false) }} - destroyOnClose> + destroyOnHidden> {/* */}
{ markAsProcessed(selectedItems.map((item) => item.MAI_SN)).then(() => setSelectedItems([])) }} >已处理 - +
({ key: 2004 + i, value: 2004 + i, label: 2004 + i })) + +const MailOrderSearchModal = ({ ...props }) => { + const [currentMailboxOPI] = useConversationStore((state) => [state.currentMailboxOPI]) + const [setMailboxNestedDirsActive, setMailboxActiveNode] = useConversationStore((state) => [state.setMailboxNestedDirsActive, state.setMailboxActiveNode]) + + const [open, setOpen] = useState(false) + const [form] = Form.useForm() + const [loading, setLoading] = useState(false) + const [formValues, setFormValues] = useState() + const onSubmitSearchMailOrder = async (values) => { + console.log('Received values of form: ', values) + setFormValues(values) + // setOpen(false) + setLoading(true) + const valuesToSub = objectMapper(values, { + year: { key: 'year', transform: (val) => (val ? dayjs(val).year() : '') }, + important: { key: 'important', transform: (val) => (val ? '1' : '0') }, + by_success: { key: 'by_success', transform: (val) => (val ? '1' : '0') }, + if_want_book: { key: 'if_want_book', transform: (val) => (val ? '1' : '0') }, + if_thinking: { key: 'if_thinking', transform: (val) => (val ? '1' : '0') }, + by_start_date: { key: 'by_start_date', transform: (val) => (val ? '1' : '0') }, + }) + const result = await getEmailDirAction({ ...valuesToSub, opi_sn: currentMailboxOPI }, true) + console.log('res', result) + setLoading(false) + // setMailboxActiveNode({ + // key: 1130915, + // parent: -1, + // iconIndex: 13, + // title: 'QYCAH250101022', + // parentTitle: '1月', + // parentIconIndex: 1, + // VKey: 1130915, + // VName: 'QYCAH250101022', + // VParent: -1, + // ImageIndex: 13, + // COLI_SN: 1130915, + // OrderSourceType: 227001, + // IsTrue: 0, + // ApplyDate: '2025-01-01T00:06:00', + // StartDate: '2024-12-16', + // IsSuccess: 0, + // OPI_SN: 586, + // }) + setOpen(false) + } + return ( + <> + + setOpen(false)} + // footer={null} + destroyOnHidden + modalRender={(dom) => ( + onSubmitSearchMailOrder(values)} + className='[&_.ant-form-item]:m-2'> + {dom} + + )}> + + + + + + +
+ + 成行订单 + + + 要预定 + + + 犹豫中 + +
+ + 按出发日期 + + {/* */} + + + +
+ + ) +} +export default MailOrderSearchModal