Merge remote-tracking branch 'origin/main'
commit
01997b7d23
@ -0,0 +1,82 @@
|
|||||||
|
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, Segmented, Divider, Typography, Flex } from 'antd'
|
||||||
|
import dayjs from 'dayjs'
|
||||||
|
import { getEmailDirAction, queryHTOrderListAction, searchEmailListAction } from '@/actions/EmailActions'
|
||||||
|
import { isEmpty, objectMapper, pick } from '@/utils/commons'
|
||||||
|
import useConversationStore from '@/stores/ConversationStore'
|
||||||
|
import { useEmailList } from '@/hooks/useEmail'
|
||||||
|
|
||||||
|
const MailListSearchModal = ({ ...props }) => {
|
||||||
|
const [currentMailboxOPI] = useConversationStore((state) => [state.currentMailboxOPI])
|
||||||
|
const { searchMailList } = useEmailList(props.mailboxDir)
|
||||||
|
|
||||||
|
const [openForm, setOpenForm] = useState(false)
|
||||||
|
const [formSearch] = Form.useForm()
|
||||||
|
const [loading, setLoading] = useState(false)
|
||||||
|
|
||||||
|
const onSubmitSearchMailList = async (values) => {
|
||||||
|
setLoading(true)
|
||||||
|
searchMailList()
|
||||||
|
setLoading(false)
|
||||||
|
setOpenForm(false)
|
||||||
|
}
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Button key={'bound'} onClick={() => setOpenForm(true)} size='small' icon={<SearchOutlined className='' />}>
|
||||||
|
查找订单
|
||||||
|
</Button>
|
||||||
|
<Modal
|
||||||
|
width={window.innerWidth < 700 ? '95%' : 960}
|
||||||
|
open={openForm}
|
||||||
|
cancelText='关闭'
|
||||||
|
okText='查找'
|
||||||
|
confirmLoading={loading}
|
||||||
|
okButtonProps={{ autoFocus: true, htmlType: 'submit', type: 'default' }}
|
||||||
|
onCancel={() => setOpenForm(false)}
|
||||||
|
footer={null}
|
||||||
|
destroyOnHidden
|
||||||
|
modalRender={(dom) => (
|
||||||
|
<Form
|
||||||
|
layout='vertical'
|
||||||
|
form={formSearch}
|
||||||
|
name='searchmaillist_form_in_modal'
|
||||||
|
initialValues={{ mailboxtype: '1' }}
|
||||||
|
clearOnDestroy
|
||||||
|
onFinish={(values) => onSubmitSearchMailList(values)}
|
||||||
|
className='[&_.ant-form-item]:m-2'>
|
||||||
|
{dom}
|
||||||
|
</Form>
|
||||||
|
)}>
|
||||||
|
<Form.Item name='mailboxtype' label='文件夹'>
|
||||||
|
<Radio.Group
|
||||||
|
options={[
|
||||||
|
{ key: '-1', value: 'ALL', label: 'All' },
|
||||||
|
{ key: '1', value: '1', label: '收件箱' },
|
||||||
|
{ key: '2', value: '2', label: '未读邮件' },
|
||||||
|
{ key: '3', value: '3', label: '已发邮件' },
|
||||||
|
{ key: '4', value: '4', label: '待发邮件' },
|
||||||
|
{ key: '5', value: '5', label: '草稿' },
|
||||||
|
{ key: '6', value: '6', label: '已发邮件' },
|
||||||
|
{ key: '7', value: '7', label: '已处理邮件' },
|
||||||
|
]}
|
||||||
|
optionType='button'
|
||||||
|
/>
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item name='sender' label='发件人'>
|
||||||
|
<Input />
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item name='receiver' label='收件人'>
|
||||||
|
<Input />
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item name='subject' label='主题'>
|
||||||
|
<Input />
|
||||||
|
</Form.Item>
|
||||||
|
<Button type='primary' htmlType='submit' loading={loading}>
|
||||||
|
查找
|
||||||
|
</Button>
|
||||||
|
</Modal>
|
||||||
|
</>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
export default MailListSearchModal
|
Loading…
Reference in New Issue