Добавлен фильтр сообщений по тексту

This commit is contained in:
Alexey 2021-08-09 16:27:13 +05:00
parent 40efe38210
commit e5eb90539c
11 changed files with 22785 additions and 49 deletions

22784
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -32,7 +32,7 @@
"react_test": "react-scripts test", "react_test": "react-scripts test",
"eject": "react-scripts eject" "eject": "react-scripts eject"
}, },
"proxy": "http://localhost:5000", "proxy": "http://192.168.1.70:5000",
"eslintConfig": { "eslintConfig": {
"extends": [ "extends": [
"react-app", "react-app",

View File

@ -1,6 +1,6 @@
import {Table, Select, DatePicker, ConfigProvider} from 'antd'; import {Table, Select, DatePicker, ConfigProvider, Input} from 'antd';
import {MessageService} from '../services/api' import {MessageService} from '../services/api'
import {useState, useEffect} from 'react' import React, {useState, useEffect, useMemo} from 'react'
import {useParams} from 'react-router-dom' import {useParams} from 'react-router-dom'
import LoaderPortal from '../components/LoaderPortal' import LoaderPortal from '../components/LoaderPortal'
import '../styles/message.css' import '../styles/message.css'
@ -11,6 +11,7 @@ import moment from 'moment'
const {Option} = Select const {Option} = Select
const pageSize = 26 const pageSize = 26
const {RangePicker} = DatePicker; const {RangePicker} = DatePicker;
const { Search } = Input
// Словарь категорий для строк таблицы // Словарь категорий для строк таблицы
const categoryDictionary = { const categoryDictionary = {
@ -52,6 +53,7 @@ const filterOptions = [
{label: 'Информация', value: 3}, {label: 'Информация', value: 3},
] ]
// Данные для таблицы // Данные для таблицы
export default function Messages() { export default function Messages() {
let {id} = useParams() let {id} = useParams()
@ -60,6 +62,7 @@ export default function Messages() {
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([])
const [searchString, setSearchString] = useState('')
const [loader, setLoader] = useState(false) const [loader, setLoader] = useState(false)
@ -68,6 +71,14 @@ export default function Messages() {
const onChangeRange = (range) => { const onChangeRange = (range) => {
setRange(range) setRange(range)
} }
const onChangeSearchString = (message) => {
if (message.length < 3) {
setSearchString('')
return
}
setSearchString(message)
}
useEffect(() => { useEffect(() => {
const GetMessages = async () => { const GetMessages = async () => {
@ -85,7 +96,8 @@ export default function Messages() {
pageSize, pageSize,
categories, categories,
begin, begin,
end) end,
searchString)
if (paginatedMessages === null){ if (paginatedMessages === null){
notify(`Данных по скважине "${id}" нет`, 'warning') notify(`Данных по скважине "${id}" нет`, 'warning')
setLoader(false) setLoader(false)
@ -112,7 +124,7 @@ export default function Messages() {
setLoader(false) setLoader(false)
} }
GetMessages() GetMessages()
}, [id, page, categories, range]) }, [id, page, categories, range, searchString])
return ( return (
<> <>
@ -133,6 +145,11 @@ export default function Messages() {
onChange={onChangeRange} onChange={onChangeRange}
/> />
</ConfigProvider> </ConfigProvider>
<Search
className="filter-selector"
placeholder="Фильтр сообщений по тексту"
onSearch={onChangeSearchString}
/>
</div> </div>
<LoaderPortal show={loader}> <LoaderPortal show={loader}>
<Table <Table

View File

@ -5,6 +5,7 @@
export type DataSaubBaseDto = { export type DataSaubBaseDto = {
date?: string; date?: string;
mode?: number | null; mode?: number | null;
idTelemetry?: number;
user?: string | null; user?: string | null;
wellDepth?: number | null; wellDepth?: number | null;
bitDepth?: number | null; bitDepth?: number | null;

View File

@ -4,6 +4,7 @@
export type FluidDataDto = { export type FluidDataDto = {
key?: number; key?: number;
lastUpdate?: string;
name?: string | null; name?: string | null;
temperature?: number; temperature?: number;
density?: number; density?: number;

View File

@ -3,6 +3,8 @@
/* eslint-disable */ /* eslint-disable */
export type MudDiagramDataDto = { export type MudDiagramDataDto = {
key?: number;
lastUpdate?: string;
probeNumber?: number; probeNumber?: number;
probeExtractionDepth?: number; probeExtractionDepth?: number;
sandstone?: number; sandstone?: number;
@ -14,15 +16,15 @@ export type MudDiagramDataDto = {
clay?: number; clay?: number;
camstone?: number; camstone?: number;
cement?: number; cement?: number;
summary?: number; summary?: string | null;
drillingMud?: number; drillingMud?: number;
sludge?: number; sludge?: number;
maxSum?: number; maxSum?: number;
methane?: number; methane?: number;
ethan?: number; ethane?: number;
propane?: number; propane?: number;
butane?: number; butane?: number;
pentane?: number; pentane?: number;
mechanicalSpeed?: number; mechanicalSpeed?: number;
preliminaryConclusion?: number; preliminaryConclusion?: string | null;
} }

View File

@ -3,8 +3,11 @@
/* eslint-disable */ /* eslint-disable */
export type NnbDataDto = { export type NnbDataDto = {
key?: number;
lastUpdate?: string;
depth?: number; depth?: number;
zenithAngle?: number; zenithAngle?: number;
magneticAzimuth?: number;
trueAzimuth?: number; trueAzimuth?: number;
conditionalViscosity?: number; conditionalViscosity?: number;
directAzimuth?: number; directAzimuth?: number;

View File

@ -9,10 +9,10 @@ export type WellStatDto = {
caption?: string | null; caption?: string | null;
cluster?: string | null; cluster?: string | null;
deposit?: string | null; deposit?: string | null;
id?: number;
latitude?: number | null; latitude?: number | null;
longitude?: number | null; longitude?: number | null;
wellType?: string | null; wellType?: string | null;
id?: number;
planStart?: string | null; planStart?: string | null;
planEnd?: string | null; planEnd?: string | null;
factStart?: string | null; factStart?: string | null;

View File

@ -15,6 +15,7 @@ export class MessageService {
* @param categoryids список категорий * @param categoryids список категорий
* @param begin дата начала * @param begin дата начала
* @param end окончание * @param end окончание
* @param searchString
* @returns MessageDtoPaginationContainer Success * @returns MessageDtoPaginationContainer Success
* @throws ApiError * @throws ApiError
*/ */
@ -25,6 +26,7 @@ take: number = 32,
categoryids?: Array<number>, categoryids?: Array<number>,
begin?: string, begin?: string,
end?: string, end?: string,
searchString?: string,
): Promise<MessageDtoPaginationContainer> { ): Promise<MessageDtoPaginationContainer> {
const result = await __request({ const result = await __request({
method: 'GET', method: 'GET',
@ -35,6 +37,7 @@ end?: string,
'categoryids': categoryids, 'categoryids': categoryids,
'begin': begin, 'begin': begin,
'end': end, 'end': end,
'searchString': searchString,
}, },
}); });
return result.body; return result.body;

View File

@ -11,7 +11,7 @@ import { request as __request } from '../core/request';
export class TelemetryService { export class TelemetryService {
/** /**
* Принимает общую информацию по скважине * Принимает общую информацию по скважин<EFBFBD><EFBFBD>
* @param uid Уникальный идентификатор отправителя * @param uid Уникальный идентификатор отправителя
* @param requestBody нформация об отправителе * @param requestBody нформация об отправителе
* @returns any Success * @returns any Success

View File

@ -178,8 +178,9 @@ tr.table_row_size {
} }
.filter-selector { .filter-selector {
width: 50%; width: 25%;
margin-right: 5px; margin-right: 5px;
margin-left: 5px;
} }
.header-tree-select { .header-tree-select {