From c2514f917cbbbf25c5c38997f18e2796f7f98b4a Mon Sep 17 00:00:00 2001 From: Alexey Date: Mon, 9 Aug 2021 11:49:26 +0500 Subject: [PATCH] =?UTF-8?q?=D0=9F=D0=BB=D0=B8=D1=82=D0=BA=D0=B8=20=D0=B4?= =?UTF-8?q?=D0=BB=D1=8F=20=D1=81=D0=BC=D0=B1=D0=BE.=20=D0=94=D1=80=D1=83?= =?UTF-8?q?=D0=B3=D0=B0=D1=8F=20=D0=BB=D0=BE=D0=B3=D0=B8=D0=BA=D0=B0=20?= =?UTF-8?q?=D1=80=D0=B0=D1=81=D1=81=D1=82=D0=B0=D0=B2=D0=BB=D0=B5=D0=BD?= =?UTF-8?q?=D0=B8=D1=8F=20+=20=D0=A1=D1=82=D0=B8=D0=BB=D0=B8=20=D0=B4?= =?UTF-8?q?=D0=BB=D1=8F=20=D0=BF=D1=83=D1=81=D1=82=D1=8B=D1=85=20=D0=BC?= =?UTF-8?q?=D0=B5=D1=81=D1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/CementFluid.jsx | 76 ++++++++-------- src/components/MessageFilter.jsx | 35 ++++++++ src/components/Nnb.jsx | 2 +- src/components/SludgeDiagram.jsx | 4 +- src/pages/Messages.jsx | 2 + src/pages/Smbo.jsx | 144 ++++++++++++++++--------------- src/styles/smbo.css | 9 ++ 7 files changed, 163 insertions(+), 109 deletions(-) create mode 100644 src/components/MessageFilter.jsx diff --git a/src/components/CementFluid.jsx b/src/components/CementFluid.jsx index bd3e5fe..b6f77f1 100644 --- a/src/components/CementFluid.jsx +++ b/src/components/CementFluid.jsx @@ -15,15 +15,15 @@ const originData = [ ]; const EditableCell = ({ - editing, - dataIndex, - title, - inputType, - record, - index, - children, - ...restProps -}) => { + editing, + dataIndex, + title, + inputType, + record, + index, + children, + ...restProps + }) => { return (
@@ -35,7 +35,7 @@ const EditableCell = ({ { required: true, message: '', - pattern: '(-?[1-9]+\d*([.,]\d+)?)$|^(-?0[.,]\d*[1-9]+)$|^0$|^0.0$' + pattern: /(-?[1-9]+\d*([.,]\d+)?)$|^(-?0[.,]\d*[1-9]+)$|^0$|^0.0$/ }, ]} > @@ -59,19 +59,19 @@ export function CementFluid() { const columns = [ { - title: 'Наименование', - key: 'name', - dataIndex: 'name', - align: 'center', - className: 'small-font' + title: 'Наименование', + key: 'name', + dataIndex: 'name', + align: 'center', + className: 'small-font' }, { - title: 'Температура, °C', - key: 'temperature', - dataIndex: 'temperature', - align: 'center', - className: 'small-font', - editable: true + title: 'Температура, °C', + key: 'temperature', + dataIndex: 'temperature', + align: 'center', + className: 'small-font', + editable: true }, { title: 'Плотность, г/см³', @@ -292,7 +292,7 @@ export function CementFluid() { return editable ? ( save(row.key)} style={{ marginRight: 8 }} > @@ -343,7 +343,7 @@ export function CementFluid() { const row = await form.validateFields(); const newData = [...data]; const index = newData.findIndex((item) => key === item.key); - + if (index > -1) { const item = newData[index]; newData.splice(index, 1, { ...item, ...row }); @@ -360,20 +360,20 @@ export function CementFluid() { }; return (<> -
- - - + +
+ + ) } \ No newline at end of file diff --git a/src/components/MessageFilter.jsx b/src/components/MessageFilter.jsx new file mode 100644 index 0000000..7b326d8 --- /dev/null +++ b/src/components/MessageFilter.jsx @@ -0,0 +1,35 @@ +import React, { useMemo, useState } from "react"; + +export default function MessageFilter() { + return ( +
+ +
+ ) +} + +function List({ words }) { + const [searchString, setSearchString] = useState("") + + function handleChange(e) { + setSearchString(e.target.value) + } + + const filteredWords = useMemo(() => { + if (!searchString) { + return words + } + return words.filter((w) => w.includes(searchString)) + }, [searchString, words]) + + return ( + <> + +
    + {filteredWords.map((word, i) => ( +
  • {word}
  • + ))} +
+ + ) +} \ No newline at end of file diff --git a/src/components/Nnb.jsx b/src/components/Nnb.jsx index d2c36f0..f3affdd 100644 --- a/src/components/Nnb.jsx +++ b/src/components/Nnb.jsx @@ -30,7 +30,7 @@ const EditableCell = ({ { required: true, message: '', - pattern: '(-?[1-9]+\d*([.,]\d+)?)$|^(-?0[.,]\d*[1-9]+)$|^0$|^0.0$' + pattern: /(-?[1-9]+\d*([.,]\d+)?)$|^(-?0[.,]\d*[1-9]+)$|^0$|^0.0$/ }, ]} > diff --git a/src/components/SludgeDiagram.jsx b/src/components/SludgeDiagram.jsx index 70e0c1c..f423d83 100644 --- a/src/components/SludgeDiagram.jsx +++ b/src/components/SludgeDiagram.jsx @@ -4,7 +4,7 @@ import {Table, Input, Form, Popconfirm, Typography } from 'antd' const originData = [ { key: '1', probeNumber: '', probeExtractionDepth: '', sandstone: '', siltstone: '', argillit: '', brokenArgillit: '', coal: '', sand: '', clay: '', - camstone: '', cement: '', summary: '', drillingMud: '', sludge: '', sludge: '', maxSum: '', methan: '', ethan: '', propan: '', butan: '', pentan: '' + camstone: '', cement: '', summary: '', drillingMud: '', sludge: '', maxSum: '', methan: '', ethan: '', propan: '', butan: '', pentan: '' } ] @@ -29,7 +29,7 @@ const EditableCell = ({ { required: true, message: '', - pattern: '(-?[1-9]+\d*([.,]\d+)?)$|^(-?0[.,]\d*[1-9]+)$|^0$|^0.0$' + pattern: /(-?[1-9]+\d*([.,]\d+)?)$|^(-?0[.,]\d*[1-9]+)$|^0$|^0.0$/ }, ]} > diff --git a/src/pages/Messages.jsx b/src/pages/Messages.jsx index 9a37f56..7007b49 100644 --- a/src/pages/Messages.jsx +++ b/src/pages/Messages.jsx @@ -5,6 +5,7 @@ import {useParams} from 'react-router-dom' import LoaderPortal from '../components/LoaderPortal' import '../styles/message.css' import notify from '../components/notify' +import MessageFilter from "../components/MessageFilter"; import locale from "antd/lib/locale/ru_RU"; import moment from 'moment' @@ -133,6 +134,7 @@ export default function Messages() { onChange={onChangeRange} /> +
{ - const placeholder = placeholderIdDictionary[placeholderId] - return { - gridColumnStart: placeholder.col, - gridRowStart: placeholder.row - } -} +const plates = [] -const SmboPlates = platesData.map((items,) => ( -
- +for (let i = 1; i < 21; i++) { + const item = platesData.filter(item => item.placeHolderId === i)[0] + const plate = item ? ( +
+ + id={item.id} + title={item.title} + placeHolderId={item.placeHolderId} + equipmentTimers={item.equipmentTimers} + equipmentSensors={item.equipmentSensors} + state={item.state} + captionValue={item.captionValue} + />
+ ) : ( +
{i}
) -) + plates.push(plate) +} export default function Smbo() { return (<>
- {SmboPlates} + {plates} + {/*
*/} + {/* План*/} + {/*
*/}
diff --git a/src/styles/smbo.css b/src/styles/smbo.css index c764e81..5f6e5aa 100644 --- a/src/styles/smbo.css +++ b/src/styles/smbo.css @@ -111,4 +111,13 @@ .block__example { width: 250px; height: 120px; +} + +.empty_place { + background-color: #505050; + text-align: center; + color: silver; + font-size: 75px; + margin-top: 5px; + align-items: center; } \ No newline at end of file