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

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

View File

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