From a4cd42973776ef4a2007be7bcd8ed986de798c68 Mon Sep 17 00:00:00 2001 From: KharchenkoVV Date: Thu, 26 Aug 2021 17:45:36 +0500 Subject: [PATCH] CF2-55: Fixed filters --- src/components/Table/index.ts | 6 ++--- src/pages/ClusterSections.jsx | 46 ++++++++++++----------------------- src/pages/ClusterWells.jsx | 4 +-- 3 files changed, 21 insertions(+), 35 deletions(-) diff --git a/src/components/Table/index.ts b/src/components/Table/index.ts index c5d6c4c..b192f1c 100644 --- a/src/components/Table/index.ts +++ b/src/components/Table/index.ts @@ -120,10 +120,10 @@ export const makeNumericColumn = (title: any, dataIndex: any, filters: any, widt width: width }) -export const makeNumericColumnPlanFact = (title: any, dataIndex: any, filters: any) => +export const makeNumericColumnPlanFact = (title: any, dataIndex: any, filters: any, width: string) => makeGroupColumn( title, [ - makeNumericColumn('п', dataIndex + 'Plan', filters, ''), - makeNumericColumn('ф', dataIndex + 'Fact', filters, ''), + makeNumericColumn('п', dataIndex + 'Plan', filters, width), + makeNumericColumn('ф', dataIndex + 'Fact', filters, width), ]) export const calcAndUpdateStats = (data: any, keys: any) => { diff --git a/src/pages/ClusterSections.jsx b/src/pages/ClusterSections.jsx index b067b4e..fbc089f 100644 --- a/src/pages/ClusterSections.jsx +++ b/src/pages/ClusterSections.jsx @@ -16,24 +16,7 @@ const filtersMinMax = [ }, ] -const filtersSectionsType = [ - { - text: "Направление", - value: "Направление", - }, - { - text: "Кондуктор", - value: "Кондуктор", - }, - { - text: "Транспорт. ствол", - value: "Транспорт. Ствол", - }, - { - text: "Хвостовик", - value: "Хвостовик", - }, -] +const filtersSectionsType = [ ] const ModalWindowButton = ({buttonIcon, buttonText, modalTitle, modalContent}) =>{ const [isModalVisible, setIsModalVisible] = useState(false) @@ -72,7 +55,7 @@ const columns = [ makeNumericColumnPlanFact('Спуск КНБК', 'sectionBhaDownSpeed', filtersMinMax),//Скорость спуска КНБК makeNumericColumnPlanFact('Подъем КНБК', 'sectionBhaUpSpeed', filtersMinMax),//Скорость подъема КНБК makeNumericColumnPlanFact('Скорость спуска ОК', 'sectionCasingDownSpeed', filtersMinMax), - makeNumericColumnPlanFact('НПВ, сут', 'notProductiveTime', filtersMinMax), + makeNumericColumnPlanFact('НПВ, сут', 'nonProductiveTime', filtersMinMax, '70px'), { title: "TVD", render: (_, record) => { - let resArr = [] - let i = 1; + let rows = [] + clusterData.statsWells?.forEach(el => { el.sections.forEach(section => { let row = { - key: section.id + i++, - id: section.id + i++, + key: el.caption + section.id, + id: el.caption + section.id, caption: el.caption, sectionType: section.caption, sectionWellDepthPlan: section.plan.wellDepthEnd, @@ -147,16 +130,19 @@ export default function ClusterSections({clusterData}) { sectionBhaUpSpeedFact: section.fact.bhaUpSpeed.toFixed(2), sectionCasingDownSpeedPlan: section.plan.casingDownSpeed.toFixed(2), sectionCasingDownSpeedFact: section.fact.casingDownSpeed.toFixed(2), - notProductiveTimePlan: section.plan.nonProductiveHours.toFixed(2), - notProductiveTimeFact: section.fact.nonProductiveHours.toFixed(2), + nonProductiveTimePlan: section.plan.nonProductiveHours.toFixed(2), + nonProductiveTimeFact: section.fact.nonProductiveHours.toFixed(2), companies: el.companies } - resArr.push(row) + rows.push(row) + + if(!filtersSectionsType.some(el => el.text === section.caption)) + filtersSectionsType.push({text: section.caption, value: section.caption}) }) }) - setWellsStat(resArr) + setWellsStat(rows) }, [id, clusterData]) @@ -167,7 +153,7 @@ export default function ClusterSections({clusterData}) { setSelectedWellsKeys(keys) }, } - + return ( <> {item.caption}), makeTextColumn('Тип скв.', 'wellType', filtersWellsType), makeGroupColumn( 'Фактические сроки', [ - makeNumericColumn('начало', 'factStart', filtersMinMax), - makeNumericColumn('окончание', 'factEnd', filtersMinMax), + makeNumericColumn('начало', 'factStart'), + makeNumericColumn('окончание', 'factEnd'), ]), makeNumericColumnPlanFact('Продолжительность', 'period', filtersMinMax), makeNumericColumnPlanFact('МСП', 'rateOfPenetration', filtersMinMax),