forked from ddrilling/asb_cloud_front
Добавлена ссылка на скачивание программы бурения
This commit is contained in:
parent
bdc9a4c285
commit
5c008043c5
@ -1,8 +1,11 @@
|
|||||||
import {Button, Tooltip} from 'antd'
|
import {Button, Tooltip} from 'antd'
|
||||||
import { useState } from "react"
|
import { FileExcelOutlined } from '@ant-design/icons'
|
||||||
|
import { useEffect, useState } from "react"
|
||||||
import {invokeWebApiWrapperAsync, download} from '../../components/factory'
|
import {invokeWebApiWrapperAsync, download} from '../../components/factory'
|
||||||
import DocumentsTemplate from './DocumentsTemplate'
|
import DocumentsTemplate from './DocumentsTemplate'
|
||||||
import LoaderPortal from '../../components/LoaderPortal'
|
import LoaderPortal from '../../components/LoaderPortal'
|
||||||
|
import { Flex } from '../../components/Grid'
|
||||||
|
import { WellService } from '../../services/api'
|
||||||
|
|
||||||
const idFileCategoryDrillingProgramItems = 13;
|
const idFileCategoryDrillingProgramItems = 13;
|
||||||
|
|
||||||
@ -10,6 +13,16 @@ export default function DrillingProgram({idWell}) {
|
|||||||
const [downloadButtonEnabled, selDownloadButtonEnabled] = useState(false)
|
const [downloadButtonEnabled, selDownloadButtonEnabled] = useState(false)
|
||||||
const [showLoader, setShowLoader] = useState(false)
|
const [showLoader, setShowLoader] = useState(false)
|
||||||
const [tooltip, setTooltip] = useState('нет файлов для формирования')
|
const [tooltip, setTooltip] = useState('нет файлов для формирования')
|
||||||
|
const [wellLabel, setWellLabel] = useState(`${idWell}`)
|
||||||
|
|
||||||
|
useEffect(() => invokeWebApiWrapperAsync(
|
||||||
|
async () => {
|
||||||
|
const well = await WellService.get(idWell)
|
||||||
|
setWellLabel(well.caption ?? `${idWell}`)
|
||||||
|
},
|
||||||
|
setShowLoader,
|
||||||
|
`Не удалось загрузить название скважины "${idWell}"`
|
||||||
|
), [idWell])
|
||||||
|
|
||||||
const urlDownloadProgram =`/api/well/${idWell}/drillingProgram`
|
const urlDownloadProgram =`/api/well/${idWell}/drillingProgram`
|
||||||
|
|
||||||
@ -37,7 +50,7 @@ export default function DrillingProgram({idWell}) {
|
|||||||
|
|
||||||
const downloadButton = <div>
|
const downloadButton = <div>
|
||||||
<span>Программа бурения</span>
|
<span>Программа бурения</span>
|
||||||
<div>
|
<Flex>
|
||||||
<Tooltip title={tooltip}>
|
<Tooltip title={tooltip}>
|
||||||
<Button
|
<Button
|
||||||
type="primary"
|
type="primary"
|
||||||
@ -46,7 +59,16 @@ export default function DrillingProgram({idWell}) {
|
|||||||
Сформировать и скачать
|
Сформировать и скачать
|
||||||
</Button>
|
</Button>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
</div>
|
<Tooltip title={tooltip}>
|
||||||
|
<Button
|
||||||
|
type="link"
|
||||||
|
onClick={downloadProgram}
|
||||||
|
disabled={!downloadButtonEnabled}>
|
||||||
|
<FileExcelOutlined />
|
||||||
|
Программа бурения {wellLabel}.xlsx
|
||||||
|
</Button>
|
||||||
|
</Tooltip>
|
||||||
|
</Flex>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
return(<LoaderPortal show={showLoader}>
|
return(<LoaderPortal show={showLoader}>
|
||||||
|
Loading…
Reference in New Issue
Block a user