diff --git a/src/pages/WellOperations/ImportExportBar.jsx b/src/pages/WellOperations/ImportExportBar.jsx index 34fe7d8..4e44ff7 100644 --- a/src/pages/WellOperations/ImportExportBar.jsx +++ b/src/pages/WellOperations/ImportExportBar.jsx @@ -12,8 +12,8 @@ const style = { margin: 4 } export const ImportExportBar = memo(({ idWell, onImported, disabled }) => { const [isImportModalVisible, setIsImportModalVisible] = useState(false) - const downloadTemplate = async () => download(`/api/well/${idWell}/wellOperations/template`) - const downloadExport = async () => download(`/api/well/${idWell}/wellOperations/export`) + const downloadTemplate = async () => await download(`/api/well/${idWell}/wellOperations/template`) + const downloadExport = async () => await download(`/api/well/${idWell}/wellOperations/export`) const onDone = () => { setIsImportModalVisible(false) diff --git a/src/pages/WellOperations/Tvd.jsx b/src/pages/WellOperations/Tvd.jsx index 49279e4..ae54cb8 100644 --- a/src/pages/WellOperations/Tvd.jsx +++ b/src/pages/WellOperations/Tvd.jsx @@ -1,7 +1,7 @@ import { useHistory } from 'react-router-dom' import { memo, useState, useRef, useEffect, useCallback } from 'react' import { Switch, Button, InputNumber, Descriptions } from 'antd' -import { DoubleLeftOutlined, DoubleRightOutlined, FilterOutlined } from '@ant-design/icons' +import { DoubleLeftOutlined, DoubleRightOutlined, ExportOutlined, FilterOutlined } from '@ant-design/icons' import { Chart, @@ -17,7 +17,7 @@ import zoomPlugin from 'chartjs-plugin-zoom' import ChartDataLabels from 'chartjs-plugin-datalabels' import LoaderPortal from '@components/LoaderPortal' -import { invokeWebApiWrapperAsync } from '@components/factory' +import { download, invokeWebApiWrapperAsync } from '@components/factory' import { makeDateColumn, makeNumericColumn, makeTextColumn, Table } from '@components/Table' import { formatDate, fractionalSum } from '@utils/datetime' import { getOperations } from '@utils/functions' @@ -154,6 +154,7 @@ export const Tvd = memo(({ idWell, title }) => { const [operations, setOperations] = useState({}) const [isLoading, setIsLoading] = useState(false) const [isTableLoading, setIsTableLoading] = useState(false) + const [isFileExporting, setIsFileExporting] = useState(false) const [xLabel, setXLabel] = useState('day') const [chart, setChart] = useState() const [npt, setNPT] = useState([]) @@ -265,6 +266,14 @@ export const Tvd = memo(({ idWell, title }) => { setTableVisible((pre) => !pre) }, []) + const onExport = useCallback(() => invokeWebApiWrapperAsync( + async () => { + await download(`/api/well/${idWell}/wellOperations/scheduleReport`) + }, + setIsFileExporting, + 'Не удалось загрузить файл' + ), [idWell]) + return (
@@ -277,6 +286,12 @@ export const Tvd = memo(({ idWell, title }) => { onChange={(checked) => setXLabel(checked ? 'date' : 'day')} style={{ marginRight: '20px' }} /> +