Исправлены стили

This commit is contained in:
Alexey 2021-05-28 12:04:38 +05:00
parent dd46525c89
commit cf4fd0f36d
7 changed files with 72 additions and 34 deletions

View File

@ -1,7 +1,11 @@
// import {UserOfWells} from "../components/UserOfWells";
export default function Analysis(props) { export default function Analysis(props) {
return ( return (
<div className="menu_title"> <div className="menu_title">
<h2>Анализ</h2> <h2>Анализ</h2>
{/*<UserOfWells data={saubData}/>*/}
<hr/>
</div> </div>
) )
} }

View File

@ -148,19 +148,18 @@ export default function Archive(props) {
const colSpan = 24 / (paramsGroups.length) const colSpan = 24 / (paramsGroups.length)
return (<div className="content-sheet"> return (<div className="content-sheet">
<div className="menu_title"> <div className="menu-title">
<h2>Архив</h2> <h2>Архив</h2>
<span style={{flexGrow: 10}}></span> <span style={{flexGrow: 10}}>&nbsp;</span>
<UserOfWells data={saubData}/> <UserOfWells data={saubData}/>
</div> </div>
<hr/> <hr/>
<div className="content-sheet"> <div className="content-sheet">
<Button type="primary" style={{ <Button type="primary"
borderRadius: '5px', className="submit-button"
font: 'bold', >
textAlign: 'center', Добавить график
margin: '5px 5px', </Button>
}}>Добавить график</Button>
Интервал:&nbsp; Интервал:&nbsp;
<Select defaultValue="600" onChange={setChartInterval}> <Select defaultValue="600" onChange={setChartInterval}>
<Option value='600'>10 минут</Option> <Option value='600'>10 минут</Option>

View File

@ -1,6 +1,6 @@
export default function Files(props) { export default function Files(props) {
return ( return (
<div className="menu_title"> <div className="menu-title">
<h2>Файлы</h2> <h2>Файлы</h2>
</div> </div>
) )

View File

@ -3,7 +3,6 @@ import Wells from './Wells'
import PageHeader from './Header' import PageHeader from './Header'
import Well from "../components/Well"; import Well from "../components/Well";
import {Redirect, Route, Switch} from "react-router-dom"; import {Redirect, Route, Switch} from "react-router-dom";
import Notification from "../components/Notification";
const {Content} = Layout const {Content} = Layout

View File

@ -1,13 +1,16 @@
import {Table} from 'antd'; import {Button, Table, Select} 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'
import {Subscribe} from '../services/signalr' import {Subscribe} from '../services/signalr'
import Loader from '../components/Loader' import Loader from '../components/Loader'
import moment from 'moment'; import moment from 'moment'
import '../styles/message.css' import '../styles/message.css'
import Notification from '../components/Notification' import Notification from '../components/Notification'
const {Option} = Select
// Словарь категорий для строк таблицы // Словарь категорий для строк таблицы
const categoryDictionary = { const categoryDictionary = {
@ -23,8 +26,6 @@ const columns = [
key: 'date', key: 'date',
dataIndex: 'date', dataIndex: 'date',
render: (item) => moment(item).format('DD MMM YYYY, HH:MM:ss'), render: (item) => moment(item).format('DD MMM YYYY, HH:MM:ss'),
sorter: (a, b) => new Date(b.date) - new Date(a.date),
sortDirections: ['descend', 'ascend'],
}, },
{ {
title: 'Категория', title: 'Категория',
@ -32,14 +33,16 @@ const columns = [
dataIndex: 'categoryId', dataIndex: 'categoryId',
render: (_, item) => categoryDictionary[item.categoryId].title, render: (_, item) => categoryDictionary[item.categoryId].title,
style: (_, item) => categoryDictionary[item.categoryId].style, style: (_, item) => categoryDictionary[item.categoryId].style,
sorter: (a, b) => a.categoryId - b.categoryId, filters: [
sortDirections: ['descend', 'ascend'], {text: 'Авария', value: '1'},
{text: 'Предупреждение', value: '2'},
{text: 'Информация', value: '3'},
]
}, },
{ {
title: 'Сообщение', title: 'Сообщение',
key: 'message', key: 'message',
dataIndex: 'message', dataIndex: 'message',
onFilter: (value, record) => record.name.indexOf(value) === 0,
}, },
{ {
title: 'Пользователь', title: 'Пользователь',
@ -48,12 +51,22 @@ const columns = [
}, },
]; ];
// Опции для фильра
// Данные для таблицы // Данные для таблицы
export default function Messages() { export default function Messages() {
let {id} = useParams() let {id} = useParams()
const [messages, setMessages] = useState([]) const [messages, setMessages] = useState([])
const [loader] = useState(false) const [loader] = useState(false)
const filterOptions = [
{label: 'Авария', value: 1},
{label: 'Предупреждение', value: 2},
{label: 'Информация', value: 3},
]
const children = filterOptions.map((line) => (<Option key={line.value}>{line.label}</Option>))
const handleReceiveMessages = (messages) => { const handleReceiveMessages = (messages) => {
if (messages) { if (messages) {
setMessages(messages.items) setMessages(messages.items)
@ -72,23 +85,42 @@ export default function Messages() {
return () => { return () => {
unSubscribeMessagesHub() unSubscribeMessagesHub()
} }
}, [id]); }, [id])
return ( return (
<> <>
<h2>Сообщения</h2> <h2>Сообщения</h2>
<hr/> <hr/>
<h3>Фильтр сообщений</h3>
<Select
mode="multiple"
allowClear
placeholder="Фильтр сообщений"
className="filter-selector"
// onChange={messagesFilter}
>
{children}
</Select>
<Button
type="primary"
className="submit-button"
>
Применть
</Button>
<Button
className="submit-button"
>
Обновить
</Button>
<Table <Table
columns={columns} columns={columns}
dataSource={messages} dataSource={messages}
rowClassName={(record) => `event_message_${record.categoryId} event_message`} rowClassName={(record) => `event_message_${record.categoryId} event_message`}
size={'small'} size={'small'}
pagination={{pageSize: 28}} pagination={{pageSize: 26}}
rowKey={(record) => record.id} rowKey={(record) => record.id}
/> />
{loader && <Loader/>} {loader && <Loader/>}
</> </>
) )
} }
// TODO Стили для отсортированных страниц

View File

@ -8,7 +8,6 @@ import {CustomColumn} from '../components/CustomColumn'
import {UserOfWells} from '../components/UserOfWells' import {UserOfWells} from '../components/UserOfWells'
import {ModeDisplay} from '../components/ModeDisplay' import {ModeDisplay} from '../components/ModeDisplay'
import {Display} from '../components/Display' import {Display} from '../components/Display'
import notify from '../components/Notification'
import moment from 'moment' import moment from 'moment'
import {Subscribe} from '../services/signalr' import {Subscribe} from '../services/signalr'
import {DataService, MessageService} from '../services/api' import {DataService, MessageService} from '../services/api'

View File

@ -118,16 +118,16 @@ html {
flex: auto; flex: auto;
} }
.menu_title, .menu-title,
.chart-footer { .chart-footer {
display: flex; display: flex;
} }
.submit_button { .submit-button {
display: flex;
align-items: center;
padding: 20px;
border-radius: 5px; border-radius: 5px;
font-weight: bold;
text-align: center;
margin: 0 5px 5px 0;
} }
.well_menu { .well_menu {
@ -140,3 +140,8 @@ html {
tr.table_row_size { tr.table_row_size {
height: 10px; height: 10px;
} }
.filter-selector {
width: 50%;
margin-right: 5px;
}