forked from ddrilling/asb_cloud_front
Исправлено скачивание программы бурения
Исправлена работа спиннера выгрузки файла
This commit is contained in:
parent
e84cc40f09
commit
9ee3e89bd1
@ -74,6 +74,16 @@ export const CategoryRender = memo(({ idWell, partData, onUpdate, onEdit, onHist
|
|||||||
`Удаление категории "${title}" скважины "${idWell}"`
|
`Удаление категории "${title}" скважины "${idWell}"`
|
||||||
), [idWell, idFileCategory, onUpdate, title])
|
), [idWell, idFileCategory, onUpdate, title])
|
||||||
|
|
||||||
|
const onUploadComplete = useCallback(() => {
|
||||||
|
onUpdate?.(idFileCategory)
|
||||||
|
setIsUploading(false)
|
||||||
|
}, [onUpdate, idFileCategory])
|
||||||
|
|
||||||
|
const onUploadError = useCallback((e) => {
|
||||||
|
notify(e?.message ?? 'Ошибка загрузки файла', 'error')
|
||||||
|
setIsUploading(false)
|
||||||
|
})
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<LoaderPortal show={isUploading}>
|
<LoaderPortal show={isUploading}>
|
||||||
<div className={'drilling_category'} {...other}>
|
<div className={'drilling_category'} {...other}>
|
||||||
@ -111,8 +121,8 @@ export const CategoryRender = memo(({ idWell, partData, onUpdate, onEdit, onHist
|
|||||||
url={uploadUrl}
|
url={uploadUrl}
|
||||||
style={{ margin: '5px 0 10px 0' }}
|
style={{ margin: '5px 0 10px 0' }}
|
||||||
onUploadStart={() => setIsUploading(true)}
|
onUploadStart={() => setIsUploading(true)}
|
||||||
onUploadComplete={() => onUpdate?.(idFileCategory)}
|
onUploadComplete={onUploadComplete}
|
||||||
onUploadError={(e) => notify(e?.message ?? 'Ошибка загрузки файла', 'error')}
|
onUploadError={onUploadError}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
<Button
|
<Button
|
||||||
|
@ -10,7 +10,7 @@ import {
|
|||||||
import { memo, useCallback, useEffect, useState } from 'react'
|
import { memo, useCallback, useEffect, useState } from 'react'
|
||||||
|
|
||||||
import LoaderPortal from '@components/LoaderPortal'
|
import LoaderPortal from '@components/LoaderPortal'
|
||||||
import { invokeWebApiWrapperAsync } from '@components/factory'
|
import { downloadFile, invokeWebApiWrapperAsync } from '@components/factory'
|
||||||
import { arrayOrDefault, formatDate } from '@utils'
|
import { arrayOrDefault, formatDate } from '@utils'
|
||||||
import { DrillingProgramService } from '@api'
|
import { DrillingProgramService } from '@api'
|
||||||
|
|
||||||
@ -109,7 +109,14 @@ export const DrillingProgram = memo(({ idWell }) => {
|
|||||||
<div className={'program_content'}>
|
<div className={'program_content'}>
|
||||||
{stateId === idStateReady ? (
|
{stateId === idStateReady ? (
|
||||||
<>
|
<>
|
||||||
<Button type={'link'} icon={<FileWordOutlined />} style={{ marginLeft: '10px' }}>{program?.name}</Button>
|
<Button
|
||||||
|
type={'link'}
|
||||||
|
icon={<FileWordOutlined />}
|
||||||
|
style={{ marginLeft: '10px' }}
|
||||||
|
onClick={() => downloadFile(program)}
|
||||||
|
>
|
||||||
|
{program?.name}
|
||||||
|
</Button>
|
||||||
<div className={'m-10'}>Размер: {program?.size}</div>
|
<div className={'m-10'}>Размер: {program?.size}</div>
|
||||||
<div className={'m-10'}>Загружен: {formatDate(program?.uploadDate)}</div>
|
<div className={'m-10'}>Загружен: {formatDate(program?.uploadDate)}</div>
|
||||||
</>
|
</>
|
||||||
|
Loading…
Reference in New Issue
Block a user