|
|
|
@ -11,7 +11,7 @@ const { RangePicker } = DatePicker
|
|
|
|
|
|
|
|
|
|
const PAGE_SIZE = 50 // 每页显示条数
|
|
|
|
|
|
|
|
|
|
const MailBox = ({ mailboxDir, onMailItemClick, ...props }) => {
|
|
|
|
|
const MailBox = ({ mailboxDir, onMailItemClick, onSelect, ...props }) => {
|
|
|
|
|
const DATE_RANGE_PRESETS = [
|
|
|
|
|
{
|
|
|
|
|
label: '本周',
|
|
|
|
@ -39,8 +39,8 @@ const MailBox = ({ mailboxDir, onMailItemClick, ...props }) => {
|
|
|
|
|
},
|
|
|
|
|
]
|
|
|
|
|
const [form] = Form.useForm()
|
|
|
|
|
|
|
|
|
|
const { mailList, loading, error, refresh } = useEmailList(mailboxDir);
|
|
|
|
|
const [selectedItems, setSelectedItems] = useState([])
|
|
|
|
|
const { mailList, loading, error, refresh } = useEmailList(mailboxDir)
|
|
|
|
|
|
|
|
|
|
const [pagination, setPagination] = useState({
|
|
|
|
|
current: 1,
|
|
|
|
@ -103,6 +103,20 @@ const MailBox = ({ mailboxDir, onMailItemClick, ...props }) => {
|
|
|
|
|
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-gray-200' : ''}`}>
|
|
|
|
|
<div className='flex flex-col gap-1'>
|
|
|
|
|
<Checkbox></Checkbox>{hasAtta}
|
|
|
|
|
className='flex border border-solid border-t-0 border-x-0 border-gray-200 hover:bg-neutral-50 p-2'>
|
|
|
|
|
<div className=''>
|
|
|
|
|
<Checkbox
|
|
|
|
|
checked={selectedItems.some((i) => i.MAI_SN === item.MAI_SN)}
|
|
|
|
|
onClick={e => {
|
|
|
|
|
console.info(item, 'checked: ' + e.target.checked)
|
|
|
|
|
const isChecked = e.target.checked;
|
|
|
|
|
const updatedSelection = isChecked
|
|
|
|
|
? [...selectedItems, item]
|
|
|
|
|
: selectedItems.filter((item) => item.MAI_SN !== item.MAI_SN)
|
|
|
|
|
setSelectedItems(updatedSelection)
|
|
|
|
|
console.info('selectedItems: ', updatedSelection)
|
|
|
|
|
}
|
|
|
|
|
}></Checkbox>
|
|
|
|
|
</div>
|
|
|
|
|
<div className='flex-1 pl-2'
|
|
|
|
|
onClick={() => {
|
|
|
|
@ -169,7 +183,26 @@ const MailBox = ({ mailboxDir, onMailItemClick, ...props }) => {
|
|
|
|
|
</Dropdown.Button>
|
|
|
|
|
<Flex wrap gap='middle' justify={'center'} className='min-w-40'>
|
|
|
|
|
<Tooltip title='全选'>
|
|
|
|
|
<Checkbox></Checkbox>
|
|
|
|
|
<Checkbox
|
|
|
|
|
indeterminate={
|
|
|
|
|
selectedItems.length > 0 &&
|
|
|
|
|
selectedItems.length < pagination.pagedList.length
|
|
|
|
|
}
|
|
|
|
|
checked={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,
|
|
|
|
|
]);
|
|
|
|
|
} else {
|
|
|
|
|
setSelectedItems([]);
|
|
|
|
|
}
|
|
|
|
|
}}
|
|
|
|
|
></Checkbox>
|
|
|
|
|
</Tooltip>
|
|
|
|
|
<Tooltip title='标记已读'>
|
|
|
|
|
<Button shape='circle' type='text' size='small' icon={<ReadOutlined />} />
|
|
|
|
@ -239,6 +272,7 @@ const MailBox = ({ mailboxDir, onMailItemClick, ...props }) => {
|
|
|
|
|
})}
|
|
|
|
|
/>
|
|
|
|
|
<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>
|
|
|
|
|