asb_cloud_front/src/pages/Cluster/WellOperationsTable.jsx

43 lines
1.3 KiB
React
Raw Normal View History

import { Table } from "antd";
import {
makeTextColumn,
makeNumericColumnPlanFact
} from "../../components/Table"
export default function WellOperationsTable({wellOperations}) {
const columns = [
makeTextColumn("","index"),
makeTextColumn("Конструкция секции","sectionType"),
makeTextColumn("Операция","operationName"),
makeNumericColumnPlanFact("Глубина забоя", "depth"),
makeNumericColumnPlanFact("Часы", "durationHours")
];
let i = 1;
const operations = wellOperations.map(el => {
return {
key: el.plan ? el.plan.id : el.fact.id,
index: i++,
sectionType: el.plan ? el.plan.wellSectionTypeName : el.fact.wellSectionTypeName,
operationName: el.plan ? el.plan.categoryName : el.fact.categoryName,
depthPlan: el.plan ? el.plan.wellDepth : '-',
depthFact: el.fact ? el.fact.wellDepth : '-',
durationHoursPlan: el.plan ? el.plan.durationHours : '-',
durationHoursFact: el.fact ? el.fact.durationHours : '-'
}
})
return(
<Table
columns={columns}
dataSource={operations}
size={"small"}
bordered
pagination={false}
rowKey={(record) => record.id}
/>
)
}