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

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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