asb_cloud_front/src/components/CustomColumn.jsx

34 lines
1.2 KiB
React
Raw Normal View History

2021-04-16 15:50:01 +05:00
import {Display} from './Display'
import RigMnemo from '../components/RigMnemo'
2021-04-16 15:50:01 +05:00
const params = [
{label:'Рот., об/мин', accessorName:'rotorSpeed', isArrowVisible:true},
{label:'Долото, м', accessorName:'bitDepth', isArrowVisible:true, format:2},
{label:'Забой, м', accessorName:'wellDepth', isArrowVisible:true, format:2},
{label:'Расход, м³/ч', accessorName:'flow', isArrowVisible:true},
{label:'Расход х.х., м³/ч', accessorName:'flowIdle', isArrowVisible:true},
{label: 'Время', accessorName: 'date', format:'HH:mm:ss'},
]
2021-04-16 15:50:01 +05:00
export const CustomColumn = ({data}) => {
const dataLast = data[data.length -1]
if(dataLast)
params.forEach(param => param.value = dataLast[param.accessorName])
2021-04-16 15:50:01 +05:00
else
params.forEach(param => param.value = '-' )
2021-04-16 15:50:01 +05:00
return (<>
{params.map(param => <Display className='border_small display_flex_container'
key={param.label}
label={param.label}
value={param.value}
suffix={param.units}
isArrowVisible = {param.isArrowVisible}
format = {param.format}
/>)}
<RigMnemo
blockPosition={dataLast?.blockPosition??0}
bitPosition={dataLast?.bitDepth??3200}/>
2021-04-16 15:50:01 +05:00
</>)
}