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 { useState } from "react"
|
||||
import { FileExcelOutlined } from '@ant-design/icons'
|
||||
import { useEffect, useState } from "react"
|
||||
import {invokeWebApiWrapperAsync, download} from '../../components/factory'
|
||||
import DocumentsTemplate from './DocumentsTemplate'
|
||||
import LoaderPortal from '../../components/LoaderPortal'
|
||||
import { Flex } from '../../components/Grid'
|
||||
import { WellService } from '../../services/api'
|
||||
|
||||
const idFileCategoryDrillingProgramItems = 13;
|
||||
|
||||
@ -10,6 +13,16 @@ export default function DrillingProgram({idWell}) {
|
||||
const [downloadButtonEnabled, selDownloadButtonEnabled] = useState(false)
|
||||
const [showLoader, setShowLoader] = useState(false)
|
||||
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`
|
||||
|
||||
@ -37,7 +50,7 @@ export default function DrillingProgram({idWell}) {
|
||||
|
||||
const downloadButton = <div>
|
||||
<span>Программа бурения</span>
|
||||
<div>
|
||||
<Flex>
|
||||
<Tooltip title={tooltip}>
|
||||
<Button
|
||||
type="primary"
|
||||
@ -46,7 +59,16 @@ export default function DrillingProgram({idWell}) {
|
||||
Сформировать и скачать
|
||||
</Button>
|
||||
</Tooltip>
|
||||
</div>
|
||||
<Tooltip title={tooltip}>
|
||||
<Button
|
||||
type="link"
|
||||
onClick={downloadProgram}
|
||||
disabled={!downloadButtonEnabled}>
|
||||
<FileExcelOutlined />
|
||||
Программа бурения {wellLabel}.xlsx
|
||||
</Button>
|
||||
</Tooltip>
|
||||
</Flex>
|
||||
</div>
|
||||
|
||||
return(<LoaderPortal show={showLoader}>
|
||||
|
Loading…
Reference in New Issue
Block a user