From 38e10aa1f4543001577463930cceb9fa8bf3ce9e Mon Sep 17 00:00:00 2001 From: KharchenkoVV Date: Wed, 28 Jul 2021 13:53:58 +0500 Subject: [PATCH] =?UTF-8?q?CF2-39:=20=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=BE=20=D0=BF=D0=BE=D0=B4=D0=BC=D0=B5=D0=BD=D1=8E?= =?UTF-8?q?=20'=D0=94=D0=BE=D0=BA=D1=83=D0=BC=D0=B5=D0=BD=D1=82=D1=8B'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Documents.jsx | 2 - src/components/MenuDocuments.jsx | 86 ++++++++++++++++++++++---------- src/pages/LastData.jsx | 6 +-- src/pages/Well.jsx | 61 +++++++--------------- 4 files changed, 80 insertions(+), 75 deletions(-) diff --git a/src/components/Documents.jsx b/src/components/Documents.jsx index 4291b62..a29a7dc 100644 --- a/src/components/Documents.jsx +++ b/src/components/Documents.jsx @@ -1,6 +1,5 @@ import {Table, DatePicker, Button, Modal, ConfigProvider} from 'antd' import { UploadOutlined } from '@ant-design/icons' -import MenuDocuments from "./MenuDocuments" import DocumentCreationForm from './modalWindows/DocumentCreationForm' import { FileService } from '../services/api' import {useState, useEffect} from "react" @@ -136,7 +135,6 @@ export default function Documents({selectedFileCategory}) { return (
-

Фильтр документов:

diff --git a/src/components/MenuDocuments.jsx b/src/components/MenuDocuments.jsx index 8aa1ad9..3c585f1 100644 --- a/src/components/MenuDocuments.jsx +++ b/src/components/MenuDocuments.jsx @@ -1,16 +1,22 @@ -import {Menu} from "antd"; +import {Layout, Menu} from "antd"; import {FolderOutlined} from "@ant-design/icons"; -import {Link} from "react-router-dom"; -import {useState} from "react" +import {Link, Route, Switch, useParams, useLocation} from "react-router-dom"; +import Documents from "../components/Documents"; +import LastData from '../pages/LastData' +import { useState, useEffect } from "react"; +const { Content } = Layout export default function MenuDocuments() { + let { id } = useParams() + let currentPath = useLocation().pathname - const [selectedItem, setSelectedItem] = useState(1) + const [selectedElement, setSelectedElement] = useState('fluidService') - const handleClick = e => { - setSelectedItem({ current: e.key }); - }; + useEffect(() => { + let pathLastElement = currentPath.split('/').pop() + setSelectedElement(pathLastElement) + }, [currentPath]) return( <> @@ -18,33 +24,63 @@ export default function MenuDocuments() { mode="horizontal" selectable={true} className="well_menu" - onClick={handleClick} - selectedKeys={[selectedItem]} + selectedKeys={[selectedElement]} > - }> - Растворный сервис + }> + Растворный сервис - }> - Цементирование + }> + Цементирование - }> - ННБ + }> + ННБ - }> - ГТИ + }> + ГТИ - }> - Документы по скважине + }> + Документы по скважине - }> - Супервайзер + }> + Супервайзер - }> - Мастер + }> + Мастер - }> - Последние данные + }> + Последние данные + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ) } diff --git a/src/pages/LastData.jsx b/src/pages/LastData.jsx index a331594..45f434c 100644 --- a/src/pages/LastData.jsx +++ b/src/pages/LastData.jsx @@ -1,10 +1,9 @@ import {Button, Modal, Checkbox } from "antd"; import {CementFluid} from "../components/CementFluid"; -import React, {useState} from "react"; +import {useState} from "react"; import {Sludge} from "../components/Sludge"; import {NnbTable} from "../components/NnbTable" import Disposition from "../components/Disposition"; -import MenuDocuments from "../components/MenuDocuments"; export default function LastData() { @@ -15,9 +14,6 @@ export default function LastData() { return ( <> -
- -