diff --git a/src/pages/Documents/DocumentsTemplate.jsx b/src/pages/Documents/DocumentsTemplate.jsx index 4a998a1..b156cf9 100644 --- a/src/pages/Documents/DocumentsTemplate.jsx +++ b/src/pages/Documents/DocumentsTemplate.jsx @@ -17,7 +17,7 @@ const pageSize = 12 const { RangePicker } = DatePicker const { Search } = Input -export default function DocumentsTemplate({ idCategory, idWell, accept }) { +export default function DocumentsTemplate({ idCategory, idWell, accept, headerChild, onChange }) { const [page, setPage] = useState(1) const [filterDataRange, setFilterDataRange] = useState([]) const [filterCompanyName, setFilterCompanyName] = useState([]) @@ -116,9 +116,7 @@ export default function DocumentsTemplate({ idCategory, idWell, accept }) { return const filesInfos = paginatedFiles.items??[] - setFiles(filesInfos) - const newPagination = makePaginationObject(paginatedFiles) setPagination(newPagination) }, @@ -128,6 +126,10 @@ export default function DocumentsTemplate({ idCategory, idWell, accept }) { } useEffect(update, [idWell, idCategory, page, filterDataRange, filterCompanyName, filterFileName]) + useEffect(()=>{ + if(onChange) + onChange(files) + }, [files, onChange]) const companies = [...new Set(files.map(file=>file.company))] .filter(company=>company) @@ -179,6 +181,8 @@ export default function DocumentsTemplate({ idCategory, idWell, accept }) { onUploadStart={() => setShowLoader(true)} onUploadComplete={handleUploadComplete}/> +    + {headerChild} { + if(!files || files.length === 0){ + setTooltip('Нет файлов для формирования программы') + selDownloadButtonEnabled(false) + return + } + + if(files.every(fileInfo => fileInfo?.name.toLowerCase().endsWith('.xlsx'))){ + setTooltip('Программа доступна для скачивания') + selDownloadButtonEnabled(true) + } + else{ + setTooltip('Список файлов содержит недопустимые типы файлов') + } + } + + const downloadButton =
+ Программа бурения +
+ + + +
+
+ return( - + accept='.xlsx' + headerChild={downloadButton} + onChange={filesUpdated} /> ) } \ No newline at end of file diff --git a/src/pages/Well.jsx b/src/pages/Well.jsx index b202ec2..a8f6e3e 100644 --- a/src/pages/Well.jsx +++ b/src/pages/Well.jsx @@ -5,6 +5,7 @@ import { AlertOutlined, FilePdfOutlined, DatabaseOutlined, + ExperimentOutlined, } from "@ant-design/icons"; import { Link, Redirect, Route, Switch, useParams } from "react-router-dom"; import TelemetryView from "./TelemetryView"; @@ -64,7 +65,7 @@ export default function Well() { > {makeMenuItems(rootPath)} - }> + }> Измерения }>