dev/2025a
Lei OT 1 week ago
parent 15acbf4f2f
commit b29b927b5c

@ -415,8 +415,7 @@ export const useEmailTemplate = (templateKey, params) => {
return { loading, error, templateContent }; return { loading, error, templateContent };
} }
export const mailboxSystemDirs = () => { export const mailboxSystemDirs = [
return [
{ key: 1, value: 1, label: '收件箱' }, { key: 1, value: 1, label: '收件箱' },
{ key: 2, value: 2, label: '未读邮件' }, { key: 2, value: 2, label: '未读邮件' },
{ key: 3, value: 3, label: '已发邮件' }, { key: 3, value: 3, label: '已发邮件' },
@ -425,4 +424,4 @@ export const mailboxSystemDirs = () => {
{ key: 6, value: 6, label: '垃圾邮件' }, { key: 6, value: 6, label: '垃圾邮件' },
{ key: 7, value: 7, label: '已处理邮件' }, { key: 7, value: 7, label: '已处理邮件' },
] ]
}

@ -1,10 +1,11 @@
import { createContext, useEffect, useState } from 'react' import { createContext, useEffect, useState } from 'react'
import { ReloadOutlined, ReadOutlined, RightOutlined, LeftOutlined, SearchOutlined, MailOutlined } from '@ant-design/icons' import { ReloadOutlined, ReadOutlined, RightOutlined, LeftOutlined, SearchOutlined, MailOutlined } from '@ant-design/icons'
import { Button, Modal, Form, Input, Checkbox, Select, Radio, DatePicker, Divider, Typography } from 'antd' import { Button, Modal, Form, Input, Checkbox, Select, Radio, DatePicker, Divider, Typography, Flex } from 'antd'
import dayjs from 'dayjs' import dayjs from 'dayjs'
import { getEmailDirAction, queryHTOrderListAction, } from '@/actions/EmailActions' import { getEmailDirAction, queryHTOrderListAction, queryInMailboxAction } from '@/actions/EmailActions'
import { isEmpty, objectMapper, pick } from '@/utils/commons' import { isEmpty, objectMapper, pick } from '@/utils/commons'
import useConversationStore from '@/stores/ConversationStore' import useConversationStore from '@/stores/ConversationStore'
import { mailboxSystemDirs } from '@/hooks/useEmail'
const MailOrderSearchModal = ({ ...props }) => { const MailOrderSearchModal = ({ ...props }) => {
const [currentMailboxOPI] = useConversationStore((state) => [state.currentMailboxOPI]) const [currentMailboxOPI] = useConversationStore((state) => [state.currentMailboxOPI])
@ -19,7 +20,7 @@ const MailOrderSearchModal = ({ ...props }) => {
setLoading(true) setLoading(true)
const valuesToSub = objectMapper(values, { const valuesToSub = objectMapper(values, {
year: { key: 'year', transform: (val) => (val ? dayjs(val).year() : '') }, year: { key: 'year', transform: (val) => (val ? dayjs(val).year() : '') },
important: { key: 'important', transform: (val) => (val || '-1') }, important: { key: 'important', transform: (val) => val || '-1' },
by_success: { key: 'by_success', 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_want_book: { key: 'if_want_book', transform: (val) => (val ? '1' : '0') },
if_thinking: { key: 'if_thinking', transform: (val) => (val ? '1' : '0') }, if_thinking: { key: 'if_thinking', transform: (val) => (val ? '1' : '0') },
@ -27,23 +28,31 @@ const MailOrderSearchModal = ({ ...props }) => {
coli_id: { key: 'coli_id', transform: (val) => (val ? val : '') }, coli_id: { key: 'coli_id', transform: (val) => (val ? val : '') },
is_biz: { key: 'sourcetype', transform: (val) => (val ? '227002' : '227001') }, is_biz: { key: 'sourcetype', transform: (val) => (val ? '227002' : '227001') },
}) })
let result; let result
if (isEmpty(valuesToSub.coli_id)) { if (isEmpty(valuesToSub.coli_id)) {
const { coli_id, sourcetype, ...mailboxParams} = valuesToSub; const { coli_id, sourcetype, ...mailboxParams } = valuesToSub
result = await getEmailDirAction({ ...mailboxParams, opi_sn: currentMailboxOPI }, false) result = await getEmailDirAction({ ...mailboxParams, opi_sn: currentMailboxOPI }, false)
updateCurrentMailboxNestedDirs(result[`${currentMailboxOPI}`]) updateCurrentMailboxNestedDirs(result[`${currentMailboxOPI}`])
} else { } else {
const htOrderParams = pick(valuesToSub, ['coli_id', 'sourcetype',]) const htOrderParams = pick(valuesToSub, ['coli_id', 'sourcetype'])
result = await queryHTOrderListAction({...htOrderParams, opi_sn: currentMailboxOPI}) result = await queryHTOrderListAction({ ...htOrderParams, opi_sn: currentMailboxOPI })
const addToTree = { const addToTree = {
key: 'search-orders', key: 'search-orders',
title: '搜索结果', title: '搜索结果',
iconIndex: 'search', iconIndex: 'search',
_raw: { COLI_SN: 0, IsTrue: 0 }, _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' }, })), 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' },
})),
} }
updateCurrentMailboxNestedDirs([addToTree]); updateCurrentMailboxNestedDirs([addToTree])
setMailboxActiveNode(addToTree); setMailboxActiveNode(addToTree)
} }
setLoading(false) setLoading(false)
setOpen(false) setOpen(false)
@ -55,19 +64,19 @@ const MailOrderSearchModal = ({ ...props }) => {
</Button> </Button>
<Modal <Modal
width={window.innerWidth < 700 ? '95%' : 960} width={window.innerWidth < 700 ? '95%' : 960}
title='查找邮件' //mask={false} // title='' //mask={false}
open={open} open={open}
cancelText='关闭' cancelText='关闭'
okText='查找' okText='查找'
confirmLoading={loading} confirmLoading={loading}
okButtonProps={{ autoFocus: true, htmlType: 'submit' }} okButtonProps={{ autoFocus: true, htmlType: 'submit', type: 'default' }}
onCancel={() => setOpen(false)} onCancel={() => setOpen(false)}
// footer={null} footer={null}
destroyOnHidden destroyOnHidden
modalRender={(dom) => ( modalRender={(dom) => (
<Form <Form
layout='inline' layout='inline'
size='small' // size='small'
form={form} form={form}
name='searchmailorder_form_in_modal' name='searchmailorder_form_in_modal'
initialValues={{ year: dayjs(), important: '-1' }} initialValues={{ year: dayjs(), important: '-1' }}
@ -77,48 +86,59 @@ const MailOrderSearchModal = ({ ...props }) => {
{dom} {dom}
</Form> </Form>
)}> )}>
<Form.Item name='year' label='年份'> <Flex wrap gap={8}>
<DatePicker picker='year' /> <div>
</Form.Item> <Typography.Text strong>按订单的时间范围</Typography.Text>
<Form.Item name='important' label='重要程度'> <Form.Item name='year' label='年份'>
<Radio.Group <DatePicker picker='year' />
options={[ </Form.Item>
{ key: '-1', value: '-1', label: 'All' }, <Form.Item name='important' label='重要程度'>
{ key: '240001', value: '240001', label: '普通' }, <Radio.Group
{ key: '240002', value: '240002', label: '较重要' }, options={[
{ key: '240003', value: '240003', label: '很重要' }, { key: '-1', value: '-1', label: 'All' },
]} { key: '240001', value: '240001', label: '普通' },
optionType='button' { key: '240002', value: '240002', label: '较重要' },
/> { key: '240003', value: '240003', label: '很重要' },
</Form.Item> ]}
<div className='flex'> optionType='button'
<Form.Item name='by_success' className='' valuePropName='checked'> />
<Checkbox>成行订单</Checkbox> </Form.Item>
</Form.Item> <div className='flex'>
<Form.Item name='if_want_book' className='' valuePropName='checked'> <Form.Item name='by_success' className='' valuePropName='checked'>
<Checkbox>要预定</Checkbox> <Checkbox>成行订单</Checkbox>
</Form.Item> </Form.Item>
<Form.Item name='if_thinking' className='' valuePropName='checked'> <Form.Item name='if_want_book' className='' valuePropName='checked'>
<Checkbox>犹豫中</Checkbox> <Checkbox>要预定</Checkbox>
</Form.Item> </Form.Item>
</div> <Form.Item name='if_thinking' className='' valuePropName='checked'>
<Form.Item name='by_start_date' className='' valuePropName='checked'> <Checkbox>犹豫中</Checkbox>
<Checkbox>按出发日期</Checkbox> </Form.Item>
</Form.Item> </div>
<div className='text-end'> <Form.Item name='by_start_date' className='' valuePropName='checked'>
<Button type='primary' htmlType='submit' loading={loading}> <Checkbox>按出发日期</Checkbox>
查找 </Form.Item>
</Button> <div className='text-end'>
</div> <Button type='primary' htmlType='submit' loading={loading}>
查找
</Button>
</div>
<Divider className='my-2' /> <Divider className='my-2' />
<Typography.Title level={5}>查找订单</Typography.Title> <Typography.Text strong>订单号精确查找</Typography.Text>
<Form.Item name='coli_id' label='订单号' className=''> <Form.Item name='coli_id' label='订单号' className=''>
<Input /> <Input />
</Form.Item> </Form.Item>
<Form.Item name='is_biz' className='' valuePropName='checked'> <Form.Item name='is_biz' className='' valuePropName='checked'>
<Checkbox>商务订单</Checkbox> <Checkbox>商务订单</Checkbox>
</Form.Item> </Form.Item>
<div className='text-end'>
<Button type='primary' htmlType='submit' loading={loading}>
查找
</Button>
</div>
</div>
</Flex>
</Modal> </Modal>
</> </>
) )

Loading…
Cancel
Save