|
|
|
@ -1,6 +1,6 @@
|
|
|
|
|
import { useEffect, useState } from 'react'
|
|
|
|
|
import { ReloadOutlined, ReadOutlined, CheckSquareOutlined, RightOutlined, LeftOutlined, ExpandOutlined } from '@ant-design/icons'
|
|
|
|
|
import { Flex, Button, Tooltip, List, Form, Row, Col, Dropdown, Input, Checkbox, DatePicker, Switch, Breadcrumb, Skeleton } from 'antd'
|
|
|
|
|
import { ReloadOutlined, ReadOutlined, RightOutlined, LeftOutlined, ExpandOutlined } from '@ant-design/icons'
|
|
|
|
|
import { Flex, Button, Tooltip, List, Form, Row, Col, Input, Checkbox, DatePicker, Switch, Breadcrumb, Skeleton } from 'antd'
|
|
|
|
|
import dayjs from 'dayjs'
|
|
|
|
|
import { useEmailList } from '@/hooks/useEmail'
|
|
|
|
|
import { isEmpty } from '@/utils/commons'
|
|
|
|
@ -12,7 +12,7 @@ const { RangePicker } = DatePicker
|
|
|
|
|
|
|
|
|
|
const PAGE_SIZE = 50 // 每页显示条数
|
|
|
|
|
|
|
|
|
|
const MailBox = ({ mailboxDir, onMailItemClick, onSelect, ...props }) => {
|
|
|
|
|
const MailBox = ({ mailboxDir, onMailItemClick, ...props }) => {
|
|
|
|
|
const DATE_RANGE_PRESETS = [
|
|
|
|
|
{
|
|
|
|
|
label: '本周',
|
|
|
|
@ -100,24 +100,21 @@ const MailBox = ({ mailboxDir, onMailItemClick, onSelect, ...props }) => {
|
|
|
|
|
const mailStateClass = item.MOI_ReadState === 0 ? 'font-bold' : ''
|
|
|
|
|
const hasAtta = item.MAI_Attachment !== 0 ? <AttachmentIcon className='text-blue-500' /> : null
|
|
|
|
|
return (
|
|
|
|
|
<li
|
|
|
|
|
className={`flex border border-solid border-t-0 border-x-0 border-gray-200 hover:bg-neutral-50 active:bg-gray-200 p-2 ${props.currentActiveMailItem === item.key ? 'bg-neutral-100' : ''}`}>
|
|
|
|
|
<div className=''>
|
|
|
|
|
<li className={`flex border border-solid border-t-0 border-x-0 border-gray-200 hover:bg-neutral-50 active:bg-gray-200 p-2 ${props.currentActiveMailItem === item.key ? 'bg-neutral-100' : ''}`}>
|
|
|
|
|
<div className=''>
|
|
|
|
|
<Checkbox
|
|
|
|
|
checked={selectedItems.some((i) => i.MAI_SN === item.MAI_SN)}
|
|
|
|
|
onClick={e => {
|
|
|
|
|
const isChecked = e.target.checked;
|
|
|
|
|
const updatedSelection = isChecked
|
|
|
|
|
? [...selectedItems, item]
|
|
|
|
|
: selectedItems.filter((item) => item.MAI_SN !== item.MAI_SN)
|
|
|
|
|
setSelectedItems(updatedSelection)
|
|
|
|
|
}
|
|
|
|
|
}></Checkbox>
|
|
|
|
|
</div>
|
|
|
|
|
<div className='flex-1 pl-2'
|
|
|
|
|
checked={selectedItems.some((i) => i.MAI_SN === item.MAI_SN)}
|
|
|
|
|
onClick={(e) => {
|
|
|
|
|
const isChecked = e.target.checked
|
|
|
|
|
const updatedSelection = isChecked ? [...selectedItems, item] : selectedItems.filter((item) => item.MAI_SN !== item.MAI_SN)
|
|
|
|
|
setSelectedItems(updatedSelection)
|
|
|
|
|
}}></Checkbox>
|
|
|
|
|
</div>
|
|
|
|
|
<div
|
|
|
|
|
className='flex-1 pl-2'
|
|
|
|
|
onClick={() => {
|
|
|
|
|
onMailItemClick(item)
|
|
|
|
|
}}>
|
|
|
|
|
}}>
|
|
|
|
|
<Flex gap='small' vertical={true} justify='space-between' className='cursor-pointer'>
|
|
|
|
|
<div>
|
|
|
|
|
{orderNumber}
|
|
|
|
@ -138,38 +135,38 @@ const MailBox = ({ mailboxDir, onMailItemClick, onSelect, ...props }) => {
|
|
|
|
|
<Flex wrap gap='middle' justify={'center'} className='min-w-40'>
|
|
|
|
|
<Tooltip title='全选'>
|
|
|
|
|
<Checkbox
|
|
|
|
|
indeterminate={
|
|
|
|
|
selectedItems.length > 0 &&
|
|
|
|
|
selectedItems.length < pagination.pagedList.length
|
|
|
|
|
}
|
|
|
|
|
checked={pagination.pagedList.length === 0 ? false : pagination.pagedList.every((item) =>
|
|
|
|
|
selectedItems.some((selected) => selected.MAI_SN === item.MAI_SN)
|
|
|
|
|
)}
|
|
|
|
|
onChange={(e) => {
|
|
|
|
|
const isChecked = e.target.checked;
|
|
|
|
|
indeterminate={selectedItems.length > 0 && selectedItems.length < pagination.pagedList.length}
|
|
|
|
|
checked={pagination.pagedList.length === 0 ? false : pagination.pagedList.every((item) => selectedItems.some((selected) => selected.MAI_SN === item.MAI_SN))}
|
|
|
|
|
onChange={(e) => {
|
|
|
|
|
const isChecked = e.target.checked
|
|
|
|
|
if (isChecked) {
|
|
|
|
|
setSelectedItems((prev) => [
|
|
|
|
|
...prev,
|
|
|
|
|
...pagination.pagedList,
|
|
|
|
|
]);
|
|
|
|
|
setSelectedItems((prev) => [...prev, ...pagination.pagedList])
|
|
|
|
|
} else {
|
|
|
|
|
setSelectedItems([]);
|
|
|
|
|
setSelectedItems([])
|
|
|
|
|
}
|
|
|
|
|
}}
|
|
|
|
|
></Checkbox>
|
|
|
|
|
}}></Checkbox>
|
|
|
|
|
</Tooltip>
|
|
|
|
|
<Tooltip title='标记已读'>
|
|
|
|
|
<Button shape='circle' type='text' size='small' icon={<ReadOutlined />}
|
|
|
|
|
onClick={() => {
|
|
|
|
|
markAsRead(selectedItems.map((item) => item.MAI_SN))
|
|
|
|
|
}}
|
|
|
|
|
<Button
|
|
|
|
|
shape='circle'
|
|
|
|
|
type='text'
|
|
|
|
|
size='small'
|
|
|
|
|
icon={<ReadOutlined />}
|
|
|
|
|
onClick={() => {
|
|
|
|
|
markAsRead(selectedItems.map((item) => item.MAI_SN))
|
|
|
|
|
}}
|
|
|
|
|
/>
|
|
|
|
|
</Tooltip>
|
|
|
|
|
<Tooltip title='已处理'>
|
|
|
|
|
<Button shape='circle' type='text' size='small' icon={<MailCheckIcon />}
|
|
|
|
|
onClick={() => {
|
|
|
|
|
markAsProcessed(selectedItems.map((item) => item.MAI_SN))
|
|
|
|
|
}} />
|
|
|
|
|
<Button
|
|
|
|
|
shape='circle'
|
|
|
|
|
type='text'
|
|
|
|
|
size='small'
|
|
|
|
|
icon={<MailCheckIcon />}
|
|
|
|
|
onClick={() => {
|
|
|
|
|
markAsProcessed(selectedItems.map((item) => item.MAI_SN))
|
|
|
|
|
}}
|
|
|
|
|
/>
|
|
|
|
|
</Tooltip>
|
|
|
|
|
<Tooltip title='刷新'>
|
|
|
|
|
<Button shape='circle' type='text' size='small' icon={<ReloadOutlined />} onClick={refresh} />
|
|
|
|
@ -214,51 +211,51 @@ const MailBox = ({ mailboxDir, onMailItemClick, onSelect, ...props }) => {
|
|
|
|
|
</Form>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div className='bg-white overflow-y-auto' style={{ height: 'calc(100vh - 198px)' }}>
|
|
|
|
|
<div className='bg-white overflow-y-auto px-2' style={{ height: 'calc(100vh - 198px)' }}>
|
|
|
|
|
<Skeleton active loading={loading}>
|
|
|
|
|
<List
|
|
|
|
|
loading={loading}
|
|
|
|
|
header={
|
|
|
|
|
<Flex align='center' justify='space-between'>
|
|
|
|
|
<Breadcrumb
|
|
|
|
|
items={props.breadcrumb.map((bc) => {
|
|
|
|
|
return {
|
|
|
|
|
title: (
|
|
|
|
|
<>
|
|
|
|
|
<MailboxDirIcon type={bc?.iconIndex} />
|
|
|
|
|
<span>{bc.title}</span>
|
|
|
|
|
</>
|
|
|
|
|
),
|
|
|
|
|
}
|
|
|
|
|
})}
|
|
|
|
|
/>
|
|
|
|
|
<List
|
|
|
|
|
loading={loading}
|
|
|
|
|
header={
|
|
|
|
|
<Flex align='center' justify='space-between'>
|
|
|
|
|
<span>已选: {selectedItems.length} 项;</span>
|
|
|
|
|
<span>
|
|
|
|
|
{(pagination.current - 1) * PAGE_SIZE + 1}-{Math.min(pagination.current * PAGE_SIZE, pagination.total)} of {pagination.total}
|
|
|
|
|
</span>
|
|
|
|
|
<Button
|
|
|
|
|
icon={<LeftOutlined />}
|
|
|
|
|
type='text'
|
|
|
|
|
onClick={() => {
|
|
|
|
|
prePage()
|
|
|
|
|
}}
|
|
|
|
|
iconPosition={'end'}></Button>
|
|
|
|
|
<Button
|
|
|
|
|
icon={<RightOutlined />}
|
|
|
|
|
type='text'
|
|
|
|
|
onClick={() => {
|
|
|
|
|
nextPage()
|
|
|
|
|
}}
|
|
|
|
|
iconPosition={'end'}></Button>
|
|
|
|
|
<Breadcrumb
|
|
|
|
|
items={props.breadcrumb.map((bc) => {
|
|
|
|
|
return {
|
|
|
|
|
title: (
|
|
|
|
|
<>
|
|
|
|
|
<MailboxDirIcon type={bc?.iconIndex} />
|
|
|
|
|
<span>{bc.title}</span>
|
|
|
|
|
</>
|
|
|
|
|
),
|
|
|
|
|
}
|
|
|
|
|
})}
|
|
|
|
|
/>
|
|
|
|
|
<Flex align='center' justify='space-between'>
|
|
|
|
|
<span>已选: {selectedItems.length} 项;</span>
|
|
|
|
|
<span>
|
|
|
|
|
{(pagination.current - 1) * PAGE_SIZE + 1}-{Math.min(pagination.current * PAGE_SIZE, pagination.total)} of {pagination.total}
|
|
|
|
|
</span>
|
|
|
|
|
<Button
|
|
|
|
|
icon={<LeftOutlined />}
|
|
|
|
|
type='text'
|
|
|
|
|
onClick={() => {
|
|
|
|
|
prePage()
|
|
|
|
|
}}
|
|
|
|
|
iconPosition={'end'}></Button>
|
|
|
|
|
<Button
|
|
|
|
|
icon={<RightOutlined />}
|
|
|
|
|
type='text'
|
|
|
|
|
onClick={() => {
|
|
|
|
|
nextPage()
|
|
|
|
|
}}
|
|
|
|
|
iconPosition={'end'}></Button>
|
|
|
|
|
</Flex>
|
|
|
|
|
</Flex>
|
|
|
|
|
</Flex>
|
|
|
|
|
}
|
|
|
|
|
itemLayout='vertical'
|
|
|
|
|
pagination={false}
|
|
|
|
|
dataSource={pagination.pagedList}
|
|
|
|
|
renderItem={mailItemRender}
|
|
|
|
|
/>
|
|
|
|
|
}
|
|
|
|
|
itemLayout='vertical'
|
|
|
|
|
pagination={false}
|
|
|
|
|
dataSource={pagination.pagedList}
|
|
|
|
|
renderItem={mailItemRender}
|
|
|
|
|
/>
|
|
|
|
|
</Skeleton>
|
|
|
|
|
</div>
|
|
|
|
|
</>
|
|
|
|
|