asb_cloud_front/src/pages/Cluster/WellOperationsTable.jsx

45 lines
1.6 KiB
React
Raw Normal View History

import { Table } from 'antd';
import {
makeTextColumn,
makeNumericColumnPlanFact
} from '../../components/Table'
import { getPrecision } from './functions'
export default function WellOperationsTable({wellOperations}) {
const columns = [
makeTextColumn('Конструкция секции','sectionType'),
makeTextColumn('Операция','operationName'),
makeNumericColumnPlanFact('Глубина забоя', 'depth', null, null, getPrecision),
makeNumericColumnPlanFact('Часы', 'durationHours', null, null, getPrecision),
makeNumericColumnPlanFact('Комментарий', 'comment', null, null, (text) => text ?? '-')
];
2021-09-02 16:33:02 +05:00
const operations = wellOperations?.map(el => {
return {
key: el.plan?.id ?? el.fact.id,
2021-08-31 12:44:39 +05:00
sectionType: el.plan?.wellSectionTypeName ?? el.fact?.wellSectionTypeName,
operationName: `${el.plan?.categoryName ?? el.fact?.categoryName ?? ''} ${' '}
2021-08-31 12:44:39 +05:00
${el.plan?.categoryInfo ?? el.fact?.categoryInfo ?? ''}`,
depthPlan: el.plan?.wellDepth,
depthFact: el.fact?.wellDepth,
durationHoursPlan: el.plan?.durationHours,
durationHoursFact: el.fact?.durationHours,
commentPlan: el.plan?.comment ?? '-',
commentFact: el.fact?.comment ?? '-'
}
})
return(
<Table
columns={columns}
dataSource={operations}
size={'small'}
bordered
pagination={{ defaultPageSize: 10 }}
rowKey={(record) => record.key}
/>
)
}