forked from ddrilling/asb_cloud_front
На ГГД добавлена кнопка экспорта, IEB исправлены колбеки
This commit is contained in:
parent
a55d0c9b42
commit
d1998ec2f6
@ -12,8 +12,8 @@ const style = { margin: 4 }
|
|||||||
export const ImportExportBar = memo(({ idWell, onImported, disabled }) => {
|
export const ImportExportBar = memo(({ idWell, onImported, disabled }) => {
|
||||||
const [isImportModalVisible, setIsImportModalVisible] = useState(false)
|
const [isImportModalVisible, setIsImportModalVisible] = useState(false)
|
||||||
|
|
||||||
const downloadTemplate = async () => download(`/api/well/${idWell}/wellOperations/template`)
|
const downloadTemplate = async () => await download(`/api/well/${idWell}/wellOperations/template`)
|
||||||
const downloadExport = async () => download(`/api/well/${idWell}/wellOperations/export`)
|
const downloadExport = async () => await download(`/api/well/${idWell}/wellOperations/export`)
|
||||||
|
|
||||||
const onDone = () => {
|
const onDone = () => {
|
||||||
setIsImportModalVisible(false)
|
setIsImportModalVisible(false)
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { useHistory } from 'react-router-dom'
|
import { useHistory } from 'react-router-dom'
|
||||||
import { memo, useState, useRef, useEffect, useCallback } from 'react'
|
import { memo, useState, useRef, useEffect, useCallback } from 'react'
|
||||||
import { Switch, Button, InputNumber, Descriptions } from 'antd'
|
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 {
|
import {
|
||||||
Chart,
|
Chart,
|
||||||
@ -17,7 +17,7 @@ import zoomPlugin from 'chartjs-plugin-zoom'
|
|||||||
import ChartDataLabels from 'chartjs-plugin-datalabels'
|
import ChartDataLabels from 'chartjs-plugin-datalabels'
|
||||||
|
|
||||||
import LoaderPortal from '@components/LoaderPortal'
|
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 { makeDateColumn, makeNumericColumn, makeTextColumn, Table } from '@components/Table'
|
||||||
import { formatDate, fractionalSum } from '@utils/datetime'
|
import { formatDate, fractionalSum } from '@utils/datetime'
|
||||||
import { getOperations } from '@utils/functions'
|
import { getOperations } from '@utils/functions'
|
||||||
@ -154,6 +154,7 @@ export const Tvd = memo(({ idWell, title }) => {
|
|||||||
const [operations, setOperations] = useState({})
|
const [operations, setOperations] = useState({})
|
||||||
const [isLoading, setIsLoading] = useState(false)
|
const [isLoading, setIsLoading] = useState(false)
|
||||||
const [isTableLoading, setIsTableLoading] = useState(false)
|
const [isTableLoading, setIsTableLoading] = useState(false)
|
||||||
|
const [isFileExporting, setIsFileExporting] = useState(false)
|
||||||
const [xLabel, setXLabel] = useState('day')
|
const [xLabel, setXLabel] = useState('day')
|
||||||
const [chart, setChart] = useState()
|
const [chart, setChart] = useState()
|
||||||
const [npt, setNPT] = useState([])
|
const [npt, setNPT] = useState([])
|
||||||
@ -265,6 +266,14 @@ export const Tvd = memo(({ idWell, title }) => {
|
|||||||
setTableVisible((pre) => !pre)
|
setTableVisible((pre) => !pre)
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
|
const onExport = useCallback(() => invokeWebApiWrapperAsync(
|
||||||
|
async () => {
|
||||||
|
await download(`/api/well/${idWell}/wellOperations/scheduleReport`)
|
||||||
|
},
|
||||||
|
setIsFileExporting,
|
||||||
|
'Не удалось загрузить файл'
|
||||||
|
), [idWell])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={'container tvd-page'}>
|
<div className={'container tvd-page'}>
|
||||||
<div className={'tvd-top'}>
|
<div className={'tvd-top'}>
|
||||||
@ -277,6 +286,12 @@ export const Tvd = memo(({ idWell, title }) => {
|
|||||||
onChange={(checked) => setXLabel(checked ? 'date' : 'day')}
|
onChange={(checked) => setXLabel(checked ? 'date' : 'day')}
|
||||||
style={{ marginRight: '20px' }}
|
style={{ marginRight: '20px' }}
|
||||||
/>
|
/>
|
||||||
|
<Button
|
||||||
|
icon={<ExportOutlined />}
|
||||||
|
loading={isFileExporting}
|
||||||
|
onClick={onExport}
|
||||||
|
style={{ marginRight: '5px' }}
|
||||||
|
>Экспорт</Button>
|
||||||
<Button
|
<Button
|
||||||
icon={tableVisible ? <DoubleLeftOutlined /> : <DoubleRightOutlined />}
|
icon={tableVisible ? <DoubleLeftOutlined /> : <DoubleRightOutlined />}
|
||||||
onClick={toogleTable}
|
onClick={toogleTable}
|
||||||
|
Loading…
Reference in New Issue
Block a user