diff --git a/src/pages/Well/WellOperations/DrillProcessFlow.jsx b/src/pages/Well/WellOperations/DrillProcessFlow.jsx index a89ec3e..5396ebd 100644 --- a/src/pages/Well/WellOperations/DrillProcessFlow.jsx +++ b/src/pages/Well/WellOperations/DrillProcessFlow.jsx @@ -1,6 +1,8 @@ -import { useState, useEffect, memo, useMemo, useCallback } from 'react' +import { useState, useEffect, memo, useMemo, useCallback, FC } from 'react' +import { Button, Tooltip } from 'antd' +import { FileOutlined } from '@ant-design/icons' -import { useWell } from '@asb/context' +import { useWell, useTopRightBlock } from '@asb/context' import { EditableTable, makeGroupColumn, @@ -11,10 +13,30 @@ import { makeSelectColumn, } from '@components/Table' import LoaderPortal from '@components/LoaderPortal' -import { invokeWebApiWrapperAsync } from '@components/factory' +import { invokeWebApiWrapperAsync, download } from '@components/factory' import { ProcessMapService, WellOperationService } from '@api' import { arrayOrDefault } from '@utils' +const style = { margin: 4 } + +const ImportExportBar = memo(({ well: givenWell, disabled }) => { + const [wellContext] = useWell() + const well = useMemo(() => givenWell ?? wellContext, [givenWell, wellContext]) + + const downloadExport = useCallback( + async () => await download(`/api/ProcessMap/getReportFile/${well.id}`), + [well.id] + ) + + return ( +
+ +
+ ) +}) + const numericRender = makeNumericRender(2) export const getColumns = async (idWell) => { @@ -25,7 +47,7 @@ export const getColumns = async (idWell) => { })) return [ - makeSelectColumn('Конструкция секции','idWellSectionType', sectionTypes, null, { + makeSelectColumn('Конструкция секции', 'idWellSectionType', sectionTypes, null, { width: 160, sorter: makeNumericSorter('idWellSectionType'), }), @@ -48,6 +70,7 @@ export const DrillProcessFlow = memo(() => { const [columns, setColumns] = useState([]) const [well] = useWell() + const setTopRightBlock = useTopRightBlock() const updateFlows = useCallback(() => invokeWebApiWrapperAsync( async () => { @@ -75,6 +98,10 @@ export const DrillProcessFlow = memo(() => { updateFlows() }, [well]) + useEffect(() => setTopRightBlock((well) => ( + + )), [setTopRightBlock]) + const tableHandlers = useMemo(() => { const handlerProps = { service: ProcessMapService, @@ -88,7 +115,12 @@ export const DrillProcessFlow = memo(() => { return { add: { ...handlerProps, action: 'insert', actionName: 'Добавление месторождения', recordParser }, edit: { ...handlerProps, action: 'update', actionName: 'Редактирование месторождения', recordParser }, - delete: { ...handlerProps, action: 'delete', actionName: 'Удаление месторождения', permission: 'DrillFlowChart.delete' }, + delete: { + ...handlerProps, + action: 'delete', + actionName: 'Удаление месторождения', + permission: 'DrillFlowChart.delete', + }, } }, [updateFlows, well.id])