Блок импорта/экспорта операций перемещён на страницы план/факт

This commit is contained in:
Александр Сироткин 2022-10-24 06:41:30 +05:00
parent a1f1ce1915
commit 1b9db1c35a
4 changed files with 9 additions and 18 deletions

View File

@ -15,11 +15,14 @@ import {
makeNumericSorter,
makeTextColumn,
} from '@components/Table'
import { Flex } from '@components/Grid'
import LoaderPortal from '@components/LoaderPortal'
import { invokeWebApiWrapperAsync } from '@components/factory'
import { arrayOrDefault } from '@utils'
import { WellOperationService } from '@api'
import ImportExportBar from './ImportExportBar'
const { TextArea } = Input
const basePageSize = 160
@ -137,6 +140,9 @@ export const WellOperationsEditor = memo(({ idType, showNpt, ...other }) => {
return (
<LoaderPortal show={showLoader}>
<Flex style={{ width: '100%' }}>
<ImportExportBar onImported={updateOperations}/>
</Flex>
<EditableTable
{...other}
bordered

View File

@ -1,11 +1,8 @@
import { useNavigate, useLocation, Outlet } from 'react-router-dom'
import { memo, useCallback, useMemo } from 'react'
import { Outlet } from 'react-router-dom'
import { memo, useMemo } from 'react'
import { RootPathContext, useRootPath } from '@asb/context'
import { Flex } from '@components/Grid'
import { getTabname, wrapPrivateComponent } from '@utils'
import { ImportExportBar } from './ImportExportBar'
import { wrapPrivateComponent } from '@utils'
const properties = {
requirements: [],
@ -15,23 +12,11 @@ const properties = {
}
const WellOperations = memo(() => {
const tab = getTabname()
const navigate = useNavigate()
const location = useLocation()
const root = useRootPath()
const rootPath = useMemo(() => `${root}/${properties.key}`, [root])
const onImported = useCallback(() =>
navigate(`${rootPath}`, { state: { from: location.pathname }})
, [navigate, location, rootPath])
const isIEBarDisabled = useMemo(() => !['plan', 'fact'].includes(tab), [tab])
return(
<RootPathContext.Provider value={rootPath}>
<Flex style={{ width: '100%' }}>
<ImportExportBar disabled={isIEBarDisabled} onImported={onImported}/>
</Flex>
<Outlet />
</RootPathContext.Provider>
)