Добавлены фильтры для сообщений. Убраны заголовки. Изменены стили.

This commit is contained in:
Alexey 2021-06-01 14:32:36 +05:00
parent 6931806372
commit e13eda5ed1
3 changed files with 32 additions and 31 deletions

View File

@ -17,7 +17,7 @@ export default function Well() {
<Layout> <Layout>
<Menu <Menu
mode="horizontal" mode="horizontal"
selectable={false} selectable={true}
className="well_menu" className="well_menu"
> >
<Menu.Item key="1" icon={<FundViewOutlined/>}> <Menu.Item key="1" icon={<FundViewOutlined/>}>

View File

@ -1,4 +1,4 @@
import {Button, Table, Select, DatePicker, ConfigProvider} from 'antd'; import {Table, Select, DatePicker, ConfigProvider} from 'antd';
import {MessageService} from '../services/api' import {MessageService} from '../services/api'
import {useState, useEffect} from 'react' import {useState, useEffect} from 'react'
import {useParams} from 'react-router-dom' import {useParams} from 'react-router-dom'
@ -57,7 +57,7 @@ export default function Messages() {
let {id} = useParams() let {id} = useParams()
const [messages, setMessages] = useState([]) const [messages, setMessages] = useState([])
const [pagination, setPagination] = useState(null) const [pagination, setPagination] = useState(null)
const [page, setPage] = useState(1) const [page, setPage] = useState(1)
const [range, setRange] = useState([]) const [range, setRange] = useState([])
const [categories, setCategories] = useState([]) const [categories, setCategories] = useState([])
@ -70,12 +70,12 @@ export default function Messages() {
setRange(range) setRange(range)
} }
const GetMessages = async() => { const GetMessages = async () => {
setLoader(true) setLoader(true)
try { try {
let begin = null let begin = null
let end = null let end = null
if(range?.length>1){ if (range?.length > 1) {
begin = range[0].toISOString() begin = range[0].toISOString()
end = range[1].toISOString() end = range[1].toISOString()
} }
@ -110,25 +110,25 @@ export default function Messages() {
return ( return (
<> <>
<h2>Сообщения</h2>
<hr/>
<h3>Фильтр сообщений</h3>
<Select
mode="multiple"
allowClear
placeholder="Фильтр сообщений"
className="filter-selector"
value={categories}
onChange = {setCategories}>
{children}
</Select>
<ConfigProvider locale={locale}>
<RangePicker
showTime
onChange={onChangeRange}
/>
</ConfigProvider>
<div className='filter-group'>
<h3 className='filter-group__heading'>Фильтр сообщений</h3>
<Select
mode="multiple"
allowClear
placeholder="Фильтр сообщений"
className="filter-selector"
value={categories}
onChange={setCategories}>
{children}
</Select>
<ConfigProvider locale={locale}>
<RangePicker
showTime
onChange={onChangeRange}
/>
</ConfigProvider>
</div>
<Table <Table
columns={columns} columns={columns}
dataSource={messages} dataSource={messages}

View File

@ -1,11 +1,3 @@
/*.ant-table.ant-table-small .ant-table-tbody > tr > td {*/
/* padding: 0;*/
/*}*/
/*.ant-table-tbody > tr > td {*/
/* border-bottom: 0.5px;*/
/*}*/
.event_message > td { .event_message > td {
font-size: 14px; font-size: 14px;
padding: 1px !important; padding: 1px !important;
@ -37,6 +29,15 @@
background: #505060; background: #505060;
} }
.filter-group {
margin: 0 0 5px 0;
}
.filter-group__heading {
margin: 5px auto;
align-items: center;
}
td.ant-table-column-sort { td.ant-table-column-sort {
color: black; color: black;
background-color: rgb(221, 247, 221); background-color: rgb(221, 247, 221);