diff --git a/src/pages/Well/Analytics/WellCompositeEditor/NewParamsTable.jsx b/src/pages/Well/Analytics/WellCompositeEditor/NewParamsTable.jsx
index 6e9d6ef..9c3d812 100644
--- a/src/pages/Well/Analytics/WellCompositeEditor/NewParamsTable.jsx
+++ b/src/pages/Well/Analytics/WellCompositeEditor/NewParamsTable.jsx
@@ -2,12 +2,75 @@ import { memo, useCallback, useEffect, useState } from 'react'
import { Button, Modal, Popconfirm } from 'antd'
import { useWell } from '@asb/context'
-import { Table } from '@components/Table'
+import { makeColumn, makeGroupColumn, makeNumericRender, makeSelectColumn, Table } from '@components/Table'
import LoaderPortal from '@components/LoaderPortal'
import { invokeWebApiWrapperAsync } from '@components/factory'
-import { DrillParamsService } from '@api'
+import { DrillParamsService, WellOperationService } from '@api'
-import { getColumns } from '@pages/Well/WellOperations/WellDrillParams'
+const getDeepValue = (data, key) => {
+ if (!key || key.trim() === '') return null
+ const keys = key.split('.')
+ let out = data
+ while (keys.length > 0) {
+ if (!(keys[0] in out)) return null
+ out = out[keys[0]]
+ keys.splice(0, 1)
+ }
+ return out
+}
+
+const makeNumericSorter = (keys) => (a, b) => getDeepValue(a, keys) - getDeepValue(b, keys)
+
+const numericRender = makeNumericRender(1)
+const makeNumericColumn = (title, dataIndex, render, other) => makeColumn(title, dataIndex, {
+ sorter: makeNumericSorter(dataIndex),
+ render: (_, record, index) => {
+ const func = render ?? ((value) => <>{value}>)
+ const item = getDeepValue(record, dataIndex)
+ return func(item, record, index)
+ },
+ align: 'right',
+ ...other,
+})
+
+const makeAvgRender = (dataIndex) => (avg, record) => {
+ const max = record[dataIndex]?.max
+ const fillW = (max - avg) / max * 100
+ return (
+
+
+
+ {numericRender(avg)}
+
+
+ )
+}
+
+const makeNumericAvgRange = (title, dataIndex, defaultRender = false) => makeGroupColumn(title, [
+ makeNumericColumn('мин', `${dataIndex}.min`),
+ makeNumericColumn('сред', `${dataIndex}.avg`, defaultRender ? undefined : makeAvgRender(dataIndex)),
+ makeNumericColumn('макс', `${dataIndex}.max`),
+])
+
+export const getColumns = async (idWell) => {
+ let sectionTypes = await WellOperationService.getSectionTypes(idWell)
+ sectionTypes = Object.entries(sectionTypes).map(([id, value]) => ({
+ label: value,
+ value: id,
+ }))
+
+ return [
+ makeSelectColumn('Конструкция секции','idWellSectionType', sectionTypes, null, {
+ width: 160,
+ sorter: makeNumericSorter('idWellSectionType'),
+ }),
+ makeNumericAvgRange('Нагрузка, т', 'axialLoad'),
+ makeNumericAvgRange('Давление, атм', 'pressure'),
+ makeNumericAvgRange('Момент на ВСП, кН·м', 'rotorTorque', true),
+ makeNumericAvgRange('Обороты на ВСП, об/мин', 'rotorSpeed'),
+ makeNumericAvgRange('Расход, л/с', 'flow'),
+ ]
+}
export const NewParamsTable = memo(({ selectedWellsKeys }) => {
const [params, setParams] = useState([])
diff --git a/src/pages/Well/Analytics/WellCompositeEditor/index.jsx b/src/pages/Well/Analytics/WellCompositeEditor/index.jsx
index c2341e1..b2ab94b 100644
--- a/src/pages/Well/Analytics/WellCompositeEditor/index.jsx
+++ b/src/pages/Well/Analytics/WellCompositeEditor/index.jsx
@@ -12,14 +12,9 @@ import { OperationStatService, WellCompositeService } from '@api'
import WellCompositeSections from './WellCompositeSections'
-const ClusterWells = lazy(() => import('@pages/Cluster/ClusterWells'))
+import '@styles/well_composite.less'
-const properties = {
- requirements: ['OperationStat.get', 'WellComposite.get'],
- title: 'Композитная скважина',
- route: 'composite/*',
- key: 'composite',
-}
+const ClusterWells = lazy(() => import('@pages/Cluster/ClusterWells'))
const WellCompositeEditor = memo(() => {
const [well] = useWell()
@@ -81,4 +76,4 @@ const WellCompositeEditor = memo(() => {
)
})
-export default wrapPrivateComponent(WellCompositeEditor, properties)
+export default wrapPrivateComponent(WellCompositeEditor, { requirements: ['OperationStat.get', 'WellComposite.get'] })
diff --git a/src/styles/well_composite.less b/src/styles/well_composite.less
new file mode 100644
index 0000000..ea64fc8
--- /dev/null
+++ b/src/styles/well_composite.less
@@ -0,0 +1,13 @@
+.avg-column {
+ & .avg-fill {
+ position: absolute;
+ right: 0;
+ top: 0;
+ height: 100%;
+ background-color: red;
+ }
+
+ & .avg-value {
+ position: relative;
+ }
+}