forked from ddrilling/asb_cloud_front
Исправлена сортировка по столбцам
This commit is contained in:
parent
37ac8a14bc
commit
d6c4261d26
@ -4,7 +4,7 @@ import { Fragment, memo, useCallback, useEffect, useState } from 'react'
|
||||
import LoaderPortal from '@components/LoaderPortal'
|
||||
import { WellSelector } from '@components/WellSelector'
|
||||
import { invokeWebApiWrapperAsync } from '@components/factory'
|
||||
import { makeGroupColumn, makeNumericColumn, makeNumericRender, makeTextColumn, Table } from '@components/Table'
|
||||
import { makeColumn, makeGroupColumn, makeNumericColumn, makeNumericRender, makeTextColumn, Table } from '@components/Table'
|
||||
import { OperationStatService, WellOperationService } from '@api'
|
||||
import { arrayOrDefault } from '@utils'
|
||||
|
||||
@ -18,10 +18,17 @@ const { Cell, Row } = Summary
|
||||
const numericRender = makeNumericRender()
|
||||
const speedNumericRender = (section) => numericRender(section?.speed)
|
||||
|
||||
const makeSectionSorter = (key, name) => (a, b) => (a?.[key]?.[name] ?? 0) - (b?.[key]?.[name] ?? 0)
|
||||
export const makeSectionColumn = (title, key, { speedRender } = {}) => makeGroupColumn(title, [
|
||||
makeNumericColumn('Проходка', key, null, null, (section => numericRender(section?.depth)), 100),
|
||||
makeNumericColumn('Время', key, null, null, (section => numericRender(section?.time)), 100),
|
||||
makeNumericColumn((<>V<sub>рейсовая</sub></>), key, null, null, speedRender ?? speedNumericRender, 100),
|
||||
makeNumericColumn('Проходка', key, null, null, (section => numericRender(section?.depth)), 100, {
|
||||
sorter: makeSectionSorter(key, 'depth'),
|
||||
}),
|
||||
makeNumericColumn('Время', key, null, null, (section => numericRender(section?.time)), 100, {
|
||||
sorter: makeSectionSorter(key, 'time'),
|
||||
}),
|
||||
makeNumericColumn((<>V<sub>рейсовая</sub></>), key, null, null, speedRender ?? speedNumericRender, 100, {
|
||||
sorter: makeSectionSorter(key, 'speed'),
|
||||
}),
|
||||
])
|
||||
|
||||
export const defaultColumns = [
|
||||
|
Loading…
Reference in New Issue
Block a user