Исправлено отображение строк в таблицах во вкладке Измерения

This commit is contained in:
ts_salikhov 2022-08-23 15:55:48 +04:00
parent 1dd19399e5
commit aceedd8dee
4 changed files with 39 additions and 13 deletions

View File

@ -134,7 +134,7 @@ export const MeasureTable = memo(({ group, updateMeasuresFunc, additionalButtons
</div>
</div>
<div className={'measure-dates mt-20px'}>
<div className={'measure-dates mt-20px p-10'}>
<Timeline className={'mt-12px ml-10px'}>
{data.map((item, index) => (
<Timeline.Item
@ -156,7 +156,7 @@ export const MeasureTable = memo(({ group, updateMeasuresFunc, additionalButtons
<div className={'w-100'}>
<LoaderPortal show={showLoader}>
<Form form={measuresForm} onFinish={handleSubmitMeasuresForm}>
<View item={displayedValues?.data ?? {}} columns={editingColumns} />
<View item={displayedValues?.data ?? {}} columns={editingColumns} rowsInColumn={group.rowsInColumn}/>
</Form>
</LoaderPortal>
</div>

View File

@ -6,18 +6,29 @@ import { Grid, GridItem } from '@components/Grid'
import '@styles/index.css'
import '@styles/measure.css'
const colsCount = 3
export const View = memo(({ columns, item }) => !item || !columns?.length ? (
export const View = memo(({ columns, item, rowsInColumn }) => {
let rowPosition = 0
let columnPosition = 1
return !item || !columns?.length ? (
<Empty key={'empty'} image={Empty.PRESENTED_IMAGE_SIMPLE} />
) : (
<Grid>
{columns.map((column, i) => (
{columns.map((column, i) => {
if (i === rowsInColumn.first) {
columnPosition = 3
rowPosition = 0
} else if (i === rowsInColumn.second) {
columnPosition = 5
rowPosition = 0
}
rowPosition++
return (
<Fragment key={i}>
<GridItem
key={column.dataIndex}
row={Math.floor(i / colsCount) + 1}
col={(i % colsCount) * 2 + 1}
row={rowPosition}
col={columnPosition}
className={'measure-column-header'}
>
{column.title}
@ -25,8 +36,8 @@ export const View = memo(({ columns, item }) => !item || !columns?.length ? (
<GridItem
key={column.title}
row={Math.floor(i / colsCount) + 1}
col={(i % colsCount) * 2 + 2}
row={rowPosition}
col={columnPosition + 1}
className={'measure-column-value'}
style={{ padding: 0 }}
>
@ -45,6 +56,6 @@ export const View = memo(({ columns, item }) => !item || !columns?.length ? (
)}
</GridItem>
</Fragment>
))}
)})}
</Grid>
))
)})

View File

@ -20,16 +20,31 @@ const defaultData = [
title: 'Замер бурового раствора',
columns: columnsDrillingFluid,
defaultValue: drillingFluidDefaultData,
rowsInColumn: {
first: 10,
second: 19,
third: 28,
},
}, {
idCategory: 2,
title: 'Шламограмма',
columns: columnsMudDiagram,
defaultValue: mudDiagramDefaultData,
rowsInColumn: {
first: 6,
second: 15,
third: 22,
},
}, {
idCategory: 3,
title: 'ННБ',
columns: columnsNnb,
defaultValue: nnbDefaultData,
rowsInColumn: {
first: 6,
second: 12,
third: 17,
},
additionalButtons: (group, idx, onClick) => (isEditing) => isEditing ? null : (
<Button
key={'table'}

View File

@ -16,9 +16,9 @@ export const columnsNnb = [
makeColumn('Пространст.\nинтенсивность, град/10 м', 'areaIntensity', numericColumnOptions),
makeColumn('Угол установки отклон., град', 'offsetStopAngle', numericColumnOptions),
makeColumn('Интенсив. по зениту, град/10 м', 'zenithIntensity', numericColumnOptions),
makeColumn('Комментарий', 'comment', numericColumnOptions),
makeColumn('Разница вертикальных глубин\nмежду планом и фактом', 'depthPlanFactDifference', numericColumnOptions),
makeColumn('Расстояние в пространстве\nмежду планом и фактом', 'distancePlanFactDifference', numericColumnOptions),
makeColumn('Комментарий', 'comment', numericColumnOptions),
]
export const nnbDefaultData = {