Исправлена ошибка с ключами при подгрузке на комп. скв.

This commit is contained in:
Александр Сироткин 2022-03-29 16:36:04 +05:00
parent c44195229e
commit 54ada2298c
2 changed files with 6 additions and 3 deletions

View File

@ -25,6 +25,8 @@ const filtersMinMax = [
{ text: 'max', value: 'max' }, { text: 'max', value: 'max' },
] ]
const sortBySectionId = (a, b) => a.sectionId - b.sectionId
const filtersSectionsType = [] const filtersSectionsType = []
const DAY_IN_MS = 1000 * 60 * 60 * 24 const DAY_IN_MS = 1000 * 60 * 60 * 24
@ -130,7 +132,7 @@ export const WellCompositeSections = memo(({ idWell, statsWells, selectedSection
makeTextColumn('скв №', 'caption', null, null, makeTextColumn('скв №', 'caption', null, null,
(text, item) => <Link to={{ pathname: `/well/${item?.id}`, state: { from: location.pathname }}}>{text ?? '-'}</Link> (text, item) => <Link to={{ pathname: `/well/${item?.id}`, state: { from: location.pathname }}}>{text ?? '-'}</Link>
), ),
makeTextColumn('Секция', 'sectionType', filtersSectionsType, null, (text) => text ?? '-'), makeTextColumn('Секция', 'sectionType', filtersSectionsType, sortBySectionId, (text) => text ?? '-'),
makeNumericColumnPlanFact('Глубина, м', 'sectionWellDepth', filtersMinMax, makeFilterMinMaxFunction), makeNumericColumnPlanFact('Глубина, м', 'sectionWellDepth', filtersMinMax, makeFilterMinMaxFunction),
makeNumericColumnPlanFact('Продолжительность, ч', 'sectionBuildDays', filtersMinMax, makeFilterMinMaxFunction), makeNumericColumnPlanFact('Продолжительность, ч', 'sectionBuildDays', filtersMinMax, makeFilterMinMaxFunction),
makeNumericColumnPlanFact('МСП, м/ч', 'sectionRateOfPenetration', filtersMinMax, makeFilterMinMaxFunction), makeNumericColumnPlanFact('МСП, м/ч', 'sectionRateOfPenetration', filtersMinMax, makeFilterMinMaxFunction),

View File

@ -42,13 +42,14 @@ export const WellCompositeEditor = memo(({ idWell, rootPath }) => {
useEffect(() => { useEffect(() => {
const wellIds = selectedSections.map((value) => value.idWellSrc) const wellIds = selectedSections.map((value) => value.idWellSrc)
.filter((id, idx, arr) => arr.lastIndexOf(id) === idx)
setSelectedIdWells(wellIds) setSelectedIdWells(wellIds)
}, [selectedSections]) }, [selectedSections])
useEffect(() => invokeWebApiWrapperAsync( useEffect(() => invokeWebApiWrapperAsync(
async () => { async () => {
const stats = await OperationStatService.getWellsStat(selectedIdWells) const stats = arrayOrDefault(await OperationStatService.getWellsStat(selectedIdWells))
setStatsWells(arrayOrDefault(stats)) setStatsWells(stats)
}, },
setShowTabLoader, setShowTabLoader,
'Не удалось загрузить статистику по скважинам/секциям', 'Не удалось загрузить статистику по скважинам/секциям',