feat: 查找邮箱/订单

dev/ckeditor
Lei OT 3 months ago
parent 52e6307769
commit be07ab175b

@ -231,7 +231,7 @@ export const getTodoOrdersAction = async (params) => {
parent: key + '-today',
parentTitle: '今日任务',
parentIconIndex: 'star',
_raw: { ...o, VKey: o.COLI_SN, VName: o.COLI_ID, VParent: -1, IsTrue: 0, ApplyDate: '', OrderSourceType: 227001, parent: -1 },
_raw: { ...o, VKey: o.COLI_SN, VName: o.COLI_ID, VParent: key + '-today', IsTrue: 0, ApplyDate: '', OrderSourceType: 227001, parent: key + '-today' },
})),
},
{
@ -247,7 +247,7 @@ export const getTodoOrdersAction = async (params) => {
parent: key + '-todo',
parentTitle: '待办任务',
parentIconIndex: 'calendar',
_raw: { ...o, VKey: o.COLI_SN, VName: o.COLI_ID, VParent: -1, IsTrue: 0, ApplyDate: '', OrderSourceType: 227001, parent: -1 },
_raw: { ...o, VKey: o.COLI_SN, VName: o.COLI_ID, VParent: key + '-todo', IsTrue: 0, ApplyDate: '', OrderSourceType: 227001, parent: key + '-todo' },
})),
},
...(!isEmpty(sticky[1] || [])
@ -265,7 +265,7 @@ export const getTodoOrdersAction = async (params) => {
parent: key + '-reminder',
parentTitle: '催信',
parentIconIndex: 'reminder',
_raw: { ...o, VKey: o.COLI_SN, VName: o.COLI_ID, VParent: -1, IsTrue: 0, ApplyDate: '', OrderSourceType: 227001, parent: -1 },
_raw: { ...o, VKey: o.COLI_SN, VName: o.COLI_ID, VParent: key + '-reminder', IsTrue: 0, ApplyDate: '', OrderSourceType: 227001, parent: key + '-reminder' },
})),
},
]
@ -428,3 +428,9 @@ export const deleteEmailAttachmentAction = async (ati_sn_list) => {
const { errcode, result } = await postJSON(`${API_HOST_V3}/mail_attachment_delete`, { ati_sn_list })
return errcode === 0 ? result : {}
};
export const queryHTOrderListAction = async (params) => {
const { errcode, result } = await fetchJSON(`${API_HOST}/query_order`, params)
return errcode !== 0 ? [] : result
}

@ -1,5 +1,5 @@
import { getEmailDirAction, getRootMailboxDirAction } from '@/actions/EmailActions'
import { buildTree, isEmpty } from '@/utils/commons'
import { buildTree, isEmpty, sortArrayByOrder } from '@/utils/commons'
import { readIndexDB, writeIndexDB, createIndexedDBStore, clean7DaysMailboxLog } from '@/utils/indexedDB';
/**
@ -85,6 +85,21 @@ const emailSlice = (set, get) => ({
setMailboxNestedDirsActive: (dir) => {
return set(() => ({ mailboxNestedDirsActive: dir }))
},
updateMailboxNestedDirs: (dirs) => {
const { mailboxNestedDirsActive } = get();
const keep = mailboxNestedDirsActive.filter((ele) => isEmpty(ele.parent))
return set(() => ({ mailboxNestedDirsActive: [...keep, ...dirs] }))
},
addMailboxNestedDirs: dirs => {
const { mailboxNestedDirsActive } = get()
const _Map = new Map(mailboxNestedDirsActive.map((obj) => [obj.key, obj]))
dirs.forEach((row) => {
_Map.set(row.key, row)
})
const _newValue = sortArrayByOrder(Array.from(_Map.values()), 'key', ['search-orders'])
return set(() => ({ mailboxNestedDirsActive: _newValue }))
},
mailboxActiveNode: {},
setMailboxActiveNode: (node) => {

@ -200,13 +200,11 @@ const EmailDetailInline = ({ mailID, emailMsg = {}, disabled = false, variant, s
const showFullBtn = variant !== 'full'
if (showFullBtn) {
btns.push(<Divider key='divider2' type='vertical' className='mx-0' />);
btns.push(
<>
<Divider key='divider2' type='vertical' className='mx-0' />
<Button key={'view'} onClick={() => handleView()} size='small' type='text' icon={<ExpandOutlined className='text-indigo-500' />}>
最大化
</Button>
</>
)
}

@ -122,10 +122,10 @@ function Follow() {
useEffect(() => {
const first = currentMailboxDEI || accountDEI[0].value
const opi = accountListDEIMapped[first].OPI_SN
setExpandTree([`${opi}-today`, `${opi}-todo`])
setExpandTree([`${opi}-today`, `${opi}-todo`, `search-orders`, ...[mailboxActiveNode?.VParent || []]])
return () => {}
}, [currentMailboxDEI, mailboxNestedDirsActive])
}, [currentMailboxDEI, mailboxNestedDirsActive, mailboxActiveNode])
return (
<>

@ -1,16 +1,16 @@
import { createContext, useEffect, useState } from 'react'
import { ReloadOutlined, ReadOutlined, RightOutlined, LeftOutlined, SearchOutlined, MailOutlined } from '@ant-design/icons'
import { Button, Modal, Form, Input, Checkbox, Select, Radio, DatePicker, Divider } from 'antd'
import { Button, Modal, Form, Input, Checkbox, Select, Radio, DatePicker, Divider, Typography } from 'antd'
import dayjs from 'dayjs'
import { getEmailDirAction } from '@/actions/EmailActions'
import { objectMapper } from '@/utils/commons'
import { getEmailDirAction, queryHTOrderListAction } from '@/actions/EmailActions'
import { isEmpty, objectMapper, pick } from '@/utils/commons'
import useConversationStore from '@/stores/ConversationStore'
const yearsArray = Array.from({ length: new Date().getFullYear() - 2004 + 1 }, (_, i) => ({ 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 [addMailboxNestedDirs, updateMailboxNestedDirs, setMailboxActiveNode] = useConversationStore((state) => [state.addMailboxNestedDirs, state.updateMailboxNestedDirs, state.setMailboxActiveNode])
const [open, setOpen] = useState(false)
const [form] = Form.useForm()
@ -23,34 +23,33 @@ const MailOrderSearchModal = ({ ...props }) => {
setLoading(true)
const valuesToSub = objectMapper(values, {
year: { key: 'year', transform: (val) => (val ? dayjs(val).year() : '') },
important: { key: 'important', transform: (val) => (val ? '1' : '0') },
important: { key: 'important', transform: (val) => (val || '-1') },
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') },
coli_id: { key: 'coli_id', transform: (val) => (val ? val : '') },
is_biz: { key: 'sourcetype', transform: (val) => (val ? '227002' : '227001') },
})
const result = await getEmailDirAction({ ...valuesToSub, opi_sn: currentMailboxOPI }, true)
console.log('res', result)
let result;
if (isEmpty(valuesToSub.coli_id)) {
const { coli_id, sourcetype, ...mailboxParams} = valuesToSub;
result = await getEmailDirAction({ ...mailboxParams, opi_sn: currentMailboxOPI }, false)
updateMailboxNestedDirs(result[`${currentMailboxOPI}`])
} else {
const htOrderParams = pick(valuesToSub, ['coli_id', 'sourcetype',])
result = await queryHTOrderListAction(htOrderParams)
const addToTree = {
key: 'search-orders',
title: '搜索结果',
iconIndex: 'search',
_raw: { COLI_SN: 0, IsTrue: 0 },
children: result.map((o) => ({ key: `search-${o.COLI_SN}`, title: `${o.COLI_ID}`, iconIndex: 13, parent: 'search-orders', parentTitle: '搜索结果', parentIconIndex: 'search', _raw: { ...o, VKey: o.COLI_SN, VName: o.COLI_ID, VParent: 'search-orders', IsTrue: 0, ApplyDate: '', OrderSourceType: htOrderParams.sourcetype, parent: 'search-orders' }, })),
}
addMailboxNestedDirs([addToTree]);
setMailboxActiveNode(addToTree);
}
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 (
@ -60,7 +59,7 @@ const MailOrderSearchModal = ({ ...props }) => {
</Button>
<Modal
width={window.innerWidth < 700 ? '95%' : 960}
title='查找订单' //mask={false}
title='查找邮件' //mask={false}
open={open}
cancelText='关闭'
okText='查找'
@ -75,7 +74,7 @@ const MailOrderSearchModal = ({ ...props }) => {
size='small'
form={form}
name='searchmailorder_form_in_modal'
initialValues={{ year: dayjs() }}
initialValues={{ year: dayjs(), important: '-1' }}
clearOnDestroy
onFinish={(values) => onSubmitSearchMailOrder(values)}
className='[&_.ant-form-item]:m-2'>
@ -83,11 +82,12 @@ const MailOrderSearchModal = ({ ...props }) => {
</Form>
)}>
<Form.Item name='year' label='年份'>
<DatePicker picker='year' maxDate={dayjs()} />
<DatePicker picker='year' />
</Form.Item>
<Form.Item name='important' label='重要程度'>
<Radio.Group
options={[
{ key: '-1', value: '-1', label: 'All' },
{ key: '240001', value: '240001', label: '普通' },
{ key: '240002', value: '240002', label: '较重要' },
{ key: '240003', value: '240003', label: '很重要' },
@ -109,10 +109,20 @@ const MailOrderSearchModal = ({ ...props }) => {
<Form.Item name='by_start_date' className='' valuePropName='checked'>
<Checkbox>按出发日期</Checkbox>
</Form.Item>
{/* <Divider className='my-2' /> */}
<Form.Item name='order' label='订单号' className=''>
<div className='text-end'>
<Button type='primary' htmlType='submit' loading={loading}>
查找
</Button>
</div>
<Divider className='my-2' />
<Typography.Title level={5}>查找订单</Typography.Title>
<Form.Item name='coli_id' label='订单号' className=''>
<Input />
</Form.Item>
<Form.Item name='is_biz' className='' valuePropName='checked'>
<Checkbox>商务订单</Checkbox>
</Form.Item>
</Modal>
</>
)

@ -1,7 +1,8 @@
import { StarTwoTone, CalendarTwoTone, FolderOutlined, DeleteOutlined, ClockCircleOutlined, FormOutlined, DatabaseOutlined, BellTwoTone } from '@ant-design/icons'
import { StarTwoTone, CalendarTwoTone, FolderOutlined, DeleteOutlined, ClockCircleOutlined, FormOutlined, DatabaseOutlined, BellTwoTone, SearchOutlined } from '@ant-design/icons'
import { InboxIcon, MailUnreadIcon, SendPlaneFillIcon } from '@/components/Icons'
const EmailDirTypeIcons = {
'search': { component: SearchOutlined, color: '', className: 'text-blue-600' },
'star': { component: StarTwoTone, color: '', className: '' },
'calendar': { component: CalendarTwoTone, color: '', className: '' },
'reminder': { component: BellTwoTone, color: '', className: '' },

Loading…
Cancel
Save